/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vtx_exec.c |
---|
0,0 → 1,632 |
/* $XFree86$ */ |
/************************************************************************** |
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the "Software"), |
to deal in the Software without restriction, including without limitation |
on the rights to use, copy, modify, merge, publish, distribute, sub |
license, and/or sell copies of the Software, and to permit persons to whom |
the Software is furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice (including the next |
paragraph) shall be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
* |
*/ |
#include "api_noop.h" |
#include "api_arrayelt.h" |
#include "context.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "enums.h" |
#include "glapi.h" |
#include "colormac.h" |
#include "light.h" |
#include "state.h" |
#include "vtxfmt.h" |
#include "tnl.h" |
#include "t_context.h" |
#include "t_array_api.h" |
static void _tnl_FlushVertices( GLcontext *, GLuint ); |
void tnl_copy_to_current( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint flag = tnl->vertex_format; |
GLint i; |
assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT); |
for (i = 0 ; i < 16 ; i++) |
if (flag & (1<<i)) |
COPY_4FV( ctx->Current.Attrib[i], tnl->attribptr[i] ); |
if (flag & VERT_BIT_INDEX) |
ctx->Current.Index = tnl->indexptr[0]; |
if (flag & VERT_BIT_EDGEFLAG) |
ctx->Current.EdgeFlag = tnl->edgeflagptr[0]; |
if (flag & VERT_BIT_MATERIAL) { |
_mesa_update_material( ctx, |
IM->Material[IM->LastMaterial], |
IM->MaterialOrMask ); |
tnl->Driver.NotifyMaterialChange( ctx ); |
} |
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; |
} |
static GLboolean discreet_gl_prim[GL_POLYGON+1] = { |
1, /* 0 points */ |
1, /* 1 lines */ |
0, /* 2 line_strip */ |
0, /* 3 line_loop */ |
1, /* 4 tris */ |
0, /* 5 tri_fan */ |
0, /* 6 tri_strip */ |
1, /* 7 quads */ |
0, /* 8 quadstrip */ |
0, /* 9 poly */ |
}; |
/* Optimize the primitive list: ONLY FOR EXECUTE ATM |
*/ |
static void optimize_prims( TNLcontext *tnl ) |
{ |
int i, j; |
if (tnl->nrprims <= 1) |
return; |
for (j = 0, i = 1 ; i < tnl->nrprims; i++) { |
int pj = tnl->primlist[j].prim & 0xf; |
int pi = tnl->primlist[i].prim & 0xf; |
if (pj == pi && discreet_gl_prim[pj] && |
tnl->primlist[i].start == tnl->primlist[j].end) { |
tnl->primlist[j].end = tnl->primlist[i].end; |
} |
else { |
j++; |
if (j != i) tnl->primlist[j] = tnl->primlist[i]; |
} |
} |
tnl->nrprims = j+1; |
} |
/* Bind vertex buffer pointers, run pipeline: |
*/ |
static void flush_prims( TNLcontext *tnl ) |
{ |
int i,j; |
tnl->dma.current.ptr = tnl->dma.current.start += |
(tnl->initial_counter - tnl->counter) * tnl->vertex_size * 4; |
tnl->tcl.vertex_format = tnl->vertex_format; |
tnl->tcl.aos_components[0] = &tmp; |
tnl->tcl.nr_aos_components = 1; |
tnl->dma.flush = 0; |
tnl->Driver.RunPipeline( ... ); |
tnl->nrprims = 0; |
} |
static void start_prim( TNLcontext *tnl, GLuint mode ) |
{ |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s %d\n", __FUNCTION__, |
tnl->initial_counter - tnl->counter); |
tnl->primlist[tnl->nrprims].start = tnl->initial_counter - tnl->counter; |
tnl->primlist[tnl->nrprims].prim = mode; |
} |
static void note_last_prim( TNLcontext *tnl, GLuint flags ) |
{ |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s %d\n", __FUNCTION__, |
tnl->initial_counter - tnl->counter); |
if (tnl->prim[0] != GL_POLYGON+1) { |
tnl->primlist[tnl->nrprims].prim |= flags; |
tnl->primlist[tnl->nrprims].end = tnl->initial_counter - tnl->counter; |
if (++tnl->nrprims == TNL_MAX_PRIMS) |
flush_prims( tnl ); |
} |
} |
static void copy_vertex( TNLcontext *tnl, GLuint n, GLfloat *dst ) |
{ |
GLuint i; |
GLfloat *src = (GLfloat *)(tnl->dma.current.address + |
tnl->dma.current.ptr + |
(tnl->primlist[tnl->nrprims].start + n) * |
tnl->vertex_size * 4); |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "copy_vertex %d\n", |
tnl->primlist[tnl->nrprims].start + n); |
for (i = 0 ; i < tnl->vertex_size; i++) { |
dst[i] = src[i]; |
} |
} |
static GLuint copy_wrapped_verts( TNLcontext *tnl, GLfloat (*tmp)[15] ) |
{ |
GLuint ovf, i; |
GLuint nr = (tnl->initial_counter - tnl->counter) - tnl->primlist[tnl->nrprims].start; |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s %d verts\n", __FUNCTION__, nr); |
switch( tnl->prim[0] ) |
{ |
case GL_POINTS: |
return 0; |
case GL_LINES: |
ovf = nr&1; |
for (i = 0 ; i < ovf ; i++) |
copy_vertex( tnl, nr-ovf+i, tmp[i] ); |
return i; |
case GL_TRIANGLES: |
ovf = nr%3; |
for (i = 0 ; i < ovf ; i++) |
copy_vertex( tnl, nr-ovf+i, tmp[i] ); |
return i; |
case GL_QUADS: |
ovf = nr&3; |
for (i = 0 ; i < ovf ; i++) |
copy_vertex( tnl, nr-ovf+i, tmp[i] ); |
return i; |
case GL_LINE_STRIP: |
if (nr == 0) |
return 0; |
copy_vertex( tnl, nr-1, tmp[0] ); |
return 1; |
case GL_LINE_LOOP: |
case GL_TRIANGLE_FAN: |
case GL_POLYGON: |
if (nr == 0) |
return 0; |
else if (nr == 1) { |
copy_vertex( tnl, 0, tmp[0] ); |
return 1; |
} else { |
copy_vertex( tnl, 0, tmp[0] ); |
copy_vertex( tnl, nr-1, tmp[1] ); |
return 2; |
} |
case GL_TRIANGLE_STRIP: |
ovf = MIN2( nr-1, 2 ); |
for (i = 0 ; i < ovf ; i++) |
copy_vertex( tnl, nr-ovf+i, tmp[i] ); |
return i; |
case GL_QUAD_STRIP: |
ovf = MIN2( nr-1, 2 ); |
if (nr > 2) ovf += nr&1; |
for (i = 0 ; i < ovf ; i++) |
copy_vertex( tnl, nr-ovf+i, tmp[i] ); |
return i; |
default: |
assert(0); |
return 0; |
} |
} |
/* Extend for vertex-format changes on wrap: |
*/ |
static void wrap_buffer( void ) |
{ |
TNLcontext *tnl = tnl->tnl; |
GLfloat tmp[3][15]; |
GLuint i, nrverts; |
if (MESA_VERBOSE & (DEBUG_VFMT|DEBUG_PRIMS)) |
_mesa_debug(NULL, "%s %d\n", __FUNCTION__, |
tnl->initial_counter - tnl->counter); |
/* Don't deal with parity. *** WONT WORK FOR COMPILE |
*/ |
if ((((tnl->initial_counter - tnl->counter) - |
tnl->primlist[tnl->nrprims].start) & 1)) { |
tnl->counter++; |
tnl->initial_counter++; |
return; |
} |
/* Copy vertices out of dma: |
*/ |
nrverts = copy_dma_verts( tnl, tmp ); |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%d vertices to copy\n", nrverts); |
/* Finish the prim at this point: |
*/ |
note_last_prim( tnl, 0 ); |
flush_prims( tnl ); |
/* Reset counter, dmaptr |
*/ |
tnl->dmaptr = (int *)(tnl->dma.current.ptr + tnl->dma.current.address); |
tnl->counter = (tnl->dma.current.end - tnl->dma.current.ptr) / |
(tnl->vertex_size * 4); |
tnl->counter--; |
tnl->initial_counter = tnl->counter; |
tnl->notify = wrap_buffer; |
tnl->dma.flush = flush_prims; |
start_prim( tnl, tnl->prim[0] ); |
/* Reemit saved vertices |
* *** POSSIBLY IN NEW FORMAT |
* --> Can't always extend at end of vertex? |
*/ |
for (i = 0 ; i < nrverts; i++) { |
if (MESA_VERBOSE & DEBUG_VERTS) { |
int j; |
_mesa_debug(NULL, "re-emit vertex %d to %p\n", i, tnl->dmaptr); |
if (MESA_VERBOSE & DEBUG_VERBOSE) |
for (j = 0 ; j < tnl->vertex_size; j++) |
_mesa_debug(NULL, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]); |
} |
memcpy( tnl->dmaptr, tmp[i], tnl->vertex_size * 4 ); |
tnl->dmaptr += tnl->vertex_size; |
tnl->counter--; |
} |
} |
/* Always follow data, don't try to predict what's necessary. |
*/ |
static GLboolean check_vtx_fmt( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) |
ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT ); |
TNL_NEWPRIM(tnl); |
tnl->vertex_format = VERT_BIT_POS; |
tnl->prim = &ctx->Driver.CurrentExecPrimitive; |
/* Currently allow the full 4 components per attrib. Can use the |
* mechanism from radeon driver color handling to reduce this (and |
* also to store ubyte colors where these are incoming). This |
* won't work for compile mode. |
* |
* Only adding components when they are first received eliminates |
* the need for displaylist fixup, as there are no 'empty' slots |
* at the start of buffers. |
*/ |
for (i = 0 ; i < 16 ; i++) { |
if (ind & (1<<i)) { |
tnl->attribptr[i] = &tnl->vertex[tnl->vertex_size].f; |
tnl->vertex_size += 4; |
tnl->attribptr[i][0] = ctx->Current.Attrib[i][0]; |
tnl->attribptr[i][1] = ctx->Current.Attrib[i][1]; |
tnl->attribptr[i][2] = ctx->Current.Attrib[i][2]; |
tnl->attribptr[i][3] = ctx->Current.Attrib[i][3]; |
} |
else |
tnl->attribptr[i] = ctx->Current.Attrib[i]; |
} |
/* Edgeflag, Index: |
*/ |
for (i = 16 ; i < 18 ; i++) |
; |
/* Materials: |
*/ |
for (i = 18 ; i < 28 ; i++) |
; |
/* Eval: |
*/ |
for (i = 28 ; i < 29 ; i++) |
; |
if (tnl->installed_vertex_format != tnl->vertex_format) { |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "reinstall on vertex_format change\n"); |
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); |
tnl->installed_vertex_format = tnl->vertex_format; |
} |
return GL_TRUE; |
} |
void _tnl_InvalidateVtxfmt( GLcontext *ctx ) |
{ |
tnl->recheck = GL_TRUE; |
tnl->fell_back = GL_FALSE; |
} |
static void _tnl_ValidateVtxfmt( GLcontext *ctx ) |
{ |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s\n", __FUNCTION__); |
if (ctx->Driver.NeedFlush) |
ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush ); |
tnl->recheck = GL_FALSE; |
if (check_vtx_fmt( ctx )) { |
if (!tnl->installed) { |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "reinstall (new install)\n"); |
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); |
ctx->Driver.FlushVertices = _tnl_FlushVertices; |
tnl->installed = GL_TRUE; |
} |
else |
_mesa_debug(NULL, "%s: already installed", __FUNCTION__); |
} |
else { |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s: failed\n", __FUNCTION__); |
if (tnl->installed) { |
if (tnl->tnl->dma.flush) |
tnl->tnl->dma.flush( tnl->tnl ); |
_tnl_wakeup_exec( ctx ); |
tnl->installed = GL_FALSE; |
} |
} |
} |
/* Begin/End |
*/ |
static void _tnl_Begin( GLenum mode ) |
{ |
GLcontext *ctx = tnl->context; |
TNLcontext *tnl = tnl->tnl; |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s\n", __FUNCTION__); |
if (mode > GL_POLYGON) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glBegin" ); |
return; |
} |
if (tnl->prim[0] != GL_POLYGON+1) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); |
return; |
} |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
if (tnl->recheck) |
_tnl_ValidateVtxfmt( ctx ); |
if (tnl->dma.flush && tnl->counter < 12) { |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s: flush almost-empty buffers\n", __FUNCTION__); |
flush_prims( tnl ); |
} |
if (!tnl->dma.flush) { |
if (tnl->dma.current.ptr + 12*tnl->vertex_size*4 > |
tnl->dma.current.end) { |
TNL_NEWPRIM( tnl ); |
_tnl_RefillCurrentDmaRegion( tnl ); |
} |
tnl->dmaptr = (int *)(tnl->dma.current.address + tnl->dma.current.ptr); |
tnl->counter = (tnl->dma.current.end - tnl->dma.current.ptr) / |
(tnl->vertex_size * 4); |
tnl->counter--; |
tnl->initial_counter = tnl->counter; |
tnl->notify = wrap_buffer; |
tnl->dma.flush = flush_prims; |
tnl->context->Driver.NeedFlush |= FLUSH_STORED_VERTICES; |
} |
tnl->prim[0] = mode; |
start_prim( tnl, mode | PRIM_BEGIN ); |
} |
static void _tnl_End( void ) |
{ |
TNLcontext *tnl = tnl->tnl; |
GLcontext *ctx = tnl->context; |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s\n", __FUNCTION__); |
if (tnl->prim[0] == GL_POLYGON+1) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); |
return; |
} |
note_last_prim( tnl, PRIM_END ); |
tnl->prim[0] = GL_POLYGON+1; |
} |
static void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) |
{ |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "%s\n", __FUNCTION__); |
assert(tnl->installed); |
if (flags & FLUSH_UPDATE_CURRENT) { |
_tnl_copy_to_current( ctx ); |
if (MESA_VERBOSE & DEBUG_VFMT) |
_mesa_debug(NULL, "reinstall on update_current\n"); |
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); |
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; |
} |
if (flags & FLUSH_STORED_VERTICES) { |
TNLcontext *tnl = TNL_CONTEXT( ctx ); |
assert (tnl->dma.flush == 0 || |
tnl->dma.flush == flush_prims); |
if (tnl->dma.flush == flush_prims) |
flush_prims( TNL_CONTEXT( ctx ) ); |
ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; |
} |
} |
/* At this point, don't expect very many versions of each function to |
* be generated, so not concerned about freeing them? |
*/ |
static void _tnl_InitVtxfmt( GLcontext *ctx ) |
{ |
GLvertexformat *vfmt = &(tnl->vtxfmt); |
MEMSET( vfmt, 0, sizeof(GLvertexformat) ); |
/* Hook in chooser functions for codegen, etc: |
*/ |
_tnl_InitVtxfmtChoosers( vfmt ); |
/* Handled fully in supported states, but no codegen: |
*/ |
vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ |
vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */ |
vfmt->Begin = _tnl_Begin; |
vfmt->End = _tnl_End; |
tnl->context = ctx; |
tnl->tnl = TNL_CONTEXT(ctx); |
tnl->prim = &ctx->Driver.CurrentExecPrimitive; |
tnl->primflags = 0; |
make_empty_list( &tnl->dfn_cache.Vertex2f ); |
make_empty_list( &tnl->dfn_cache.Vertex2fv ); |
make_empty_list( &tnl->dfn_cache.Vertex3f ); |
make_empty_list( &tnl->dfn_cache.Vertex3fv ); |
make_empty_list( &tnl->dfn_cache.Color4ub ); |
make_empty_list( &tnl->dfn_cache.Color4ubv ); |
make_empty_list( &tnl->dfn_cache.Color3ub ); |
make_empty_list( &tnl->dfn_cache.Color3ubv ); |
make_empty_list( &tnl->dfn_cache.Color4f ); |
make_empty_list( &tnl->dfn_cache.Color4fv ); |
make_empty_list( &tnl->dfn_cache.Color3f ); |
make_empty_list( &tnl->dfn_cache.Color3fv ); |
make_empty_list( &tnl->dfn_cache.SecondaryColor3fEXT ); |
make_empty_list( &tnl->dfn_cache.SecondaryColor3fvEXT ); |
make_empty_list( &tnl->dfn_cache.SecondaryColor3ubEXT ); |
make_empty_list( &tnl->dfn_cache.SecondaryColor3ubvEXT ); |
make_empty_list( &tnl->dfn_cache.Normal3f ); |
make_empty_list( &tnl->dfn_cache.Normal3fv ); |
make_empty_list( &tnl->dfn_cache.TexCoord2f ); |
make_empty_list( &tnl->dfn_cache.TexCoord2fv ); |
make_empty_list( &tnl->dfn_cache.TexCoord1f ); |
make_empty_list( &tnl->dfn_cache.TexCoord1fv ); |
make_empty_list( &tnl->dfn_cache.MultiTexCoord2fARB ); |
make_empty_list( &tnl->dfn_cache.MultiTexCoord2fvARB ); |
make_empty_list( &tnl->dfn_cache.MultiTexCoord1fARB ); |
make_empty_list( &tnl->dfn_cache.MultiTexCoord1fvARB ); |
_tnl_InitCodegen( &tnl->codegen ); |
} |
static void free_funcs( struct dynfn *l ) |
{ |
struct dynfn *f, *tmp; |
foreach_s (f, tmp, l) { |
remove_from_list( f ); |
ALIGN_FREE( f->code ); |
FREE( f ); |
} |
} |
static void _tnl_DestroyVtxfmt( GLcontext *ctx ) |
{ |
count_funcs(); |
free_funcs( &tnl->dfn_cache.Vertex2f ); |
free_funcs( &tnl->dfn_cache.Vertex2fv ); |
free_funcs( &tnl->dfn_cache.Vertex3f ); |
free_funcs( &tnl->dfn_cache.Vertex3fv ); |
free_funcs( &tnl->dfn_cache.Color4ub ); |
free_funcs( &tnl->dfn_cache.Color4ubv ); |
free_funcs( &tnl->dfn_cache.Color3ub ); |
free_funcs( &tnl->dfn_cache.Color3ubv ); |
free_funcs( &tnl->dfn_cache.Color4f ); |
free_funcs( &tnl->dfn_cache.Color4fv ); |
free_funcs( &tnl->dfn_cache.Color3f ); |
free_funcs( &tnl->dfn_cache.Color3fv ); |
free_funcs( &tnl->dfn_cache.SecondaryColor3ubEXT ); |
free_funcs( &tnl->dfn_cache.SecondaryColor3ubvEXT ); |
free_funcs( &tnl->dfn_cache.SecondaryColor3fEXT ); |
free_funcs( &tnl->dfn_cache.SecondaryColor3fvEXT ); |
free_funcs( &tnl->dfn_cache.Normal3f ); |
free_funcs( &tnl->dfn_cache.Normal3fv ); |
free_funcs( &tnl->dfn_cache.TexCoord2f ); |
free_funcs( &tnl->dfn_cache.TexCoord2fv ); |
free_funcs( &tnl->dfn_cache.TexCoord1f ); |
free_funcs( &tnl->dfn_cache.TexCoord1fv ); |
free_funcs( &tnl->dfn_cache.MultiTexCoord2fARB ); |
free_funcs( &tnl->dfn_cache.MultiTexCoord2fvARB ); |
free_funcs( &tnl->dfn_cache.MultiTexCoord1fARB ); |
free_funcs( &tnl->dfn_cache.MultiTexCoord1fvARB ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vtx_x86.c |
---|
0,0 → 1,705 |
/* $XFree86$ */ |
/************************************************************************** |
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the "Software"), |
to deal in the Software without restriction, including without limitation |
on the rights to use, copy, modify, merge, publish, distribute, sub |
license, and/or sell copies of the Software, and to permit persons to whom |
the Software is furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice (including the next |
paragraph) shall be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "imports.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "vtxfmt.h" |
#if defined(USE_X86_ASM) |
struct dynfn *tnl_makeX86Vertex2f( TNLcontext *tnl, int key ) |
{ |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (RADEON_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
switch (tnl->vertex_size) { |
default: { |
/* Repz convenient as it's possible to emit code for any size |
* vertex with little tweaking. Might as well read vertsize |
* though, and have only one of these. |
*/ |
static char temp[] = { |
0x57, /* push %edi */ |
0x56, /* push %esi */ |
0xbe, 0, 0, 0, 0, /* mov $VERTEX+2,%esi */ |
0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ |
0x8b, 0x44, 0x24, 0x0c, /* mov 0x0c(%esp,1),%eax */ |
0x8b, 0x54, 0x24, 0x10, /* mov 0x10(%esp,1),%edx */ |
0x89, 0x07, /* mov %eax,(%edi) */ |
0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ |
0x83, 0xc7, 0x08, /* add $0x8,%edi */ |
0xb9, 0, 0, 0, 0, /* mov $VERTSIZE-2,%ecx */ |
0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ |
0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ |
0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ |
0x48, /* dec %eax */ |
0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ |
0x5e, /* pop %esi */ |
0x5f, /* pop %edi */ |
0x74, 0x01, /* je +1 */ |
0xc3, /* ret */ |
0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[2]); |
FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 37, 0x0, tnl->vertex_size-2); |
FIXUP(dfn->code, 44, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 50, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 56, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); |
break; |
} |
} |
insert_at_head( &tnl->dfn_cache.Vertex3f, dfn ); |
dfn->key = key; |
return dfn; |
} |
/* Build specialized versions of the immediate calls on the fly for |
* the current state. Generic x86 versions. |
*/ |
struct dynfn *tnl_makeX86Vertex3f( TNLcontext *tnl, int key ) |
{ |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (RADEON_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
switch (tnl->vertex_size) { |
case 4: { |
static char temp[] = { |
0x8b, 0x0d, 0,0,0,0, /* mov DMAPTR,%ecx */ |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0x8b, 0x54, 0x24, 0x08, /* mov 0x8(%esp,1),%edx */ |
0x89, 0x01, /* mov %eax,(%ecx) */ |
0x89, 0x51, 0x04, /* mov %edx,0x4(%ecx) */ |
0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ |
0x8b, 0x15, 0,0,0,0, /* mov VERTEX[3],%edx */ |
0x89, 0x41, 0x08, /* mov %eax,0x8(%ecx) */ |
0x89, 0x51, 0x0c, /* mov %edx,0xc(%ecx) */ |
0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ |
0x83, 0xc1, 0x10, /* add $0x10,%ecx */ |
0x48, /* dec %eax */ |
0x89, 0x0d, 0,0,0,0, /* mov %ecx,DMAPTR */ |
0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ |
0x74, 0x01, /* je +1 */ |
0xc3, /* ret */ |
0xff, 0x25, 0,0,0,0 /* jmp *NOTIFY */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 2, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 25, 0x0, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 36, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 46, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 51, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 60, 0x0, (int)&tnl->notify); |
break; |
} |
case 6: { |
static char temp[] = { |
0x57, /* push %edi */ |
0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ |
0x8b, 0x44, 0x24, 0x8, /* mov 0x8(%esp,1),%eax */ |
0x8b, 0x54, 0x24, 0xc, /* mov 0xc(%esp,1),%edx */ |
0x8b, 0x4c, 0x24, 0x10, /* mov 0x10(%esp,1),%ecx */ |
0x89, 0x07, /* mov %eax,(%edi) */ |
0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ |
0x89, 0x4f, 0x08, /* mov %ecx,0x8(%edi) */ |
0xa1, 0, 0, 0, 0, /* mov VERTEX[3],%eax */ |
0x8b, 0x15, 0, 0, 0, 0, /* mov VERTEX[4],%edx */ |
0x8b, 0x0d, 0, 0, 0, 0, /* mov VERTEX[5],%ecx */ |
0x89, 0x47, 0x0c, /* mov %eax,0xc(%edi) */ |
0x89, 0x57, 0x10, /* mov %edx,0x10(%edi) */ |
0x89, 0x4f, 0x14, /* mov %ecx,0x14(%edi) */ |
0x83, 0xc7, 0x18, /* add $0x18,%edi */ |
0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ |
0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ |
0x48, /* dec %eax */ |
0x5f, /* pop %edi */ |
0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ |
0x74, 0x01, /* je +1 */ |
0xc3, /* ret */ |
0xff, 0x25, 0,0,0,0, /* jmp *NOTIFY */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 3, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 28, 0x0, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 34, 0x0, (int)&tnl->vertex[4]); |
FIXUP(dfn->code, 40, 0x0, (int)&tnl->vertex[5]); |
FIXUP(dfn->code, 57, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 63, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 70, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 79, 0x0, (int)&tnl->notify); |
break; |
} |
default: { |
/* Repz convenient as it's possible to emit code for any size |
* vertex with little tweaking. Might as well read vertsize |
* though, and have only one of these. |
*/ |
static char temp[] = { |
0x57, /* push %edi */ |
0x56, /* push %esi */ |
0xbe, 0, 0, 0, 0, /* mov $VERTEX+3,%esi */ |
0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ |
0x8b, 0x44, 0x24, 0x0c, /* mov 0x0c(%esp,1),%eax */ |
0x8b, 0x54, 0x24, 0x10, /* mov 0x10(%esp,1),%edx */ |
0x8b, 0x4c, 0x24, 0x14, /* mov 0x14(%esp,1),%ecx */ |
0x89, 0x07, /* mov %eax,(%edi) */ |
0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ |
0x89, 0x4f, 0x08, /* mov %ecx,0x8(%edi) */ |
0x83, 0xc7, 0x0c, /* add $0xc,%edi */ |
0xb9, 0, 0, 0, 0, /* mov $VERTSIZE-3,%ecx */ |
0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ |
0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ |
0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ |
0x48, /* dec %eax */ |
0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ |
0x5e, /* pop %esi */ |
0x5f, /* pop %edi */ |
0x74, 0x01, /* je +1 */ |
0xc3, /* ret */ |
0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 37, 0x0, tnl->vertex_size-3); |
FIXUP(dfn->code, 44, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 50, 0x0, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 56, 0x0, (int)&tnl->counter); |
FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); |
break; |
} |
} |
insert_at_head( &tnl->dfn_cache.Vertex3f, dfn ); |
dfn->key = key; |
return dfn; |
} |
struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *tnl, int key ) |
{ |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
switch (tnl->vertex_size) { |
case 6: { |
static char temp[] = { |
0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ |
0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ |
0x8b, 0x11, /* mov (%ecx),%edx */ |
0x89, 0x10, /* mov %edx,(%eax) */ |
0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ |
0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ |
0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ |
0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ |
0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ |
0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ |
0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ |
0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ |
0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ |
0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ |
0x83, 0xc0, 0x18, /* add $0x18,%eax */ |
0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ |
0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ |
0x48, /* dec %eax */ |
0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ |
0x74, 0x01, /* je 2a4 <.f11> */ |
0xc3, /* ret */ |
0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); |
FIXUP(dfn->code, 45, 0x00000024, (int)&tnl->vertex[5]); |
FIXUP(dfn->code, 56, 0x00000000, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 61, 0x00000004, (int)&tnl->counter); |
FIXUP(dfn->code, 67, 0x00000004, (int)&tnl->counter); |
FIXUP(dfn->code, 76, 0x00000008, (int)&tnl->notify); |
break; |
} |
case 8: { |
static char temp[] = { |
0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ |
0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ |
0x8b, 0x11, /* mov (%ecx),%edx */ |
0x89, 0x10, /* mov %edx,(%eax) */ |
0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ |
0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ |
0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ |
0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ |
0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ |
0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ |
0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ |
0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ |
0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ |
0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ |
0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ |
0x89, 0x48, 0x18, /* mov %ecx,0x18(%eax) */ |
0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ |
0x89, 0x50, 0x1c, /* mov %edx,0x1c(%eax) */ |
0x83, 0xc0, 0x20, /* add $0x20,%eax */ |
0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ |
0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ |
0x48, /* dec %eax */ |
0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ |
0x74, 0x01, /* je 2a4 <.f11> */ |
0xc3, /* ret */ |
0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); |
FIXUP(dfn->code, 45, 0x0000001c, (int)&tnl->vertex[5]); |
FIXUP(dfn->code, 51, 0x00000020, (int)&tnl->vertex[6]); |
FIXUP(dfn->code, 63, 0x00000024, (int)&tnl->vertex[7]); |
FIXUP(dfn->code, 74, 0x00000000, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 79, 0x00000004, (int)&tnl->counter); |
FIXUP(dfn->code, 85, 0x00000004, (int)&tnl->counter); |
FIXUP(dfn->code, 94, 0x00000008, (int)&tnl->notify); |
break; |
} |
default: { |
/* Repz convenient as it's possible to emit code for any size |
* vertex with little tweaking. Might as well read vertsize |
* though, and have only one of these. |
*/ |
static char temp[] = { |
0x8b, 0x54, 0x24, 0x04, /* mov 0x4(%esp,1),%edx */ |
0x57, /* push %edi */ |
0x56, /* push %esi */ |
0x8b, 0x3d, 1,1,1,1, /* mov DMAPTR,%edi */ |
0x8b, 0x02, /* mov (%edx),%eax */ |
0x8b, 0x4a, 0x04, /* mov 0x4(%edx),%ecx */ |
0x8b, 0x72, 0x08, /* mov 0x8(%edx),%esi */ |
0x89, 0x07, /* mov %eax,(%edi) */ |
0x89, 0x4f, 0x04, /* mov %ecx,0x4(%edi) */ |
0x89, 0x77, 0x08, /* mov %esi,0x8(%edi) */ |
0x83, 0xc7, 0x0c, /* add $0xc,%edi */ |
0xb9, 0x06, 0x00, 0x00, 0x00, /* mov $VERTSIZE-3,%ecx */ |
0xbe, 0x58, 0x00, 0x00, 0x00, /* mov $VERTEX[3],%esi */ |
0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ |
0x89, 0x3d, 1, 1, 1, 1, /* mov %edi,DMAPTR */ |
0xa1, 2, 2, 2, 2, /* mov COUNTER,%eax */ |
0x5e, /* pop %esi */ |
0x5f, /* pop %edi */ |
0x48, /* dec %eax */ |
0xa3, 2, 2, 2, 2, /* mov %eax,COUNTER */ |
0x74, 0x01, /* je +1 */ |
0xc3, /* ret */ |
0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 8, 0x01010101, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 32, 0x00000006, tnl->vertex_size-3); |
FIXUP(dfn->code, 37, 0x00000058, (int)&tnl->vertex[3]); |
FIXUP(dfn->code, 45, 0x01010101, (int)&tnl->dmaptr); |
FIXUP(dfn->code, 50, 0x02020202, (int)&tnl->counter); |
FIXUP(dfn->code, 58, 0x02020202, (int)&tnl->counter); |
FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); |
break; |
} |
} |
insert_at_head( &tnl->dfn_cache.Vertex3fv, dfn ); |
dfn->key = key; |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr4fv( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0, 0, 0, 0, /* mov $DEST,%edx */ |
0x8b, 0x08, /* mov (%eax),%ecx */ |
0x89, 0x0a, /* mov %ecx,(%edx) */ |
0x8b, 0x48, 0x04, /* mov 0x4(%eax),%ecx */ |
0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ |
0x8b, 0x48, 0x08, /* mov 0x8(%eax),%ecx */ |
0x89, 0x4a, 0x08, /* mov %ecx,0x8(%edx) */ |
0x8b, 0x48, 0x0a, /* mov 0xa(%eax),%ecx */ |
0x89, 0x4a, 0x0a, /* mov %ecx,0xa(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr4f( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0x89, 0x02, /* mov %eax,(%edx) */ |
0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ |
0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ |
0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ |
0x89, 0x42, 0x08, /* mov %eax,0x8(%edx) */ |
0x8b, 0x44, 0x24, 0x10, /* mov 0x10(%esp,1),%eax */ |
0x89, 0x42, 0x0a, /* mov %eax,0xa(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr3fv( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0, 0, 0, 0, /* mov $DEST,%edx */ |
0x8b, 0x08, /* mov (%eax),%ecx */ |
0x89, 0x0a, /* mov %ecx,(%edx) */ |
0x8b, 0x48, 0x04, /* mov 0x4(%eax),%ecx */ |
0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ |
0x8b, 0x48, 0x08, /* mov 0x8(%eax),%ecx */ |
0x89, 0x4a, 0x08, /* mov %ecx,0x8(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr3f( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0x89, 0x02, /* mov %eax,(%edx) */ |
0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ |
0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ |
0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ |
0x89, 0x42, 0x08, /* mov %eax,0x8(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr4ubv( TNLcontext *tnl, int key ) |
{ |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
insert_at_head( &tnl->dfn_cache.Color4ubv, dfn ); |
dfn->key = key; |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
if (key & TNL_CP_VC_FRMT_PKCOLOR) { |
static char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x00, /* mov (%eax),%eax */ |
0x89, 0x02, /* mov %eax,(%edx) */ |
0xc3, /* ret */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x12345678, (int)tnl->ubytecolorptr); |
return dfn; |
} |
else { |
static char temp[] = { |
0x53, /* push %ebx */ |
0xba, 0x00, 0x00, 0x00, 0x00, /* mov $0x0,%edx */ |
0x31, 0xc0, /* xor %eax,%eax */ |
0x31, 0xc9, /* xor %ecx,%ecx */ |
0x8b, 0x5c, 0x24, 0x08, /* mov 0x8(%esp,1), %ebx */ |
0x8b, 0x1b, /* mov (%ebx), %ebx */ |
0x88, 0xd8, /* mov %bl, %al */ |
0x88, 0xf9, /* mov %bh, %cl */ |
0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ |
0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ |
0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ |
0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ |
0x31, 0xc0, /* xor %eax,%eax */ |
0x31, 0xc9, /* xor %ecx,%ecx */ |
0xc1, 0xeb, 0x10, /* shr $0x10, %ebx */ |
0x88, 0xd8, /* mov %bl, %al */ |
0x88, 0xf9, /* mov %bh, %cl */ |
0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ |
0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ |
0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ |
0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ |
0x5b, /* pop %ebx */ |
0xc3, /* ret */ |
}; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); |
FIXUP(dfn->code, 27, 0xdeadbeaf, (int)tnl->floatcolorptr); |
FIXUP(dfn->code, 33, 0xdeadbeaf, (int)tnl->floatcolorptr+4); |
FIXUP(dfn->code, 55, 0xdeadbeaf, (int)tnl->floatcolorptr+8); |
FIXUP(dfn->code, 61, 0xdeadbeaf, (int)tnl->floatcolorptr+12); |
return dfn; |
} |
} |
struct dynfn *tnl_makeX86Attr4ub( TNLcontext *tnl, int key ) |
{ |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
if (key & TNL_CP_VC_FRMT_PKCOLOR) { |
/* XXX push/pop */ |
static char temp[] = { |
0x53, /* push %ebx */ |
0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ |
0x8b, 0x54, 0x24, 0x0c, /* mov 0xc(%esp,1),%edx */ |
0x8b, 0x4c, 0x24, 0x10, /* mov 0x10(%esp,1),%ecx */ |
0x8b, 0x5c, 0x24, 0x14, /* mov 0x14(%esp,1),%ebx */ |
0xa2, 0, 0, 0, 0, /* mov %al,DEST */ |
0x88, 0x15, 0, 0, 0, 0, /* mov %dl,DEST+1 */ |
0x88, 0x0d, 0, 0, 0, 0, /* mov %cl,DEST+2 */ |
0x88, 0x1d, 0, 0, 0, 0, /* mov %bl,DEST+3 */ |
0x5b, /* pop %ebx */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
insert_at_head( &tnl->dfn_cache.Color4ub, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 18, 0x0, (int)tnl->ubytecolorptr); |
FIXUP(dfn->code, 24, 0x0, (int)tnl->ubytecolorptr+1); |
FIXUP(dfn->code, 30, 0x0, (int)tnl->ubytecolorptr+2); |
FIXUP(dfn->code, 36, 0x0, (int)tnl->ubytecolorptr+3); |
return dfn; |
} |
else |
return 0; |
} |
struct dynfn *tnl_makeX86Attr2fv( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x08, /* mov (%eax),%ecx */ |
0x8b, 0x40, 0x04, /* mov 0x4(%eax),%eax */ |
0x89, 0x0a, /* mov %ecx,(%edx) */ |
0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr2f( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0x8b, 0x4c, 0x24, 0x08, /* mov 0x8(%esp,1),%ecx */ |
0x89, 0x02, /* mov %eax,(%edx) */ |
0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr1fv( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x08, /* mov (%eax),%ecx */ |
0x89, 0x0a, /* mov %ecx,(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); |
return dfn; |
} |
struct dynfn *tnl_makeX86Attr1f( TNLcontext *tnl, int key ) |
{ |
static char temp[] = { |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0x89, 0x02, /* mov %eax,(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
if (TNL_DEBUG & DEBUG_CODEGEN) |
_mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); |
insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); |
return dfn; |
} |
void _tnl_InitX86Codegen( struct dfn_generators *gen ) |
{ |
gen->Attr1f = tnl_makeX86Attr1f; |
gen->Attr1fv = tnl_makeX86Attr1fv; |
gen->Attr2f = tnl_makeX86Attr2f; |
gen->Attr2fv = tnl_makeX86Attr2fv; |
gen->Attr3f = tnl_makeX86Attr3f; |
gen->Attr3fv = tnl_makeX86Attr3fv; |
gen->Attr4f = tnl_makeX86Attr4f; |
gen->Attr4fv = tnl_makeX86Attr4fv; |
gen->Attr4ub = tnl_makeX86Attr4ub; |
gen->Attr4ubv = tnl_makeX86Attr4ubv; |
gen->Vertex3f = tnl_makeX86Vertex3f; |
gen->Vertex3fv = tnl_makeX86Vertex3fv; |
} |
#else |
void _tnl_InitX86Codegen( struct dfn_generators *gen ) |
{ |
(void) gen; |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vtx_api.c |
---|
0,0 → 1,808 |
/* $XFree86$ */ |
/************************************************************************** |
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the "Software"), |
to deal in the Software without restriction, including without limitation |
on the rights to use, copy, modify, merge, publish, distribute, sub |
license, and/or sell copies of the Software, and to permit persons to whom |
the Software is furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice (including the next |
paragraph) shall be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "mtypes.h" |
#include "colormac.h" |
#include "simple_list.h" |
#include "vtxfmt.h" |
#include "t_vtx_api.h" |
/* Fallback versions of all the entrypoints for situations where |
* codegen isn't available. This is slowed significantly by all the |
* gumph necessary to get to the tnl pointer. |
*/ |
/* MultiTexcoord ends up with both of these branches, unfortunately |
* (it may get its own version of the macro after size-tracking is |
* working). |
* |
* Errors (VertexAttribNV when ATTR>15) are handled at a higher level. |
*/ |
#define ATTRF( ATTR, N, A, B, C, D ) \ |
{ \ |
GET_CURRENT_CONTEXT( ctx ); \ |
TNLcontext *tnl = TNL_CONTEXT(ctx); \ |
\ |
if ((ATTR) == 0) { \ |
int i; \ |
\ |
if (N>0) tnl->vbptr[0].f = A; \ |
if (N>1) tnl->vbptr[1].f = B; \ |
if (N>2) tnl->vbptr[2].f = C; \ |
if (N>3) tnl->vbptr[3].f = D; \ |
\ |
for (i = N; i < tnl->vertex_size; i++) \ |
*tnl->vbptr[i].i = tnl->vertex[i].i; \ |
\ |
tnl->vbptr += tnl->vertex_size; \ |
\ |
if (--tnl->counter == 0) \ |
tnl->notify(); \ |
} \ |
else { \ |
GLfloat *dest = tnl->attrptr[ATTR]; \ |
if (N>0) dest[0] = A; \ |
if (N>1) dest[1] = B; \ |
if (N>2) dest[2] = C; \ |
if (N>3) dest[3] = D; \ |
} \ |
} |
#define ATTR4F( ATTR, A, B, C, D ) ATTRF( ATTR, 4, A, B, C, D ) |
#define ATTR3F( ATTR, A, B, C, D ) ATTRF( ATTR, 3, A, B, C, 1 ) |
#define ATTR2F( ATTR, A, B, C, D ) ATTRF( ATTR, 2, A, B, 0, 1 ) |
#define ATTR1F( ATTR, A, B, C, D ) ATTRF( ATTR, 1, A, 0, 0, 1 ) |
#define ATTR3UB( ATTR, A, B, C ) \ |
ATTR3F( ATTR, \ |
UBYTE_TO_FLOAT(A), \ |
UBYTE_TO_FLOAT(B), \ |
UBYTE_TO_FLOAT(C)) |
#define ATTR4UB( ATTR, A, B, C, D ) \ |
ATTR4F( ATTR, \ |
UBYTE_TO_FLOAT(A), \ |
UBYTE_TO_FLOAT(B), \ |
UBYTE_TO_FLOAT(C), \ |
UBYTE_TO_FLOAT(D)) |
/* Vertex |
*/ |
static void tnl_Vertex2f( GLfloat x, GLfloat y ) |
{ |
ATTR2F( VERT_ATTRIB_POS, x, y ); |
} |
static void tnl_Vertex2fv( const GLfloat *v ) |
{ |
ATTR2F( VERT_ATTRIB_POS, v[0], v[1] ); |
} |
static void tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) |
{ |
ATTR3F( VERT_ATTRIB_POS, x, y, z ); |
} |
static void tnl_Vertex3fv( const GLfloat *v ) |
{ |
ATTR3F( VERT_ATTRIB_POS, v[0], v[1], v[2] ); |
} |
static void tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
ATTR4F( VERT_ATTRIB_POS, x, y, z, w ); |
} |
static void tnl_Vertex4fv( const GLfloat *v ) |
{ |
ATTR4F( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] ); |
} |
/* Color |
*/ |
static void tnl_Color3ub( GLubyte r, GLubyte g, GLubyte b ) |
{ |
ATTR3UB( VERT_ATTRIB_COLOR0, r, g, b ); |
} |
static void tnl_Color3ubv( const GLubyte *v ) |
{ |
ATTR3UB( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] ); |
} |
static void tnl_Color4ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) |
{ |
ATTR4UB( VERT_ATTRIB_COLOR0, r, g, b, a ); |
} |
static void tnl_Color4ubv( const GLubyte *v ) |
{ |
ATTR4UB( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] ); |
} |
static void tnl_Color3f( GLfloat r, GLfloat g, GLfloat b ) |
{ |
ATTR3F( VERT_ATTRIB_COLOR0, r, g, b ); |
} |
static void tnl_Color3fv( const GLfloat *v ) |
{ |
ATTR3F( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] ); |
} |
static void tnl_Color4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) |
{ |
ATTR4F( VERT_ATTRIB_COLOR0, r, g, b, a ); |
} |
static void tnl_Color4fv( const GLfloat *v ) |
{ |
ATTR4F( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] ); |
} |
/* Secondary Color |
*/ |
static void tnl_SecondaryColor3ubEXT( GLubyte r, GLubyte g, GLubyte b ) |
{ |
ATTR3UB( VERT_ATTRIB_COLOR1, r, g, b ); |
} |
static void tnl_SecondaryColor3ubvEXT( const GLubyte *v ) |
{ |
ATTR3UB( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); |
} |
static void tnl_SecondaryColor3fEXT( GLfloat r, GLfloat g, GLfloat b ) |
{ |
ATTR3F( VERT_ATTRIB_COLOR1, r, g, b ); |
} |
static void tnl_SecondaryColor3fvEXT( const GLfloat *v ) |
{ |
ATTR3F( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); |
} |
/* Fog Coord |
*/ |
static void tnl_FogCoordfEXT( GLfloat f ) |
{ |
ATTR1F( VERT_ATTRIB_FOG, f ); |
} |
static void tnl_FogCoordfvEXT( const GLfloat *v ) |
{ |
ATTR1F( VERT_ATTRIB_FOG, v[0] ); |
} |
/* Normal |
*/ |
static void tnl_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 ) |
{ |
ATTR3F( VERT_ATTRIB_NORMAL, n0, n1, n2 ); |
} |
static void tnl_Normal3fv( const GLfloat *v ) |
{ |
ATTR3F( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); |
} |
/* TexCoord |
*/ |
static void tnl_TexCoord1f( GLfloat s ) |
{ |
ATTR1F( VERT_ATTRIB_TEX0, s ); |
} |
static void tnl_TexCoord1fv( const GLfloat *v ) |
{ |
ATTR1F( VERT_ATTRIB_TEX0, v[0] ); |
} |
static void tnl_TexCoord2f( GLfloat s, GLfloat t ) |
{ |
ATTR2F( VERT_ATTRIB_TEX0, s, t ); |
} |
static void tnl_TexCoord2fv( const GLfloat *v ) |
{ |
ATTR2F( VERT_ATTRIB_TEX0, v[0], v[1] ); |
} |
static void tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r ) |
{ |
ATTR3F( VERT_ATTRIB_TEX0, s, t, r ); |
} |
static void tnl_TexCoord3fv( const GLfloat *v ) |
{ |
ATTR3F( VERT_ATTRIB_TEX0, v[0], v[1], v[2] ); |
} |
static void tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) |
{ |
ATTR4F( VERT_ATTRIB_TEX0, s, t, r, q ); |
} |
static void tnl_TexCoord4fv( const GLfloat *v ) |
{ |
ATTR4F( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] ); |
} |
/* Miscellaneous: |
* |
* These don't alias NV attributes, but still need similar treatment. |
* Basically these are attributes with numbers greater than 16. |
*/ |
static void tnl_EdgeFlag( GLboolean flag ) |
{ |
GLfloat f = flag ? 1 : 0; |
ATTR1F( VERT_ATTRIB_EDGEFLAG, f); |
} |
static void tnl_EdgeFlagv( const GLboolean *flag ) |
{ |
GLfloat f = flag[0] ? 1 : 0; |
ATTR1F( VERT_ATTRIB_EDGEFLAG, f); |
} |
static void tnl_Indexi( GLint idx ) |
{ |
ATTR1F( VERT_ATTRIB_INDEX, idx ); |
} |
static void tnl_Indexiv( const GLint *idx ) |
{ |
ATTR1F( VERT_ATTRIB_INDEX, idx ); |
} |
/* Use dispatch switching to build 'ranges' of eval vertices for each |
* type, avoiding need for flags. (Make |
* evalcoords/evalpoints/vertices/attr0 mutually exclusive) |
*/ |
static void _tnl_EvalCoord1f( GLfloat u ) |
{ |
ATTR1F( VERT_ATTRIB_POS, u ); |
} |
static void _tnl_EvalCoord1fv( const GLfloat *v ) |
{ |
ATTR1F( VERT_ATTRIB_POS, v[0] ); |
} |
static void _tnl_EvalCoord2f( GLfloat u, GLfloat v ) |
{ |
ATTR2F( VERT_ATTRIB_POS, u, v ); |
} |
static void _tnl_EvalCoord2fv( const GLfloat *v ) |
{ |
ATTR2F( VERT_ATTRIB_POS, v[0], v[1] ); |
} |
/* Second level dispatch table for MultiTexCoord, Material and |
* VertexAttribNV. |
* |
* Need this because we want to track things like vertex attribute |
* sizes, presence/otherwise of attribs in recorded vertices, etc, by |
* manipulating the state of dispatch tables. Need therefore a |
* dispatch slot for each value of 'index' or 'unit' in VertexAttribNV |
* and MultiTexCoordARB. Also need a mechnism for keeping this data |
* consistent with what's coming in via the Vertex/Normal/etc api |
* above (where aliasing exists with the traditional entrypoints). |
* Note that MultiTexCoordARB aliases with TexCoord when unit==0. |
* |
* Need presence tracking for material components, too, but not size |
* tracking or help with aliasing. Could move material to seperate |
* dispatch without the "*4" below, or even do the checks every time. |
*/ |
struct attr_dispatch_tab { |
void (*tab[32*4])( void ); |
void (*swapped[32*4])( void ); |
int swapcount; |
int installed_sizes[32]; |
}; |
#define DISPATCH_ATTR1F( ATTR, N, ) |
tnl->vb.attr_dispatch |
/* Result at the back end after second dispatch -- could further |
* specialize for attr zero -- maybe just in the codegen version. |
*/ |
static void tnl_Attr1f( GLint attr, GLfloat s ) |
{ |
ATTR1F( attr, s ); |
} |
static void tnl_Attr1fv( GLint attr, const GLfloat *v ) |
{ |
ATTR1F( attr, v[0] ); |
} |
static void tnl_Attr2f( GLint attr, GLfloat s, GLfloat t ) |
{ |
ATTR2F( attr, s, t ); |
} |
static void tnl_Attr2fv( GLint attr, const GLfloat *v ) |
{ |
ATTR2F( attr, v[0], v[1] ); |
} |
static void tnl_Attr3f( GLint attr, GLfloat s, GLfloat t, GLfloat r ) |
{ |
ATTR3F( attr, s, t, r ); |
} |
static void tnl_Attr3fv( GLint attr, const GLfloat *v ) |
{ |
ATTR3F( attr, v[0], v[1], v[2] ); |
} |
static void tnl_Attr4f( GLint attr, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) |
{ |
ATTR4F( attr, s, t, r, q ); |
} |
static void tnl_Attr4fv( GLint attr, const GLfloat *v ) |
{ |
ATTR4F( attr, v[0], v[1], v[2], v[3] ); |
} |
/* MultiTexcoord: Send through second level dispatch. |
*/ |
static void tnl_MultiTexCoord1fARB( GLenum target, GLfloat s ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR1F( attr, s ); |
} |
static void tnl_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR1F( attr, v[0] ); |
} |
static void tnl_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR2F( attr, s, t ); |
} |
static void tnl_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR2F( attr, v[0], v[1] ); |
} |
static void tnl_MultiTexCoord3fARB( GLenum target, GLfloat s, GLfloat t, |
GLfloat r) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR3F( attr, s, t, r ); |
} |
static void tnl_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR3F( attr, v[0], v[1], v[2] ); |
} |
static void tnl_MultiTexCoord4fARB( GLenum target, GLfloat s, GLfloat t, |
GLfloat r, GLfloat q ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR4F( attr, s, t, r, q ); |
} |
static void tnl_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) |
{ |
GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; |
if (attr < MAX_VERT_ATTRS) |
DISPATCH_ATTR4F( attr, v[0], v[1], v[2], v[3] ); |
} |
/* NV_vertex_program: |
* |
* Check for errors & reroute through second dispatch layer to get |
* size tracking per-attribute. |
*/ |
static void tnl_VertexAttrib1fNV( GLuint index, GLfloat s ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR1F( index, s ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR1F( index, v[0] ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib2fNV( GLuint index, GLfloat s, GLfloat t ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR2F( index, s, t ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR2F( index, v[0], v[1] ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib3fNV( GLuint index, GLfloat s, GLfloat t, |
GLfloat r ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR3F( index, s, t, r ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR3F( index, v[0], v[1], v[2] ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib4fNV( GLuint index, GLfloat s, GLfloat t, |
GLfloat r, GLfloat q ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR4F( index, s, t, r, q ); |
else |
DISPATCH_ERROR; |
} |
static void tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) |
{ |
if (index < MAX_VERT_ATTRS) |
DISPATCH_ATTR4F( index, v[0], v[1], v[2], v[3] ); |
else |
DISPATCH_ERROR; |
} |
/* Materials: |
* |
* These are treated as per-vertex attributes, at indices above where |
* the NV_vertex_program leaves off. There are a lot of good things |
* about treating materials this way. |
* |
* *** Need a dispatch step (like VertexAttribute GLint attr, and MultiTexCoord) |
* *** to expand vertex size, etc. Use the same second level dispatch |
* *** (keyed by attr number) as above. |
*/ |
#define MAT( ATTR, face, params ) \ |
do { \ |
if (face != GL_BACK) \ |
DISPATCH_ATTRF( ATTR, N, params ); \ |
if (face != GL_FRONT) \ |
DISPATCH_ATTRF( ATTR+7, N, params ); \ |
} while (0) |
/* NOTE: Have to remove/dealwith colormaterial crossovers, probably |
* later on - in the meantime just store everything. |
*/ |
static void _tnl_Materialfv( GLenum face, GLenum pname, |
const GLfloat *params ) |
{ |
switch (pname) { |
case GL_EMISSION: |
MAT( VERT_ATTRIB_FRONT_EMMISSION, 4, face, params ); |
break; |
case GL_AMBIENT: |
MAT( VERT_ATTRIB_FRONT_AMBIENT, 4, face, params ); |
break; |
case GL_DIFFUSE: |
MAT( VERT_ATTRIB_FRONT_DIFFUSE, 4, face, params ); |
break; |
case GL_SPECULAR: |
MAT( VERT_ATTRIB_FRONT_SPECULAR, 4, face, params ); |
break; |
case GL_SHININESS: |
MAT( VERT_ATTRIB_FRONT_SHININESS, 1, face, params ); |
break; |
case GL_COLOR_INDEXES: |
MAT( VERT_ATTRIB_FRONT_EMMISSION, 3, face, params ); |
break; |
case GL_AMBIENT_AND_DIFFUSE: |
MAT( VERT_ATTRIB_FRONT_AMBIENT, 4, face, params ); |
MAT( VERT_ATTRIB_FRONT_DIFFUSE, 4, face, params ); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, where ); |
return; |
} |
} |
/* Codegen support |
*/ |
static struct dynfn *lookup( struct dynfn *l, int key ) |
{ |
struct dynfn *f; |
foreach( f, l ) { |
if (f->key == key) |
return f; |
} |
return 0; |
} |
/* Vertex descriptor |
*/ |
struct _tnl_vertex_descriptor { |
GLuint attr_bits[4]; |
}; |
/* Can't use the loopback template for this: |
*/ |
#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \ |
static void choose_##FN ARGS1 \ |
{ \ |
int key = tnl->vertex_format & (MASK|ACTIVE); \ |
struct dynfn *dfn = lookup( &tnl->dfn_cache.FN, key ); \ |
\ |
if (dfn == 0) \ |
dfn = tnl->codegen.FN( &vb, key ); \ |
else if (MESA_VERBOSE & DEBUG_CODEGEN) \ |
_mesa_debug(NULL, "%s -- cached codegen\n", __FUNCTION__ ); \ |
\ |
if (dfn) \ |
tnl->context->Exec->FN = (FNTYPE)(dfn->code); \ |
else { \ |
if (MESA_VERBOSE & DEBUG_CODEGEN) \ |
_mesa_debug(NULL, "%s -- generic version\n", __FUNCTION__ ); \ |
tnl->context->Exec->FN = tnl_##FN; \ |
} \ |
\ |
tnl->context->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ |
tnl->context->Exec->FN ARGS2; \ |
} |
CHOOSE(Normal3f, p3f, 3, VERT_ATTRIB_NORMAL, |
(GLfloat a,GLfloat b,GLfloat c), (a,b,c)) |
CHOOSE(Normal3fv, pfv, 3, VERT_ATTRIB_NORMAL, |
(const GLfloat *v), (v)) |
CHOOSE(Color4ub, p4ub, 4, VERT_ATTRIB_COLOR0, |
(GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d)) |
CHOOSE(Color4ubv, pubv, 4, VERT_ATTRIB_COLOR0, |
(const GLubyte *v), (v)) |
CHOOSE(Color3ub, p3ub, 3, VERT_ATTRIB_COLOR0, |
(GLubyte a,GLubyte b, GLubyte c), (a,b,c)) |
CHOOSE(Color3ubv, pubv, 3, VERT_ATTRIB_COLOR0, |
(const GLubyte *v), (v)) |
CHOOSE(Color4f, p4f, 4, VERT_ATTRIB_COLOR0, |
(GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d)) |
CHOOSE(Color4fv, pfv, 4, VERT_ATTRIB_COLOR0, |
(const GLfloat *v), (v)) |
CHOOSE(Color3f, p3f, 3, VERT_ATTRIB_COLOR0, |
(GLfloat a,GLfloat b, GLfloat c), (a,b,c)) |
CHOOSE(Color3fv, pfv, 3, VERT_ATTRIB_COLOR0, |
(const GLfloat *v), (v)) |
CHOOSE(SecondaryColor3ubEXT, p3ub, VERT_ATTRIB_COLOR1, |
(GLubyte a,GLubyte b, GLubyte c), (a,b,c)) |
CHOOSE(SecondaryColor3ubvEXT, pubv, VERT_ATTRIB_COLOR1, |
(const GLubyte *v), (v)) |
CHOOSE(SecondaryColor3fEXT, p3f, VERT_ATTRIB_COLOR1, |
(GLfloat a,GLfloat b, GLfloat c), (a,b,c)) |
CHOOSE(SecondaryColor3fvEXT, pfv, VERT_ATTRIB_COLOR1, |
(const GLfloat *v), (v)) |
CHOOSE(TexCoord2f, p2f, VERT_ATTRIB_TEX0, |
(GLfloat a,GLfloat b), (a,b)) |
CHOOSE(TexCoord2fv, pfv, VERT_ATTRIB_TEX0, |
(const GLfloat *v), (v)) |
CHOOSE(TexCoord1f, p1f, VERT_ATTRIB_TEX0, |
(GLfloat a), (a)) |
CHOOSE(TexCoord1fv, pfv, VERT_ATTRIB_TEX0, |
(const GLfloat *v), (v)) |
CHOOSE(MultiTexCoord2fARB, pe2f, VERT_ATTRIB_TEX0, |
(GLenum u,GLfloat a,GLfloat b), (u,a,b)) |
CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL, |
(GLenum u,const GLfloat *v), (u,v)) |
CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL, |
(GLenum u,GLfloat a), (u,a)) |
CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL, |
(GLenum u,const GLfloat *v), (u,v)) |
CHOOSE(Vertex3f, p3f, VERT_ATTRIB_POS, |
(GLfloat a,GLfloat b,GLfloat c), (a,b,c)) |
CHOOSE(Vertex3fv, pfv, VERT_ATTRIB_POS, |
(const GLfloat *v), (v)) |
CHOOSE(Vertex2f, p2f, VERT_ATTRIB_POS, |
(GLfloat a,GLfloat b), (a,b)) |
CHOOSE(Vertex2fv, pfv, VERT_ATTRIB_POS, |
(const GLfloat *v), (v)) |
void _tnl_InitVtxfmtChoosers( GLvertexformat *vfmt ) |
{ |
vfmt->Color3f = choose_Color3f; |
vfmt->Color3fv = choose_Color3fv; |
vfmt->Color3ub = choose_Color3ub; |
vfmt->Color3ubv = choose_Color3ubv; |
vfmt->Color4f = choose_Color4f; |
vfmt->Color4fv = choose_Color4fv; |
vfmt->Color4ub = choose_Color4ub; |
vfmt->Color4ubv = choose_Color4ubv; |
vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT; |
vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT; |
vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; |
vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; |
vfmt->MultiTexCoord1fARB = dd_MultiTexCoord1fARB; |
vfmt->MultiTexCoord1fvARB = dd_MultiTexCoord1fvARB; |
vfmt->MultiTexCoord2fARB = dd_MultiTexCoord2fARB; |
vfmt->MultiTexCoord2fvARB = dd_MultiTexCoord2fvARB; |
vfmt->MultiTexCoord3fARB = dd_MultiTexCoord3fARB; |
vfmt->MultiTexCoord3fvARB = dd_MultiTexCoord3fvARB; |
vfmt->MultiTexCoord4fARB = dd_MultiTexCoord4fARB; |
vfmt->MultiTexCoord4fvARB = dd_MultiTexCoord4fvARB; |
vfmt->Normal3f = choose_Normal3f; |
vfmt->Normal3fv = choose_Normal3fv; |
vfmt->TexCoord1f = choose_TexCoord1f; |
vfmt->TexCoord1fv = choose_TexCoord1fv; |
vfmt->TexCoord2f = choose_TexCoord2f; |
vfmt->TexCoord2fv = choose_TexCoord2fv; |
vfmt->TexCoord3f = choose_TexCoord3f; |
vfmt->TexCoord3fv = choose_TexCoord3fv; |
vfmt->TexCoord4f = choose_TexCoord4f; |
vfmt->TexCoord4fv = choose_TexCoord4fv; |
vfmt->Vertex2f = choose_Vertex2f; |
vfmt->Vertex2fv = choose_Vertex2fv; |
vfmt->Vertex3f = choose_Vertex3f; |
vfmt->Vertex3fv = choose_Vertex3fv; |
vfmt->Vertex4f = choose_Vertex4f; |
vfmt->Vertex4fv = choose_Vertex4fv; |
vfmt->FogCoordfvEXT = choose_FogCoordfvEXT; |
vfmt->FogCoordfEXT = choose_FogCoordfEXT; |
vfmt->EdgeFlag = choose_EdgeFlag; |
vfmt->EdgeFlagv = choose_EdgeFlagv; |
vfmt->Indexi = choose_Indexi; |
vfmt->Indexiv = choose_Indexiv; |
vfmt->EvalCoord1f = choose_EvalCoord1f; |
vfmt->EvalCoord1fv = choose_EvalCoord1fv; |
vfmt->EvalCoord2f = choose_EvalCoord2f; |
vfmt->EvalCoord2fv = choose_EvalCoord2fv; |
vfmt->Materialfv = dd_Materialfv; |
} |
static struct dynfn *codegen_noop( struct _vb *vb, int key ) |
{ |
(void) vb; (void) key; |
return 0; |
} |
void _tnl_InitCodegen( struct dfn_generators *gen ) |
{ |
/* Generate an attribute or vertex command. |
*/ |
gen->Attr1f = codegen_noop; |
gen->Attr1fv = codegen_noop; |
gen->Attr2f = codegen_noop; |
gen->Attr2fv = codegen_noop; |
gen->Attr3f = codegen_noop; |
gen->Attr3fv = codegen_noop; |
gen->Attr4f = codegen_noop; |
gen->Attr4fv = codegen_noop; |
/* Index is never zero for these... |
*/ |
gen->Attr3ub = codegen_noop; |
gen->Attr3ubv = codegen_noop; |
gen->Attr4ub = codegen_noop; |
gen->Attr4ubv = codegen_noop; |
/* As above, but deal with the extra (redundant by now) index |
* argument to the generated function. |
*/ |
gen->NVAttr1f = codegen_noop; |
gen->NVAttr1fv = codegen_noop; |
gen->NVAttr2f = codegen_noop; |
gen->NVAttr2fv = codegen_noop; |
gen->NVAttr3f = codegen_noop; |
gen->NVAttr3fv = codegen_noop; |
gen->NVAttr4f = codegen_noop; |
gen->NVAttr4fv = codegen_noop; |
if (!getenv("MESA_NO_CODEGEN")) { |
#if defined(USE_X86_ASM) |
_tnl_InitX86Codegen( gen ); |
#endif |
#if defined(USE_SSE_ASM) |
_tnl_InitSSECodegen( gen ); |
#endif |
#if defined(USE_3DNOW_ASM) |
#endif |
#if defined(USE_SPARC_ASM) |
#endif |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vtx_api.h |
---|
0,0 → 1,234 |
/* $XFree86$ */ |
/************************************************************************** |
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the "Software"), |
to deal in the Software without restriction, including without limitation |
on the rights to use, copy, modify, merge, publish, distribute, sub |
license, and/or sell copies of the Software, and to permit persons to whom |
the Software is furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice (including the next |
paragraph) shall be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
* |
*/ |
#ifndef __RADEON_VTXFMT_H__ |
#define __RADEON_VTXFMT_H__ |
#ifdef GLX_DIRECT_RENDERING |
#include "_tnl__context.h" |
extern void _tnl_UpdateVtxfmt( GLcontext *ctx ); |
extern void _tnl_InitVtxfmt( GLcontext *ctx ); |
extern void _tnl_InvalidateVtxfmt( GLcontext *ctx ); |
extern void _tnl_DestroyVtxfmt( GLcontext *ctx ); |
typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat ); |
typedef void (*p3f)( GLfloat, GLfloat, GLfloat ); |
typedef void (*p2f)( GLfloat, GLfloat ); |
typedef void (*p1f)( GLfloat ); |
typedef void (*pe2f)( GLenum, GLfloat, GLfloat ); |
typedef void (*pe1f)( GLenum, GLfloat ); |
typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte ); |
typedef void (*p3ub)( GLubyte, GLubyte, GLubyte ); |
typedef void (*pfv)( const GLfloat * ); |
typedef void (*pefv)( GLenum, const GLfloat * ); |
typedef void (*pubv)( const GLubyte * ); |
/* Want to keep a cache of these around. Each is parameterized by |
* only a single value which has only a small range. Only expect a |
* few, so just rescan the list each time? |
*/ |
struct dynfn { |
struct dynfn *next, *prev; |
int key; |
char *code; |
}; |
struct dfn_lists { |
struct dynfn Vertex2f; |
struct dynfn Vertex2fv; |
struct dynfn Vertex3f; |
struct dynfn Vertex3fv; |
struct dynfn Color4ub; |
struct dynfn Color4ubv; |
struct dynfn Color3ub; |
struct dynfn Color3ubv; |
struct dynfn Color4f; |
struct dynfn Color4fv; |
struct dynfn Color3f; |
struct dynfn Color3fv; |
struct dynfn SecondaryColor3ubEXT; |
struct dynfn SecondaryColor3ubvEXT; |
struct dynfn SecondaryColor3fEXT; |
struct dynfn SecondaryColor3fvEXT; |
struct dynfn Normal3f; |
struct dynfn Normal3fv; |
struct dynfn TexCoord2f; |
struct dynfn TexCoord2fv; |
struct dynfn TexCoord1f; |
struct dynfn TexCoord1fv; |
struct dynfn MultiTexCoord2fARB; |
struct dynfn MultiTexCoord2fvARB; |
struct dynfn MultiTexCoord1fARB; |
struct dynfn MultiTexCoord1fvARB; |
}; |
struct _vb; |
struct dfn_generators { |
struct dynfn *(*Vertex2f)( struct _vb *, int ); |
struct dynfn *(*Vertex2fv)( struct _vb *, int ); |
struct dynfn *(*Vertex3f)( struct _vb *, int ); |
struct dynfn *(*Vertex3fv)( struct _vb *, int ); |
struct dynfn *(*Color4ub)( struct _vb *, int ); |
struct dynfn *(*Color4ubv)( struct _vb *, int ); |
struct dynfn *(*Color3ub)( struct _vb *, int ); |
struct dynfn *(*Color3ubv)( struct _vb *, int ); |
struct dynfn *(*Color4f)( struct _vb *, int ); |
struct dynfn *(*Color4fv)( struct _vb *, int ); |
struct dynfn *(*Color3f)( struct _vb *, int ); |
struct dynfn *(*Color3fv)( struct _vb *, int ); |
struct dynfn *(*SecondaryColor3ubEXT)( struct _vb *, int ); |
struct dynfn *(*SecondaryColor3ubvEXT)( struct _vb *, int ); |
struct dynfn *(*SecondaryColor3fEXT)( struct _vb *, int ); |
struct dynfn *(*SecondaryColor3fvEXT)( struct _vb *, int ); |
struct dynfn *(*Normal3f)( struct _vb *, int ); |
struct dynfn *(*Normal3fv)( struct _vb *, int ); |
struct dynfn *(*TexCoord2f)( struct _vb *, int ); |
struct dynfn *(*TexCoord2fv)( struct _vb *, int ); |
struct dynfn *(*TexCoord1f)( struct _vb *, int ); |
struct dynfn *(*TexCoord1fv)( struct _vb *, int ); |
struct dynfn *(*MultiTexCoord2fARB)( struct _vb *, int ); |
struct dynfn *(*MultiTexCoord2fvARB)( struct _vb *, int ); |
struct dynfn *(*MultiTexCoord1fARB)( struct _vb *, int ); |
struct dynfn *(*MultiTexCoord1fvARB)( struct _vb *, int ); |
}; |
struct prim { |
GLuint start; |
GLuint end; |
GLuint prim; |
}; |
#define _TNL__MAX_PRIMS 64 |
struct tnl_vbinfo { |
/* Keep these first: referenced from codegen templates: |
*/ |
GLint counter; |
GLint *dmaptr; |
void (*notify)( void ); |
union { float f; int i; GLubyte ub4[4]; } vertex[16*4]; |
GLfloat *attrptr[16]; |
GLuint size[16]; |
GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */ |
GLuint primflags; |
GLboolean installed; |
GLboolean recheck; |
GLint vertex_size; |
GLint initial_counter; |
GLint nrverts; |
GLuint vertex_format; |
GLuint installed_vertex_format; |
struct prim primlist[RADEON_MAX_PRIMS]; |
int nrprims; |
struct dfn_lists dfn_cache; |
struct dfn_generators codegen; |
GLvertexformat vtxfmt; |
}; |
extern void _tnl_InitVtxfmtChoosers( GLvertexformat *vfmt ); |
#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \ |
do { \ |
int *icode = (int *)(CODE+OFFSET); \ |
assert (*icode == CHECKVAL); \ |
*icode = (int)NEWVAL; \ |
} while (0) |
/* Useful for figuring out the offsets: |
*/ |
#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \ |
do { \ |
while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \ |
cprintf("%s/%d CVAL %x OFFSET %d\n", __FUNCTION__, \ |
__LINE__, CHECKVAL, OFFSET); \ |
*(int *)(CODE+OFFSET) = (int)NEWVAL; \ |
OFFSET += 4; \ |
} while (0) |
/* |
*/ |
void _tnl_InitCodegen( struct dfn_generators *gen ); |
void _tnl_InitX86Codegen( struct dfn_generators *gen ); |
void _tnl_InitSSECodegen( struct dfn_generators *gen ); |
void _tnl_copy_to_current( GLcontext *ctx ); |
/* Defined in tnl_vtxfmt_c.c. |
*/ |
struct dynfn *tnl_makeX86Vertex2f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Vertex2fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Vertex3f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color4ub( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color4ubv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color3ub( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color3ubv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color4f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color4fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color3f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Color3fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86SecondaryColor3ubEXT( TNLcontext *, int ); |
struct dynfn *tnl_makeX86SecondaryColor3ubvEXT( TNLcontext *, int ); |
struct dynfn *tnl_makeX86SecondaryColor3fEXT( TNLcontext *, int ); |
struct dynfn *tnl_makeX86SecondaryColor3fvEXT( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Normal3f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86Normal3fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86TexCoord2f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86TexCoord2fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86TexCoord1f( TNLcontext *, int ); |
struct dynfn *tnl_makeX86TexCoord1fv( TNLcontext *, int ); |
struct dynfn *tnl_makeX86MultiTexCoord2fARB( TNLcontext *, int ); |
struct dynfn *tnl_makeX86MultiTexCoord2fvARB( TNLcontext *, int ); |
struct dynfn *tnl_makeX86MultiTexCoord1fARB( TNLcontext *, int ); |
struct dynfn *tnl_makeX86MultiTexCoord1fvARB( TNLcontext *, int ); |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_lighttmp.h |
---|
0,0 → 1,1003 |
/* $Id: t_vb_lighttmp.h,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* |
* Authors: |
* Brian Paul |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#if (IDX & LIGHT_FLAGS) |
# define VSTRIDE (4 * sizeof(GLfloat)) |
# define NSTRIDE nstride /*(3 * sizeof(GLfloat))*/ |
# define CHECK_MATERIAL(x) (flags[x] & VERT_BIT_MATERIAL) |
# define CHECK_END_VB(x) (flags[x] & VERT_BIT_END_VB) |
# if (IDX & LIGHT_COLORMATERIAL) |
# define CMSTRIDE STRIDE_F(CMcolor, CMstride) |
# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_BIT_COLOR0) |
# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_COLOR0|VERT_BIT_MATERIAL)) |
# define DO_ANOTHER_NORMAL(x) \ |
((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL) |
# define REUSE_LIGHT_RESULTS(x) \ |
((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0) |
# else |
# define CMSTRIDE (void)0 |
# define CHECK_COLOR_MATERIAL(x) 0 |
# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_MATERIAL)) |
# define DO_ANOTHER_NORMAL(x) \ |
((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL) |
# define REUSE_LIGHT_RESULTS(x) \ |
((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0) |
# endif |
#else |
# define VSTRIDE vstride |
# define NSTRIDE nstride |
# define CHECK_MATERIAL(x) 0 /* no materials on array paths */ |
# define CHECK_END_VB(XX) (XX >= nr) |
# if (IDX & LIGHT_COLORMATERIAL) |
# define CMSTRIDE STRIDE_F(CMcolor, CMstride) |
# define CHECK_COLOR_MATERIAL(x) (x < nr) /* always have colormaterial */ |
# define CHECK_VALIDATE(x) (x < nr) |
# define DO_ANOTHER_NORMAL(x) 0 /* always stop to recalc colormat */ |
# else |
# define CMSTRIDE (void)0 |
# define CHECK_COLOR_MATERIAL(x) 0 /* no colormaterial */ |
# define CHECK_VALIDATE(x) (0) |
# define DO_ANOTHER_NORMAL(XX) (XX < nr) /* keep going to end of vb */ |
# endif |
# define REUSE_LIGHT_RESULTS(x) 0 /* always have a new normal */ |
#endif |
#if (IDX & LIGHT_TWOSIDE) |
# define NR_SIDES 2 |
#else |
# define NR_SIDES 1 |
#endif |
/* define TRACE if to trace lighting code */ |
/* |
* ctx is the current context |
* VB is the vertex buffer |
* stage is the lighting stage-private data |
* input is the vector of eye or object-space vertex coordinates |
*/ |
static void TAG(light_rgba_spec)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
GLfloat (*base)[3] = ctx->Light._BaseColor; |
GLchan sumA[2]; |
GLuint j; |
const GLuint vstride = input->stride; |
const GLfloat *vertex = (GLfloat *)input->data; |
const GLuint nstride = VB->NormalPtr->stride; |
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; |
GLfloat *CMcolor; |
GLuint CMstride; |
GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; |
GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; |
GLchan (*Fspec)[4] = (GLchan (*)[4]) store->LitSecondary[0].Ptr; |
GLchan (*Bspec)[4] = (GLchan (*)[4]) store->LitSecondary[1].Ptr; |
const GLuint nr = VB->Count; |
const GLuint *flags = VB->Flag; |
struct gl_material (*new_material)[2] = VB->Material; |
const GLuint *new_material_mask = VB->MaterialMask; |
(void) flags; |
(void) nstride; |
(void) vstride; |
#ifdef TRACE |
cprintf("%s\n", __FUNCTION__ ); |
#endif |
if (IDX & LIGHT_COLORMATERIAL) { |
if (VB->ColorPtr[0]->Type != GL_FLOAT || |
VB->ColorPtr[0]->Size != 4) |
import_color_material( ctx, stage ); |
CMcolor = (GLfloat *) VB->ColorPtr[0]->Ptr; |
CMstride = VB->ColorPtr[0]->StrideB; |
} |
VB->ColorPtr[0] = &store->LitColor[0]; |
VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) { |
VB->ColorPtr[1] = &store->LitColor[1]; |
VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); |
} |
/* Side-effects done, can we finish now? |
*/ |
if (stage->changed_inputs == 0) |
return; |
for ( j=0 ; |
j<nr ; |
j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal,NSTRIDE),CMSTRIDE) |
{ |
GLfloat sum[2][3], spec[2][3]; |
struct gl_light *light; |
if ( CHECK_COLOR_MATERIAL(j) ) |
_mesa_update_color_material( ctx, CMcolor ); |
if ( CHECK_MATERIAL(j) ) |
_mesa_update_material( ctx, new_material[j], new_material_mask[j] ); |
if ( CHECK_VALIDATE(j) ) { |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); |
} |
COPY_3V(sum[0], base[0]); |
ZERO_3V(spec[0]); |
if (IDX & LIGHT_TWOSIDE) { |
COPY_3V(sum[1], base[1]); |
ZERO_3V(spec[1]); |
} |
/* Add contribution from each enabled light source */ |
foreach (light, &ctx->Light.EnabledList) { |
GLfloat n_dot_h; |
GLfloat correction; |
GLint side; |
GLfloat contrib[3]; |
GLfloat attenuation; |
GLfloat VP[3]; /* unit vector from vertex to light */ |
GLfloat n_dot_VP; /* n dot VP */ |
GLfloat *h; |
/* compute VP and attenuation */ |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
/* directional light */ |
COPY_3V(VP, light->_VP_inf_norm); |
attenuation = light->_VP_inf_spot_attenuation; |
} |
else { |
GLfloat d; /* distance from vertex to light */ |
SUB_3V(VP, light->_Position, vertex); |
d = (GLfloat) LEN_3FV( VP ); |
if (d > 1e-6) { |
GLfloat invd = 1.0F / d; |
SELF_SCALE_SCALAR_3V(VP, invd); |
} |
attenuation = 1.0F / (light->ConstantAttenuation + d * |
(light->LinearAttenuation + d * |
light->QuadraticAttenuation)); |
/* spotlight attenuation */ |
if (light->_Flags & LIGHT_SPOT) { |
GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); |
if (PV_dot_dir<light->_CosCutoff) { |
continue; /* this light makes no contribution */ |
} |
else { |
GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); |
GLint k = (GLint) x; |
GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] |
+ (x-k)*light->_SpotExpTable[k][1]); |
attenuation *= spot; |
} |
} |
} |
if (attenuation < 1e-3) |
continue; /* this light makes no contribution */ |
/* Compute dot product or normal and vector from V to light pos */ |
n_dot_VP = DOT3( normal, VP ); |
/* Which side gets the diffuse & specular terms? */ |
if (n_dot_VP < 0.0F) { |
ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); |
if (!(IDX & LIGHT_TWOSIDE)) { |
continue; |
} |
side = 1; |
correction = -1; |
n_dot_VP = -n_dot_VP; |
} |
else { |
if (IDX & LIGHT_TWOSIDE) { |
ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); |
} |
side = 0; |
correction = 1; |
} |
/* diffuse term */ |
COPY_3V(contrib, light->_MatAmbient[side]); |
ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); |
ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib ); |
/* specular term - cannibalize VP... */ |
if (ctx->Light.Model.LocalViewer) { |
GLfloat v[3]; |
COPY_3V(v, vertex); |
NORMALIZE_3FV(v); |
SUB_3V(VP, VP, v); /* h = VP + VPe */ |
h = VP; |
NORMALIZE_3FV(h); |
} |
else if (light->_Flags & LIGHT_POSITIONAL) { |
h = VP; |
ACC_3V(h, ctx->_EyeZDir); |
NORMALIZE_3FV(h); |
} |
else { |
h = light->_h_inf_norm; |
} |
n_dot_h = correction * DOT3(normal, h); |
if (n_dot_h > 0.0F) { |
GLfloat spec_coef; |
struct gl_shine_tab *tab = ctx->_ShineTable[side]; |
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); |
if (spec_coef > 1.0e-10) { |
spec_coef *= attenuation; |
ACC_SCALE_SCALAR_3V( spec[side], spec_coef, |
light->_MatSpecular[side]); |
} |
} |
} /*loop over lights*/ |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] ); |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Fspec[j], spec[0] ); |
Fcolor[j][3] = sumA[0]; |
if (IDX & LIGHT_TWOSIDE) { |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] ); |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Bspec[j], spec[1] ); |
Bcolor[j][3] = sumA[1]; |
} |
} |
} |
static void TAG(light_rgba)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
GLuint j; |
GLfloat (*base)[3] = ctx->Light._BaseColor; |
GLchan sumA[2]; |
const GLuint vstride = input->stride; |
const GLfloat *vertex = (GLfloat *) input->data; |
const GLuint nstride = VB->NormalPtr->stride; |
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; |
GLfloat *CMcolor; |
GLuint CMstride; |
GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; |
GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; |
GLchan (*color[2])[4]; |
const GLuint *flags = VB->Flag; |
struct gl_material (*new_material)[2] = VB->Material; |
const GLuint *new_material_mask = VB->MaterialMask; |
const GLuint nr = VB->Count; |
#ifdef TRACE |
cprintf("%s\n", __FUNCTION__ ); |
#endif |
(void) flags; |
(void) nstride; |
(void) vstride; |
color[0] = Fcolor; |
color[1] = Bcolor; |
if (IDX & LIGHT_COLORMATERIAL) { |
if (VB->ColorPtr[0]->Type != GL_FLOAT || |
VB->ColorPtr[0]->Size != 4) |
import_color_material( ctx, stage ); |
CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; |
CMstride = VB->ColorPtr[0]->StrideB; |
} |
VB->ColorPtr[0] = &store->LitColor[0]; |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) { |
VB->ColorPtr[1] = &store->LitColor[1]; |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); |
} |
if (stage->changed_inputs == 0) |
return; |
for ( j=0 ; |
j<nr ; |
j++,STRIDE_F(vertex,VSTRIDE), STRIDE_F(normal,NSTRIDE),CMSTRIDE) |
{ |
GLfloat sum[2][3]; |
struct gl_light *light; |
if ( CHECK_COLOR_MATERIAL(j) ) |
_mesa_update_color_material( ctx, CMcolor ); |
if ( CHECK_MATERIAL(j) ) |
_mesa_update_material( ctx, new_material[j], new_material_mask[j] ); |
if ( CHECK_VALIDATE(j) ) { |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); |
} |
COPY_3V(sum[0], base[0]); |
if ( IDX & LIGHT_TWOSIDE ) |
COPY_3V(sum[1], base[1]); |
/* Add contribution from each enabled light source */ |
foreach (light, &ctx->Light.EnabledList) { |
GLfloat n_dot_h; |
GLfloat correction; |
GLint side; |
GLfloat contrib[3]; |
GLfloat attenuation = 1.0; |
GLfloat VP[3]; /* unit vector from vertex to light */ |
GLfloat n_dot_VP; /* n dot VP */ |
GLfloat *h; |
/* compute VP and attenuation */ |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
/* directional light */ |
COPY_3V(VP, light->_VP_inf_norm); |
attenuation = light->_VP_inf_spot_attenuation; |
} |
else { |
GLfloat d; /* distance from vertex to light */ |
SUB_3V(VP, light->_Position, vertex); |
d = (GLfloat) LEN_3FV( VP ); |
if ( d > 1e-6) { |
GLfloat invd = 1.0F / d; |
SELF_SCALE_SCALAR_3V(VP, invd); |
} |
attenuation = 1.0F / (light->ConstantAttenuation + d * |
(light->LinearAttenuation + d * |
light->QuadraticAttenuation)); |
/* spotlight attenuation */ |
if (light->_Flags & LIGHT_SPOT) { |
GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); |
if (PV_dot_dir<light->_CosCutoff) { |
continue; /* this light makes no contribution */ |
} |
else { |
GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); |
GLint k = (GLint) x; |
GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] |
+ (x-k)*light->_SpotExpTable[k][1]); |
attenuation *= spot; |
} |
} |
} |
if (attenuation < 1e-3) |
continue; /* this light makes no contribution */ |
/* Compute dot product or normal and vector from V to light pos */ |
n_dot_VP = DOT3( normal, VP ); |
/* which side are we lighting? */ |
if (n_dot_VP < 0.0F) { |
ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); |
if (!(IDX & LIGHT_TWOSIDE)) |
continue; |
side = 1; |
correction = -1; |
n_dot_VP = -n_dot_VP; |
} |
else { |
if (IDX & LIGHT_TWOSIDE) { |
ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); |
} |
side = 0; |
correction = 1; |
} |
COPY_3V(contrib, light->_MatAmbient[side]); |
/* diffuse term */ |
ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); |
/* specular term - cannibalize VP... */ |
{ |
if (ctx->Light.Model.LocalViewer) { |
GLfloat v[3]; |
COPY_3V(v, vertex); |
NORMALIZE_3FV(v); |
SUB_3V(VP, VP, v); /* h = VP + VPe */ |
h = VP; |
NORMALIZE_3FV(h); |
} |
else if (light->_Flags & LIGHT_POSITIONAL) { |
h = VP; |
ACC_3V(h, ctx->_EyeZDir); |
NORMALIZE_3FV(h); |
} |
else { |
h = light->_h_inf_norm; |
} |
n_dot_h = correction * DOT3(normal, h); |
if (n_dot_h > 0.0F) |
{ |
GLfloat spec_coef; |
struct gl_shine_tab *tab = ctx->_ShineTable[side]; |
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); |
ACC_SCALE_SCALAR_3V( contrib, spec_coef, |
light->_MatSpecular[side]); |
} |
} |
ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); |
} |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] ); |
Fcolor[j][3] = sumA[0]; |
if (IDX & LIGHT_TWOSIDE) { |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] ); |
Bcolor[j][3] = sumA[1]; |
} |
} |
} |
/* As below, but with just a single light. |
*/ |
static void TAG(light_fast_rgba_single)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
const GLuint nstride = VB->NormalPtr->stride; |
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; |
GLfloat *CMcolor; |
GLuint CMstride; |
GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; |
GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; |
const struct gl_light *light = ctx->Light.EnabledList.next; |
const GLuint *flags = VB->Flag; |
GLchan basechan[2][4]; |
GLuint j = 0; |
struct gl_material (*new_material)[2] = VB->Material; |
const GLuint *new_material_mask = VB->MaterialMask; |
GLfloat base[2][3]; |
const GLuint nr = VB->Count; |
#ifdef TRACE |
cprintf("%s\n", __FUNCTION__ ); |
#endif |
(void) input; /* doesn't refer to Eye or Obj */ |
(void) flags; |
(void) nr; |
(void) nstride; |
if (IDX & LIGHT_COLORMATERIAL) { |
if (VB->ColorPtr[0]->Type != GL_FLOAT || |
VB->ColorPtr[0]->Size != 4) |
import_color_material( ctx, stage ); |
CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; |
CMstride = VB->ColorPtr[0]->StrideB; |
} |
VB->ColorPtr[0] = &store->LitColor[0]; |
if (IDX & LIGHT_TWOSIDE) |
VB->ColorPtr[1] = &store->LitColor[1]; |
if (stage->changed_inputs == 0) |
return; |
do { |
if ( CHECK_COLOR_MATERIAL(j) ) { |
_mesa_update_color_material( ctx, CMcolor ); |
} |
if ( CHECK_MATERIAL(j) ) |
_mesa_update_material( ctx, new_material[j], new_material_mask[j] ); |
if ( CHECK_VALIDATE(j) ) |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
/* No attenuation, so incoporate _MatAmbient into base color. |
*/ |
COPY_3V(base[0], light->_MatAmbient[0]); |
ACC_3V(base[0], ctx->Light._BaseColor[0] ); |
UNCLAMPED_FLOAT_TO_RGB_CHAN( basechan[0], base[0] ); |
UNCLAMPED_FLOAT_TO_CHAN(basechan[0][3], |
ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) { |
COPY_3V(base[1], light->_MatAmbient[1]); |
ACC_3V(base[1], ctx->Light._BaseColor[1]); |
UNCLAMPED_FLOAT_TO_RGB_CHAN( basechan[1], base[1]); |
UNCLAMPED_FLOAT_TO_CHAN(basechan[1][3], |
ctx->Light.Material[1].Diffuse[3]); |
} |
do { |
GLfloat n_dot_VP = DOT3(normal, light->_VP_inf_norm); |
if (n_dot_VP < 0.0F) { |
if (IDX & LIGHT_TWOSIDE) { |
GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); |
GLfloat sum[3]; |
COPY_3V(sum, base[1]); |
ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); |
if (n_dot_h > 0.0F) { |
GLfloat spec; |
GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); |
ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); |
} |
UNCLAMPED_FLOAT_TO_RGB_CHAN(Bcolor[j], sum ); |
Bcolor[j][3] = basechan[1][3]; |
} |
COPY_CHAN4(Fcolor[j], basechan[0]); |
} |
else { |
GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm); |
GLfloat sum[3]; |
COPY_3V(sum, base[0]); |
ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]); |
if (n_dot_h > 0.0F) { |
GLfloat spec; |
GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); |
ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]); |
} |
UNCLAMPED_FLOAT_TO_RGB_CHAN(Fcolor[j], sum ); |
Fcolor[j][3] = basechan[0][3]; |
if (IDX & LIGHT_TWOSIDE) COPY_CHAN4(Bcolor[j], basechan[1]); |
} |
j++; |
CMSTRIDE; |
STRIDE_F(normal, NSTRIDE); |
} while (DO_ANOTHER_NORMAL(j)); |
for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE, STRIDE_F(normal,NSTRIDE)) |
{ |
COPY_CHAN4(Fcolor[j], Fcolor[j-1]); |
if (IDX & LIGHT_TWOSIDE) |
COPY_CHAN4(Bcolor[j], Bcolor[j-1]); |
} |
} while (!CHECK_END_VB(j)); |
} |
/* Light infinite lights |
*/ |
static void TAG(light_fast_rgba)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
GLchan sumA[2]; |
const GLuint nstride = VB->NormalPtr->stride; |
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; |
GLfloat *CMcolor; |
GLuint CMstride; |
GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; |
GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; |
const GLuint *flags = VB->Flag; |
GLuint j = 0; |
struct gl_material (*new_material)[2] = VB->Material; |
GLuint *new_material_mask = VB->MaterialMask; |
const GLuint nr = VB->Count; |
const struct gl_light *light; |
#ifdef TRACE |
cprintf("%s\n", __FUNCTION__ ); |
#endif |
(void) flags; |
(void) input; |
(void) nr; |
(void) nstride; |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); |
if (IDX & LIGHT_COLORMATERIAL) { |
if (VB->ColorPtr[0]->Type != GL_FLOAT || |
VB->ColorPtr[0]->Size != 4) |
import_color_material( ctx, stage ); |
CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; |
CMstride = VB->ColorPtr[0]->StrideB; |
} |
VB->ColorPtr[0] = &store->LitColor[0]; |
if (IDX & LIGHT_TWOSIDE) |
VB->ColorPtr[1] = &store->LitColor[1]; |
if (stage->changed_inputs == 0) |
return; |
do { |
do { |
GLfloat sum[2][3]; |
if ( CHECK_COLOR_MATERIAL(j) ) |
_mesa_update_color_material( ctx, CMcolor ); |
if ( CHECK_MATERIAL(j) ) |
_mesa_update_material( ctx, new_material[j], new_material_mask[j] ); |
if ( CHECK_VALIDATE(j) ) { |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]); |
if (IDX & LIGHT_TWOSIDE) |
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], |
ctx->Light.Material[1].Diffuse[3]); |
} |
COPY_3V(sum[0], ctx->Light._BaseColor[0]); |
if (IDX & LIGHT_TWOSIDE) |
COPY_3V(sum[1], ctx->Light._BaseColor[1]); |
foreach (light, &ctx->Light.EnabledList) { |
GLfloat n_dot_h, n_dot_VP, spec; |
ACC_3V(sum[0], light->_MatAmbient[0]); |
if (IDX & LIGHT_TWOSIDE) |
ACC_3V(sum[1], light->_MatAmbient[1]); |
n_dot_VP = DOT3(normal, light->_VP_inf_norm); |
if (n_dot_VP > 0.0F) { |
ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]); |
n_dot_h = DOT3(normal, light->_h_inf_norm); |
if (n_dot_h > 0.0F) { |
struct gl_shine_tab *tab = ctx->_ShineTable[0]; |
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); |
ACC_SCALE_SCALAR_3V( sum[0], spec, |
light->_MatSpecular[0]); |
} |
} |
else if (IDX & LIGHT_TWOSIDE) { |
ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); |
n_dot_h = -DOT3(normal, light->_h_inf_norm); |
if (n_dot_h > 0.0F) { |
struct gl_shine_tab *tab = ctx->_ShineTable[1]; |
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); |
ACC_SCALE_SCALAR_3V( sum[1], spec, |
light->_MatSpecular[1]); |
} |
} |
} |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Fcolor[j], sum[0] ); |
Fcolor[j][3] = sumA[0]; |
if (IDX & LIGHT_TWOSIDE) { |
UNCLAMPED_FLOAT_TO_RGB_CHAN( Bcolor[j], sum[1] ); |
Bcolor[j][3] = sumA[1]; |
} |
j++; |
CMSTRIDE; |
STRIDE_F(normal, NSTRIDE); |
} while (DO_ANOTHER_NORMAL(j)); |
/* Reuse the shading results while there is no change to |
* normal or material values. |
*/ |
for ( ; REUSE_LIGHT_RESULTS(j) ; j++, CMSTRIDE, STRIDE_F(normal, NSTRIDE)) |
{ |
COPY_CHAN4(Fcolor[j], Fcolor[j-1]); |
if (IDX & LIGHT_TWOSIDE) |
COPY_CHAN4(Bcolor[j], Bcolor[j-1]); |
} |
} while (!CHECK_END_VB(j)); |
} |
/* |
* Use current lighting/material settings to compute the color indexes |
* for an array of vertices. |
* Input: n - number of vertices to light |
* side - 0=use front material, 1=use back material |
* vertex - array of [n] vertex position in eye coordinates |
* normal - array of [n] surface normal vector |
* Output: indexResult - resulting array of [n] color indexes |
*/ |
static void TAG(light_ci)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
GLuint j; |
const GLuint vstride = input->stride; |
const GLfloat *vertex = (GLfloat *) input->data; |
const GLuint nstride = VB->NormalPtr->stride; |
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; |
GLfloat *CMcolor; |
GLuint CMstride; |
const GLuint *flags = VB->Flag; |
GLuint *indexResult[2]; |
struct gl_material (*new_material)[2] = VB->Material; |
GLuint *new_material_mask = VB->MaterialMask; |
const GLuint nr = VB->Count; |
#ifdef TRACE |
cprintf("%s\n", __FUNCTION__ ); |
#endif |
(void) flags; |
(void) nstride; |
(void) vstride; |
VB->IndexPtr[0] = &store->LitIndex[0]; |
if (IDX & LIGHT_TWOSIDE) |
VB->IndexPtr[1] = &store->LitIndex[1]; |
if (stage->changed_inputs == 0) |
return; |
indexResult[0] = VB->IndexPtr[0]->data; |
if (IDX & LIGHT_TWOSIDE) |
indexResult[1] = VB->IndexPtr[1]->data; |
if (IDX & LIGHT_COLORMATERIAL) { |
if (VB->ColorPtr[0]->Type != GL_FLOAT || |
VB->ColorPtr[0]->Size != 4) |
import_color_material( ctx, stage ); |
CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; |
CMstride = VB->ColorPtr[0]->StrideB; |
} |
/* loop over vertices */ |
for ( j=0 ; |
j<nr ; |
j++,STRIDE_F(vertex,VSTRIDE),STRIDE_F(normal, NSTRIDE), CMSTRIDE) |
{ |
GLfloat diffuse[2], specular[2]; |
GLuint side = 0; |
struct gl_light *light; |
if ( CHECK_COLOR_MATERIAL(j) ) |
_mesa_update_color_material( ctx, CMcolor ); |
if ( CHECK_MATERIAL(j) ) |
_mesa_update_material( ctx, new_material[j], new_material_mask[j] ); |
if ( CHECK_VALIDATE(j) ) |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
diffuse[0] = specular[0] = 0.0F; |
if ( IDX & LIGHT_TWOSIDE ) { |
diffuse[1] = specular[1] = 0.0F; |
} |
/* Accumulate diffuse and specular from each light source */ |
foreach (light, &ctx->Light.EnabledList) { |
GLfloat attenuation = 1.0F; |
GLfloat VP[3]; /* unit vector from vertex to light */ |
GLfloat n_dot_VP; /* dot product of l and n */ |
GLfloat *h, n_dot_h, correction = 1.0; |
/* compute l and attenuation */ |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
/* directional light */ |
COPY_3V(VP, light->_VP_inf_norm); |
} |
else { |
GLfloat d; /* distance from vertex to light */ |
SUB_3V(VP, light->_Position, vertex); |
d = (GLfloat) LEN_3FV( VP ); |
if ( d > 1e-6) { |
GLfloat invd = 1.0F / d; |
SELF_SCALE_SCALAR_3V(VP, invd); |
} |
attenuation = 1.0F / (light->ConstantAttenuation + d * |
(light->LinearAttenuation + d * |
light->QuadraticAttenuation)); |
/* spotlight attenuation */ |
if (light->_Flags & LIGHT_SPOT) { |
GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); |
if (PV_dot_dir < light->_CosCutoff) { |
continue; /* this light makes no contribution */ |
} |
else { |
GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); |
GLint k = (GLint) x; |
GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] |
+ (x-k)*light->_SpotExpTable[k][1]); |
attenuation *= spot; |
} |
} |
} |
if (attenuation < 1e-3) |
continue; /* this light makes no contribution */ |
n_dot_VP = DOT3( normal, VP ); |
/* which side are we lighting? */ |
if (n_dot_VP < 0.0F) { |
if (!(IDX & LIGHT_TWOSIDE)) |
continue; |
side = 1; |
correction = -1; |
n_dot_VP = -n_dot_VP; |
} |
/* accumulate diffuse term */ |
diffuse[side] += n_dot_VP * light->_dli * attenuation; |
/* specular term */ |
if (ctx->Light.Model.LocalViewer) { |
GLfloat v[3]; |
COPY_3V(v, vertex); |
NORMALIZE_3FV(v); |
SUB_3V(VP, VP, v); /* h = VP + VPe */ |
h = VP; |
NORMALIZE_3FV(h); |
} |
else if (light->_Flags & LIGHT_POSITIONAL) { |
h = VP; |
/* Strangely, disabling this addition fixes a conformance |
* problem. If this code is enabled, l_sed.c fails. |
*/ |
/*ACC_3V(h, ctx->_EyeZDir);*/ |
NORMALIZE_3FV(h); |
} |
else { |
h = light->_h_inf_norm; |
} |
n_dot_h = correction * DOT3(normal, h); |
if (n_dot_h > 0.0F) { |
GLfloat spec_coef; |
struct gl_shine_tab *tab = ctx->_ShineTable[side]; |
GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef); |
specular[side] += spec_coef * light->_sli * attenuation; |
} |
} /*loop over lights*/ |
/* Now compute final color index */ |
for (side = 0 ; side < NR_SIDES ; side++) { |
struct gl_material *mat = &ctx->Light.Material[side]; |
GLfloat index; |
if (specular[side] > 1.0F) { |
index = mat->SpecularIndex; |
} |
else { |
GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex; |
GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex; |
index = mat->AmbientIndex |
+ diffuse[side] * (1.0F-specular[side]) * d_a |
+ specular[side] * s_a; |
if (index > mat->SpecularIndex) { |
index = mat->SpecularIndex; |
} |
} |
indexResult[side][j] = (GLuint) (GLint) index; |
} |
} /*for vertex*/ |
} |
static void TAG(init_light_tab)( void ) |
{ |
_tnl_light_tab[IDX] = TAG(light_rgba); |
_tnl_light_fast_tab[IDX] = TAG(light_fast_rgba); |
_tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single); |
_tnl_light_spec_tab[IDX] = TAG(light_rgba_spec); |
_tnl_light_ci_tab[IDX] = TAG(light_ci); |
} |
#undef TAG |
#undef IDX |
#undef NR_SIDES |
#undef NSTRIDE |
#undef VSTRIDE |
#undef CHECK_MATERIAL |
#undef CHECK_END_VB |
#undef DO_ANOTHER_NORMAL |
#undef REUSE_LIGHT_RESULTS |
#undef CMSTRIDE |
#undef CHECK_COLOR_MATERIAL |
#undef CHECK_VALIDATE |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_array_api.h |
---|
0,0 → 1,47 |
/* $Id: t_array_api.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_VARRAY_H |
#define _T_VARRAY_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); |
extern void _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices); |
extern void _tnl_DrawRangeElements(GLenum mode, GLuint start, |
GLuint end, GLsizei count, GLenum type, |
const GLvoid *indices); |
extern void _tnl_array_init( GLcontext *ctx ); |
extern void _tnl_array_destroy( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_eval_api.c |
---|
0,0 → 1,248 |
/* $Id: t_eval_api.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell - original code |
* Brian Paul - vertex program updates |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_eval.h" |
#include "t_eval_api.h" |
#include "t_imm_api.h" |
#include "t_imm_alloc.h" |
#include "t_imm_exec.h" |
/* KW: If are compiling, we don't know whether eval will produce a |
* vertex when it is run in the future. If this is pure immediate |
* mode, eval is a noop if neither vertex map is enabled. |
* |
* Thus we need to have a check in the display list code or |
* elsewhere for eval(1,2) vertices in the case where |
* map(1,2)_vertex is disabled, and to purge those vertices from |
* the vb. |
*/ |
void |
_tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
GLfloat u, du; |
GLenum prim; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glEvalMesh1()"); |
switch (mode) { |
case GL_POINT: |
prim = GL_POINTS; |
break; |
case GL_LINE: |
prim = GL_LINE_STRIP; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); |
return; |
} |
/* No effect if vertex maps disabled. |
*/ |
if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && |
(!ctx->VertexProgram.Enabled || !ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) |
return; |
du = ctx->Eval.MapGrid1du; |
u = ctx->Eval.MapGrid1u1 + i1 * du; |
/* Need to turn off compilation -- this is already saved, and the |
* coordinates generated and the test above depend on state that |
* may change before the list is executed. |
* |
* TODO: Anaylse display lists to determine if this state is |
* constant. |
* |
* State to watch: |
* - enabled maps |
* - map state for each enabled map, including control points |
* - grid state |
* |
* Could alternatively cache individual maps in arrays, rather than |
* building immediates. |
*/ |
{ |
GLboolean compiling = ctx->CompileFlag; |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct immediate *im = TNL_CURRENT_IM(ctx); |
GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p); |
NotifyBegin = tnl->Driver.NotifyBegin; |
tnl->Driver.NotifyBegin = 0; |
if (compiling) { |
struct immediate *tmp = _tnl_alloc_immediate( ctx ); |
FLUSH_VERTICES( ctx, 0 ); |
SET_IMMEDIATE( ctx, tmp ); |
TNL_CURRENT_IM(ctx)->ref_count++; |
ctx->CompileFlag = GL_FALSE; |
} |
_tnl_Begin( prim ); |
for (i=i1;i<=i2;i++,u+=du) { |
_tnl_eval_coord1f( ctx, u ); |
} |
_tnl_end(ctx); |
/* Need this for replay *and* compile: |
*/ |
FLUSH_VERTICES( ctx, 0 ); |
tnl->Driver.NotifyBegin = NotifyBegin; |
if (compiling) { |
TNL_CURRENT_IM(ctx)->ref_count--; |
ASSERT( TNL_CURRENT_IM(ctx)->ref_count == 0 ); |
_tnl_free_immediate( ctx, TNL_CURRENT_IM(ctx) ); |
SET_IMMEDIATE( ctx, im ); |
ctx->CompileFlag = GL_TRUE; |
} |
} |
} |
void |
_tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i, j; |
GLfloat u, du, v, dv, v1, u1; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glEvalMesh2()"); |
/* No effect if vertex maps disabled. |
*/ |
if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && |
(!ctx->VertexProgram.Enabled || !ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) |
return; |
du = ctx->Eval.MapGrid2du; |
dv = ctx->Eval.MapGrid2dv; |
v1 = ctx->Eval.MapGrid2v1 + j1 * dv; |
u1 = ctx->Eval.MapGrid2u1 + i1 * du; |
/* Need to turn off compilation -- this is already saved, and the |
* coordinates generated and the test above depend on state that |
* may change before the list is executed. |
*/ |
{ |
GLboolean compiling = ctx->CompileFlag; |
struct immediate *im = TNL_CURRENT_IM(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p); |
NotifyBegin = tnl->Driver.NotifyBegin; |
tnl->Driver.NotifyBegin = 0; |
if (compiling) { |
struct immediate *tmp = _tnl_alloc_immediate( ctx ); |
FLUSH_VERTICES( ctx, 0 ); |
SET_IMMEDIATE( ctx, tmp ); |
TNL_CURRENT_IM(ctx)->ref_count++; |
ctx->CompileFlag = GL_FALSE; |
} |
switch (mode) { |
case GL_POINT: |
_tnl_Begin( GL_POINTS ); |
for (v=v1,j=j1;j<=j2;j++,v+=dv) { |
for (u=u1,i=i1;i<=i2;i++,u+=du) { |
_tnl_eval_coord2f( ctx, u, v ); |
} |
} |
_tnl_end(ctx); |
break; |
case GL_LINE: |
for (v=v1,j=j1;j<=j2;j++,v+=dv) { |
_tnl_Begin( GL_LINE_STRIP ); |
for (u=u1,i=i1;i<=i2;i++,u+=du) { |
_tnl_eval_coord2f( ctx, u, v ); |
} |
_tnl_end(ctx); |
} |
for (u=u1,i=i1;i<=i2;i++,u+=du) { |
_tnl_Begin( GL_LINE_STRIP ); |
for (v=v1,j=j1;j<=j2;j++,v+=dv) { |
_tnl_eval_coord2f( ctx, u, v ); |
} |
_tnl_end(ctx); |
} |
break; |
case GL_FILL: |
for (v=v1,j=j1;j<j2;j++,v+=dv) { |
_tnl_Begin( GL_TRIANGLE_STRIP ); |
for (u=u1,i=i1;i<=i2;i++,u+=du) { |
_tnl_eval_coord2f( ctx, u, v ); |
_tnl_eval_coord2f( ctx, u, v+dv ); |
} |
_tnl_end(ctx); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" ); |
return; |
} |
/* Need this for replay *and* compile: |
*/ |
FLUSH_VERTICES( ctx, 0 ); |
tnl->Driver.NotifyBegin = NotifyBegin; |
if (compiling) { |
TNL_CURRENT_IM(ctx)->ref_count--; |
_tnl_free_immediate( ctx, TNL_CURRENT_IM( ctx ) ); |
SET_IMMEDIATE( ctx, im ); |
ctx->CompileFlag = GL_TRUE; |
} |
} |
} |
void _tnl_eval_init( GLcontext *ctx ) |
{ |
GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); |
vfmt->EvalMesh1 = _tnl_exec_EvalMesh1; |
vfmt->EvalMesh2 = _tnl_exec_EvalMesh2; |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_eval_api.h |
---|
0,0 → 1,44 |
/* $Id: t_eval_api.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_EVAL_H |
#define _T_EVAL_H |
#include "mtypes.h" |
#include "t_context.h" |
/* Use _mesa_save_EvalMesh{1,2} to save these to display lists. |
*/ |
extern void _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); |
extern void _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, |
GLint j1, GLint j2 ); |
void _tnl_eval_init( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vtx_sse.c |
---|
0,0 → 1,91 |
/* $XFree86$ */ |
/************************************************************************** |
Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the "Software"), |
to deal in the Software without restriction, including without limitation |
on the rights to use, copy, modify, merge, publish, distribute, sub |
license, and/or sell copies of the Software, and to permit persons to whom |
the Software is furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice (including the next |
paragraph) shall be included in all copies or substantial portions of the |
Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "imports.h" |
#include "simple_list.h" |
#include "t_vtx_api.h" |
#if defined(USE_SSE_ASM) |
/* Build specialized versions of the immediate calls on the fly for |
* the current state. ???P4 SSE2 versions??? |
*/ |
static struct dynfn *makeSSENormal3fv( struct _vb *vb, int key ) |
{ |
/* Requires P4 (sse2?) |
*/ |
static unsigned char temp[] = { |
0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ |
0xba, 0x78, 0x56, 0x34, 0x12, /* mov $0x12345678,%edx */ |
0xf3, 0x0f, 0x7e, 0x00, /* movq (%eax),%xmm0 */ |
0x66, 0x0f, 0x6e, 0x48, 0x08, /* movd 0x8(%eax),%xmm1 */ |
0x66, 0x0f, 0xd6, 0x42, 0x0c, /* movq %xmm0,0xc(%edx) */ |
0x66, 0x0f, 0x7e, 0x4a, 0x14, /* movd %xmm1,0x14(%edx) */ |
0xc3, /* ret */ |
}; |
struct dynfn *dfn = MALLOC_STRUCT( dynfn ); |
insert_at_head( &vb->dfn_cache.Normal3fv, dfn ); |
dfn->key = key; |
dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); |
memcpy (dfn->code, temp, sizeof(temp)); |
FIXUP(dfn->code, 5, 0x0, (int)vb->normalptr); |
return dfn; |
} |
void _tnl_InitSSECodegen( struct dfn_generators *gen ) |
{ |
/* Need to: |
* - check kernel sse support |
* - check p4/sse2 |
*/ |
(void) makeSSENormal3fv; |
} |
#else |
void _tnl_InitSSECodegen( struct dfn_generators *gen ) |
{ |
(void) gen; |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_alloc.c |
---|
0,0 → 1,124 |
/* $Id: t_imm_alloc.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "mtypes.h" |
#include "t_imm_alloc.h" |
static int id = 0; /* give each struct immediate a unique ID number */ |
static struct immediate *real_alloc_immediate( GLcontext *ctx ) |
{ |
struct immediate *IM = ALIGN_CALLOC_STRUCT( immediate, 32 ); |
if (!IM) |
return 0; |
/* memset(IM, 0, sizeof(*IM)); */ |
IM->id = id++; |
IM->ref_count = 0; |
IM->FlushElt = 0; |
IM->LastPrimitive = IMM_MAX_COPIED_VERTS; |
IM->Count = IMM_MAX_COPIED_VERTS; |
IM->Start = IMM_MAX_COPIED_VERTS; |
IM->Material = 0; |
IM->MaterialMask = 0; |
IM->MaxTextureUnits = ctx->Const.MaxTextureUnits; |
IM->TexSize = 0; |
IM->NormalLengthPtr = 0; |
IM->CopyTexSize = 0; |
IM->CopyStart = IM->Start; |
return IM; |
} |
static void real_free_immediate( struct immediate *IM ) |
{ |
static int freed = 0; |
if (IM->Material) { |
FREE( IM->Material ); |
FREE( IM->MaterialMask ); |
IM->Material = 0; |
IM->MaterialMask = 0; |
} |
if (IM->NormalLengthPtr) |
ALIGN_FREE( IM->NormalLengthPtr ); |
ALIGN_FREE( IM ); |
freed++; |
/* printf("outstanding %d\n", id - freed); */ |
} |
/* Cache a single allocated immediate struct. |
*/ |
struct immediate *_tnl_alloc_immediate( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct immediate *tmp = tnl->freed_immediate; |
if (tmp) { |
tnl->freed_immediate = 0; |
return tmp; |
} |
else |
return real_alloc_immediate( ctx ); |
} |
/* May be called after tnl is destroyed. |
*/ |
void _tnl_free_immediate( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
ASSERT(IM->ref_count == 0); |
if (IM->NormalLengthPtr) { |
ALIGN_FREE(IM->NormalLengthPtr); |
IM->NormalLengthPtr = NULL; |
} |
if (!tnl) { |
real_free_immediate( IM ); |
} |
else { |
if (tnl->freed_immediate) |
real_free_immediate( tnl->freed_immediate ); |
tnl->freed_immediate = IM; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_rendertmp.h |
---|
0,0 → 1,445 |
/* $Id: t_vb_rendertmp.h,v 1.1 2003-02-28 11:48:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef POSTFIX |
#define POSTFIX |
#endif |
#ifndef INIT |
#define INIT(x) |
#endif |
#ifndef NEED_EDGEFLAG_SETUP |
#define NEED_EDGEFLAG_SETUP 0 |
#define EDGEFLAG_GET(a) 0 |
#define EDGEFLAG_SET(a,b) (void)b |
#endif |
#ifndef RESET_STIPPLE |
#define RESET_STIPPLE |
#endif |
#ifndef RESET_OCCLUSION |
#define RESET_OCCLUSION |
#endif |
#ifndef TEST_PRIM_END |
#define TEST_PRIM_END(flags) (flags & PRIM_END) |
#define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) |
#define TEST_PRIM_PARITY(flags) (flags & PRIM_PARITY) |
#endif |
#ifndef ELT |
#define ELT(x) x |
#endif |
#ifndef RENDER_TAB_QUALIFIER |
#define RENDER_TAB_QUALIFIER static |
#endif |
static void TAG(render_points)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
LOCAL_VARS; |
(void) flags; |
RESET_OCCLUSION; |
INIT(GL_POINTS); |
RENDER_POINTS( start, count ); |
POSTFIX; |
} |
static void TAG(render_lines)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
RESET_OCCLUSION; |
INIT(GL_LINES); |
for (j=start+1; j<count; j+=2 ) { |
RESET_STIPPLE; |
RENDER_LINE( ELT(j-1), ELT(j) ); |
} |
POSTFIX; |
} |
static void TAG(render_line_strip)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
RESET_OCCLUSION; |
INIT(GL_LINE_STRIP); |
if (TEST_PRIM_BEGIN(flags)) { |
RESET_STIPPLE; |
} |
for (j=start+1; j<count; j++ ) |
RENDER_LINE( ELT(j-1), ELT(j) ); |
POSTFIX; |
} |
static void TAG(render_line_loop)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint i; |
LOCAL_VARS; |
(void) flags; |
RESET_OCCLUSION; |
INIT(GL_LINE_LOOP); |
if (start+1 < count) { |
if (TEST_PRIM_BEGIN(flags)) { |
RESET_STIPPLE; |
RENDER_LINE( ELT(start), ELT(start+1) ); |
} |
for ( i = start+2 ; i < count ; i++) { |
RENDER_LINE( ELT(i-1), ELT(i) ); |
} |
if ( TEST_PRIM_END(flags)) { |
RENDER_LINE( ELT(count-1), ELT(start) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_triangles)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
INIT(GL_TRIANGLES); |
if (NEED_EDGEFLAG_SETUP) { |
for (j=start+2; j<count; j+=3) { |
/* Leave the edgeflags as supplied by the user. |
*/ |
RESET_STIPPLE; |
RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); |
} |
} else { |
for (j=start+2; j<count; j+=3) { |
RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_tri_strip)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
GLuint parity = 0; |
LOCAL_VARS; |
if (TEST_PRIM_PARITY(flags)) |
parity = 1; |
INIT(GL_TRIANGLE_STRIP); |
if (NEED_EDGEFLAG_SETUP) { |
for (j=start+2;j<count;j++,parity^=1) { |
GLuint ej2 = ELT(j-2+parity); |
GLuint ej1 = ELT(j-1-parity); |
GLuint ej = ELT(j); |
GLboolean ef2 = EDGEFLAG_GET( ej2 ); |
GLboolean ef1 = EDGEFLAG_GET( ej1 ); |
GLboolean ef = EDGEFLAG_GET( ej ); |
if (TEST_PRIM_BEGIN(flags)) { |
RESET_STIPPLE; |
} |
EDGEFLAG_SET( ej2, GL_TRUE ); |
EDGEFLAG_SET( ej1, GL_TRUE ); |
EDGEFLAG_SET( ej, GL_TRUE ); |
RENDER_TRI( ej2, ej1, ej ); |
EDGEFLAG_SET( ej2, ef2 ); |
EDGEFLAG_SET( ej1, ef1 ); |
EDGEFLAG_SET( ej, ef ); |
} |
} else { |
for (j=start+2; j<count ; j++, parity^=1) { |
RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_tri_fan)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
INIT(GL_TRIANGLE_FAN); |
if (NEED_EDGEFLAG_SETUP) { |
for (j=start+2;j<count;j++) { |
/* For trifans, all edges are boundary. |
*/ |
GLuint ejs = ELT(start); |
GLuint ej1 = ELT(j-1); |
GLuint ej = ELT(j); |
GLboolean efs = EDGEFLAG_GET( ejs ); |
GLboolean ef1 = EDGEFLAG_GET( ej1 ); |
GLboolean ef = EDGEFLAG_GET( ej ); |
if (TEST_PRIM_BEGIN(flags)) { |
RESET_STIPPLE; |
} |
EDGEFLAG_SET( ejs, GL_TRUE ); |
EDGEFLAG_SET( ej1, GL_TRUE ); |
EDGEFLAG_SET( ej, GL_TRUE ); |
RENDER_TRI( ejs, ej1, ej); |
EDGEFLAG_SET( ejs, efs ); |
EDGEFLAG_SET( ej1, ef1 ); |
EDGEFLAG_SET( ej, ef ); |
} |
} else { |
for (j=start+2;j<count;j++) { |
RENDER_TRI( ELT(start), ELT(j-1), ELT(j) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_poly)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j = start+2; |
LOCAL_VARS; |
(void) flags; |
INIT(GL_POLYGON); |
if (NEED_EDGEFLAG_SETUP) { |
GLboolean efstart = EDGEFLAG_GET( ELT(start) ); |
GLboolean efcount = EDGEFLAG_GET( ELT(count-1) ); |
/* If the primitive does not begin here, the first edge |
* is non-boundary. |
*/ |
if (!TEST_PRIM_BEGIN(flags)) |
EDGEFLAG_SET( ELT(start), GL_FALSE ); |
else { |
RESET_STIPPLE; |
} |
/* If the primitive does not end here, the final edge is |
* non-boundary. |
*/ |
if (!TEST_PRIM_END(flags)) |
EDGEFLAG_SET( ELT(count-1), GL_FALSE ); |
/* Draw the first triangles (possibly zero) |
*/ |
if (j+1<count) { |
GLboolean ef = EDGEFLAG_GET( ELT(j) ); |
EDGEFLAG_SET( ELT(j), GL_FALSE ); |
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); |
EDGEFLAG_SET( ELT(j), ef ); |
j++; |
/* Don't render the first edge again: |
*/ |
EDGEFLAG_SET( ELT(start), GL_FALSE ); |
for (;j+1<count;j++) { |
GLboolean efj = EDGEFLAG_GET( ELT(j) ); |
EDGEFLAG_SET( ELT(j), GL_FALSE ); |
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); |
EDGEFLAG_SET( ELT(j), efj ); |
} |
} |
/* Draw the last or only triangle |
*/ |
if (j < count) |
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); |
/* Restore the first and last edgeflags: |
*/ |
EDGEFLAG_SET( ELT(count-1), efcount ); |
EDGEFLAG_SET( ELT(start), efstart ); |
} |
else { |
for (j=start+2;j<count;j++) { |
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_quads)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
INIT(GL_QUADS); |
if (NEED_EDGEFLAG_SETUP) { |
for (j=start+3; j<count; j+=4) { |
/* Use user-specified edgeflags for quads. |
*/ |
RESET_STIPPLE; |
RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); |
} |
} else { |
for (j=start+3; j<count; j+=4) { |
RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_quad_strip)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
GLuint j; |
LOCAL_VARS; |
(void) flags; |
INIT(GL_QUAD_STRIP); |
if (NEED_EDGEFLAG_SETUP) { |
for (j=start+3;j<count;j+=2) { |
/* All edges are boundary. Set edgeflags to 1, draw the |
* quad, and restore them to the original values. |
*/ |
GLboolean ef3 = EDGEFLAG_GET( ELT(j-3) ); |
GLboolean ef2 = EDGEFLAG_GET( ELT(j-2) ); |
GLboolean ef1 = EDGEFLAG_GET( ELT(j-1) ); |
GLboolean ef = EDGEFLAG_GET( ELT(j) ); |
if (TEST_PRIM_BEGIN(flags)) { |
RESET_STIPPLE; |
} |
EDGEFLAG_SET( ELT(j-3), GL_TRUE ); |
EDGEFLAG_SET( ELT(j-2), GL_TRUE ); |
EDGEFLAG_SET( ELT(j-1), GL_TRUE ); |
EDGEFLAG_SET( ELT(j), GL_TRUE ); |
RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); |
EDGEFLAG_SET( ELT(j-3), ef3 ); |
EDGEFLAG_SET( ELT(j-2), ef2 ); |
EDGEFLAG_SET( ELT(j-1), ef1 ); |
EDGEFLAG_SET( ELT(j), ef ); |
} |
} else { |
for (j=start+3;j<count;j+=2) { |
RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) ); |
} |
} |
POSTFIX; |
} |
static void TAG(render_noop)( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
(void)(ctx && start && count && flags); |
} |
RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, |
GLuint, |
GLuint, |
GLuint) = |
{ |
TAG(render_points), |
TAG(render_lines), |
TAG(render_line_loop), |
TAG(render_line_strip), |
TAG(render_triangles), |
TAG(render_tri_strip), |
TAG(render_tri_fan), |
TAG(render_quads), |
TAG(render_quad_strip), |
TAG(render_poly), |
TAG(render_noop), |
}; |
#ifndef PRESERVE_VB_DEFS |
#undef RENDER_TRI |
#undef RENDER_QUAD |
#undef RENDER_LINE |
#undef RENDER_POINTS |
#undef LOCAL_VARS |
#undef INIT |
#undef POSTFIX |
#undef RESET_STIPPLE |
#undef DBG |
#undef ELT |
#undef RENDER_TAB_QUALIFIER |
#endif |
#ifndef PRESERVE_TAG |
#undef TAG |
#endif |
#undef PRESERVE_VB_DEFS |
#undef PRESERVE_TAG |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_fixup.c |
---|
0,0 → 1,871 |
/* $Id: t_imm_fixup.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "enums.h" |
#include "dlist.h" |
#include "colormac.h" |
#include "light.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "state.h" |
#include "mtypes.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_imm_alloc.h" |
#include "t_imm_debug.h" |
#include "t_imm_elt.h" |
#include "t_imm_fixup.h" |
#include "t_imm_exec.h" |
#include "t_pipeline.h" |
static const GLuint increment[GL_POLYGON+2] = { 1,2,1,1,3,1,1,4,2,1,1 }; |
static const GLuint intro[GL_POLYGON+2] = { 0,0,2,2,0,2,2,0,2,2,0 }; |
void |
_tnl_fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match ) |
{ |
GLuint i = start; |
for (;;) { |
if ((flag[++i] & match) == 0) { |
COPY_4FV(data[i], data[i-1]); |
if (flag[i] & VERT_BIT_END_VB) break; |
} |
} |
} |
void |
_tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match ) |
{ |
GLuint i = start; |
for (;;) { |
if ((flag[++i] & match) == 0) { |
/* _mesa_debug(NULL, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ |
/* data[i], */ |
/* data[i-1][0], */ |
/* data[i-1][1], */ |
/* data[i-1][2]); */ |
COPY_3V(data[i], data[i-1]); |
if (flag[i] & VERT_BIT_END_VB) break; |
} |
} |
} |
void |
_tnl_fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match ) |
{ |
GLuint i = start; |
for (;;) { |
if ((flag[++i] & match) == 0) { |
data[i] = data[i-1]; |
if (flag[i] & VERT_BIT_END_VB) break; |
} |
} |
flag[i] |= match; |
} |
void |
_tnl_fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match ) |
{ |
GLuint i = start; |
for (;;) { |
if ((flag[++i] & match) == 0) { |
data[i] = data[i-1]; |
if (flag[i] & VERT_BIT_END_VB) break; |
} |
} |
flag[i] |= match; |
} |
void |
_tnl_fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match ) |
{ |
GLuint i = start; |
for (;;) { |
if ((flag[++i] & match) == 0) { |
data[i] = data[i-1]; |
if (flag[i] & VERT_BIT_END_VB) break; |
} |
} |
flag[i] |= match; |
} |
static void |
fixup_first_4f( GLfloat data[][4], GLuint flag[], GLuint match, |
GLuint start, GLfloat *dflt ) |
{ |
GLuint i = start-1; |
match |= VERT_BIT_END_VB; |
while ((flag[++i]&match) == 0) |
COPY_4FV(data[i], dflt); |
} |
#if 0 |
static void |
fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match, |
GLuint start, GLfloat *dflt ) |
{ |
GLuint i = start-1; |
match |= VERT_BIT_END_VB; |
/* _mesa_debug(NULL, "fixup_first_3f default: %f %f %f start: %d\n", */ |
/* dflt[0], dflt[1], dflt[2], start); */ |
while ((flag[++i]&match) == 0) |
COPY_3FV(data[i], dflt); |
} |
#endif |
static void |
fixup_first_1ui( GLuint data[], GLuint flag[], GLuint match, |
GLuint start, GLuint dflt ) |
{ |
GLuint i = start-1; |
match |= VERT_BIT_END_VB; |
while ((flag[++i]&match) == 0) |
data[i] = dflt; |
} |
#if 00 |
static void |
fixup_first_1f( GLfloat data[], GLuint flag[], GLuint match, |
GLuint start, GLfloat dflt ) |
{ |
GLuint i = start-1; |
match |= VERT_BIT_END_VB; |
while ((flag[++i]&match) == 0) |
data[i] = dflt; |
} |
#endif |
static void |
fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match, |
GLuint start, GLubyte dflt ) |
{ |
GLuint i = start-1; |
match |= VERT_BIT_END_VB; |
while ((flag[++i]&match) == 0) |
data[i] = dflt; |
} |
/* |
* Copy vertex attributes from the ctx->Current group into the immediate |
* struct at the given position according to copyMask. |
*/ |
static void copy_from_current( GLcontext *ctx, struct immediate *IM, |
GLuint pos, GLuint copyMask ) |
{ |
GLuint attrib, attribBit; |
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) |
_tnl_print_vert_flags("copy from current", copyMask); |
#if 0 |
if (copyMask & VERT_BIT_NORMAL) { |
COPY_4V(IM->Attrib[VERT_ATTRIB_NORMAL][pos], |
ctx->Current.Attrib[VERT_ATTRIB_NORMAL]); |
} |
if (copyMask & VERT_BIT_COLOR0) { |
COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][pos], |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); |
} |
if (copyMask & VERT_BIT_COLOR1) |
COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR1][pos], |
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); |
if (copyMask & VERT_BIT_FOG) |
IM->Attrib[VERT_ATTRIB_FOG][pos][0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
if (copyMask & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (copyMask & VERT_BIT_TEX(i)) |
COPY_4FV(IM->Attrib[VERT_ATTRIB_TEX0 + i][pos], |
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]); |
} |
} |
#else |
for (attrib = 0, attribBit = 1; attrib < 16; attrib++, attribBit <<= 1) { |
if (copyMask & attribBit) { |
COPY_4FV( IM->Attrib[attrib][pos], ctx->Current.Attrib[attrib]); |
} |
} |
#endif |
if (copyMask & VERT_BIT_INDEX) |
IM->Index[pos] = ctx->Current.Index; |
if (copyMask & VERT_BIT_EDGEFLAG) |
IM->EdgeFlag[pos] = ctx->Current.EdgeFlag; |
} |
void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint start = IM->CopyStart; |
GLuint andflag = IM->CopyAndFlag; |
GLuint orflag = IM->CopyOrFlag | IM->Evaluated; |
GLuint fixup; |
IM->CopyTexSize = IM->TexSize; |
/* _mesa_debug(ctx, "Fixup input, Start: %u Count: %u LastData: %u\n", */ |
/* IM->Start, IM->Count, IM->LastData); */ |
/* _tnl_print_vert_flags("Orflag", orflag); */ |
/* _tnl_print_vert_flags("Andflag", andflag); */ |
fixup = ~andflag & VERT_BITS_FIXUP; |
if (!ctx->CompileFlag) |
fixup &= tnl->pipeline.inputs; |
if (!ctx->ExecuteFlag) |
fixup &= orflag; |
if ((orflag & (VERT_BIT_POS|VERT_BITS_EVAL_ANY)) == 0) |
fixup = 0; |
if (fixup) { |
GLuint copy = fixup & ~IM->Flag[start]; |
/* Equivalent to a lazy copy-from-current when setting up the |
* immediate. |
*/ |
if (ctx->ExecuteFlag && copy) |
copy_from_current( ctx, IM, start, copy ); |
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) |
_tnl_print_vert_flags("fixup", fixup); |
/* XXX replace these conditionals with a loop over the 16 |
* vertex attributes. |
*/ |
if (fixup & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (fixup & VERT_BIT_TEX(i)) { |
if (orflag & VERT_BIT_TEX(i)) |
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, |
start, VERT_BIT_TEX(i) ); |
else |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, |
VERT_BIT_END_VB, start, |
IM->Attrib[VERT_ATTRIB_TEX0 + i][start]); |
} |
} |
} |
if (fixup & VERT_BIT_EDGEFLAG) { |
if (orflag & VERT_BIT_EDGEFLAG) |
_tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_BIT_EDGEFLAG ); |
else |
fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_BIT_END_VB, start, |
IM->EdgeFlag[start] ); |
} |
if (fixup & VERT_BIT_INDEX) { |
if (orflag & VERT_BIT_INDEX) |
_tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_BIT_INDEX ); |
else |
fixup_first_1ui( IM->Index, IM->Flag, VERT_BIT_END_VB, start, |
IM->Index[start] ); |
} |
if (fixup & VERT_BIT_COLOR0) { |
if (orflag & VERT_BIT_COLOR0) |
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, start, |
VERT_BIT_COLOR0 ); |
/* No need for else case as the drivers understand stride |
* zero here. (TODO - propogate this) |
*/ |
} |
if (fixup & VERT_BIT_COLOR1) { |
if (orflag & VERT_BIT_COLOR1) |
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, start, |
VERT_BIT_COLOR1 ); |
else |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, VERT_BIT_END_VB, start, |
IM->Attrib[VERT_ATTRIB_COLOR1][start] ); |
} |
if (fixup & VERT_BIT_FOG) { |
if (orflag & VERT_BIT_FOG) |
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, |
start, VERT_BIT_FOG ); |
else |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, VERT_BIT_END_VB, |
start, IM->Attrib[VERT_ATTRIB_FOG][start] ); |
} |
if (fixup & VERT_BIT_NORMAL) { |
if (orflag & VERT_BIT_NORMAL) |
_tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, start, |
VERT_BIT_NORMAL ); |
else |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, |
VERT_BIT_END_VB, start, |
IM->Attrib[VERT_ATTRIB_NORMAL][start] ); |
} |
} |
/* Prune possible half-filled slot. |
*/ |
IM->Flag[IM->LastData+1] &= ~VERT_BIT_END_VB; |
IM->Flag[IM->Count] |= VERT_BIT_END_VB; |
/* Materials: |
*/ |
if (IM->MaterialOrMask & ~IM->MaterialAndMask) { |
GLuint vulnerable = IM->MaterialOrMask; |
GLuint i = IM->Start; |
do { |
while (!(IM->Flag[i] & VERT_BIT_MATERIAL)) |
i++; |
vulnerable &= ~IM->MaterialMask[i]; |
_mesa_copy_material_pairs( IM->Material[i], |
ctx->Light.Material, |
vulnerable ); |
++i; |
} while (vulnerable); |
} |
} |
static void |
copy_material( struct immediate *next, |
struct immediate *prev, |
GLuint dst, GLuint src ) |
{ |
/* _mesa_debug(NULL, "%s\n", __FUNCTION__); */ |
if (next->Material == 0) { |
next->Material = (struct gl_material (*)[2]) |
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 ); |
next->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); |
} |
next->MaterialMask[dst] = prev->MaterialOrMask; |
MEMCPY(next->Material[dst], prev->Material[src], |
2 * sizeof(struct gl_material)); |
} |
static GLboolean is_fan_like[GL_POLYGON+1] = { |
GL_FALSE, |
GL_FALSE, |
GL_TRUE, /* line loop */ |
GL_FALSE, |
GL_FALSE, |
GL_FALSE, |
GL_TRUE, /* tri fan */ |
GL_FALSE, |
GL_FALSE, |
GL_TRUE /* polygon */ |
}; |
/* Copy the untransformed data from the shared vertices of a primitive |
* that wraps over two immediate structs. This is done prior to |
* set_immediate so that prev and next may point to the same |
* structure. In general it's difficult to avoid this copy on long |
* primitives. |
* |
* Have to be careful with the transitions between display list |
* replay, compile and normal execute modes. |
*/ |
void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct immediate *prev = tnl->ExecCopySource; |
struct vertex_arrays *inputs = &tnl->imm_inputs; |
GLuint count = tnl->ExecCopyCount; |
GLuint *elts = tnl->ExecCopyElts; |
GLuint offset = IMM_MAX_COPIED_VERTS - count; |
GLuint i; |
if (!prev) { |
ASSERT(tnl->ExecCopyCount == 0); |
return; |
} |
next->CopyStart = next->Start - count; |
if ((prev->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT && |
ctx->Array.LockCount && |
ctx->Array.Vertex.Enabled) |
{ |
/* Copy Elt values only |
*/ |
for (i = 0 ; i < count ; i++) |
{ |
GLuint src = elts[i+offset]; |
GLuint dst = next->CopyStart+i; |
next->Elt[dst] = prev->Elt[src]; |
next->Flag[dst] = VERT_BIT_ELT; |
elts[i+offset] = dst; |
} |
/* _mesa_debug(ctx, "ADDING VERT_BIT_ELT!\n"); */ |
next->CopyOrFlag |= VERT_BIT_ELT; |
next->CopyAndFlag &= VERT_BIT_ELT; |
} |
else { |
GLuint copy = tnl->pipeline.inputs & (prev->CopyOrFlag|prev->Evaluated); |
GLuint flag; |
if (is_fan_like[ctx->Driver.CurrentExecPrimitive]) { |
flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_BITS_FIXUP); |
next->CopyOrFlag |= flag; |
} |
else { |
/* Don't let an early 'glColor', etc. poison the elt path. |
*/ |
flag = ((prev->OrFlag|prev->Evaluated) & VERT_BITS_FIXUP); |
} |
next->TexSize |= tnl->ExecCopyTexSize; |
next->CopyAndFlag &= flag; |
/* _tnl_print_vert_flags("copy vertex components", copy); */ |
/* _tnl_print_vert_flags("prev copyorflag", prev->CopyOrFlag); */ |
/* _tnl_print_vert_flags("flag", flag); */ |
/* Copy whole vertices |
*/ |
for (i = 0 ; i < count ; i++) |
{ |
GLuint src = elts[i+offset]; |
GLuint isrc = src - prev->CopyStart; |
GLuint dst = next->CopyStart+i; |
/* Values subject to eval must be copied out of the 'inputs' |
* struct. (Copied rows should not be evaluated twice). |
* |
* Note these pointers are null when inactive. |
*/ |
COPY_4FV( next->Attrib[VERT_ATTRIB_POS][dst], |
inputs->Obj.data[isrc] ); |
if (copy & VERT_BIT_NORMAL) { |
/* _mesa_debug(ctx, "copy vert norm %d to %d (%p): %f %f %f\n", */ |
/* isrc, dst, */ |
/* next->Normal[dst], */ |
/* inputs->Normal.data[isrc][0], */ |
/* inputs->Normal.data[isrc][1], */ |
/* inputs->Normal.data[isrc][2]); */ |
COPY_3FV( next->Attrib[VERT_ATTRIB_NORMAL][dst], inputs->Normal.data[isrc] ); |
} |
if (copy & VERT_BIT_COLOR0) |
COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR0][dst], |
((GLfloat (*)[4])inputs->Color.Ptr)[isrc] ); |
if (copy & VERT_BIT_INDEX) |
next->Index[dst] = inputs->Index.data[isrc]; |
if (copy & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0 ; i < prev->MaxTextureUnits ; i++) { |
if (copy & VERT_BIT_TEX(i)) |
COPY_4FV( next->Attrib[VERT_ATTRIB_TEX0 + i][dst], |
inputs->TexCoord[i].data[isrc] ); |
} |
} |
/* Remaining values should be the same in the 'input' struct and the |
* original immediate. |
*/ |
if (copy & (VERT_BIT_ELT|VERT_BIT_EDGEFLAG|VERT_BIT_COLOR1|VERT_BIT_FOG| |
VERT_BIT_MATERIAL)) { |
if (prev->Flag[src] & VERT_BIT_MATERIAL) |
copy_material(next, prev, dst, src); |
next->Elt[dst] = prev->Elt[src]; |
next->EdgeFlag[dst] = prev->EdgeFlag[src]; |
COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR1][dst], |
prev->Attrib[VERT_ATTRIB_COLOR1][src] ); |
COPY_4FV( next->Attrib[VERT_ATTRIB_FOG][dst], |
prev->Attrib[VERT_ATTRIB_FOG][src] ); |
} |
next->Flag[dst] = flag; |
next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP| |
VERT_BIT_MATERIAL| |
VERT_BIT_POS); |
elts[i+offset] = dst; |
} |
} |
if (--tnl->ExecCopySource->ref_count == 0) |
_tnl_free_immediate( ctx, tnl->ExecCopySource ); |
tnl->ExecCopySource = next; next->ref_count++; |
} |
/* Revive a compiled immediate struct - propogate new 'Current' |
* values. Often this is redundant because the current values were |
* known and fixed up at compile time (or in the first execution of |
* the cassette). |
*/ |
void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint fixup; |
GLuint start = IM->Start; |
/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ |
IM->Evaluated = 0; |
IM->CopyOrFlag = IM->OrFlag; |
IM->CopyAndFlag = IM->AndFlag; |
IM->CopyTexSize = IM->TexSize | tnl->ExecCopyTexSize; |
_tnl_copy_immediate_vertices( ctx, IM ); |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { |
ASSERT(IM->CopyStart == IM->Start); |
} |
/* Naked array elements can be copied into the first cassette in a |
* display list. Need to translate them away: |
*/ |
if (IM->CopyOrFlag & VERT_BIT_ELT) { |
GLuint copy = tnl->pipeline.inputs & ~ctx->Array._Enabled; |
GLuint i; |
ASSERT(IM->CopyStart < IM->Start); |
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->Start ); |
for (i = IM->CopyStart ; i < IM->Start ; i++) |
copy_from_current( ctx, IM, i, copy ); |
_tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->Start ); |
} |
fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_BITS_FIXUP; |
/* _tnl_print_vert_flags("fixup compiled", fixup); */ |
if (fixup) { |
/* XXX try to replace this code with a loop over the 16 vertex |
* attributes. |
*/ |
if (fixup & VERT_BIT_NORMAL) { |
fixup_first_4f(IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, |
VERT_BIT_NORMAL, start, |
ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); |
} |
if (fixup & VERT_BIT_COLOR0) { |
if (IM->CopyOrFlag & VERT_BIT_COLOR0) |
fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, |
VERT_BIT_COLOR0, start, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
else |
fixup &= ~VERT_BIT_COLOR0; |
} |
if (fixup & VERT_BIT_COLOR1) |
fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, |
VERT_BIT_COLOR1, start, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR1] ); |
if (fixup & VERT_BIT_FOG) |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, |
VERT_BIT_FOG, start, |
ctx->Current.Attrib[VERT_ATTRIB_FOG] ); |
if (fixup & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (fixup & VERT_BIT_TEX(i)) |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, |
VERT_BIT_TEX(i), start, |
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i] ); |
} |
} |
if (fixup & VERT_BIT_EDGEFLAG) |
fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_BIT_EDGEFLAG, start, |
ctx->Current.EdgeFlag ); |
if (fixup & VERT_BIT_INDEX) |
fixup_first_1ui(IM->Index, IM->Flag, VERT_BIT_INDEX, start, |
ctx->Current.Index ); |
IM->CopyOrFlag |= fixup; |
} |
/* Materials: |
*/ |
if (IM->MaterialOrMask & ~IM->MaterialAndMask) { |
GLuint vulnerable = IM->MaterialOrMask; |
GLuint i = IM->Start; |
do { |
while (!(IM->Flag[i] & VERT_BIT_MATERIAL)) |
i++; |
vulnerable &= ~IM->MaterialMask[i]; |
_mesa_copy_material_pairs( IM->Material[i], |
ctx->Light.Material, |
vulnerable ); |
++i; |
} while (vulnerable); |
} |
} |
static void copy_none( TNLcontext *tnl, GLuint start, GLuint count, GLuint ovf) |
{ |
(void) (start && ovf && tnl && count); |
} |
static void copy_last( TNLcontext *tnl, GLuint start, GLuint count, GLuint ovf) |
{ |
(void) start; (void) ovf; |
tnl->ExecCopyCount = 1; |
tnl->ExecCopyElts[2] = count-1; |
} |
static void copy_first_and_last( TNLcontext *tnl, GLuint start, GLuint count, |
GLuint ovf) |
{ |
(void) ovf; |
tnl->ExecCopyCount = 2; |
tnl->ExecCopyElts[1] = start; |
tnl->ExecCopyElts[2] = count-1; |
} |
static void copy_last_two( TNLcontext *tnl, GLuint start, GLuint count, |
GLuint ovf ) |
{ |
(void) start; |
tnl->ExecCopyCount = 2+ovf; |
tnl->ExecCopyElts[0] = count-3; |
tnl->ExecCopyElts[1] = count-2; |
tnl->ExecCopyElts[2] = count-1; |
} |
static void copy_overflow( TNLcontext *tnl, GLuint start, GLuint count, |
GLuint ovf ) |
{ |
(void) start; |
tnl->ExecCopyCount = ovf; |
tnl->ExecCopyElts[0] = count-3; |
tnl->ExecCopyElts[1] = count-2; |
tnl->ExecCopyElts[2] = count-1; |
} |
typedef void (*copy_func)( TNLcontext *tnl, GLuint start, GLuint count, |
GLuint ovf ); |
static copy_func copy_tab[GL_POLYGON+2] = |
{ |
copy_none, |
copy_overflow, |
copy_first_and_last, |
copy_last, |
copy_overflow, |
copy_last_two, |
copy_first_and_last, |
copy_overflow, |
copy_last_two, |
copy_first_and_last, |
copy_none |
}; |
/* Figure out what vertices need to be copied next time. |
*/ |
void |
_tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint last = IM->LastPrimitive; |
GLuint prim = ctx->Driver.CurrentExecPrimitive; |
GLuint pincr = increment[prim]; |
GLuint pintro = intro[prim]; |
GLuint ovf = 0; |
/* _mesa_debug(ctx, "_tnl_get_exec_copy_verts %s\n", */ |
/* _mesa_lookup_enum_by_nr(prim)); */ |
if (tnl->ExecCopySource) |
if (--tnl->ExecCopySource->ref_count == 0) |
_tnl_free_immediate( ctx, tnl->ExecCopySource ); |
if (prim == GL_POLYGON+1) { |
tnl->ExecCopySource = 0; |
tnl->ExecCopyCount = 0; |
tnl->ExecCopyTexSize = 0; |
tnl->ExecParity = 0; |
} else { |
/* Remember this immediate as the one to copy from. |
*/ |
tnl->ExecCopySource = IM; IM->ref_count++; |
tnl->ExecCopyCount = 0; |
tnl->ExecCopyTexSize = IM->CopyTexSize; |
if (IM->LastPrimitive != IM->CopyStart) |
tnl->ExecParity = 0; |
tnl->ExecParity ^= IM->PrimitiveLength[IM->LastPrimitive] & 1; |
if (pincr != 1 && (IM->Count - last - pintro)) |
ovf = (IM->Count - last - pintro) % pincr; |
if (last < IM->Count) |
copy_tab[prim]( tnl, last, IM->Count, ovf ); |
} |
} |
/* Recalculate ExecCopyElts, ExecParity, etc. |
*/ |
void |
_tnl_get_purged_copy_verts( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { |
GLuint last = IM->LastPrimitive; |
GLenum prim = IM->Primitive[last]; |
GLuint pincr = increment[prim]; |
GLuint pintro = intro[prim]; |
GLuint ovf = 0, i; |
tnl->ExecCopyCount = 0; |
if (IM->LastPrimitive != IM->CopyStart) |
tnl->ExecParity = 0; |
tnl->ExecParity ^= IM->PrimitiveLength[IM->LastPrimitive] & 1; |
if (pincr != 1 && (IM->Count - last - pintro)) |
ovf = (IM->Count - last - pintro) % pincr; |
if (last < IM->Count) |
copy_tab[prim]( tnl, last, IM->Count, ovf ); |
for (i = 0 ; i < tnl->ExecCopyCount ; i++) |
tnl->ExecCopyElts[i] = IM->Elt[tnl->ExecCopyElts[i]]; |
} |
} |
void _tnl_upgrade_current_data( GLcontext *ctx, |
GLuint required, |
GLuint flags ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
struct immediate *IM = (struct immediate *)VB->import_source; |
ASSERT(IM); |
/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */ |
if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) { |
struct gl_client_array *tmp = &tnl->imm_inputs.Color; |
GLuint start = IM->CopyStart; |
tmp->Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start; |
tmp->StrideB = 4 * sizeof(GLfloat); |
tmp->Flags = 0; |
COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][start], |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); |
/* |
ASSERT(IM->Flag[IM->LastData+1] & VERT_BIT_END_VB); |
*/ |
fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, |
VERT_BIT_END_VB, |
start, IM->Attrib[VERT_ATTRIB_COLOR0][start] ); |
VB->importable_data &= ~VERT_BIT_COLOR0; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_alloc.h |
---|
0,0 → 1,40 |
/* $Id: t_imm_alloc.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_IMM_ALLOC_H |
#define _T_IMM_ALLOC_H |
#include "mtypes.h" |
#include "t_context.h" |
extern struct immediate *_tnl_alloc_immediate( GLcontext *ctx ); |
extern void _tnl_free_immediate( GLcontext *ctx, struct immediate *im ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_fixup.h |
---|
0,0 → 1,64 |
/* $Id: t_imm_fixup.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_IMM_FIXUP_H |
#define _T_IMM_FIXUP_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_fixup_1ub( GLubyte *data, GLuint flag[], |
GLuint start, GLuint match ); |
extern void _tnl_fixup_1f( GLfloat *data, GLuint flag[], |
GLuint start, GLuint match ); |
extern void _tnl_fixup_1ui( GLuint *data, GLuint flag[], |
GLuint start, GLuint match ); |
extern void _tnl_fixup_3f( float data[][3], GLuint flag[], |
GLuint start, GLuint match ); |
extern void _tnl_fixup_4f( GLfloat data[][4], GLuint flag[], |
GLuint start, GLuint match ); |
extern void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ); |
extern void _tnl_fixup_compiled_cassette( GLcontext *ctx, |
struct immediate *IM ); |
extern void _tnl_copy_immediate_vertices( GLcontext *ctx, |
struct immediate *IM ); |
extern void _tnl_get_purged_copy_verts( GLcontext *ctx, struct immediate *IM ); |
extern void _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ); |
extern void _tnl_upgrade_current_data( GLcontext *ctx, GLuint required, |
GLuint flags ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_fog.c |
---|
0,0 → 1,254 |
/* $Id: t_vb_fog.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
struct fog_stage_data { |
GLvector4f fogcoord; /* has actual storage allocated */ |
GLvector4f input; /* points into VB->EyePtr Z values */ |
}; |
#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) |
#define FOG_EXP_TABLE_SIZE 256 |
#define FOG_MAX (10.0) |
#define EXP_FOG_MAX .0006595 |
#define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE) |
static GLfloat exp_table[FOG_EXP_TABLE_SIZE]; |
static GLfloat inited = 0; |
#if 1 |
#define NEG_EXP( result, narg ) \ |
do { \ |
GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR)); \ |
GLint k = (GLint) f; \ |
if (k > FOG_EXP_TABLE_SIZE-2) \ |
result = (GLfloat) EXP_FOG_MAX; \ |
else \ |
result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]); \ |
} while (0) |
#else |
#define NEG_EXP( result, narg ) \ |
do { \ |
result = exp(-narg); \ |
} while (0) |
#endif |
static void init_static_data( void ) |
{ |
GLfloat f = 0.0F; |
GLint i = 0; |
for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { |
exp_table[i] = (GLfloat) exp(-f); |
} |
inited = 1; |
} |
static void make_win_fog_coords( GLcontext *ctx, GLvector4f *out, |
const GLvector4f *in ) |
{ |
GLfloat end = ctx->Fog.End; |
GLfloat *v = in->start; |
GLuint stride = in->stride; |
GLuint n = in->count; |
GLfloat (*data)[4] = out->data; |
GLfloat d; |
GLuint i; |
out->count = in->count; |
switch (ctx->Fog.Mode) { |
case GL_LINEAR: |
if (ctx->Fog.Start == ctx->Fog.End) |
d = 1.0F; |
else |
d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); |
for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { |
GLfloat f = (end - ABSF(*v)) * d; |
data[i][0] = CLAMP(f, 0.0F, 1.0F); |
} |
break; |
case GL_EXP: |
d = ctx->Fog.Density; |
for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) |
NEG_EXP( data[i][0], d * ABSF(*v) ); |
break; |
case GL_EXP2: |
d = ctx->Fog.Density*ctx->Fog.Density; |
for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { |
GLfloat z = *v; |
NEG_EXP( data[i][0], d * z * z ); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad fog mode in make_fog_coord"); |
return; |
} |
} |
static GLboolean run_fog_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct fog_stage_data *store = FOG_STAGE_DATA(stage); |
GLvector4f *input; |
if (stage->changed_inputs == 0) |
return GL_TRUE; |
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { |
/* fog computed from Z depth */ |
/* source = VB->ObjPtr or VB->EyePtr coords */ |
/* dest = VB->FogCoordPtr = fog stage private storage */ |
VB->FogCoordPtr = &store->fogcoord; |
if (!ctx->_NeedEyeCoords) { |
const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; |
GLfloat plane[4]; |
/* Use this to store calculated eye z values: |
*/ |
input = &store->fogcoord; |
plane[0] = m[2]; |
plane[1] = m[6]; |
plane[2] = m[10]; |
plane[3] = m[14]; |
/* Full eye coords weren't required, just calculate the |
* eye Z values. |
*/ |
_mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data, |
4 * sizeof(GLfloat), |
VB->ObjPtr, plane ); |
input->count = VB->ObjPtr->count; |
} |
else { |
input = &store->input; |
if (VB->EyePtr->size < 2) |
_mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); |
input->data = (GLfloat (*)[4]) &(VB->EyePtr->data[0][2]); |
input->start = VB->EyePtr->start+2; |
input->stride = VB->EyePtr->stride; |
input->count = VB->EyePtr->count; |
} |
} |
else { |
/* use glFogCoord() coordinates */ |
/* source = VB->FogCoordPtr */ |
input = VB->FogCoordPtr; |
/* dest = fog stage private storage */ |
VB->FogCoordPtr = &store->fogcoord; |
} |
make_win_fog_coords( ctx, VB->FogCoordPtr, input ); |
return GL_TRUE; |
} |
static void check_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
stage->active = ctx->Fog.Enabled && !ctx->VertexProgram.Enabled; |
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) |
stage->inputs = VERT_BIT_EYE; |
else |
stage->inputs = VERT_BIT_FOG; |
} |
/* Called the first time stage->run() is invoked. |
*/ |
static GLboolean alloc_fog_data( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct fog_stage_data *store; |
stage->privatePtr = MALLOC(sizeof(*store)); |
store = FOG_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
_mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); |
_mesa_vector4f_init( &store->input, 0, 0 ); |
if (!inited) |
init_static_data(); |
/* Now run the stage. |
*/ |
stage->run = run_fog_stage; |
return stage->run( ctx, stage ); |
} |
static void free_fog_data( struct gl_pipeline_stage *stage ) |
{ |
struct fog_stage_data *store = FOG_STAGE_DATA(stage); |
if (store) { |
_mesa_vector4f_free( &store->fogcoord ); |
FREE( store ); |
stage->privatePtr = NULL; |
} |
} |
const struct gl_pipeline_stage _tnl_fog_coordinate_stage = |
{ |
"build fog coordinates", /* name */ |
_NEW_FOG, /* check_state */ |
_NEW_FOG, /* run_state */ |
GL_FALSE, /* active? */ |
0, /* inputs */ |
VERT_BIT_FOG, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private_data */ |
free_fog_data, /* dtr */ |
check_fog_stage, /* check */ |
alloc_fog_data /* run -- initially set to init. */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_cliptmp.h |
---|
0,0 → 1,271 |
/* $Id: t_vb_cliptmp.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#define CLIP_DOTPROD(K, A, B, C, D) X(K)*A + Y(K)*B + Z(K)*C + W(K)*D |
#define POLY_CLIP( PLANE, A, B, C, D ) \ |
do { \ |
if (mask & PLANE) { \ |
GLuint idxPrev = inlist[0]; \ |
GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D ); \ |
GLuint outcount = 0; \ |
GLuint i; \ |
\ |
inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ |
for (i = 1; i <= n; i++) { \ |
GLuint idx = inlist[i]; \ |
GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \ |
\ |
clipmask[idxPrev] |= PLANE; \ |
if (!NEGATIVE(dpPrev)) { \ |
outlist[outcount++] = idxPrev; \ |
clipmask[idxPrev] &= ~PLANE; \ |
} \ |
\ |
if (DIFFERENT_SIGNS(dp, dpPrev)) { \ |
GLuint newvert = VB->LastClipped++; \ |
VB->ClipMask[newvert] = 0; \ |
outlist[outcount++] = newvert; \ |
if (NEGATIVE(dp)) { \ |
/* Going out of bounds. Avoid division by zero as we \ |
* know dp != dpPrev from DIFFERENT_SIGNS, above. \ |
*/ \ |
GLfloat t = dp / (dp - dpPrev); \ |
INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \ |
interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \ |
} else { \ |
/* Coming back in. \ |
*/ \ |
GLfloat t = dpPrev / (dpPrev - dp); \ |
INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \ |
interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \ |
} \ |
} \ |
\ |
idxPrev = idx; \ |
dpPrev = dp; \ |
} \ |
\ |
if (outcount < 3) \ |
return; \ |
\ |
{ \ |
GLuint *tmp = inlist; \ |
inlist = outlist; \ |
outlist = tmp; \ |
n = outcount; \ |
} \ |
} \ |
} while (0) |
#define LINE_CLIP(PLANE, A, B, C, D ) \ |
do { \ |
if (mask & PLANE) { \ |
GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \ |
GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \ |
\ |
if (DIFFERENT_SIGNS(dpI, dpJ)) { \ |
GLuint newvert = VB->LastClipped++; \ |
VB->ClipMask[newvert] = 0; \ |
if (NEGATIVE(dpJ)) { \ |
GLfloat t = dpI / (dpI - dpJ); \ |
VB->ClipMask[jj] |= PLANE; \ |
INTERP_4F( t, coord[newvert], coord[ii], coord[jj] ); \ |
interp( ctx, t, newvert, ii, jj, GL_FALSE ); \ |
jj = newvert; \ |
} else { \ |
GLfloat t = dpJ / (dpJ - dpI); \ |
VB->ClipMask[ii] |= PLANE; \ |
INTERP_4F( t, coord[newvert], coord[jj], coord[ii] ); \ |
interp( ctx, t, newvert, jj, ii, GL_FALSE ); \ |
ii = newvert; \ |
} \ |
} \ |
else if (NEGATIVE(dpI)) \ |
return; \ |
} \ |
} while (0) |
/* Clip a line against the viewport and user clip planes. |
*/ |
static INLINE void |
TAG(clip_line)( GLcontext *ctx, GLuint i, GLuint j, GLubyte mask ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
interp_func interp = tnl->Driver.Render.Interp; |
GLfloat (*coord)[4] = VB->ClipPtr->data; |
GLuint ii = i, jj = j, p; |
VB->LastClipped = VB->FirstClipped; |
if (mask & 0x3f) { |
LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); |
LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); |
LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); |
LINE_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); |
LINE_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); |
LINE_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); |
} |
if (mask & CLIP_USER_BIT) { |
for (p=0;p<MAX_CLIP_PLANES;p++) { |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; |
const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; |
const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; |
const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; |
LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); |
} |
} |
} |
if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj) |
tnl->Driver.Render.CopyPV( ctx, jj, j ); |
tnl->Driver.Render.ClippedLine( ctx, ii, jj ); |
} |
/* Clip a triangle against the viewport and user clip planes. |
*/ |
static INLINE void |
TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
interp_func interp = tnl->Driver.Render.Interp; |
GLfloat (*coord)[4] = VB->ClipPtr->data; |
GLuint pv = v2; |
GLuint vlist[2][MAX_CLIPPED_VERTICES]; |
GLuint *inlist = vlist[0], *outlist = vlist[1]; |
GLuint p; |
GLubyte *clipmask = VB->ClipMask; |
GLuint n = 3; |
ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ |
VB->LastClipped = VB->FirstClipped; |
if (mask & 0x3f) { |
POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); |
POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); |
POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); |
POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); |
POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); |
POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); |
} |
if (mask & CLIP_USER_BIT) { |
for (p=0;p<MAX_CLIP_PLANES;p++) { |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; |
const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; |
const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; |
const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; |
POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); |
} |
} |
} |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
if (pv != inlist[0]) { |
ASSERT( inlist[0] >= VB->FirstClipped ); |
tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); |
} |
} |
tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); |
} |
/* Clip a quad against the viewport and user clip planes. |
*/ |
static INLINE void |
TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, |
GLubyte mask ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
interp_func interp = tnl->Driver.Render.Interp; |
GLfloat (*coord)[4] = VB->ClipPtr->data; |
GLuint pv = v3; |
GLuint vlist[2][MAX_CLIPPED_VERTICES]; |
GLuint *inlist = vlist[0], *outlist = vlist[1]; |
GLuint p; |
GLubyte *clipmask = VB->ClipMask; |
GLuint n = 4; |
ASSIGN_4V(inlist, v3, v0, v1, v2 ); /* pv rotated to slot zero */ |
VB->LastClipped = VB->FirstClipped; |
if (mask & 0x3f) { |
POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); |
POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); |
POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); |
POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); |
POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); |
POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); |
} |
if (mask & CLIP_USER_BIT) { |
for (p=0;p<MAX_CLIP_PLANES;p++) { |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; |
const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; |
const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; |
const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; |
POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); |
} |
} |
} |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
if (pv != inlist[0]) { |
ASSERT( inlist[0] >= VB->FirstClipped ); |
tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); |
} |
} |
tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); |
} |
#undef W |
#undef Z |
#undef Y |
#undef X |
#undef SIZE |
#undef TAG |
#undef POLY_CLIP |
#undef LINE_CLIP |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_render.c |
---|
0,0 → 1,425 |
/* $Id: t_vb_render.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
/* |
* Render whole vertex buffers, including projection of vertices from |
* clip space and clipping of primitives. |
* |
* This file makes calls to project vertices and to the point, line |
* and triangle rasterizers via the function pointers: |
* |
* context->Driver.Render.* |
* |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "enums.h" |
#include "macros.h" |
#include "imports.h" |
#include "mtypes.h" |
#include "mmath.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
#include "t_pipeline.h" |
/**********************************************************************/ |
/* Clip single primitives */ |
/**********************************************************************/ |
#if defined(USE_IEEE) |
#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31)) |
#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) |
#else |
#define NEGATIVE(x) (x < 0) |
#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0) |
/* Could just use (x*y<0) except for the flatshading requirements. |
* Maybe there's a better way? |
*/ |
#endif |
#define W(i) coord[i][3] |
#define Z(i) coord[i][2] |
#define Y(i) coord[i][1] |
#define X(i) coord[i][0] |
#define SIZE 4 |
#define TAG(x) x##_4 |
#include "t_vb_cliptmp.h" |
/**********************************************************************/ |
/* Clip and render whole begin/end objects */ |
/**********************************************************************/ |
#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) |
#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] |
#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val |
/* Vertices, with the possibility of clipping. |
*/ |
#define RENDER_POINTS( start, count ) \ |
tnl->Driver.Render.Points( ctx, start, count ) |
#define RENDER_LINE( v1, v2 ) \ |
do { \ |
GLubyte c1 = mask[v1], c2 = mask[v2]; \ |
GLubyte ormask = c1|c2; \ |
if (!ormask) \ |
LineFunc( ctx, v1, v2 ); \ |
else if (!(c1 & c2 & 0x3f)) \ |
clip_line_4( ctx, v1, v2, ormask ); \ |
} while (0) |
#define RENDER_TRI( v1, v2, v3 ) \ |
do { \ |
GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ |
GLubyte ormask = c1|c2|c3; \ |
if (!ormask) \ |
TriangleFunc( ctx, v1, v2, v3 ); \ |
else if (!(c1 & c2 & c3 & 0x3f)) \ |
clip_tri_4( ctx, v1, v2, v3, ormask ); \ |
} while (0) |
#define RENDER_QUAD( v1, v2, v3, v4 ) \ |
do { \ |
GLubyte c1 = mask[v1], c2 = mask[v2]; \ |
GLubyte c3 = mask[v3], c4 = mask[v4]; \ |
GLubyte ormask = c1|c2|c3|c4; \ |
if (!ormask) \ |
QuadFunc( ctx, v1, v2, v3, v4 ); \ |
else if (!(c1 & c2 & c3 & c4 & 0x3f)) \ |
clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ |
} while (0) |
#define LOCAL_VARS \ |
TNLcontext *tnl = TNL_CONTEXT(ctx); \ |
struct vertex_buffer *VB = &tnl->vb; \ |
const GLuint * const elt = VB->Elts; \ |
const GLubyte *mask = VB->ClipMask; \ |
const GLuint sz = VB->ClipPtr->size; \ |
const line_func LineFunc = tnl->Driver.Render.Line; \ |
const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ |
const quad_func QuadFunc = tnl->Driver.Render.Quad; \ |
const GLboolean stipple = ctx->Line.StippleFlag; \ |
(void) (LineFunc && TriangleFunc && QuadFunc); \ |
(void) elt; (void) mask; (void) sz; (void) stipple; |
#define TAG(x) clip_##x##_verts |
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) |
#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) |
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE |
#define PRESERVE_VB_DEFS |
#include "t_vb_rendertmp.h" |
/* Elts, with the possibility of clipping. |
*/ |
#undef ELT |
#undef TAG |
#define ELT(x) elt[x] |
#define TAG(x) clip_##x##_elts |
#include "t_vb_rendertmp.h" |
/* TODO: do this for all primitives, verts and elts: |
*/ |
static void clip_elt_triangles( GLcontext *ctx, |
GLuint start, |
GLuint count, |
GLuint flags ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; |
struct vertex_buffer *VB = &tnl->vb; |
const GLuint * const elt = VB->Elts; |
GLubyte *mask = VB->ClipMask; |
GLuint last = count-2; |
GLuint j; |
(void) flags; |
tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); |
for (j=start; j < last; j+=3 ) { |
GLubyte c1 = mask[elt[j]]; |
GLubyte c2 = mask[elt[j+1]]; |
GLubyte c3 = mask[elt[j+2]]; |
GLubyte ormask = c1|c2|c3; |
if (ormask) { |
if (start < j) |
render_tris( ctx, start, j, 0 ); |
if (!(c1&c2&c3&0x3f)) |
clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); |
start = j+3; |
} |
} |
if (start < j) |
render_tris( ctx, start, j, 0 ); |
} |
/**********************************************************************/ |
/* Render whole begin/end objects */ |
/**********************************************************************/ |
#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) |
#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] |
#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val |
/* Vertices, no clipping. |
*/ |
#define RENDER_POINTS( start, count ) \ |
tnl->Driver.Render.Points( ctx, start, count ) |
#define RENDER_LINE( v1, v2 ) \ |
LineFunc( ctx, v1, v2 ) |
#define RENDER_TRI( v1, v2, v3 ) \ |
TriangleFunc( ctx, v1, v2, v3 ) |
#define RENDER_QUAD( v1, v2, v3, v4 ) \ |
QuadFunc( ctx, v1, v2, v3, v4 ) |
#define TAG(x) _tnl_##x##_verts |
#define LOCAL_VARS \ |
TNLcontext *tnl = TNL_CONTEXT(ctx); \ |
struct vertex_buffer *VB = &tnl->vb; \ |
const GLuint * const elt = VB->Elts; \ |
const line_func LineFunc = tnl->Driver.Render.Line; \ |
const triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ |
const quad_func QuadFunc = tnl->Driver.Render.Quad; \ |
const GLboolean stipple = ctx->Line.StippleFlag; \ |
(void) (LineFunc && TriangleFunc && QuadFunc); \ |
(void) elt; (void) stipple |
#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) |
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE |
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) |
#define RENDER_TAB_QUALIFIER |
#define PRESERVE_VB_DEFS |
#include "t_vb_rendertmp.h" |
/* Elts, no clipping. |
*/ |
#undef ELT |
#define TAG(x) _tnl_##x##_elts |
#define ELT(x) elt[x] |
#include "t_vb_rendertmp.h" |
/**********************************************************************/ |
/* Helper functions for drivers */ |
/**********************************************************************/ |
void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLuint *tmp = VB->Elts; |
VB->Elts = (GLuint *)elts; |
tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); |
VB->Elts = tmp; |
} |
void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->Driver.Render.Line( ctx, ii, jj ); |
} |
/**********************************************************************/ |
/* Clip and render whole vertex buffers */ |
/**********************************************************************/ |
static GLboolean run_render( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLuint new_inputs = stage->changed_inputs; |
render_func *tab; |
GLint pass = 0; |
/* Allow the drivers to lock before projected verts are built so |
* that window coordinates are guarenteed not to change before |
* rendering. |
*/ |
ASSERT(tnl->Driver.Render.Start); |
tnl->Driver.Render.Start( ctx ); |
ASSERT(tnl->Driver.Render.BuildVertices); |
ASSERT(tnl->Driver.Render.PrimitiveNotify); |
ASSERT(tnl->Driver.Render.Points); |
ASSERT(tnl->Driver.Render.Line); |
ASSERT(tnl->Driver.Render.Triangle); |
ASSERT(tnl->Driver.Render.Quad); |
ASSERT(tnl->Driver.Render.ResetLineStipple); |
ASSERT(tnl->Driver.Render.Interp); |
ASSERT(tnl->Driver.Render.CopyPV); |
ASSERT(tnl->Driver.Render.ClippedLine); |
ASSERT(tnl->Driver.Render.ClippedPolygon); |
ASSERT(tnl->Driver.Render.Finish); |
tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, new_inputs ); |
if (VB->ClipOrMask) { |
tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; |
clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; |
} |
else { |
tab = (VB->Elts ? |
tnl->Driver.Render.PrimTabElts : |
tnl->Driver.Render.PrimTabVerts); |
} |
do |
{ |
GLuint i, length, flags = 0; |
for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) |
{ |
flags = VB->Primitive[i]; |
length= VB->PrimitiveLength[i]; |
ASSERT(length || (flags & PRIM_LAST)); |
ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); |
if (MESA_VERBOSE & VERBOSE_PRIMS) |
_mesa_debug(NULL, "MESA prim %s %d..%d\n", |
_mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), |
i, i+length); |
if (length) |
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); |
} |
} while (tnl->Driver.Render.Multipass && |
tnl->Driver.Render.Multipass( ctx, ++pass )); |
tnl->Driver.Render.Finish( ctx ); |
/* _swrast_flush(ctx); */ |
/* usleep(1000000); */ |
return GL_FALSE; /* finished the pipe */ |
} |
/**********************************************************************/ |
/* Render pipeline stage */ |
/**********************************************************************/ |
/* Quite a bit of work involved in finding out the inputs for the |
* render stage. |
*/ |
static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
GLuint inputs = VERT_BIT_CLIP; |
GLuint i; |
if (ctx->Visual.rgbMode) { |
inputs |= VERT_BIT_COLOR0; |
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) |
inputs |= VERT_BIT_COLOR1; |
if (ctx->Texture._EnabledUnits) { |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (ctx->Texture.Unit[i]._ReallyEnabled) |
inputs |= VERT_BIT_TEX(i); |
} |
} |
} |
else { |
inputs |= VERT_BIT_INDEX; |
} |
if (ctx->Point._Attenuated) |
inputs |= VERT_BIT_POINT_SIZE; |
/* How do drivers turn this off? |
*/ |
if (ctx->Fog.Enabled) |
inputs |= VERT_BIT_FOG; |
if (ctx->_TriangleCaps & DD_TRI_UNFILLED) |
inputs |= VERT_BIT_EDGEFLAG; |
if (ctx->RenderMode==GL_FEEDBACK) |
inputs |= VERT_BITS_TEX_ANY; |
stage->inputs = inputs; |
} |
static void dtr( struct gl_pipeline_stage *stage ) |
{ |
} |
const struct gl_pipeline_stage _tnl_render_stage = |
{ |
"render", /* name */ |
(_NEW_BUFFERS | |
_DD_NEW_SEPARATE_SPECULAR | |
_DD_NEW_FLATSHADE | |
_NEW_TEXTURE| |
_NEW_LIGHT| |
_NEW_POINT| |
_NEW_FOG| |
_DD_NEW_TRI_UNFILLED | |
_NEW_RENDERMODE), /* re-check (new inputs, interp function) */ |
0, /* re-run (always runs) */ |
GL_TRUE, /* active? */ |
0, /* inputs (set in check_render) */ |
0, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private data */ |
dtr, /* destructor */ |
check_render, /* check */ |
run_render /* run */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_array_import.c |
---|
0,0 → 1,432 |
/* $Id: t_array_import.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "state.h" |
#include "mtypes.h" |
#include "array_cache/acache.h" |
#include "math/m_translate.h" |
#include "t_array_import.h" |
#include "t_context.h" |
#include "t_imm_debug.h" |
static void _tnl_import_vertex( GLcontext *ctx, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
tmp = _ac_import_vertex(ctx, |
GL_FLOAT, |
stride ? 4*sizeof(GLfloat) : 0, |
0, |
writeable, |
&is_writeable); |
inputs->Obj.data = (GLfloat (*)[4]) tmp->Ptr; |
inputs->Obj.start = (GLfloat *) tmp->Ptr; |
inputs->Obj.stride = tmp->StrideB; |
inputs->Obj.size = tmp->Size; |
inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->Obj.stride != 4*sizeof(GLfloat)) |
inputs->Obj.flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->Obj.flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_normal( GLcontext *ctx, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
tmp = _ac_import_normal(ctx, GL_FLOAT, |
stride ? 3*sizeof(GLfloat) : 0, writeable, |
&is_writeable); |
inputs->Normal.data = (GLfloat (*)[4]) tmp->Ptr; |
inputs->Normal.start = (GLfloat *) tmp->Ptr; |
inputs->Normal.stride = tmp->StrideB; |
inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->Normal.stride != 3*sizeof(GLfloat)) |
inputs->Normal.flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->Normal.flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_color( GLcontext *ctx, |
GLenum type, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
tmp = _ac_import_color(ctx, |
type, |
stride ? 4*sizeof(GLfloat) : 0, |
4, |
writeable, |
&is_writeable); |
inputs->Color = *tmp; |
} |
static void _tnl_import_secondarycolor( GLcontext *ctx, |
GLenum type, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
tmp = _ac_import_secondarycolor(ctx, |
type, |
stride ? 4*sizeof(GLfloat) : 0, |
4, |
writeable, |
&is_writeable); |
inputs->SecondaryColor = *tmp; |
} |
static void _tnl_import_fogcoord( GLcontext *ctx, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
tmp = _ac_import_fogcoord(ctx, GL_FLOAT, |
stride ? sizeof(GLfloat) : 0, writeable, |
&is_writeable); |
inputs->FogCoord.data = (GLfloat (*)[4]) tmp->Ptr; |
inputs->FogCoord.start = (GLfloat *) tmp->Ptr; |
inputs->FogCoord.stride = tmp->StrideB; |
inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->FogCoord.stride != sizeof(GLfloat)) |
inputs->FogCoord.flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->FogCoord.flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_index( GLcontext *ctx, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
tmp = _ac_import_index(ctx, GL_UNSIGNED_INT, |
stride ? sizeof(GLuint) : 0, writeable, |
&is_writeable); |
inputs->Index.data = (GLuint *) tmp->Ptr; |
inputs->Index.start = (GLuint *) tmp->Ptr; |
inputs->Index.stride = tmp->StrideB; |
inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->Index.stride != sizeof(GLuint)) |
inputs->Index.flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->Index.flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_texcoord( GLcontext *ctx, |
GLuint unit, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT, |
stride ? 4 * sizeof(GLfloat) : 0, |
0, |
writeable, |
&is_writeable); |
inputs->TexCoord[unit].data = (GLfloat (*)[4]) tmp->Ptr; |
inputs->TexCoord[unit].start = (GLfloat *) tmp->Ptr; |
inputs->TexCoord[unit].stride = tmp->StrideB; |
inputs->TexCoord[unit].size = tmp->Size; |
inputs->TexCoord[unit].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->TexCoord[unit].stride != 4*sizeof(GLfloat)) |
inputs->TexCoord[unit].flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->TexCoord[unit].flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_edgeflag( GLcontext *ctx, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, |
stride ? sizeof(GLubyte) : 0, |
0, |
&is_writeable); |
inputs->EdgeFlag.data = (GLubyte *) tmp->Ptr; |
inputs->EdgeFlag.start = (GLubyte *) tmp->Ptr; |
inputs->EdgeFlag.stride = tmp->StrideB; |
inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->EdgeFlag.stride != sizeof(GLubyte)) |
inputs->EdgeFlag.flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->EdgeFlag.flags |= VEC_NOT_WRITEABLE; |
} |
static void _tnl_import_attrib( GLcontext *ctx, |
GLuint index, |
GLboolean writeable, |
GLboolean stride ) |
{ |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
struct gl_client_array *tmp; |
GLboolean is_writeable = 0; |
tmp = _ac_import_attrib(ctx, index, GL_FLOAT, |
stride ? 4 * sizeof(GLfloat) : 0, |
4, /* want GLfloat[4] */ |
writeable, |
&is_writeable); |
inputs->Attribs[index].data = (GLfloat (*)[4]) tmp->Ptr; |
inputs->Attribs[index].start = (GLfloat *) tmp->Ptr; |
inputs->Attribs[index].stride = tmp->StrideB; |
inputs->Attribs[index].size = tmp->Size; |
inputs->Attribs[index].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); |
if (inputs->Attribs[index].stride != 4 * sizeof(GLfloat)) |
inputs->Attribs[index].flags |= VEC_BAD_STRIDE; |
if (!is_writeable) |
inputs->Attribs[index].flags |= VEC_NOT_WRITEABLE; |
} |
/** |
* Callback for VB stages that need to improve the quality of arrays |
* bound to the VB. This is only necessary for client arrays which |
* have not been transformed at any point in the pipeline. |
* \param required - bitmask of VERT_*_BIT flags |
* \param flags - bitmask of VEC_* flags (ex: VEC_NOT_WRITABLE) |
*/ |
static void _tnl_upgrade_client_data( GLcontext *ctx, |
GLuint required, |
GLuint flags ) |
{ |
GLuint i; |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0; |
GLboolean stride = (flags & VEC_BAD_STRIDE) != 0; |
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; |
GLuint ca_flags = 0; |
(void) inputs; |
if (writeable || stride) ca_flags |= CA_CLIENT_DATA; |
if ((required & VERT_BIT_CLIP) && VB->ClipPtr == VB->ObjPtr) |
required |= VERT_BIT_POS; |
/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */ |
if ((required & VERT_BIT_POS) && (VB->ObjPtr->flags & flags)) { |
ASSERT(VB->ObjPtr == &inputs->Obj); |
_tnl_import_vertex( ctx, writeable, stride ); |
VB->importable_data &= ~(VERT_BIT_POS|VERT_BIT_CLIP); |
} |
if ((required & VERT_BIT_NORMAL) && (VB->NormalPtr->flags & flags)) { |
ASSERT(VB->NormalPtr == &inputs->Normal); |
_tnl_import_normal( ctx, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_NORMAL; |
} |
if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & ca_flags)) { |
ASSERT(VB->ColorPtr[0] == &inputs->Color); |
_tnl_import_color( ctx, GL_FLOAT, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_COLOR0; |
} |
if ((required & VERT_BIT_COLOR1) && |
(VB->SecondaryColorPtr[0]->Flags & ca_flags)) { |
ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor); |
_tnl_import_secondarycolor( ctx, GL_FLOAT, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_COLOR1; |
} |
if ((required & VERT_BIT_FOG) |
&& (VB->FogCoordPtr->flags & flags)) { |
ASSERT(VB->FogCoordPtr == &inputs->FogCoord); |
_tnl_import_fogcoord( ctx, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_FOG; |
} |
if ((required & VERT_BIT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { |
ASSERT(VB->IndexPtr[0] == &inputs->Index); |
_tnl_import_index( ctx, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_INDEX; |
} |
if (required & VERT_BITS_TEX_ANY) |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if ((required & VERT_BIT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { |
ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); |
_tnl_import_texcoord( ctx, i, writeable, stride ); |
VB->importable_data &= ~VERT_BIT_TEX(i); |
} |
/* XXX not sure what to do here for vertex program arrays */ |
} |
void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLuint inputs = tnl->pipeline.inputs; |
struct vertex_arrays *tmp = &tnl->array_inputs; |
/* _mesa_debug(ctx, "%s %d..%d // %d..%d\n", __FUNCTION__, */ |
/* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */ |
/* _tnl_print_vert_flags(" inputs", inputs); */ |
/* _tnl_print_vert_flags(" _Enabled", ctx->Array._Enabled); */ |
/* _tnl_print_vert_flags(" importable", inputs & VERT_BITS_FIXUP); */ |
VB->Count = count - start; |
VB->FirstClipped = VB->Count; |
VB->Elts = NULL; |
VB->MaterialMask = NULL; |
VB->Material = NULL; |
VB->Flag = NULL; |
VB->Primitive = tnl->tmp_primitive; |
VB->PrimitiveLength = tnl->tmp_primitive_length; |
VB->import_data = _tnl_upgrade_client_data; |
VB->importable_data = inputs & VERT_BITS_FIXUP; |
if (ctx->Array.LockCount) { |
ASSERT(start == (GLint) ctx->Array.LockFirst); |
ASSERT(count == (GLint) ctx->Array.LockCount); |
} |
_ac_import_range( ctx, start, count ); |
if (inputs & VERT_BIT_POS) { |
_tnl_import_vertex( ctx, 0, 0 ); |
tmp->Obj.count = VB->Count; |
VB->ObjPtr = &tmp->Obj; |
} |
if (inputs & VERT_BIT_NORMAL) { |
_tnl_import_normal( ctx, 0, 0 ); |
tmp->Normal.count = VB->Count; |
VB->NormalPtr = &tmp->Normal; |
} |
if (inputs & VERT_BIT_COLOR0) { |
_tnl_import_color( ctx, 0, 0, 0 ); |
VB->ColorPtr[0] = &tmp->Color; |
VB->ColorPtr[1] = 0; |
} |
if (inputs & VERT_BITS_TEX_ANY) { |
GLuint unit; |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (inputs & VERT_BIT_TEX(unit)) { |
_tnl_import_texcoord( ctx, unit, GL_FALSE, GL_FALSE ); |
tmp->TexCoord[unit].count = VB->Count; |
VB->TexCoordPtr[unit] = &tmp->TexCoord[unit]; |
} |
} |
} |
if (inputs & (VERT_BIT_INDEX | VERT_BIT_FOG | |
VERT_BIT_EDGEFLAG | VERT_BIT_COLOR1)) { |
if (inputs & VERT_BIT_INDEX) { |
_tnl_import_index( ctx, 0, 0 ); |
tmp->Index.count = VB->Count; |
VB->IndexPtr[0] = &tmp->Index; |
VB->IndexPtr[1] = 0; |
} |
if (inputs & VERT_BIT_FOG) { |
_tnl_import_fogcoord( ctx, 0, 0 ); |
tmp->FogCoord.count = VB->Count; |
VB->FogCoordPtr = &tmp->FogCoord; |
} |
if (inputs & VERT_BIT_EDGEFLAG) { |
_tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); |
VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data; |
} |
if (inputs & VERT_BIT_COLOR1) { |
_tnl_import_secondarycolor( ctx, 0, 0, 0 ); |
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; |
VB->SecondaryColorPtr[1] = 0; |
} |
} |
/* XXX not 100% sure this is finished. Keith should probably inspect. */ |
if (ctx->VertexProgram.Enabled) { |
GLuint index; |
for (index = 0; index < VERT_ATTRIB_MAX; index++) { |
/* XXX check program->InputsRead to reduce work here */ |
_tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE ); |
VB->AttribPtr[index] = &tmp->Attribs[index]; |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_api.c |
---|
0,0 → 1,1368 |
/* $Id: t_imm_api.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "dlist.h" |
#include "enums.h" |
#include "light.h" |
#include "imports.h" |
#include "state.h" |
#include "colormac.h" |
#include "macros.h" |
#include "vtxfmt.h" |
#include "t_context.h" |
#include "t_imm_api.h" |
#include "t_imm_elt.h" |
#include "t_imm_exec.h" |
#include "t_imm_dlist.h" |
/* A cassette is full or flushed on a statechange. |
*/ |
void _tnl_flush_immediate( GLcontext *ctx, struct immediate *IM ) |
{ |
if (!ctx) { |
/* We were called by glVertex, glEvalCoord, glArrayElement, etc. |
* The current context is corresponds to the IM structure. |
*/ |
GET_CURRENT_CONTEXT(context); |
ctx = context; |
} |
if (MESA_VERBOSE & VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, "_tnl_flush_immediate IM: %d compiling: %d\n", |
IM->id, ctx->CompileFlag); |
if (IM->FlushElt == FLUSH_ELT_EAGER) { |
_tnl_translate_array_elts( ctx, IM, IM->LastPrimitive, IM->Count ); |
} |
/* Mark the last primitive: |
*/ |
IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; |
IM->Primitive[IM->LastPrimitive] |= PRIM_LAST; |
if (ctx->CompileFlag) |
_tnl_compile_cassette( ctx, IM ); |
else |
_tnl_execute_cassette( ctx, IM ); |
} |
/* Hook for ctx->Driver.FlushVertices: |
*/ |
void _tnl_flush_vertices( GLcontext *ctx, GLuint flags ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
if (MESA_VERBOSE & VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, |
"_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n", |
flags, IM->id, IM->Start, IM->Count, IM->Start, |
IM->Flag[IM->Start]); |
if (IM->Flag[IM->Start]) { |
if ((flags & FLUSH_UPDATE_CURRENT) || |
IM->Count > IM->Start || |
(IM->Flag[IM->Start] & (VERT_BIT_BEGIN | VERT_BIT_END))) { |
_tnl_flush_immediate( ctx, IM ); |
} |
} |
} |
void |
_tnl_save_Begin( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
GLuint inflags, state; |
/* _mesa_debug(ctx, "%s: before: %x\n", __FUNCTION__, IM->BeginState); */ |
if (mode > GL_POLYGON) { |
_mesa_compile_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" ); |
return; |
} |
if (ctx->NewState) |
_mesa_update_state(ctx); |
#if 000 |
/* if only a very few slots left, might as well flush now |
*/ |
if (IM->Count > IMM_MAXDATA-8) { |
_tnl_flush_immediate( ctx, IM ); |
IM = TNL_CURRENT_IM(ctx); |
} |
#endif |
/* Check for and flush buffered vertices from internal operations. |
*/ |
if (IM->SavedBeginState) { |
_tnl_flush_immediate( ctx, IM ); |
IM = TNL_CURRENT_IM(ctx); |
IM->BeginState = IM->SavedBeginState; |
IM->SavedBeginState = 0; |
} |
state = IM->BeginState; |
inflags = state & (VERT_BEGIN_0|VERT_BEGIN_1); |
state |= inflags << 2; /* set error conditions */ |
if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1)) |
{ |
GLuint count = IM->Count; |
GLuint last = IM->LastPrimitive; |
state |= (VERT_BEGIN_0|VERT_BEGIN_1); |
IM->Flag[count] |= VERT_BIT_BEGIN; |
IM->Primitive[count] = mode | PRIM_BEGIN; |
IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive; |
IM->LastPrimitive = count; |
/* Not quite right. Need to use the fallback '_aa_ArrayElement' |
* when not known to be inside begin/end and arrays are |
* unlocked. |
*/ |
if (IM->FlushElt == FLUSH_ELT_EAGER) { |
_tnl_translate_array_elts( ctx, IM, last, count ); |
} |
} |
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; |
IM->BeginState = state; |
/* Update save_primitive now. Don't touch ExecPrimitive as this is |
* updated in the replay of this cassette if we are in |
* COMPILE_AND_EXECUTE mode. |
*/ |
if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) |
ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; |
else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) |
ctx->Driver.CurrentSavePrimitive = mode; |
} |
void |
_tnl_Begin( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
ASSERT (!ctx->CompileFlag); |
if (mode > GL_POLYGON) { |
_mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin(0x%x)", mode ); |
return; |
} |
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_Begin" ); |
return; |
} |
if (ctx->NewState) |
_mesa_update_state(ctx); |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
GLuint count = IM->Count; |
GLuint last = IM->LastPrimitive; |
if (IM->Start == IM->Count && |
tnl->Driver.NotifyBegin && |
tnl->Driver.NotifyBegin( ctx, mode )) { |
return; |
} |
assert( IM->SavedBeginState == 0 ); |
assert( IM->BeginState == 0 ); |
/* Not quite right. Need to use the fallback '_aa_ArrayElement' |
* when not known to be inside begin/end and arrays are |
* unlocked. |
*/ |
if (IM->FlushElt == FLUSH_ELT_EAGER) { |
_tnl_translate_array_elts( ctx, IM, last, count ); |
} |
IM->Flag[count] |= VERT_BIT_BEGIN; |
IM->Primitive[count] = mode | PRIM_BEGIN; |
IM->PrimitiveLength[last] = count - last; |
IM->LastPrimitive = count; |
IM->BeginState = (VERT_BEGIN_0|VERT_BEGIN_1); |
/* _mesa_debug(ctx, "%s: %x\n", __FUNCTION__, IM->BeginState); */ |
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; |
ctx->Driver.CurrentExecPrimitive = mode; |
} |
} |
/* Function which allows operations like 'glRectf' to decompose to a |
* begin/end object and vertices without worrying about what happens |
* with display lists. |
*/ |
GLboolean |
_tnl_hard_begin( GLcontext *ctx, GLenum p ) |
{ |
/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ |
if (!ctx->CompileFlag) { |
/* If not compiling, treat as a normal begin(). |
*/ |
/* _mesa_debug(ctx, "%s: treating as glBegin\n", __FUNCTION__); */ |
glBegin( p ); |
return GL_TRUE; |
} |
else { |
/* Otherwise, need to do special processing to preserve the |
* condition that these vertices will only be replayed outside |
* future begin/end objects. |
*/ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
if (ctx->NewState) |
_mesa_update_state(ctx); |
if (IM->Count > IMM_MAXDATA-8) { |
_tnl_flush_immediate( ctx, IM ); |
IM = TNL_CURRENT_IM(ctx); |
} |
/* A lot depends on the degree to which the display list has |
* constrained the possible begin/end states at this point: |
*/ |
switch (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) { |
case VERT_BEGIN_0|VERT_BEGIN_1: |
/* This is an immediate known to be inside a begin/end object. |
*/ |
ASSERT(ctx->Driver.CurrentSavePrimitive <= GL_POLYGON); |
IM->BeginState |= (VERT_ERROR_1|VERT_ERROR_0); |
return GL_FALSE; |
case VERT_BEGIN_0: |
case VERT_BEGIN_1: |
/* This is a display-list immediate in an unknown begin/end |
* state. Assert it is empty and convert it to a 'hard' one. |
*/ |
ASSERT(IM->SavedBeginState == 0); |
ASSERT(ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN); |
/* Push current beginstate, to be restored later. Don't worry |
* about raising errors. |
*/ |
IM->SavedBeginState = IM->BeginState; |
/* FALLTHROUGH */ |
case 0: |
/* Unless we have fallen through, this is an immediate known to |
* be outside begin/end objects. |
*/ |
ASSERT(ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN || |
ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END); |
ASSERT (IM->FlushElt != FLUSH_ELT_EAGER); |
IM->BeginState |= VERT_BEGIN_0|VERT_BEGIN_1; |
IM->Flag[IM->Count] |= VERT_BIT_BEGIN; |
IM->Primitive[IM->Count] = p | PRIM_BEGIN; |
IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; |
IM->LastPrimitive = IM->Count; |
/* This is necessary as this immediate will not be flushed in |
* _tnl_end() -- we leave it active, hoping to pick up more |
* vertices before the next state change. |
*/ |
ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; |
return GL_TRUE; |
default: |
assert (0); |
return GL_TRUE; |
} |
} |
} |
/* Both streams now outside begin/end. |
* |
* Leave SavedBeginState untouched -- attempt to gather several |
* rects/arrays together in a single immediate struct. |
*/ |
void |
_tnl_end( GLcontext *ctx ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
GLuint state = IM->BeginState; |
GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1); |
assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES ); |
state |= inflags << 2; /* errors */ |
if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1)) |
{ |
GLuint count = IM->Count; |
GLuint last = IM->LastPrimitive; |
state &= ~(VERT_BEGIN_0|VERT_BEGIN_1); /* update state */ |
IM->Flag[count] |= VERT_BIT_END; |
IM->Primitive[last] |= PRIM_END; |
IM->PrimitiveLength[last] = count - last; |
IM->Primitive[count] = PRIM_OUTSIDE_BEGIN_END; /* removes PRIM_BEGIN |
* flag if length == 0 |
*/ |
IM->LastPrimitive = count; |
if (IM->FlushElt == FLUSH_ELT_EAGER) { |
_tnl_translate_array_elts( ctx, IM, last, count ); |
} |
} |
IM->BeginState = state; |
if (!ctx->CompileFlag) { |
if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) |
_mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_End" ); |
else |
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; |
} |
/* You can set this flag to get the old 'flush_vb on glEnd()' |
* behaviour. |
*/ |
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) |
_tnl_flush_immediate( ctx, IM ); |
} |
void |
_tnl_End(void) |
{ |
GET_CURRENT_CONTEXT(ctx); |
_tnl_end( ctx ); |
/* Need to keep save primitive uptodate in COMPILE and |
* COMPILE_AND_EXEC modes, need to keep exec primitive uptodate |
* otherwise. |
*/ |
if (ctx->CompileFlag) |
ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; |
} |
#define COLOR( r, g, b, a ) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint count = IM->Count; \ |
GLfloat *color = IM->Attrib[VERT_ATTRIB_COLOR0][count]; \ |
IM->Flag[count] |= VERT_BIT_COLOR0; \ |
color[0] = r; \ |
color[1] = g; \ |
color[2] = b; \ |
color[3] = a; \ |
} |
static void |
_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue ) |
{ |
COLOR( red, green, blue, 1.0 ); |
} |
static void |
_tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue ) |
{ |
COLOR(UBYTE_TO_FLOAT(red), |
UBYTE_TO_FLOAT(green), |
UBYTE_TO_FLOAT(blue), |
1.0); |
} |
static void |
_tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) |
{ |
COLOR( red, green, blue, alpha ); |
} |
static void |
_tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) |
{ |
COLOR(UBYTE_TO_FLOAT(red), |
UBYTE_TO_FLOAT(green), |
UBYTE_TO_FLOAT(blue), |
UBYTE_TO_FLOAT(alpha)); |
} |
static void |
_tnl_Color3fv( const GLfloat *v ) |
{ |
COLOR( v[0], v[1], v[2], 1.0 ); |
} |
static void |
_tnl_Color3ubv( const GLubyte *v ) |
{ |
COLOR(UBYTE_TO_FLOAT(v[0]), |
UBYTE_TO_FLOAT(v[1]), |
UBYTE_TO_FLOAT(v[2]), |
1.0 ); |
} |
static void |
_tnl_Color4fv( const GLfloat *v ) |
{ |
COLOR( v[0], v[1], v[2], v[3] ); |
} |
static void |
_tnl_Color4ubv( const GLubyte *v) |
{ |
COLOR(UBYTE_TO_FLOAT(v[0]), |
UBYTE_TO_FLOAT(v[1]), |
UBYTE_TO_FLOAT(v[2]), |
UBYTE_TO_FLOAT(v[3])); |
} |
#define SECONDARY_COLOR( r, g, b ) \ |
{ \ |
GLuint count; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_COLOR1; \ |
IM->Attrib[VERT_ATTRIB_COLOR1][count][0] = r; \ |
IM->Attrib[VERT_ATTRIB_COLOR1][count][1] = g; \ |
IM->Attrib[VERT_ATTRIB_COLOR1][count][2] = b; \ |
} |
static void |
_tnl_SecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue ) |
{ |
SECONDARY_COLOR( red, green, blue ); |
} |
static void |
_tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue ) |
{ |
SECONDARY_COLOR(UBYTE_TO_FLOAT(red), |
UBYTE_TO_FLOAT(green), |
UBYTE_TO_FLOAT(blue)); |
} |
static void |
_tnl_SecondaryColor3fvEXT( const GLfloat *v ) |
{ |
SECONDARY_COLOR( v[0], v[1], v[2] ); |
} |
static void |
_tnl_SecondaryColor3ubvEXT( const GLubyte *v ) |
{ |
SECONDARY_COLOR(UBYTE_TO_FLOAT(v[0]), |
UBYTE_TO_FLOAT(v[1]), |
UBYTE_TO_FLOAT(v[2])); |
} |
static void |
_tnl_EdgeFlag( GLboolean flag ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->EdgeFlag[count] = flag; |
IM->Flag[count] |= VERT_BIT_EDGEFLAG; |
} |
static void |
_tnl_EdgeFlagv( const GLboolean *flag ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->EdgeFlag[count] = *flag; |
IM->Flag[count] |= VERT_BIT_EDGEFLAG; |
} |
static void |
_tnl_FogCoordfEXT( GLfloat f ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->Attrib[VERT_ATTRIB_FOG][count][0] = f; /*FogCoord[count] = f;*/ |
IM->Flag[count] |= VERT_BIT_FOG; |
} |
static void |
_tnl_FogCoordfvEXT( const GLfloat *v ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->Attrib[VERT_ATTRIB_FOG][count][0] = v[0]; /*FogCoord[count] = v[0];*/ |
IM->Flag[count] |= VERT_BIT_FOG; |
} |
static void |
_tnl_Indexi( GLint c ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->Index[count] = c; |
IM->Flag[count] |= VERT_BIT_INDEX; |
} |
static void |
_tnl_Indexiv( const GLint *c ) |
{ |
GLuint count; |
GET_IMMEDIATE; |
count = IM->Count; |
IM->Index[count] = *c; |
IM->Flag[count] |= VERT_BIT_INDEX; |
} |
#define NORMAL( x, y, z ) \ |
{ \ |
GLuint count; \ |
GLfloat *normal; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_NORMAL; \ |
normal = IM->Attrib[VERT_ATTRIB_NORMAL][count]; \ |
ASSIGN_3V(normal, x,y,z); \ |
} |
#if defined(USE_IEEE) |
#define NORMALF( x, y, z ) \ |
{ \ |
GLuint count; \ |
fi_type *normal; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_NORMAL; \ |
normal = (fi_type *)IM->Attrib[VERT_ATTRIB_NORMAL][count]; \ |
normal[0].i = ((fi_type *)&(x))->i; \ |
normal[1].i = ((fi_type *)&(y))->i; \ |
normal[2].i = ((fi_type *)&(z))->i; \ |
} |
#else |
#define NORMALF NORMAL |
#endif |
static void |
_tnl_Normal3f( GLfloat nx, GLfloat ny, GLfloat nz ) |
{ |
NORMALF(nx, ny, nz); |
} |
static void |
_tnl_Normal3fv( const GLfloat *v ) |
{ |
NORMALF( v[0], v[1], v[2] ); |
/* struct immediate *IM = (struct immediate *)(((GLcontext *) _glapi_Context)->swtnl_im); */ |
/* IM->Flag[IM->Count] = VERT_NORM; */ |
} |
#define TEXCOORD1(s) \ |
{ \ |
GLuint count; \ |
GLfloat *tc; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_TEX0; \ |
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ |
ASSIGN_4V(tc,s,0,0,1); \ |
} |
#define TEXCOORD2(s, t) \ |
{ \ |
GLuint count; \ |
GLfloat *tc; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_TEX0; \ |
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ |
ASSIGN_4V(tc, s, t, 0, 1); \ |
} |
#define TEXCOORD3(s, t, u) \ |
{ \ |
GLuint count; \ |
GLfloat *tc; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_TEX0; \ |
IM->TexSize |= TEX_0_SIZE_3; \ |
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ |
ASSIGN_4V(tc, s, t, u, 1); \ |
} |
#define TEXCOORD4(s, t, u, v) \ |
{ \ |
GLuint count; \ |
GLfloat *tc; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_TEX0; \ |
IM->TexSize |= TEX_0_SIZE_4; \ |
tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ |
ASSIGN_4V(tc, s, t, u, v); \ |
} |
#if defined(USE_IEEE) |
#define TEXCOORD2F(s, t) \ |
{ \ |
GLuint count; \ |
fi_type *tc; \ |
GET_IMMEDIATE; \ |
count = IM->Count; \ |
IM->Flag[count] |= VERT_BIT_TEX0; \ |
tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0][count]; \ |
tc[0].i = ((fi_type *)&(s))->i; \ |
tc[1].i = ((fi_type *)&(t))->i; \ |
tc[2].i = 0; \ |
tc[3].i = IEEE_ONE; \ |
} |
#else |
#define TEXCOORD2F TEXCOORD2 |
#endif |
static void |
_tnl_TexCoord1f( GLfloat s ) |
{ |
TEXCOORD1(s); |
} |
static void |
_tnl_TexCoord2f( GLfloat s, GLfloat t ) |
{ |
TEXCOORD2F(s, t); |
} |
static void |
_tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r ) |
{ |
TEXCOORD3(s, t, r); |
} |
static void |
_tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) |
{ |
TEXCOORD4(s, t, r, q) |
} |
static void |
_tnl_TexCoord1fv( const GLfloat *v ) |
{ |
TEXCOORD1(v[0]); |
} |
static void |
_tnl_TexCoord2fv( const GLfloat *v ) |
{ |
TEXCOORD2F(v[0], v[1]); |
} |
static void |
_tnl_TexCoord3fv( const GLfloat *v ) |
{ |
TEXCOORD3(v[0], v[1], v[2]); |
} |
static void |
_tnl_TexCoord4fv( const GLfloat *v ) |
{ |
TEXCOORD4(v[0], v[1], v[2], v[3]); |
} |
/* KW: Run into bad problems in vertex copying if we don't fully pad |
* the incoming vertices. |
*/ |
#define VERTEX2(IM, x,y) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_POS; \ |
ASSIGN_4V(dest, x, y, 0, 1); \ |
/* ASSERT(IM->Flag[IM->Count]==0); */ \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#define VERTEX3(IM,x,y,z) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BITS_OBJ_23; \ |
ASSIGN_4V(dest, x, y, z, 1); \ |
/* ASSERT(IM->Flag[IM->Count]==0); */ \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#define VERTEX4(IM, x,y,z,w) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BITS_OBJ_234; \ |
ASSIGN_4V(dest, x, y, z, w); \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#if defined(USE_IEEE) |
#define VERTEX2F(IM, x, y) \ |
{ \ |
GLuint count = IM->Count++; \ |
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_POS; \ |
dest[0].i = ((fi_type *)&(x))->i; \ |
dest[1].i = ((fi_type *)&(y))->i; \ |
dest[2].i = 0; \ |
dest[3].i = IEEE_ONE; \ |
/* ASSERT(IM->Flag[IM->Count]==0); */ \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#else |
#define VERTEX2F VERTEX2 |
#endif |
#if defined(USE_IEEE) |
#define VERTEX3F(IM, x, y, z) \ |
{ \ |
GLuint count = IM->Count++; \ |
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BITS_OBJ_23; \ |
dest[0].i = ((fi_type *)&(x))->i; \ |
dest[1].i = ((fi_type *)&(y))->i; \ |
dest[2].i = ((fi_type *)&(z))->i; \ |
dest[3].i = IEEE_ONE; \ |
/* ASSERT(IM->Flag[IM->Count]==0); */ \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#else |
#define VERTEX3F VERTEX3 |
#endif |
#if defined(USE_IEEE) |
#define VERTEX4F(IM, x, y, z, w) \ |
{ \ |
GLuint count = IM->Count++; \ |
fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BITS_OBJ_234; \ |
dest[0].i = ((fi_type *)&(x))->i; \ |
dest[1].i = ((fi_type *)&(y))->i; \ |
dest[2].i = ((fi_type *)&(z))->i; \ |
dest[3].i = ((fi_type *)&(w))->i; \ |
if (count == IMM_MAXDATA - 1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#else |
#define VERTEX4F VERTEX4 |
#endif |
static void |
_tnl_Vertex2f( GLfloat x, GLfloat y ) |
{ |
GET_IMMEDIATE; |
VERTEX2F( IM, x, y ); |
} |
static void |
_tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_IMMEDIATE; |
VERTEX3F( IM, x, y, z ); |
} |
static void |
_tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
GET_IMMEDIATE; |
VERTEX4F( IM, x, y, z, w ); |
} |
static void |
_tnl_Vertex2fv( const GLfloat *v ) |
{ |
GET_IMMEDIATE; |
VERTEX2F( IM, v[0], v[1] ); |
} |
static void |
_tnl_Vertex3fv( const GLfloat *v ) |
{ |
GET_IMMEDIATE; |
VERTEX3F( IM, v[0], v[1], v[2] ); |
} |
static void |
_tnl_Vertex4fv( const GLfloat *v ) |
{ |
GET_IMMEDIATE; |
VERTEX4F( IM, v[0], v[1], v[2], v[3] ); |
} |
/* |
* GL_ARB_multitexture |
* |
* Note: the multitexture spec says that specifying an invalid target |
* has undefined results and does not have to generate an error. Just |
* don't crash. We no-op on invalid targets. |
*/ |
#define MAX_TARGET (GL_TEXTURE0_ARB + MAX_TEXTURE_UNITS) |
#define MULTI_TEXCOORD1(target, s) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint texunit = target - GL_TEXTURE0_ARB; \ |
if (texunit < IM->MaxTextureUnits) { \ |
GLuint count = IM->Count; \ |
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ |
ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F); \ |
IM->Flag[count] |= VERT_BIT_TEX(texunit); \ |
} \ |
} |
#define MULTI_TEXCOORD2(target, s, t) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint texunit = target - GL_TEXTURE0_ARB; \ |
if (texunit < IM->MaxTextureUnits) { \ |
GLuint count = IM->Count; \ |
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ |
ASSIGN_4V(tc, s, t, 0.0F, 1.0F); \ |
IM->Flag[count] |= VERT_BIT_TEX(texunit); \ |
} \ |
} |
#define MULTI_TEXCOORD3(target, s, t, u) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint texunit = target - GL_TEXTURE0_ARB; \ |
if (texunit < IM->MaxTextureUnits) { \ |
GLuint count = IM->Count; \ |
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ |
ASSIGN_4V(tc, s, t, u, 1.0F); \ |
IM->Flag[count] |= VERT_BIT_TEX(texunit); \ |
IM->TexSize |= TEX_SIZE_3(texunit); \ |
} \ |
} |
#define MULTI_TEXCOORD4(target, s, t, u, v) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint texunit = target - GL_TEXTURE0_ARB; \ |
if (texunit < IM->MaxTextureUnits) { \ |
GLuint count = IM->Count; \ |
GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ |
ASSIGN_4V(tc, s, t, u, v); \ |
IM->Flag[count] |= VERT_BIT_TEX(texunit); \ |
IM->TexSize |= TEX_SIZE_4(texunit); \ |
} \ |
} |
#if defined(USE_IEEE) |
#define MULTI_TEXCOORD2F(target, s, t) \ |
{ \ |
GET_IMMEDIATE; \ |
GLuint texunit = target - GL_TEXTURE0_ARB; \ |
if (texunit < IM->MaxTextureUnits) { \ |
GLuint count = IM->Count; \ |
fi_type *tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count];\ |
IM->Flag[count] |= VERT_BIT_TEX(texunit); \ |
tc[0].i = ((fi_type *)&(s))->i; \ |
tc[1].i = ((fi_type *)&(t))->i; \ |
tc[2].i = 0; \ |
tc[3].i = IEEE_ONE; \ |
} \ |
} |
#else |
#define MULTI_TEXCOORD2F MULTI_TEXCOORD2 |
#endif |
static void |
_tnl_MultiTexCoord1fARB(GLenum target, GLfloat s) |
{ |
MULTI_TEXCOORD1( target, s ); |
} |
static void |
_tnl_MultiTexCoord1fvARB(GLenum target, const GLfloat *v) |
{ |
MULTI_TEXCOORD1( target, v[0] ); |
} |
static void |
_tnl_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) |
{ |
MULTI_TEXCOORD2F( target, s, t ); |
} |
static void |
_tnl_MultiTexCoord2fvARB(GLenum target, const GLfloat *v) |
{ |
MULTI_TEXCOORD2F( target, v[0], v[1] ); |
} |
static void |
_tnl_MultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) |
{ |
MULTI_TEXCOORD3( target, s, t, r ); |
} |
static void |
_tnl_MultiTexCoord3fvARB(GLenum target, const GLfloat *v) |
{ |
MULTI_TEXCOORD3( target, v[0], v[1], v[2] ); |
} |
static void |
_tnl_MultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) |
{ |
MULTI_TEXCOORD4( target, s, t, r, q ); |
} |
static void |
_tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v) |
{ |
MULTI_TEXCOORD4( target, v[0], v[1], v[2], v[3] ); |
} |
/* KW: Because the eval values don't become 'current', fixup will flow |
* through these vertices, and then evaluation will write on top |
* of the fixup results. |
* |
* Note: using Obj to hold eval coord data. |
*/ |
#define EVALCOORD1(IM, x) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_EVAL_C1; \ |
ASSIGN_4V(dest, x, 0, 0, 1); \ |
if (count == IMM_MAXDATA-1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#define EVALCOORD2(IM, x, y) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_EVAL_C2; \ |
ASSIGN_4V(dest, x, y, 0, 1); \ |
if (count == IMM_MAXDATA-1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#define EVALPOINT1(IM, x) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_EVAL_P1; \ |
ASSIGN_4V(dest, x, 0, 0, 1); \ |
if (count == IMM_MAXDATA-1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
#define EVALPOINT2(IM, x, y) \ |
{ \ |
GLuint count = IM->Count++; \ |
GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ |
IM->Flag[count] |= VERT_BIT_EVAL_P2; \ |
ASSIGN_4V(dest, x, y, 0, 1); \ |
if (count == IMM_MAXDATA-1) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
static void |
_tnl_EvalCoord1f( GLfloat u ) |
{ |
GET_IMMEDIATE; |
EVALCOORD1( IM, u ); |
} |
static void |
_tnl_EvalCoord1fv( const GLfloat *u ) |
{ |
GET_IMMEDIATE; |
EVALCOORD1( IM, (GLfloat) *u ); |
} |
static void |
_tnl_EvalCoord2f( GLfloat u, GLfloat v ) |
{ |
GET_IMMEDIATE; |
EVALCOORD2( IM, u, v ); |
} |
static void |
_tnl_EvalCoord2fv( const GLfloat *u ) |
{ |
GET_IMMEDIATE; |
EVALCOORD2( IM, u[0], u[1] ); |
} |
static void |
_tnl_EvalPoint1( GLint i ) |
{ |
GET_IMMEDIATE; |
EVALPOINT1( IM, (GLfloat) i ); |
} |
static void |
_tnl_EvalPoint2( GLint i, GLint j ) |
{ |
GET_IMMEDIATE; |
EVALPOINT2( IM, (GLfloat) i, (GLfloat) j ); |
} |
/* Need to use the default array-elt outside begin/end for strict |
* conformance. |
*/ |
#define ARRAY_ELT( IM, i ) \ |
{ \ |
GLuint count = IM->Count; \ |
IM->Elt[count] = i; \ |
IM->Flag[count] &= IM->ArrayEltFlags; \ |
IM->Flag[count] |= VERT_BIT_ELT; \ |
IM->FlushElt = IM->ArrayEltFlush; \ |
IM->Count += IM->ArrayEltIncr; \ |
if (IM->Count == IMM_MAXDATA) \ |
_tnl_flush_immediate( NULL, IM ); \ |
} |
static void |
_tnl_ArrayElement( GLint i ) |
{ |
GET_IMMEDIATE; |
ARRAY_ELT( IM, i ); |
} |
/* Internal functions. These are safe to use providing either: |
* |
* - It is determined that a display list is not being compiled, or |
* if so that these commands won't be compiled into the list (see |
* t_eval.c for an example). |
* |
* - _tnl_hard_begin() is used instead of _tnl_[bB]egin, and tested |
* for a GL_TRUE return value. See _tnl_Rectf, below. |
*/ |
void |
_tnl_eval_coord1f( GLcontext *CC, GLfloat u ) |
{ |
struct immediate *i = TNL_CURRENT_IM(CC); |
EVALCOORD1( i, u ); |
} |
void |
_tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v ) |
{ |
struct immediate *i = TNL_CURRENT_IM(CC); |
EVALCOORD2( i, u, v ); |
} |
/* |
* NV_vertex_program |
*/ |
static void |
_tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
if (index < 16) { |
GET_IMMEDIATE; |
const GLuint count = IM->Count; |
GLfloat *attrib = IM->Attrib[index][count]; |
ASSIGN_4V(attrib, x, y, z, w); |
IM->Flag[count] |= (1 << index); |
if (index == 0) { |
IM->Count++; |
if (count == IMM_MAXDATA - 1) |
_tnl_flush_immediate( NULL, IM ); |
} |
} |
else { |
GET_CURRENT_CONTEXT(ctx); |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)"); |
} |
} |
static void |
_tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) |
{ |
if (index < 16) { |
GET_IMMEDIATE; |
const GLuint count = IM->Count; |
GLfloat *attrib = IM->Attrib[index][count]; |
COPY_4V(attrib, v); |
IM->Flag[count] |= (1 << index); |
if (index == 0) { |
IM->Count++; |
if (count == IMM_MAXDATA - 1) |
_tnl_flush_immediate( NULL, IM ); |
} |
} |
else { |
GET_CURRENT_CONTEXT(ctx); |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)"); |
} |
} |
/* Execute a glRectf() function. _tnl_hard_begin() ensures the check |
* on outside_begin_end is executed even in compiled lists. These |
* vertices can now participate in the same immediate as regular ones, |
* even in most display lists. |
*/ |
static void |
_tnl_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (_tnl_hard_begin( ctx, GL_QUADS )) { |
glVertex2f( x1, y1 ); |
glVertex2f( x2, y1 ); |
glVertex2f( x2, y2 ); |
glVertex2f( x1, y2 ); |
glEnd(); |
} |
} |
static void |
_tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
GLuint count = IM->Count; |
struct gl_material *mat; |
GLuint bitmask = _mesa_material_bitmask(ctx, face, pname, ~0, "Materialfv"); |
if (bitmask == 0) |
return; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "_tnl_Materialfv\n"); |
if (tnl->IsolateMaterials && |
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */ |
{ |
_tnl_flush_immediate( ctx, IM ); |
IM = TNL_CURRENT_IM(ctx); |
count = IM->Count; |
} |
if (!(IM->Flag[count] & VERT_BIT_MATERIAL)) { |
if (!IM->Material) { |
IM->Material = (struct gl_material (*)[2]) |
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 ); |
IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); |
IM->MaterialMask[IM->LastMaterial] = 0; |
} |
else if (IM->MaterialOrMask & ~bitmask) { |
_mesa_copy_material_pairs( IM->Material[count], |
IM->Material[IM->LastMaterial], |
IM->MaterialOrMask & ~bitmask ); |
} |
IM->Flag[count] |= VERT_BIT_MATERIAL; |
IM->MaterialMask[count] = 0; |
IM->MaterialAndMask &= IM->MaterialMask[IM->LastMaterial]; |
IM->LastMaterial = count; |
} |
IM->MaterialOrMask |= bitmask; |
IM->MaterialMask[count] |= bitmask; |
mat = IM->Material[count]; |
if (bitmask & FRONT_AMBIENT_BIT) { |
COPY_4FV( mat[0].Ambient, params ); |
} |
if (bitmask & BACK_AMBIENT_BIT) { |
COPY_4FV( mat[1].Ambient, params ); |
} |
if (bitmask & FRONT_DIFFUSE_BIT) { |
COPY_4FV( mat[0].Diffuse, params ); |
} |
if (bitmask & BACK_DIFFUSE_BIT) { |
COPY_4FV( mat[1].Diffuse, params ); |
} |
if (bitmask & FRONT_SPECULAR_BIT) { |
COPY_4FV( mat[0].Specular, params ); |
} |
if (bitmask & BACK_SPECULAR_BIT) { |
COPY_4FV( mat[1].Specular, params ); |
} |
if (bitmask & FRONT_EMISSION_BIT) { |
COPY_4FV( mat[0].Emission, params ); |
} |
if (bitmask & BACK_EMISSION_BIT) { |
COPY_4FV( mat[1].Emission, params ); |
} |
if (bitmask & FRONT_SHININESS_BIT) { |
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); |
mat[0].Shininess = shininess; |
} |
if (bitmask & BACK_SHININESS_BIT) { |
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); |
mat[1].Shininess = shininess; |
} |
if (bitmask & FRONT_INDEXES_BIT) { |
mat[0].AmbientIndex = params[0]; |
mat[0].DiffuseIndex = params[1]; |
mat[0].SpecularIndex = params[2]; |
} |
if (bitmask & BACK_INDEXES_BIT) { |
mat[1].AmbientIndex = params[0]; |
mat[1].DiffuseIndex = params[1]; |
mat[1].SpecularIndex = params[2]; |
} |
if (tnl->IsolateMaterials && |
!(IM->BeginState & VERT_BEGIN_1)) /* heuristic */ |
{ |
_tnl_flush_immediate( ctx, IM ); |
} |
} |
void _tnl_imm_vtxfmt_init( GLcontext *ctx ) |
{ |
GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); |
/* All begin/end operations are handled by this vertex format: |
*/ |
vfmt->ArrayElement = _tnl_ArrayElement; |
vfmt->Begin = _tnl_Begin; |
vfmt->Color3f = _tnl_Color3f; |
vfmt->Color3fv = _tnl_Color3fv; |
vfmt->Color3ub = _tnl_Color3ub; |
vfmt->Color3ubv = _tnl_Color3ubv; |
vfmt->Color4f = _tnl_Color4f; |
vfmt->Color4fv = _tnl_Color4fv; |
vfmt->Color4ub = _tnl_Color4ub; |
vfmt->Color4ubv = _tnl_Color4ubv; |
vfmt->EdgeFlag = _tnl_EdgeFlag; |
vfmt->EdgeFlagv = _tnl_EdgeFlagv; |
vfmt->End = _tnl_End; |
vfmt->EvalCoord1f = _tnl_EvalCoord1f; |
vfmt->EvalCoord1fv = _tnl_EvalCoord1fv; |
vfmt->EvalCoord2f = _tnl_EvalCoord2f; |
vfmt->EvalCoord2fv = _tnl_EvalCoord2fv; |
vfmt->EvalPoint1 = _tnl_EvalPoint1; |
vfmt->EvalPoint2 = _tnl_EvalPoint2; |
vfmt->FogCoordfEXT = _tnl_FogCoordfEXT; |
vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT; |
vfmt->Indexi = _tnl_Indexi; |
vfmt->Indexiv = _tnl_Indexiv; |
vfmt->Materialfv = _tnl_Materialfv; |
vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1fARB; |
vfmt->MultiTexCoord1fvARB = _tnl_MultiTexCoord1fvARB; |
vfmt->MultiTexCoord2fARB = _tnl_MultiTexCoord2fARB; |
vfmt->MultiTexCoord2fvARB = _tnl_MultiTexCoord2fvARB; |
vfmt->MultiTexCoord3fARB = _tnl_MultiTexCoord3fARB; |
vfmt->MultiTexCoord3fvARB = _tnl_MultiTexCoord3fvARB; |
vfmt->MultiTexCoord4fARB = _tnl_MultiTexCoord4fARB; |
vfmt->MultiTexCoord4fvARB = _tnl_MultiTexCoord4fvARB; |
vfmt->Normal3f = _tnl_Normal3f; |
vfmt->Normal3fv = _tnl_Normal3fv; |
vfmt->SecondaryColor3fEXT = _tnl_SecondaryColor3fEXT; |
vfmt->SecondaryColor3fvEXT = _tnl_SecondaryColor3fvEXT; |
vfmt->SecondaryColor3ubEXT = _tnl_SecondaryColor3ubEXT; |
vfmt->SecondaryColor3ubvEXT = _tnl_SecondaryColor3ubvEXT; |
vfmt->TexCoord1f = _tnl_TexCoord1f; |
vfmt->TexCoord1fv = _tnl_TexCoord1fv; |
vfmt->TexCoord2f = _tnl_TexCoord2f; |
vfmt->TexCoord2fv = _tnl_TexCoord2fv; |
vfmt->TexCoord3f = _tnl_TexCoord3f; |
vfmt->TexCoord3fv = _tnl_TexCoord3fv; |
vfmt->TexCoord4f = _tnl_TexCoord4f; |
vfmt->TexCoord4fv = _tnl_TexCoord4fv; |
vfmt->Vertex2f = _tnl_Vertex2f; |
vfmt->Vertex2fv = _tnl_Vertex2fv; |
vfmt->Vertex3f = _tnl_Vertex3f; |
vfmt->Vertex3fv = _tnl_Vertex3fv; |
vfmt->Vertex4f = _tnl_Vertex4f; |
vfmt->Vertex4fv = _tnl_Vertex4fv; |
vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV; |
vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV; |
/* Outside begin/end functions (from t_varray.c, t_eval.c, ...): |
*/ |
vfmt->Rectf = _tnl_Rectf; |
/* Just use the core function: |
*/ |
vfmt->CallList = _mesa_CallList; |
vfmt->prefer_float_colors = GL_FALSE; |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_array_import.h |
---|
0,0 → 1,37 |
/* $Id: t_array_import.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_ARRAY_IMPORT_H |
#define _T_ARRAY_IMPORT_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ); |
extern void _tnl_array_import_init( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/tnl.h |
---|
0,0 → 1,78 |
/* $Id: tnl.h,v 1.1 2003-02-28 11:48:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _TNL_H |
#define _TNL_H |
#include "mtypes.h" |
/* These are the public-access functions exported from tnl. (A few |
* more are currently hooked into dispatch directly by the module |
* itself.) |
*/ |
extern GLboolean |
_tnl_CreateContext( GLcontext *ctx ); |
extern void |
_tnl_DestroyContext( GLcontext *ctx ); |
extern void |
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); |
/* Functions to revive the tnl module after being unhooked from |
* dispatch and/or driver callbacks. |
*/ |
/* Restore just the ctx->Exec table: |
*/ |
extern void |
_tnl_wakeup_exec( GLcontext *ctx ); |
/* Restore both ctx->Exec and ctx->Save: |
*/ |
extern void |
_tnl_wakeup_save_exec( GLcontext *ctx ); |
/* Driver configuration options: |
*/ |
extern void |
_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); |
extern void |
_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); |
extern void |
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); |
extern void |
_tnl_isolate_materials( GLcontext *ctx, GLboolean flag ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_api.h |
---|
0,0 → 1,57 |
/* $Id: t_imm_api.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_VTXFMT_H |
#define _T_VTXFMT_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_save_Begin( GLenum mode ); |
extern void _tnl_Begin( GLenum mode ); |
extern void _tnl_Begin( GLenum mode ); |
extern void _tnl_End(void); |
/* TNL-private internal functions for building higher-level operations: |
*/ |
extern GLboolean _tnl_hard_begin( GLcontext *ctx, GLenum p ); |
extern void _tnl_end( GLcontext *ctx ); |
extern void _tnl_vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ); |
extern void _tnl_eval_coord1f( GLcontext *CC, GLfloat u ); |
extern void _tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v ); |
extern void _tnl_array_element( GLcontext *CC, GLint i ); |
/* Initialize our part of the vtxfmt struct: |
*/ |
extern void _tnl_imm_vtxfmt_init( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_dlist.c |
---|
0,0 → 1,656 |
/* $Id: t_imm_dlist.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "dlist.h" |
#include "debug.h" |
#include "mmath.h" |
#include "imports.h" |
#include "state.h" |
#include "t_context.h" |
#include "t_imm_api.h" |
#include "t_imm_elt.h" |
#include "t_imm_alloc.h" |
#include "t_imm_dlist.h" |
#include "t_imm_debug.h" |
#include "t_imm_exec.h" |
#include "t_imm_fixup.h" |
#include "t_pipeline.h" |
typedef struct { |
struct immediate *IM; |
GLuint Start; |
GLuint Count; |
GLuint BeginState; |
GLuint SavedBeginState; |
GLuint OrFlag; |
GLuint AndFlag; |
GLuint TexSize; |
GLuint LastData; |
GLuint LastPrimitive; |
GLuint LastMaterial; |
GLuint MaterialOrMask; |
GLuint MaterialAndMask; |
} TNLvertexcassette; |
static void execute_compiled_cassette( GLcontext *ctx, void *data ); |
static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM ); |
static void build_normal_lengths( struct immediate *IM ) |
{ |
GLuint i; |
GLfloat len; |
GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL] + IM->Start; |
GLfloat *dest = IM->NormalLengthPtr; |
GLuint *flags = IM->Flag + IM->Start; |
GLuint count = IM->Count - IM->Start; |
if (!dest) { |
dest = IM->NormalLengthPtr = (GLfloat *) ALIGN_MALLOC( IMM_SIZE*sizeof(GLfloat), 32 ); |
if (!dest) return; |
} |
dest += IM->Start; |
len = (GLfloat) LEN_3FV( data[0] ); |
if (len > 0.0F) len = 1.0F / len; |
for (i = 0 ; i < count ; ) { |
dest[i] = len; |
if (flags[++i] & VERT_BIT_NORMAL) { |
len = (GLfloat) LEN_3FV( data[i] ); |
if (len > 0.0F) len = 1.0F / len; |
} |
} |
} |
static void fixup_normal_lengths( struct immediate *IM ) |
{ |
GLuint i; |
GLfloat len = 1.0F; /* just to silence warnings */ |
GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL]; |
GLfloat *dest = IM->NormalLengthPtr; |
GLuint *flags = IM->Flag; |
for (i = IM->CopyStart ; i <= IM->Start ; i++) { |
len = (GLfloat) LEN_3FV( data[i] ); |
if (len > 0.0F) len = 1.0F / len; |
dest[i] = len; |
} |
if (i < IM->Count) { |
while (!(flags[i] & (VERT_BIT_NORMAL|VERT_BIT_END_VB))) { |
dest[i] = len; |
i++; |
} |
} |
} |
/* Insert the active immediate struct onto the display list currently |
* being built. |
*/ |
void |
_tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
struct immediate *im = TNL_CURRENT_IM(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
TNLvertexcassette *node; |
GLuint new_beginstate; |
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) |
_mesa_debug(ctx, "_tnl_compiled_cassette IM: %d\n", IM->id); |
if (IM->FlushElt) { |
ASSERT (IM->FlushElt == FLUSH_ELT_LAZY); |
_tnl_translate_array_elts( ctx, IM, IM->Start, IM->Count ); |
} |
_tnl_compute_orflag( IM, IM->Start ); |
/* Need to clear this flag, or fixup gets confused. (The |
* array-elements have been translated away by now, so it's ok to |
* remove it.) |
*/ |
IM->OrFlag &= ~VERT_BIT_ELT; |
IM->AndFlag &= ~VERT_BIT_ELT; |
_tnl_fixup_input( ctx, IM ); |
node = (TNLvertexcassette *) |
_mesa_alloc_instruction(ctx, |
tnl->opcode_vertex_cassette, |
sizeof(TNLvertexcassette)); |
if (!node) |
return; |
node->IM = im; im->ref_count++; |
node->Start = im->Start; |
node->Count = im->Count; |
node->BeginState = im->BeginState; |
node->SavedBeginState = im->SavedBeginState; |
node->OrFlag = im->OrFlag; |
node->TexSize = im->TexSize; |
node->AndFlag = im->AndFlag; |
node->LastData = im->LastData; |
node->LastPrimitive = im->LastPrimitive; |
node->LastMaterial = im->LastMaterial; |
node->MaterialOrMask = im->MaterialOrMask; |
node->MaterialAndMask = im->MaterialAndMask; |
if (tnl->CalcDListNormalLengths) { |
build_normal_lengths( im ); |
} |
if (ctx->ExecuteFlag) { |
execute_compiled_cassette( ctx, (void *)node ); |
} |
/* Discard any errors raised in the last cassette. |
*/ |
new_beginstate = node->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1); |
/* Decide whether this immediate struct is full, or can be used for |
* the next batch of vertices as well. |
*/ |
if (im->Count > IMM_MAXDATA - 16) { |
/* Call it full... |
*/ |
struct immediate *new_im = _tnl_alloc_immediate(ctx); |
new_im->ref_count++; |
im->ref_count--; /* remove CURRENT_IM reference */ |
ASSERT(im->ref_count > 0); /* it is compiled into a display list */ |
SET_IMMEDIATE( ctx, new_im ); |
_tnl_reset_compile_input( ctx, IMM_MAX_COPIED_VERTS, |
new_beginstate, node->SavedBeginState ); |
} else { |
/* Still some room in the current immediate. |
*/ |
_tnl_reset_compile_input( ctx, im->Count+1+IMM_MAX_COPIED_VERTS, |
new_beginstate, node->SavedBeginState); |
} |
} |
static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
/* Can potentially overwrite primitive details - need to save the |
* first slot: |
*/ |
tnl->DlistPrimitive = IM->Primitive[IM->Start]; |
tnl->DlistPrimitiveLength = IM->PrimitiveLength[IM->Start]; |
tnl->DlistLastPrimitive = IM->LastPrimitive; |
/* The first primitive may be different from what was recorded in |
* the immediate struct. Consider an immediate that starts with a |
* glBegin, compiled in a display list, which is called from within |
* an existing Begin/End object. |
*/ |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { |
GLuint i; |
if (IM->BeginState & VERT_ERROR_1) |
_mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); |
for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) |
if (IM->Flag[i] & (VERT_BIT_BEGIN|VERT_BIT_END_VB)) |
break; |
/* Would like to just ignore vertices upto this point. Can't |
* set copystart because it might skip materials? |
*/ |
ASSERT(IM->Start == IM->CopyStart); |
if (i > IM->CopyStart || !(IM->Flag[IM->Start] & VERT_BIT_BEGIN)) { |
IM->Primitive[IM->CopyStart] = GL_POLYGON+1; |
IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; |
if (IM->Flag[i] & VERT_BIT_END_VB) { |
IM->Primitive[IM->CopyStart] |= PRIM_LAST; |
IM->LastPrimitive = IM->CopyStart; |
} |
} |
} else { |
GLuint i; |
if (IM->BeginState & VERT_ERROR_0) |
_mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); |
if (IM->CopyStart == IM->Start && |
IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB)) |
{ |
} |
else |
{ |
IM->Primitive[IM->CopyStart] = ctx->Driver.CurrentExecPrimitive; |
if (tnl->ExecParity) |
IM->Primitive[IM->CopyStart] |= PRIM_PARITY; |
/* one of these should be true, else we'll be in an infinite loop |
*/ |
ASSERT(IM->PrimitiveLength[IM->Start] > 0 || |
IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB)); |
for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) |
if (IM->Flag[i] & (VERT_BIT_END | VERT_BIT_END_VB)) { |
IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; |
if (IM->Flag[i] & VERT_BIT_END_VB) { |
IM->Primitive[IM->CopyStart] |= PRIM_LAST; |
IM->LastPrimitive = IM->CopyStart; |
} |
if (IM->Flag[i] & VERT_BIT_END) { |
IM->Primitive[IM->CopyStart] |= PRIM_END; |
} |
break; |
} |
} |
} |
} |
/* Undo any changes potentially made to the immediate in the range |
* IM->Start..IM->Count above. |
*/ |
static void restore_compiled_primitives( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
IM->Primitive[IM->Start] = tnl->DlistPrimitive; |
IM->PrimitiveLength[IM->Start] = tnl->DlistPrimitiveLength; |
} |
static void |
execute_compiled_cassette( GLcontext *ctx, void *data ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
TNLvertexcassette *node = (TNLvertexcassette *)data; |
struct immediate *IM = node->IM; |
/* _mesa_debug("%s\n", __FUNCTION__); */ |
IM->Start = node->Start; |
IM->CopyStart = node->Start; |
IM->Count = node->Count; |
IM->BeginState = node->BeginState; |
IM->SavedBeginState = node->SavedBeginState; |
IM->OrFlag = node->OrFlag; |
IM->TexSize = node->TexSize; |
IM->AndFlag = node->AndFlag; |
IM->LastData = node->LastData; |
IM->LastPrimitive = node->LastPrimitive; |
IM->LastMaterial = node->LastMaterial; |
IM->MaterialOrMask = node->MaterialOrMask; |
IM->MaterialAndMask = node->MaterialAndMask; |
if ((MESA_VERBOSE & VERBOSE_DISPLAY_LIST) && |
(MESA_VERBOSE & VERBOSE_IMMEDIATE)) |
_tnl_print_cassette( IM ); |
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) { |
_mesa_debug(ctx, "Run cassette %d, rows %d..%d, beginstate %x ", |
IM->id, IM->Start, IM->Count, IM->BeginState); |
_tnl_print_vert_flags("orflag", IM->OrFlag); |
} |
/* Need to respect 'HardBeginEnd' even if the commands are looped |
* back to a driver tnl module. |
*/ |
if (IM->SavedBeginState) { |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) |
tnl->ReplayHardBeginEnd = 1; |
if (!tnl->ReplayHardBeginEnd) { |
/* This is a user error. Whatever operation (like glRectf) |
* decomposed to this hard begin/end pair is now being run |
* inside a begin/end object -- illegally. Reject it and |
* raise an error. |
*/ |
_mesa_error(ctx, GL_INVALID_OPERATION, "hard replay"); |
return; |
} |
} |
if (tnl->LoopbackDListCassettes) { |
/* (tnl->IsolateMaterials && (IM->OrFlag & VERT_MATERIAL)) ) { */ |
fixup_compiled_primitives( ctx, IM ); |
loopback_compiled_cassette( ctx, IM ); |
restore_compiled_primitives( ctx, IM ); |
} |
else { |
if (ctx->NewState) |
_mesa_update_state(ctx); |
if (tnl->pipeline.build_state_changes) |
_tnl_validate_pipeline( ctx ); |
_tnl_fixup_compiled_cassette( ctx, IM ); |
fixup_compiled_primitives( ctx, IM ); |
if (IM->Primitive[IM->LastPrimitive] & PRIM_END) |
ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1; |
else if ((IM->Primitive[IM->LastPrimitive] & PRIM_BEGIN) || |
(IM->Primitive[IM->LastPrimitive] & PRIM_MODE_MASK) == |
PRIM_OUTSIDE_BEGIN_END) { |
ctx->Driver.CurrentExecPrimitive = |
IM->Primitive[IM->LastPrimitive] & PRIM_MODE_MASK; |
} |
_tnl_get_exec_copy_verts( ctx, IM ); |
if (IM->NormalLengthPtr) |
fixup_normal_lengths( IM ); |
if (IM->Count == IM->Start) |
_tnl_copy_to_current( ctx, IM, IM->OrFlag, IM->LastData ); |
else { |
/* _tnl_print_cassette( IM ); */ |
_tnl_run_cassette( ctx, IM ); |
} |
restore_compiled_primitives( ctx, IM ); |
} |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) |
tnl->ReplayHardBeginEnd = 0; |
} |
static void |
destroy_compiled_cassette( GLcontext *ctx, void *data ) |
{ |
TNLvertexcassette *node = (TNLvertexcassette *)data; |
if ( --node->IM->ref_count == 0 ) |
_tnl_free_immediate( ctx, node->IM ); |
} |
static void |
print_compiled_cassette( GLcontext *ctx, void *data ) |
{ |
TNLvertexcassette *node = (TNLvertexcassette *)data; |
struct immediate *IM = node->IM; |
_mesa_debug(ctx, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", |
node->IM->id, node->Start, node->Count); |
IM->Start = node->Start; |
IM->CopyStart = node->Start; |
IM->Count = node->Count; |
IM->BeginState = node->BeginState; |
IM->OrFlag = node->OrFlag; |
IM->TexSize = node->TexSize; |
IM->AndFlag = node->AndFlag; |
IM->LastData = node->LastData; |
IM->LastPrimitive = node->LastPrimitive; |
IM->LastMaterial = node->LastMaterial; |
IM->MaterialOrMask = node->MaterialOrMask; |
IM->MaterialAndMask = node->MaterialAndMask; |
_tnl_print_cassette( node->IM ); |
} |
void |
_tnl_BeginCallList( GLcontext *ctx, GLuint list ) |
{ |
(void) ctx; |
(void) list; |
FLUSH_CURRENT(ctx, 0); |
} |
/* Called at the tail of a CallList. Make current immediate aware of |
* any new to-be-copied vertices. |
*/ |
void |
_tnl_EndCallList( GLcontext *ctx ) |
{ |
GLuint beginstate = 0; |
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) |
beginstate = VERT_BEGIN_0|VERT_BEGIN_1; |
_tnl_reset_exec_input( ctx, TNL_CURRENT_IM(ctx)->Start, beginstate, 0 ); |
} |
void |
_tnl_EndList( GLcontext *ctx ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
ctx->swtnl_im = 0; |
IM->ref_count--; |
/* outside begin/end, even in COMPILE_AND_EXEC, |
* so no vertices to copy, right? |
*/ |
ASSERT(TNL_CONTEXT(ctx)->ExecCopyCount == 0); |
/* If this one isn't free, get a clean one. (Otherwise we'll be |
* using one that's already half full). |
*/ |
if (IM->ref_count != 0) |
IM = _tnl_alloc_immediate( ctx ); |
ASSERT(IM->ref_count == 0); |
SET_IMMEDIATE( ctx, IM ); |
IM->ref_count++; |
_tnl_reset_exec_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); |
} |
void |
_tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
/* Use the installed immediate struct. No vertices in the current |
* immediate, no copied vertices in the system. |
*/ |
ASSERT(TNL_CURRENT_IM(ctx)); |
ASSERT(TNL_CURRENT_IM(ctx)->Start == IMM_MAX_COPIED_VERTS); |
ASSERT(TNL_CURRENT_IM(ctx)->Start == TNL_CURRENT_IM(ctx)->Count); |
ASSERT(TNL_CONTEXT(ctx)->ExecCopyCount == 0); |
/* Set current Begin/End state to unknown: |
*/ |
IM->BeginState = VERT_BEGIN_0; |
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; |
} |
void |
_tnl_dlist_init( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->opcode_vertex_cassette = |
_mesa_alloc_opcode( ctx, |
sizeof(TNLvertexcassette), |
execute_compiled_cassette, |
destroy_compiled_cassette, |
print_compiled_cassette ); |
} |
static void emit_material( struct gl_material *src, GLuint bitmask ) |
{ |
if (bitmask & FRONT_EMISSION_BIT) |
glMaterialfv( GL_FRONT, GL_EMISSION, src[0].Emission ); |
if (bitmask & BACK_EMISSION_BIT) |
glMaterialfv( GL_BACK, GL_EMISSION, src[1].Emission ); |
if (bitmask & FRONT_AMBIENT_BIT) |
glMaterialfv( GL_FRONT, GL_AMBIENT, src[0].Ambient ); |
if (bitmask & BACK_AMBIENT_BIT) |
glMaterialfv( GL_BACK, GL_AMBIENT, src[1].Ambient ); |
if (bitmask & FRONT_DIFFUSE_BIT) |
glMaterialfv( GL_FRONT, GL_DIFFUSE, src[0].Diffuse ); |
if (bitmask & BACK_DIFFUSE_BIT) |
glMaterialfv( GL_BACK, GL_DIFFUSE, src[1].Diffuse ); |
if (bitmask & FRONT_SPECULAR_BIT) |
glMaterialfv( GL_FRONT, GL_SPECULAR, src[0].Specular ); |
if (bitmask & BACK_SPECULAR_BIT) |
glMaterialfv( GL_BACK, GL_SPECULAR, src[1].Specular ); |
if (bitmask & FRONT_SHININESS_BIT) |
glMaterialfv( GL_FRONT, GL_SHININESS, &src[0].Shininess ); |
if (bitmask & BACK_SHININESS_BIT) |
glMaterialfv( GL_BACK, GL_SHININESS, &src[1].Shininess ); |
if (bitmask & FRONT_INDEXES_BIT) { |
GLfloat ind[3]; |
ind[0] = src[0].AmbientIndex; |
ind[1] = src[0].DiffuseIndex; |
ind[2] = src[0].SpecularIndex; |
glMaterialfv( GL_FRONT, GL_COLOR_INDEXES, ind ); |
} |
if (bitmask & BACK_INDEXES_BIT) { |
GLfloat ind[3]; |
ind[0] = src[1].AmbientIndex; |
ind[1] = src[1].DiffuseIndex; |
ind[2] = src[1].SpecularIndex; |
glMaterialfv( GL_BACK, GL_COLOR_INDEXES, ind ); |
} |
} |
/* Low-performance helper function to allow driver-supplied tnl |
* modules to process tnl display lists. This is primarily supplied |
* to avoid fallbacks if CallList is invoked inside a Begin/End pair. |
* For higher performance, drivers should fallback to tnl (if outside |
* begin/end), or (for tnl hardware) implement their own display list |
* mechanism. |
*/ |
static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
GLuint i; |
GLuint *flags = IM->Flag; |
GLuint orflag = IM->OrFlag; |
GLuint j; |
void (GLAPIENTRY *vertex)( const GLfloat * ); |
void (GLAPIENTRY *texcoordfv[MAX_TEXTURE_UNITS])( GLenum, const GLfloat * ); |
GLuint maxtex = 0; |
GLuint p, length, prim = 0; |
if (orflag & VERT_BITS_OBJ_234) |
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex4fv; |
else |
vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex3fv; |
if (orflag & VERT_BITS_TEX_ANY) { |
for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) { |
if (orflag & VERT_BIT_TEX(j)) { |
maxtex = j+1; |
if ((IM->TexSize & TEX_SIZE_4(j)) == TEX_SIZE_4(j)) |
texcoordfv[j] = glMultiTexCoord4fvARB; |
else if (IM->TexSize & TEX_SIZE_3(j)) |
texcoordfv[j] = glMultiTexCoord3fvARB; |
else |
texcoordfv[j] = glMultiTexCoord2fvARB; |
} |
} |
} |
for (p = IM->Start ; !(prim & PRIM_LAST) ; p += length) |
{ |
prim = IM->Primitive[p]; |
length= IM->PrimitiveLength[p]; |
ASSERT(length || (prim & PRIM_LAST)); |
ASSERT((prim & PRIM_MODE_MASK) <= GL_POLYGON+1); |
if (prim & PRIM_BEGIN) { |
glBegin(prim & PRIM_MODE_MASK); |
} |
for ( i = p ; i <= p+length ; i++) { |
if (flags[i] & VERT_BITS_TEX_ANY) { |
GLuint k; |
for (k = 0 ; k < maxtex ; k++) { |
if (flags[i] & VERT_BIT_TEX(k)) { |
texcoordfv[k]( GL_TEXTURE0_ARB + k, |
IM->Attrib[VERT_ATTRIB_TEX0 + k][i] ); |
} |
} |
} |
if (flags[i] & VERT_BIT_NORMAL) |
glNormal3fv(IM->Attrib[VERT_ATTRIB_NORMAL][i]); |
if (flags[i] & VERT_BIT_COLOR0) |
glColor4fv( IM->Attrib[VERT_ATTRIB_COLOR0][i] ); |
if (flags[i] & VERT_BIT_COLOR1) |
_glapi_Dispatch->SecondaryColor3fvEXT( IM->Attrib[VERT_ATTRIB_COLOR1][i] ); |
if (flags[i] & VERT_BIT_FOG) |
_glapi_Dispatch->FogCoordfEXT( IM->Attrib[VERT_ATTRIB_FOG][i][0] ); |
if (flags[i] & VERT_BIT_INDEX) |
glIndexi( IM->Index[i] ); |
if (flags[i] & VERT_BIT_EDGEFLAG) |
glEdgeFlag( IM->EdgeFlag[i] ); |
if (flags[i] & VERT_BIT_MATERIAL) |
emit_material( IM->Material[i], IM->MaterialMask[i] ); |
if (flags[i]&VERT_BITS_OBJ_234) |
vertex( IM->Attrib[VERT_ATTRIB_POS][i] ); |
else if (flags[i] & VERT_BIT_EVAL_C1) |
glEvalCoord1f( IM->Attrib[VERT_ATTRIB_POS][i][0] ); |
else if (flags[i] & VERT_BIT_EVAL_P1) |
glEvalPoint1( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0] ); |
else if (flags[i] & VERT_BIT_EVAL_C2) |
glEvalCoord2f( IM->Attrib[VERT_ATTRIB_POS][i][0], |
IM->Attrib[VERT_ATTRIB_POS][i][1] ); |
else if (flags[i] & VERT_BIT_EVAL_P2) |
glEvalPoint2( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0], |
(GLint) IM->Attrib[VERT_ATTRIB_POS][i][1] ); |
} |
if (prim & PRIM_END) { |
glEnd(); |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_texgen.c |
---|
0,0 → 1,692 |
/* $Id: t_vb_texgen.c,v 1.1 2003-02-28 11:48:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Brian Paul |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "imports.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
/*********************************************************************** |
* Automatic texture coordinate generation (texgen) code. |
*/ |
struct texgen_stage_data; |
typedef void (*texgen_func)( GLcontext *ctx, |
struct texgen_stage_data *store, |
GLuint unit); |
struct texgen_stage_data { |
/* Per-texunit derived state. |
*/ |
GLuint TexgenSize[MAX_TEXTURE_UNITS]; |
GLuint TexgenHoles[MAX_TEXTURE_UNITS]; |
texgen_func TexgenFunc[MAX_TEXTURE_UNITS]; |
/* Temporary values used in texgen. |
*/ |
GLfloat (*tmp_f)[3]; |
GLfloat *tmp_m; |
/* Buffered outputs of the stage. |
*/ |
GLvector4f texcoord[MAX_TEXTURE_UNITS]; |
}; |
#define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr) |
static GLuint all_bits[5] = { |
0, |
VEC_SIZE_1, |
VEC_SIZE_2, |
VEC_SIZE_3, |
VEC_SIZE_4, |
}; |
#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) |
#define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP) |
#define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \ |
TEXGEN_REFLECTION_MAP_NV) |
static void build_m3( GLfloat f[][3], GLfloat m[], |
const GLvector4f *normal, |
const GLvector4f *eye ) |
{ |
GLuint stride = eye->stride; |
GLfloat *coord = (GLfloat *)eye->start; |
GLuint count = eye->count; |
const GLfloat *norm = normal->start; |
GLuint i; |
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) { |
GLfloat u[3], two_nu, fx, fy, fz; |
COPY_3V( u, coord ); |
NORMALIZE_3FV( u ); |
two_nu = 2.0F * DOT3(norm,u); |
fx = f[i][0] = u[0] - norm[0] * two_nu; |
fy = f[i][1] = u[1] - norm[1] * two_nu; |
fz = f[i][2] = u[2] - norm[2] * two_nu; |
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); |
if (m[i] != 0.0F) { |
m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); |
} |
} |
} |
static void build_m2( GLfloat f[][3], GLfloat m[], |
const GLvector4f *normal, |
const GLvector4f *eye ) |
{ |
GLuint stride = eye->stride; |
GLfloat *coord = eye->start; |
GLuint count = eye->count; |
GLfloat *norm = normal->start; |
GLuint i; |
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) { |
GLfloat u[3], two_nu, fx, fy, fz; |
COPY_2V( u, coord ); |
u[2] = 0; |
NORMALIZE_3FV( u ); |
two_nu = 2.0F * DOT3(norm,u); |
fx = f[i][0] = u[0] - norm[0] * two_nu; |
fy = f[i][1] = u[1] - norm[1] * two_nu; |
fz = f[i][2] = u[2] - norm[2] * two_nu; |
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); |
if (m[i] != 0.0F) { |
m[i] = 0.5F / (GLfloat) GL_SQRT(m[i]); |
} |
} |
} |
typedef void (*build_m_func)( GLfloat f[][3], |
GLfloat m[], |
const GLvector4f *normal, |
const GLvector4f *eye ); |
static build_m_func build_m_tab[5] = { |
0, |
0, |
build_m2, |
build_m3, |
build_m3 |
}; |
/* This is unusual in that we respect the stride of the output vector |
* (f). This allows us to pass in either a texcoord vector4f, or a |
* temporary vector3f. |
*/ |
static void build_f3( GLfloat *f, |
GLuint fstride, |
const GLvector4f *normal, |
const GLvector4f *eye ) |
{ |
GLuint stride = eye->stride; |
GLfloat *coord = eye->start; |
GLuint count = eye->count; |
GLfloat *norm = normal->start; |
GLuint i; |
for (i=0;i<count;i++) { |
GLfloat u[3], two_nu; |
COPY_3V( u, coord ); |
NORMALIZE_3FV( u ); |
two_nu = 2.0F * DOT3(norm,u); |
f[0] = u[0] - norm[0] * two_nu; |
f[1] = u[1] - norm[1] * two_nu; |
f[2] = u[2] - norm[2] * two_nu; |
STRIDE_F(coord,stride); |
STRIDE_F(f,fstride); |
STRIDE_F(norm, normal->stride); |
} |
} |
static void build_f2( GLfloat *f, |
GLuint fstride, |
const GLvector4f *normal, |
const GLvector4f *eye ) |
{ |
GLuint stride = eye->stride; |
GLfloat *coord = eye->start; |
GLuint count = eye->count; |
GLfloat *norm = normal->start; |
GLuint i; |
for (i=0;i<count;i++) { |
GLfloat u[3], two_nu; |
COPY_2V( u, coord ); |
u[2] = 0; |
NORMALIZE_3FV( u ); |
two_nu = 2.0F * DOT3(norm,u); |
f[0] = u[0] - norm[0] * two_nu; |
f[1] = u[1] - norm[1] * two_nu; |
f[2] = u[2] - norm[2] * two_nu; |
STRIDE_F(coord,stride); |
STRIDE_F(f,fstride); |
STRIDE_F(norm, normal->stride); |
} |
} |
typedef void (*build_f_func)( GLfloat *f, |
GLuint fstride, |
const GLvector4f *normal_vec, |
const GLvector4f *eye ); |
/* Just treat 4-vectors as 3-vectors. |
*/ |
static build_f_func build_f_tab[5] = { |
0, |
0, |
build_f2, |
build_f3, |
build_f3 |
}; |
/* Special case texgen functions. |
*/ |
static void texgen_reflection_map_nv( GLcontext *ctx, |
struct texgen_stage_data *store, |
GLuint unit ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLvector4f *in = VB->TexCoordPtr[unit]; |
GLvector4f *out = &store->texcoord[unit]; |
build_f_tab[VB->EyePtr->size]( out->start, |
out->stride, |
VB->NormalPtr, |
VB->EyePtr ); |
if (in) { |
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; |
out->count = in->count; |
out->size = MAX2(in->size, 3); |
if (in->size == 4) |
_mesa_copy_tab[0x8]( out, in ); |
} |
else { |
out->flags |= VEC_SIZE_3; |
out->size = 3; |
out->count = in->count; |
} |
} |
static void texgen_normal_map_nv( GLcontext *ctx, |
struct texgen_stage_data *store, |
GLuint unit ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLvector4f *in = VB->TexCoordPtr[unit]; |
GLvector4f *out = &store->texcoord[unit]; |
GLvector4f *normal = VB->NormalPtr; |
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; |
GLuint count = VB->Count; |
GLuint i; |
const GLfloat *norm = normal->start; |
for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) { |
texcoord[i][0] = norm[0]; |
texcoord[i][1] = norm[1]; |
texcoord[i][2] = norm[2]; |
} |
if (in) { |
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; |
out->count = in->count; |
out->size = MAX2(in->size, 3); |
if (in->size == 4) |
_mesa_copy_tab[0x8]( out, in ); |
} |
else { |
out->flags |= VEC_SIZE_3; |
out->size = 3; |
out->count = in->count; |
} |
} |
static void texgen_sphere_map( GLcontext *ctx, |
struct texgen_stage_data *store, |
GLuint unit ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLvector4f *in = VB->TexCoordPtr[unit]; |
GLvector4f *out = &store->texcoord[unit]; |
GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; |
GLuint count = VB->Count; |
GLuint i; |
GLfloat (*f)[3] = store->tmp_f; |
GLfloat *m = store->tmp_m; |
/* _mesa_debug(NULL, "%s normstride %d eyestride %d\n", */ |
/* __FUNCTION__, VB->NormalPtr->stride, */ |
/* VB->EyePtr->stride); */ |
(build_m_tab[VB->EyePtr->size])( store->tmp_f, |
store->tmp_m, |
VB->NormalPtr, |
VB->EyePtr ); |
for (i=0;i<count;i++) { |
texcoord[i][0] = f[i][0] * m[i] + 0.5F; |
texcoord[i][1] = f[i][1] * m[i] + 0.5F; |
} |
if (in) { |
out->size = MAX2(in->size,2); |
out->count = in->count; |
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; |
if (in->size > 2) |
_mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); |
} else { |
out->size = 2; |
out->flags |= VEC_SIZE_2; |
out->count = in->count; |
} |
} |
static void texgen( GLcontext *ctx, |
struct texgen_stage_data *store, |
GLuint unit ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLvector4f *in = VB->TexCoordPtr[unit]; |
GLvector4f *out = &store->texcoord[unit]; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
const GLvector4f *obj = VB->ObjPtr; |
const GLvector4f *eye = VB->EyePtr; |
const GLvector4f *normal = VB->NormalPtr; |
GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; |
GLfloat *indata; |
GLuint count = VB->Count; |
GLfloat (*f)[3] = store->tmp_f; |
GLfloat *m = store->tmp_m; |
GLuint holes = 0; |
if (texUnit->_GenFlags & TEXGEN_NEED_M) { |
build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); |
} else if (texUnit->_GenFlags & TEXGEN_NEED_F) { |
build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); |
} |
if (!in) { |
ASSERT(0); |
in = out; |
in->count = VB->Count; |
out->size = store->TexgenSize[unit]; |
out->flags |= texUnit->TexGenEnabled; |
out->count = VB->Count; |
holes = store->TexgenHoles[unit]; |
} |
else { |
GLuint copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); |
if (copy) |
_mesa_copy_tab[copy]( out, in ); |
out->size = MAX2(in->size, store->TexgenSize[unit]); |
out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; |
out->count = in->count; |
holes = ~all_bits[in->size] & store->TexgenHoles[unit]; |
} |
if (holes) { |
if (holes & VEC_DIRTY_2) _mesa_vector4f_clean_elem(out, count, 2); |
if (holes & VEC_DIRTY_1) _mesa_vector4f_clean_elem(out, count, 1); |
if (holes & VEC_DIRTY_0) _mesa_vector4f_clean_elem(out, count, 0); |
} |
if (texUnit->TexGenEnabled & S_BIT) { |
GLuint i; |
switch (texUnit->GenModeS) { |
case GL_OBJECT_LINEAR: |
_mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, |
sizeof(out->data[0]), obj, |
texUnit->ObjectPlaneS ); |
break; |
case GL_EYE_LINEAR: |
_mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, |
sizeof(out->data[0]), eye, |
texUnit->EyePlaneS ); |
break; |
case GL_SPHERE_MAP: |
for (indata=in->start,i=0 ; i<count ;i++, STRIDE_F(indata,in->stride)) |
texcoord[i][0] = indata[0] * m[i] + 0.5F; |
break; |
case GL_REFLECTION_MAP_NV: |
for (i=0;i<count;i++) |
texcoord[i][0] = f[i][0]; |
break; |
case GL_NORMAL_MAP_NV: { |
const GLfloat *norm = normal->start; |
for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) { |
texcoord[i][0] = norm[0]; |
} |
break; |
} |
default: |
_mesa_problem(ctx, "Bad S texgen"); |
} |
} |
if (texUnit->TexGenEnabled & T_BIT) { |
GLuint i; |
switch (texUnit->GenModeT) { |
case GL_OBJECT_LINEAR: |
_mesa_dotprod_tab[obj->size]( &(out->data[0][1]), |
sizeof(out->data[0]), obj, |
texUnit->ObjectPlaneT ); |
break; |
case GL_EYE_LINEAR: |
_mesa_dotprod_tab[eye->size]( &(out->data[0][1]), |
sizeof(out->data[0]), eye, |
texUnit->EyePlaneT ); |
break; |
case GL_SPHERE_MAP: |
for (indata=in->start,i=0; i<count ;i++,STRIDE_F(indata,in->stride)) |
texcoord[i][1] = indata[1] * m[i] + 0.5F; |
break; |
case GL_REFLECTION_MAP_NV: |
for (i=0;i<count;i++) |
texcoord[i][0] = f[i][0]; |
break; |
case GL_NORMAL_MAP_NV: { |
const GLfloat *norm = normal->start; |
for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) { |
texcoord[i][1] = norm[1]; |
} |
break; |
} |
default: |
_mesa_problem(ctx, "Bad T texgen"); |
} |
} |
if (texUnit->TexGenEnabled & R_BIT) { |
GLuint i; |
switch (texUnit->GenModeR) { |
case GL_OBJECT_LINEAR: |
_mesa_dotprod_tab[obj->size]( &(out->data[0][2]), |
sizeof(out->data[0]), obj, |
texUnit->ObjectPlaneR ); |
break; |
case GL_EYE_LINEAR: |
_mesa_dotprod_tab[eye->size]( &(out->data[0][2]), |
sizeof(out->data[0]), eye, |
texUnit->EyePlaneR ); |
break; |
case GL_REFLECTION_MAP_NV: |
for (i=0;i<count;i++) |
texcoord[i][2] = f[i][2]; |
break; |
case GL_NORMAL_MAP_NV: { |
const GLfloat *norm = normal->start; |
for (i=0;i<count;i++,STRIDE_F(norm, normal->stride)) { |
texcoord[i][2] = norm[2]; |
} |
break; |
} |
default: |
_mesa_problem(ctx, "Bad R texgen"); |
} |
} |
if (texUnit->TexGenEnabled & Q_BIT) { |
switch (texUnit->GenModeQ) { |
case GL_OBJECT_LINEAR: |
_mesa_dotprod_tab[obj->size]( &(out->data[0][3]), |
sizeof(out->data[0]), obj, |
texUnit->ObjectPlaneQ ); |
break; |
case GL_EYE_LINEAR: |
_mesa_dotprod_tab[eye->size]( &(out->data[0][3]), |
sizeof(out->data[0]), eye, |
texUnit->EyePlaneQ ); |
break; |
default: |
_mesa_problem(ctx, "Bad Q texgen"); |
} |
} |
} |
static GLboolean run_texgen_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage ); |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) { |
if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i))) |
store->TexgenFunc[i]( ctx, store, i ); |
VB->TexCoordPtr[i] = &store->texcoord[i]; |
} |
return GL_TRUE; |
} |
static GLboolean run_validate_texgen_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; |
if (texUnit->TexGenEnabled) { |
GLuint sz; |
if (texUnit->TexGenEnabled & R_BIT) |
sz = 4; |
else if (texUnit->TexGenEnabled & Q_BIT) |
sz = 3; |
else if (texUnit->TexGenEnabled & T_BIT) |
sz = 2; |
else |
sz = 1; |
store->TexgenSize[i] = sz; |
store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled); |
store->TexgenFunc[i] = texgen; |
if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { |
if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { |
store->TexgenFunc[i] = texgen_reflection_map_nv; |
} |
else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { |
store->TexgenFunc[i] = texgen_normal_map_nv; |
} |
} |
else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && |
texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { |
store->TexgenFunc[i] = texgen_sphere_map; |
} |
} |
} |
stage->run = run_texgen_stage; |
return stage->run( ctx, stage ); |
} |
static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
GLuint i; |
stage->active = 0; |
if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) { |
GLuint inputs = 0; |
GLuint outputs = 0; |
if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR) |
inputs |= VERT_BIT_POS; |
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) |
inputs |= VERT_BIT_EYE; |
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) |
inputs |= VERT_BIT_NORMAL; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) |
{ |
outputs |= VERT_BIT_TEX(i); |
/* Need the original input in case it contains a Q coord: |
* (sigh) |
*/ |
inputs |= VERT_BIT_TEX(i); |
/* Something for Feedback? */ |
} |
if (stage->privatePtr) |
stage->run = run_validate_texgen_stage; |
stage->active = 1; |
stage->inputs = inputs; |
stage->outputs = outputs; |
} |
} |
/* Called the first time stage->run() is invoked. |
*/ |
static GLboolean alloc_texgen_data( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct texgen_stage_data *store; |
GLuint i; |
stage->privatePtr = CALLOC(sizeof(*store)); |
store = TEXGEN_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); |
store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); |
store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); |
/* Now validate and run the stage. |
*/ |
stage->run = run_validate_texgen_stage; |
return stage->run( ctx, stage ); |
} |
static void free_texgen_data( struct gl_pipeline_stage *stage ) |
{ |
struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); |
GLuint i; |
if (store) { |
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) |
if (store->texcoord[i].data) |
_mesa_vector4f_free( &store->texcoord[i] ); |
if (store->tmp_f) FREE( store->tmp_f ); |
if (store->tmp_m) FREE( store->tmp_m ); |
FREE( store ); |
stage->privatePtr = NULL; |
} |
} |
const struct gl_pipeline_stage _tnl_texgen_stage = |
{ |
"texgen", /* name */ |
_NEW_TEXTURE, /* when to call check() */ |
_NEW_TEXTURE, /* when to invalidate stored data */ |
GL_FALSE, /* active? */ |
0, /* inputs */ |
0, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private data */ |
free_texgen_data, /* destructor */ |
check_texgen, /* check */ |
alloc_texgen_data /* run -- initially set to alloc data */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_context.c |
---|
0,0 → 1,244 |
/* $Id: t_context.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "dlist.h" |
#include "light.h" |
#include "vtxfmt.h" |
#include "t_context.h" |
#include "t_array_api.h" |
#include "t_eval_api.h" |
#include "t_imm_alloc.h" |
#include "t_imm_api.h" |
#include "t_imm_exec.h" |
#include "t_imm_dlist.h" |
#include "t_pipeline.h" |
#include "tnl.h" |
#ifndef THREADS |
struct immediate *_tnl_CurrentInput = NULL; |
#endif |
void |
_tnl_MakeCurrent( GLcontext *ctx, |
GLframebuffer *drawBuffer, |
GLframebuffer *readBuffer ) |
{ |
#ifndef THREADS |
SET_IMMEDIATE( ctx, TNL_CURRENT_IM(ctx) ); |
#endif |
} |
static void |
install_driver_callbacks( GLcontext *ctx ) |
{ |
ctx->Driver.NewList = _tnl_NewList; |
ctx->Driver.EndList = _tnl_EndList; |
ctx->Driver.FlushVertices = _tnl_flush_vertices; |
ctx->Driver.MakeCurrent = _tnl_MakeCurrent; |
ctx->Driver.BeginCallList = _tnl_BeginCallList; |
ctx->Driver.EndCallList = _tnl_EndCallList; |
} |
GLboolean |
_tnl_CreateContext( GLcontext *ctx ) |
{ |
TNLcontext *tnl; |
/* Create the TNLcontext structure |
*/ |
ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) ); |
if (!tnl) { |
return GL_FALSE; |
} |
/* Initialize the VB. |
*/ |
tnl->vb.Size = MAX2( IMM_SIZE, |
ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES); |
/* Initialize tnl state and tnl->vtxfmt. |
*/ |
_tnl_dlist_init( ctx ); |
_tnl_array_init( ctx ); |
_tnl_imm_init( ctx ); |
_tnl_eval_init( ctx ); |
_tnl_install_pipeline( ctx, _tnl_default_pipeline ); |
tnl->NeedNdcCoords = GL_TRUE; |
tnl->LoopbackDListCassettes = GL_FALSE; |
tnl->CalcDListNormalLengths = GL_TRUE; |
/* Hook our functions into exec and compile dispatch tables. |
*/ |
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); |
tnl->save_vtxfmt = tnl->vtxfmt; |
tnl->save_vtxfmt.CallList = _mesa_save_CallList; |
tnl->save_vtxfmt.EvalMesh1 = _mesa_save_EvalMesh1; |
tnl->save_vtxfmt.EvalMesh2 = _mesa_save_EvalMesh2; |
tnl->save_vtxfmt.Begin = _tnl_save_Begin; |
_mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); |
/* Set a few default values in the driver struct. |
*/ |
install_driver_callbacks(ctx); |
ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT; |
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; |
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; |
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; |
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; |
tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables; |
return GL_TRUE; |
} |
void |
_tnl_DestroyContext( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
_tnl_array_destroy( ctx ); |
_tnl_imm_destroy( ctx ); |
_tnl_destroy_pipeline( ctx ); |
_tnl_free_immediate( ctx, tnl->freed_immediate ); |
FREE(tnl); |
ctx->swtnl_context = 0; |
} |
void |
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
if (new_state & _NEW_ARRAY) { |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
IM->ArrayEltFlags = ~ctx->Array._Enabled; |
IM->ArrayEltFlush = (ctx->Array.LockCount |
? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER); |
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0; |
tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */ |
} |
tnl->pipeline.run_state_changes |= new_state; |
tnl->pipeline.build_state_changes |= (new_state & |
tnl->pipeline.build_state_trigger); |
tnl->eval.EvalNewState |= new_state; |
} |
void |
_tnl_wakeup_exec( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
install_driver_callbacks(ctx); |
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; |
/* Hook our functions into exec and compile dispatch tables. |
*/ |
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); |
/* Call all appropriate driver callbacks to revive state. |
*/ |
_tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer ); |
/* Assume we haven't been getting state updates either: |
*/ |
_tnl_InvalidateState( ctx, ~0 ); |
tnl->pipeline.run_input_changes = ~0; |
if (ctx->Light.ColorMaterialEnabled) { |
_mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
} |
} |
void |
_tnl_wakeup_save_exec( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
_tnl_wakeup_exec( ctx ); |
_mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); |
} |
void |
_tnl_need_projected_coords( GLcontext *ctx, GLboolean mode ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
if (tnl->NeedNdcCoords != mode) { |
tnl->NeedNdcCoords = mode; |
_tnl_InvalidateState( ctx, _NEW_PROJECTION ); |
} |
} |
void |
_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->LoopbackDListCassettes = mode; |
} |
void |
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->CalcDListNormalLengths = mode; |
} |
void |
_tnl_isolate_materials( GLcontext *ctx, GLboolean mode ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->IsolateMaterials = mode; |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_dlist.h |
---|
0,0 → 1,45 |
/* $Id: t_imm_dlist.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _T_DLIST_H |
#define _T_DLIST_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_dlist_init( GLcontext *ctx ); |
extern void _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ); |
extern void _tnl_EndList( GLcontext *ctx ); |
extern void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ); |
extern void _tnl_EndCallList( GLcontext *ctx ); |
extern void _tnl_BeginCallList( GLcontext *ctx, GLuint list ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_elt.c |
---|
0,0 → 1,834 |
/* $Id: t_imm_elt.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_translate.h" |
#include "t_context.h" |
#include "t_imm_elt.h" |
typedef void (*trans_elt_1f_func)(GLfloat *to, |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_1ui_func)(GLuint *to, |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_1ub_func)(GLubyte *to, |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_4us_func)(GLushort (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], |
CONST void *ptr, |
GLuint stride, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ); |
static trans_elt_1f_func _tnl_trans_elt_1f_tab[MAX_TYPES]; |
static trans_elt_1ui_func _tnl_trans_elt_1ui_tab[MAX_TYPES]; |
static trans_elt_1ub_func _tnl_trans_elt_1ub_tab[MAX_TYPES]; |
static trans_elt_3f_func _tnl_trans_elt_3f_tab[MAX_TYPES]; |
static trans_elt_4ub_func _tnl_trans_elt_4ub_tab[5][MAX_TYPES]; |
static trans_elt_4us_func _tnl_trans_elt_4us_tab[5][MAX_TYPES]; |
static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; |
#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) |
/* Code specific to array element implementation. There is a small |
* subtlety in the bits CHECK() tests, and the way bits are set in |
* glArrayElement which ensures that if, eg, in the case that the |
* vertex array is disabled and normal array is enabled, and we get |
* either sequence: |
* |
* ArrayElement() OR Normal() |
* Normal() ArrayElement() |
* Vertex() Vertex() |
* |
* That the correct value for normal is used. |
*/ |
#define TAB(x) _tnl_trans_elt##x##_tab |
#define ARGS GLuint *flags, GLuint *elts, GLuint match, \ |
GLuint start, GLuint n |
#define SRC_START 0 |
#define DST_START start |
#define CHECK if ((flags[i]&match) == VERT_BIT_ELT) |
#define NEXT_F (void)1 |
#define NEXT_F2 f = first + elts[i] * stride; |
/* GL_BYTE |
*/ |
#define SRC GLbyte |
#define SRC_IDX TYPE_IDX(GL_BYTE) |
#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) |
#define TRX_US(us, f,n) us = BYTE_TO_USHORT( PTR_ELT(f,n) ) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLbyte_elt |
#define DEST_4F trans_4_GLbyte_4f_elt |
#define DEST_4UB trans_4_GLbyte_4ub_elt |
#define DEST_4US trans_4_GLbyte_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLbyte_elt |
#define DEST_4F trans_3_GLbyte_4f_elt |
#define DEST_4UB trans_3_GLbyte_4ub_elt |
#define DEST_4US trans_3_GLbyte_4us_elt |
#define DEST_3F trans_3_GLbyte_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLbyte_elt |
#define DEST_4F trans_2_GLbyte_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLbyte_elt |
#define DEST_4F trans_1_GLbyte_4f_elt |
#define DEST_1UB trans_1_GLbyte_1ub_elt |
#define DEST_1UI trans_1_GLbyte_1ui_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
#undef SRC_IDX |
/* GL_UNSIGNED_BYTE |
*/ |
#define SRC GLubyte |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) |
#define TRX_3F(f,n) UBYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) UBYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) |
#define TRX_US(us, f,n) us = PTR_ELT(f,n) |
#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) |
/* 4ub->4ub handled in special case below. |
*/ |
#define SZ 4 |
#define INIT init_trans_4_GLubyte_elt |
#define DEST_4F trans_4_GLubyte_4f_elt |
#define DEST_4US trans_4_GLubyte_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLubyte_elt |
#define DEST_4F trans_3_GLubyte_4f_elt |
#define DEST_3F trans_3_GLubyte_3f_elt |
#define DEST_4UB trans_3_GLubyte_4ub_elt |
#define DEST_4US trans_3_GLubyte_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLubyte_elt |
#define DEST_1UI trans_1_GLubyte_1ui_elt |
#define DEST_1UB trans_1_GLubyte_1ub_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_SHORT |
*/ |
#define SRC GLshort |
#define SRC_IDX TYPE_IDX(GL_SHORT) |
#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) |
#define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLshort_elt |
#define DEST_4F trans_4_GLshort_4f_elt |
#define DEST_4UB trans_4_GLshort_4ub_elt |
#define DEST_4US trans_4_GLshort_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLshort_elt |
#define DEST_4F trans_3_GLshort_4f_elt |
#define DEST_4UB trans_3_GLshort_4ub_elt |
#define DEST_4US trans_3_GLshort_4us_elt |
#define DEST_3F trans_3_GLshort_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLshort_elt |
#define DEST_4F trans_2_GLshort_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLshort_elt |
#define DEST_4F trans_1_GLshort_4f_elt |
#define DEST_1UB trans_1_GLshort_1ub_elt |
#define DEST_1UI trans_1_GLshort_1ui_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_UNSIGNED_SHORT |
*/ |
#define SRC GLushort |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) |
#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) |
#define TRX_US(us,f,n) us = PTR_ELT(f,n) |
#define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLushort_elt |
#define DEST_4F trans_4_GLushort_4f_elt |
#define DEST_4UB trans_4_GLushort_4ub_elt |
#define DEST_4US trans_4_GLushort_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLushort_elt |
#define DEST_4F trans_3_GLushort_4f_elt |
#define DEST_4UB trans_3_GLushort_4ub_elt |
#define DEST_4US trans_3_GLushort_4us_elt |
#define DEST_3F trans_3_GLushort_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLushort_elt |
#define DEST_4F trans_2_GLushort_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLushort_elt |
#define DEST_4F trans_1_GLushort_4f_elt |
#define DEST_1UB trans_1_GLushort_1ub_elt |
#define DEST_1UI trans_1_GLushort_1ui_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_INT |
*/ |
#define SRC GLint |
#define SRC_IDX TYPE_IDX(GL_INT) |
#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) |
#define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLint_elt |
#define DEST_4F trans_4_GLint_4f_elt |
#define DEST_4UB trans_4_GLint_4ub_elt |
#define DEST_4US trans_4_GLint_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLint_elt |
#define DEST_4F trans_3_GLint_4f_elt |
#define DEST_4UB trans_3_GLint_4ub_elt |
#define DEST_4US trans_3_GLint_4us_elt |
#define DEST_3F trans_3_GLint_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLint_elt |
#define DEST_4F trans_2_GLint_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLint_elt |
#define DEST_4F trans_1_GLint_4f_elt |
#define DEST_1UB trans_1_GLint_1ub_elt |
#define DEST_1UI trans_1_GLint_1ui_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_UNSIGNED_INT |
*/ |
#define SRC GLuint |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) |
#define TRX_3F(f,n) UINT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) |
#define TRX_US(us, f,n) us = (GLushort) (PTR_ELT(f,n) >> 16) |
#define TRX_UI(f,n) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLuint_elt |
#define DEST_4F trans_4_GLuint_4f_elt |
#define DEST_4UB trans_4_GLuint_4ub_elt |
#define DEST_4US trans_4_GLuint_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLuint_elt |
#define DEST_4F trans_3_GLuint_4f_elt |
#define DEST_4UB trans_3_GLuint_4ub_elt |
#define DEST_4US trans_3_GLuint_4us_elt |
#define DEST_3F trans_3_GLuint_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLuint_elt |
#define DEST_4F trans_2_GLuint_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLuint_elt |
#define DEST_4F trans_1_GLuint_4f_elt |
#define DEST_1UB trans_1_GLuint_1ub_elt |
#define DEST_1UI trans_1_GLuint_1ui_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_DOUBLE |
*/ |
#define SRC GLdouble |
#define SRC_IDX TYPE_IDX(GL_DOUBLE) |
#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) |
#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) |
#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) |
#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) |
#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) |
#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLdouble_elt |
#define DEST_4F trans_4_GLdouble_4f_elt |
#define DEST_4UB trans_4_GLdouble_4ub_elt |
#define DEST_4US trans_4_GLdouble_4us_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLdouble_elt |
#define DEST_4F trans_3_GLdouble_4f_elt |
#define DEST_4UB trans_3_GLdouble_4ub_elt |
#define DEST_4US trans_3_GLdouble_4us_elt |
#define DEST_3F trans_3_GLdouble_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLdouble_elt |
#define DEST_4F trans_2_GLdouble_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLdouble_elt |
#define DEST_4F trans_1_GLdouble_4f_elt |
#define DEST_1UB trans_1_GLdouble_1ub_elt |
#define DEST_1UI trans_1_GLdouble_1ui_elt |
#define DEST_1F trans_1_GLdouble_1f_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
/* GL_FLOAT |
*/ |
#define SRC GLfloat |
#define SRC_IDX TYPE_IDX(GL_FLOAT) |
#define SZ 4 |
#define INIT init_trans_4_GLfloat_elt |
#define DEST_4UB trans_4_GLfloat_4ub_elt |
#define DEST_4US trans_4_GLfloat_4us_elt |
#define DEST_4F trans_4_GLfloat_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLfloat_elt |
#define DEST_4F trans_3_GLfloat_4f_elt |
#define DEST_4UB trans_3_GLfloat_4ub_elt |
#define DEST_4US trans_3_GLfloat_4us_elt |
#define DEST_3F trans_3_GLfloat_3f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLfloat_elt |
#define DEST_4F trans_2_GLfloat_4f_elt |
#include "math/m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLfloat_elt |
#define DEST_4F trans_1_GLfloat_3f_elt |
#define DEST_1UB trans_1_GLfloat_1ub_elt |
#define DEST_1UI trans_1_GLfloat_1ui_elt |
#define DEST_1F trans_1_GLfloat_1f_elt |
#include "math/m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
static void trans_4_GLubyte_4ub(GLubyte (*t)[4], |
CONST void *Ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) start; |
if (((((long) f | (long) stride)) & 3L) == 0L) { |
/* Aligned. |
*/ |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
COPY_4UBV( t[i], f ); |
} |
} |
} else { |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
t[i][0] = f[0]; |
t[i][1] = f[1]; |
t[i][2] = f[2]; |
t[i][3] = f[3]; |
} |
} |
} |
} |
static void init_translate_elt(void) |
{ |
MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); |
MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); |
MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); |
MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); |
MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); |
MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); |
TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub; |
init_trans_4_GLbyte_elt(); |
init_trans_3_GLbyte_elt(); |
init_trans_2_GLbyte_elt(); |
init_trans_1_GLbyte_elt(); |
init_trans_1_GLubyte_elt(); |
init_trans_3_GLubyte_elt(); |
init_trans_4_GLubyte_elt(); |
init_trans_4_GLshort_elt(); |
init_trans_3_GLshort_elt(); |
init_trans_2_GLshort_elt(); |
init_trans_1_GLshort_elt(); |
init_trans_4_GLushort_elt(); |
init_trans_3_GLushort_elt(); |
init_trans_2_GLushort_elt(); |
init_trans_1_GLushort_elt(); |
init_trans_4_GLint_elt(); |
init_trans_3_GLint_elt(); |
init_trans_2_GLint_elt(); |
init_trans_1_GLint_elt(); |
init_trans_4_GLuint_elt(); |
init_trans_3_GLuint_elt(); |
init_trans_2_GLuint_elt(); |
init_trans_1_GLuint_elt(); |
init_trans_4_GLdouble_elt(); |
init_trans_3_GLdouble_elt(); |
init_trans_2_GLdouble_elt(); |
init_trans_1_GLdouble_elt(); |
init_trans_4_GLfloat_elt(); |
init_trans_3_GLfloat_elt(); |
init_trans_2_GLfloat_elt(); |
init_trans_1_GLfloat_elt(); |
} |
#undef TAB |
#undef CLASS |
#undef ARGS |
#undef CHECK |
#undef START |
void _tnl_imm_elt_init( void ) |
{ |
init_translate_elt(); |
} |
#if 00 |
static void _tnl_trans_elt_1f(GLfloat *to, |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_1f_tab[TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#endif |
static void _tnl_trans_elt_1ui(GLuint *to, |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_1ui_tab[TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
static void _tnl_trans_elt_1ub(GLubyte *to, |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_1ub_tab[TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#if 0 |
static void _tnl_trans_elt_4ub(GLubyte (*to)[4], |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_4ub_tab[from->Size][TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#endif |
#if 0 |
static void _tnl_trans_elt_4us(GLushort (*to)[4], |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_4us_tab[from->Size][TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#endif |
static void _tnl_trans_elt_4f(GLfloat (*to)[4], |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_4f_tab[from->Size][TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#if 0 |
static void _tnl_trans_elt_3f(GLfloat (*to)[3], |
const struct gl_client_array *from, |
GLuint *flags, |
GLuint *elts, |
GLuint match, |
GLuint start, |
GLuint n ) |
{ |
_tnl_trans_elt_3f_tab[TYPE_IDX(from->Type)]( to, |
from->Ptr, |
from->StrideB, |
flags, |
elts, |
match, |
start, |
n ); |
} |
#endif |
/* Batch function to translate away all the array elements in the |
* input buffer prior to transform. Done only the first time a vertex |
* buffer is executed or compiled. |
* |
* KW: Have to do this after each glEnd if arrays aren't locked. |
*/ |
void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, |
GLuint start, GLuint count ) |
{ |
GLuint *flags = IM->Flag; |
GLuint *elts = IM->Elt; |
GLuint translate = ctx->Array._Enabled; |
GLuint i; |
if (MESA_VERBOSE & VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count); |
if (translate & VERT_BIT_POS) { |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS], |
&ctx->Array.Vertex, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_POS), |
start, count); |
if (ctx->Array.Vertex.Size == 4) |
translate |= VERT_BITS_OBJ_234; |
else if (ctx->Array.Vertex.Size == 3) |
translate |= VERT_BITS_OBJ_23; |
} |
if (translate & VERT_BIT_NORMAL) |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL], |
&ctx->Array.Normal, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL), |
start, count); |
if (translate & VERT_BIT_EDGEFLAG) |
_tnl_trans_elt_1ub( IM->EdgeFlag, |
&ctx->Array.EdgeFlag, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG), |
start, count); |
if (translate & VERT_BIT_COLOR0) { |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0], |
&ctx->Array.Color, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0), |
start, count); |
} |
if (translate & VERT_BIT_COLOR1) { |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1], |
&ctx->Array.SecondaryColor, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1), |
start, count); |
} |
if (translate & VERT_BIT_FOG) |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG], |
&ctx->Array.FogCoord, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG), |
start, count); |
if (translate & VERT_BIT_INDEX) |
_tnl_trans_elt_1ui( IM->Index, |
&ctx->Array.Index, |
flags, elts, (VERT_BIT_ELT|VERT_BIT_INDEX), |
start, count); |
if (translate & VERT_BITS_TEX_ANY) { |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (translate & VERT_BIT_TEX(i)) { |
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], |
&ctx->Array.TexCoord[i], |
flags, elts, (VERT_BIT_ELT|VERT_BIT_TEX(i)), |
start, count); |
if (ctx->Array.TexCoord[i].Size == 4) |
IM->TexSize |= TEX_SIZE_4(i); |
else if (ctx->Array.TexCoord[i].Size == 3) |
IM->TexSize |= TEX_SIZE_3(i); |
} |
} |
for (i = start ; i < count ; i++) |
if (flags[i] & VERT_BIT_ELT) flags[i] |= translate; |
IM->FlushElt = 0; |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_exec.c |
---|
0,0 → 1,598 |
/* $Id: t_imm_exec.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file tnl/t_imm_exec.c |
* \brief Setup to execute immediate-mode vertex data. |
* \author Keith Whitwell |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "dlist.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "light.h" |
#include "state.h" |
#include "mtypes.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_array_import.h" |
#include "t_imm_alloc.h" |
#include "t_imm_api.h" |
#include "t_imm_debug.h" |
#include "t_imm_dlist.h" |
#include "t_imm_eval.h" |
#include "t_imm_elt.h" |
#include "t_imm_exec.h" |
#include "t_imm_fixup.h" |
#include "t_pipeline.h" |
static void reset_input( GLcontext *ctx, |
GLuint start, |
GLuint beginstate, |
GLuint savedbeginstate ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
/* Clear the dirty part of the flag array. |
*/ |
if (start < IM->Count+2) |
MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start)); |
if (MESA_VERBOSE & VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, "reset_input: IM(%d) new %x\n", IM->id, beginstate); |
IM->Start = start; |
IM->Count = start; |
IM->LastMaterial = start; |
IM->BeginState = beginstate; |
IM->SavedBeginState = savedbeginstate; |
IM->TexSize = 0; |
IM->MaterialOrMask = 0; |
if (IM->MaterialMask) |
IM->MaterialMask[IM->Start] = 0; |
IM->ArrayEltFlags = ~ctx->Array._Enabled; |
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0; |
IM->ArrayEltFlush = ctx->Array.LockCount ? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER; |
} |
void _tnl_reset_exec_input( GLcontext *ctx, |
GLuint start, |
GLuint beginstate, |
GLuint savedbeginstate ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
reset_input( ctx, start, beginstate, savedbeginstate ); |
IM->CopyStart = start - tnl->ExecCopyCount; |
IM->Primitive[IM->CopyStart] = ctx->Driver.CurrentExecPrimitive; |
if (tnl->ExecParity) |
IM->Primitive[IM->CopyStart] |= PRIM_PARITY; |
IM->LastPrimitive = IM->CopyStart; |
} |
void _tnl_reset_compile_input( GLcontext *ctx, |
GLuint start, |
GLuint beginstate, |
GLuint savedbeginstate ) |
{ |
struct immediate *IM = TNL_CURRENT_IM(ctx); |
reset_input( ctx, start, beginstate, savedbeginstate ); |
IM->CopyStart = start; |
IM->LastPrimitive = IM->Start; |
} |
/** |
* Copy the last specified normal, color, texcoord, edge flag, etc |
* from the immediate struct into the ctx->Current attribute group. |
*/ |
void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM, |
GLuint flag, GLuint count ) |
{ |
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) |
_tnl_print_vert_flags("copy to current", flag); |
/* XXX should be able to replace these conditions with a loop over |
* the 16 vertex attributes. |
*/ |
if (flag & VERT_BIT_NORMAL) |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], |
IM->Attrib[VERT_ATTRIB_NORMAL][count]); |
if (flag & VERT_BIT_INDEX) |
ctx->Current.Index = IM->Index[count]; |
if (flag & VERT_BIT_EDGEFLAG) |
ctx->Current.EdgeFlag = IM->EdgeFlag[count]; |
if (flag & VERT_BIT_COLOR0) { |
COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], |
IM->Attrib[VERT_ATTRIB_COLOR0][count]); |
if (ctx->Light.ColorMaterialEnabled) { |
_mesa_update_color_material( ctx, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
} |
} |
if (flag & VERT_BIT_COLOR1) |
COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR1], |
IM->Attrib[VERT_ATTRIB_COLOR1][count]); |
if (flag & VERT_BIT_FOG) |
ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = IM->Attrib[VERT_ATTRIB_FOG][count][0]; |
if (flag & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (flag & VERT_BIT_TEX(i)) { |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], |
IM->Attrib[VERT_ATTRIB_TEX0 + i][count]); |
} |
} |
} |
if (flag & VERT_BIT_MATERIAL) { |
_mesa_update_material( ctx, |
IM->Material[IM->LastMaterial], |
IM->MaterialOrMask ); |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
} |
} |
void _tnl_compute_orflag( struct immediate *IM, GLuint start ) |
{ |
GLuint count = IM->Count; |
GLuint orflag = 0; |
GLuint andflag = ~0U; |
GLuint i; |
IM->LastData = count-1; |
/* Compute the flags for the whole buffer. |
*/ |
for (i = start ; i < count ; i++) { |
andflag &= IM->Flag[i]; |
orflag |= IM->Flag[i]; |
} |
/* It is possible there will be data in the buffer arising from |
* calls like 'glNormal', 'glMaterial' that occur after the final |
* glVertex, glEval, etc. Additionally, a buffer can consist of |
* eg. a single glMaterial call, in which case IM->Start == |
* IM->Count, but the buffer is definitely not empty. |
*/ |
if (IM->Flag[i] & VERT_BITS_DATA) { |
IM->LastData++; |
orflag |= IM->Flag[i]; |
} |
IM->Flag[IM->LastData+1] |= VERT_BIT_END_VB; |
IM->CopyAndFlag = IM->AndFlag = andflag; |
IM->OrFlag = orflag; |
IM->CopyOrFlag = orflag; |
IM->Evaluated = 0; |
} |
/** |
* This is where the vertex data is transfered from the 'struct immediate |
* into the 'struct vertex_buffer'. |
* |
* Note: The 'start' member of the GLvector structs is now redundant |
* because we always re-transform copied vertices, and the vectors |
* below are set up so that the first copied vertex (if any) appears |
* at position zero. |
*/ |
static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
struct vertex_arrays *tmp = &tnl->imm_inputs; |
GLuint inputs = tnl->pipeline.inputs; /* for copy-to-current */ |
const GLuint start = IM->CopyStart; |
const GLuint count = IM->Count - start; |
/* TODO: optimize the case where nothing has changed. (Just bind |
* tmp to vb). |
*/ |
/* Setup constant data in the VB. |
*/ |
VB->Count = count; |
VB->FirstClipped = IMM_MAXDATA - IM->CopyStart; |
VB->import_data = NULL; |
VB->importable_data = 0; |
/* Need an IM->FirstPrimitive? |
*/ |
VB->Primitive = IM->Primitive + IM->CopyStart; |
VB->PrimitiveLength = IM->PrimitiveLength + IM->CopyStart; |
VB->FirstPrimitive = 0; |
VB->Flag = IM->Flag + start; |
/* TexCoordPtr's are zeroed in loop below. |
*/ |
VB->NormalPtr = NULL; |
VB->NormalLengthPtr = NULL; |
VB->EdgeFlag = NULL; |
VB->IndexPtr[0] = NULL; |
VB->IndexPtr[1] = NULL; |
VB->ColorPtr[0] = NULL; |
VB->ColorPtr[1] = NULL; |
VB->SecondaryColorPtr[0] = NULL; |
VB->SecondaryColorPtr[1] = NULL; |
VB->Elts = NULL; |
VB->MaterialMask = NULL; |
VB->Material = NULL; |
/* _tnl_print_vert_flags("copy-orflag", IM->CopyOrFlag); */ |
/* _tnl_print_vert_flags("orflag", IM->OrFlag); */ |
/* _tnl_print_vert_flags("inputs", inputs); */ |
/* Setup the initial values of array pointers in the vb. |
*/ |
if (inputs & VERT_BIT_POS) { |
tmp->Obj.data = IM->Attrib[VERT_ATTRIB_POS] + start; |
tmp->Obj.start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_POS] + start); |
tmp->Obj.count = count; |
VB->ObjPtr = &tmp->Obj; |
if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_234) |
tmp->Obj.size = 4; |
else if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_23) |
tmp->Obj.size = 3; |
else |
tmp->Obj.size = 2; |
} |
if (inputs & VERT_BIT_NORMAL) { |
tmp->Normal.data = IM->Attrib[VERT_ATTRIB_NORMAL] + start; |
tmp->Normal.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_NORMAL] + start); |
tmp->Normal.count = count; |
tmp->Normal.size = 3; /* just to be safe */ |
VB->NormalPtr = &tmp->Normal; |
if (IM->NormalLengthPtr) |
VB->NormalLengthPtr = IM->NormalLengthPtr + start; |
} |
if (inputs & VERT_BIT_INDEX) { |
tmp->Index.count = count; |
tmp->Index.data = IM->Index + start; |
tmp->Index.start = IM->Index + start; |
VB->IndexPtr[0] = &tmp->Index; |
} |
if (inputs & VERT_BIT_FOG) { |
tmp->FogCoord.data = IM->Attrib[VERT_ATTRIB_FOG] + start; |
tmp->FogCoord.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_FOG] + start); |
tmp->FogCoord.count = count; |
VB->FogCoordPtr = &tmp->FogCoord; |
} |
if (inputs & VERT_BIT_COLOR1) { |
tmp->SecondaryColor.Ptr = IM->Attrib[VERT_ATTRIB_COLOR1] + start; |
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; |
} |
if (inputs & VERT_BIT_EDGEFLAG) { |
VB->EdgeFlag = IM->EdgeFlag + start; |
} |
if (inputs & VERT_BIT_COLOR0) { |
if (IM->CopyOrFlag & VERT_BIT_COLOR0) { |
tmp->Color.Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start; |
tmp->Color.StrideB = 4 * sizeof(GLfloat); |
tmp->Color.Flags = 0; |
} |
else { |
tmp->Color.Ptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
tmp->Color.StrideB = 0; |
tmp->Color.Flags = CA_CLIENT_DATA; /* hack */ |
VB->import_source = IM; |
VB->importable_data |= VERT_BIT_COLOR0; |
VB->import_data = _tnl_upgrade_current_data; |
} |
VB->ColorPtr[0] = &tmp->Color; |
} |
if (inputs & VERT_BITS_TEX_ANY) { |
GLuint i; |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { |
VB->TexCoordPtr[i] = NULL; |
if (inputs & VERT_BIT_TEX(i)) { |
tmp->TexCoord[i].count = count; |
tmp->TexCoord[i].data = IM->Attrib[VERT_ATTRIB_TEX0 + i] + start; |
tmp->TexCoord[i].start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_TEX0 + i] + start); |
tmp->TexCoord[i].size = 2; |
if (IM->TexSize & TEX_SIZE_3(i)) { |
tmp->TexCoord[i].size = 3; |
if (IM->TexSize & TEX_SIZE_4(i)) |
tmp->TexCoord[i].size = 4; |
} |
VB->TexCoordPtr[i] = &tmp->TexCoord[i]; |
} |
} |
} |
if ((inputs & IM->OrFlag & VERT_BIT_MATERIAL) && IM->Material) { |
VB->MaterialMask = IM->MaterialMask + start; |
VB->Material = IM->Material + start; |
} |
/* GL_NV_vertex_program */ |
if (ctx->VertexProgram.Enabled) { |
GLuint attr; |
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { |
tmp->Attribs[attr].count = count; |
tmp->Attribs[attr].data = IM->Attrib[attr] + start; |
tmp->Attribs[attr].start = (GLfloat *) (IM->Attrib[attr] + start); |
tmp->Attribs[attr].size = 4; |
VB->AttribPtr[attr] = &(tmp->Attribs[attr]); |
} |
} |
} |
/** |
* Called by exec_vert_cassette, execute_compiled_cassette, but not |
* exec_elt_cassette. |
*/ |
void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
_tnl_vb_bind_immediate( ctx, IM ); |
if (IM->OrFlag & VERT_BITS_EVAL_ANY) |
_tnl_eval_immediate( ctx, IM ); |
/* Invalidate all stored data before and after run: |
*/ |
tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; |
tnl->Driver.RunPipeline( ctx ); |
tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; |
_tnl_copy_to_current( ctx, IM, IM->OrFlag, IM->LastData ); |
} |
/** |
* Called for regular vertex cassettes. |
*/ |
static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
if (IM->FlushElt) { |
/* Orflag is computed twice, but only reach this code if app is |
* using a mixture of glArrayElement() and glVertex() while |
* arrays are locked (else would be in exec_elt_cassette now). |
*/ |
ASSERT(ctx->Array.LockCount); |
ASSERT(IM->FlushElt == FLUSH_ELT_LAZY); |
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->Count ); |
_tnl_compute_orflag( IM, IM->CopyStart ); |
} |
_tnl_fixup_input( ctx, IM ); |
/* _tnl_print_cassette( IM ); */ |
_tnl_run_cassette( ctx, IM ); |
} |
/* Called for pure, locked VERT_BIT_ELT cassettes instead of |
* _tnl_run_cassette. |
*/ |
static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
_tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); |
/* Take only elements and primitive information from the immediate: |
*/ |
VB->Elts = IM->Elt + IM->CopyStart; |
VB->Primitive = IM->Primitive + IM->CopyStart; |
VB->PrimitiveLength = IM->PrimitiveLength + IM->CopyStart; |
VB->FirstPrimitive = 0; |
/* Run the pipeline. No input changes as a result of this action. |
*/ |
tnl->Driver.RunPipeline( ctx ); |
/* Still need to update current values: |
*/ |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { |
_tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData ); |
_tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->LastData ); |
} |
} |
static void |
exec_empty_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
if (IM->FlushElt) |
_tnl_translate_array_elts( ctx, IM, IM->CopyStart, IM->CopyStart ); |
_tnl_copy_to_current( ctx, IM, IM->OrFlag, IM->LastData ); |
} |
/** |
* Called for all cassettes when not compiling or playing a display |
* list. |
*/ |
void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
_tnl_compute_orflag( IM, IM->Start ); |
_tnl_copy_immediate_vertices( ctx, IM ); |
_tnl_get_exec_copy_verts( ctx, IM ); |
if (tnl->pipeline.build_state_changes) |
_tnl_validate_pipeline( ctx ); |
if (IM->CopyStart == IM->Count) { |
exec_empty_cassette( ctx, IM ); |
} |
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT && |
ctx->Array.LockCount && |
ctx->Array.Vertex.Enabled) { |
exec_elt_cassette( ctx, IM ); |
} |
else { |
exec_vert_cassette( ctx, IM ); |
} |
/* Only reuse the immediate if there are no copied vertices living |
* inside it: |
*/ |
{ |
GLuint begin_state = IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1); |
GLuint saved_begin_state = IM->SavedBeginState; |
if (--IM->ref_count != 0) { |
IM = _tnl_alloc_immediate( ctx ); |
SET_IMMEDIATE( ctx, IM ); |
} |
IM->ref_count++; |
_tnl_reset_exec_input( ctx, IMM_MAX_COPIED_VERTS, |
begin_state, saved_begin_state ); |
} |
if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) |
ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; |
} |
/** |
* Setup vector pointers that will be used to bind immediates to VB's. |
*/ |
void _tnl_imm_init( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_arrays *tmp = &tnl->imm_inputs; |
GLuint i; |
static int firsttime = 1; |
if (firsttime) { |
firsttime = 0; |
_tnl_imm_elt_init(); |
} |
ctx->swtnl_im = _tnl_alloc_immediate( ctx ); |
TNL_CURRENT_IM(ctx)->ref_count++; |
tnl->ExecCopyTexSize = 0; |
tnl->ExecCopyCount = 0; |
tnl->ExecCopySource = 0; |
TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS; |
_mesa_vector4f_init( &tmp->Obj, 0, 0 ); |
_mesa_vector4f_init( &tmp->Normal, 0, 0 ); |
tmp->Color.Ptr = NULL; |
tmp->Color.Type = GL_FLOAT; |
tmp->Color.Size = 4; |
tmp->Color.Stride = 0; |
tmp->Color.StrideB = 4 * sizeof(GLfloat); |
tmp->Color.Flags = 0; |
tmp->SecondaryColor.Ptr = NULL; |
tmp->SecondaryColor.Type = GL_FLOAT; |
tmp->SecondaryColor.Size = 4; |
tmp->SecondaryColor.Stride = 0; |
tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat); |
tmp->SecondaryColor.Flags = 0; |
_mesa_vector4f_init( &tmp->FogCoord, 0, 0 ); |
_mesa_vector1ui_init( &tmp->Index, 0, 0 ); |
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) |
_mesa_vector4f_init( &tmp->TexCoord[i], 0, 0); |
/* Install the first immediate. Intially outside begin/end. |
*/ |
_tnl_reset_exec_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); |
tnl->ReplayHardBeginEnd = 0; |
_tnl_imm_vtxfmt_init( ctx ); |
} |
/** |
* Deallocate the immediate-mode buffer for the given context, if |
* its reference count goes to zero. |
*/ |
void _tnl_imm_destroy( GLcontext *ctx ) |
{ |
if (TNL_CURRENT_IM(ctx)) { |
TNL_CURRENT_IM(ctx)->ref_count--; |
if (TNL_CURRENT_IM(ctx)->ref_count == 0) |
_tnl_free_immediate( ctx, TNL_CURRENT_IM(ctx) ); |
/* |
* Don't use SET_IMMEDIATE here, or else we'll whack the |
* _tnl_CurrentInput pointer - not good when another |
* context has already been made current. |
* So we just set the context's own tnl immediate pointer |
* to 0. |
*/ |
ctx->swtnl_im = NULL; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_debug.c |
---|
0,0 → 1,183 |
/* $Id: t_imm_debug.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "mtypes.h" |
#include "context.h" |
#include "imports.h" |
#include "t_context.h" |
#include "t_imm_debug.h" |
void _tnl_print_vert_flags( const char *name, GLuint flags ) |
{ |
_mesa_debug(NULL, |
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", |
name, |
flags, |
(flags & VERT_BIT_CLIP) ? "clip/proj-clip/glend, " : "", |
(flags & VERT_BIT_EDGEFLAG) ? "edgeflag, " : "", |
(flags & VERT_BIT_ELT) ? "array-elt, " : "", |
(flags & VERT_BIT_END_VB) ? "end-vb, " : "", |
(flags & VERT_BITS_EVAL_ANY) ? "eval-coord, " : "", |
(flags & VERT_BIT_EYE) ? "eye/glbegin, " : "", |
(flags & VERT_BIT_FOG) ? "fog-coord, " : "", |
(flags & VERT_BIT_INDEX) ? "index, " : "", |
(flags & VERT_BIT_MATERIAL) ? "material, " : "", |
(flags & VERT_BIT_NORMAL) ? "normals, " : "", |
(flags & VERT_BIT_POS) ? "obj, " : "", |
(flags & VERT_BIT_OBJ_3) ? "obj-3, " : "", |
(flags & VERT_BIT_OBJ_4) ? "obj-4, " : "", |
(flags & VERT_BIT_POINT_SIZE) ? "point-size, " : "", |
(flags & VERT_BIT_COLOR0) ? "colors, " : "", |
(flags & VERT_BIT_COLOR1) ? "specular, " : "", |
(flags & VERT_BIT_TEX0) ? "texcoord0, " : "", |
(flags & VERT_BIT_TEX1) ? "texcoord1, " : "", |
(flags & VERT_BIT_TEX2) ? "texcoord2, " : "", |
(flags & VERT_BIT_TEX3) ? "texcoord3, " : "", |
(flags & VERT_BIT_TEX4) ? "texcoord4, " : "", |
(flags & VERT_BIT_TEX5) ? "texcoord5, " : "", |
(flags & VERT_BIT_TEX6) ? "texcoord6, " : "", |
(flags & VERT_BIT_TEX7) ? "texcoord7, " : "" |
); |
} |
void _tnl_print_cassette( struct immediate *IM ) |
{ |
GLuint i; |
GLuint *flags = IM->Flag; |
GLuint andflag = IM->CopyAndFlag; |
GLuint orflag = (IM->CopyOrFlag|IM->Evaluated); |
GLuint state = IM->BeginState; |
GLuint req = ~0; |
_mesa_debug(NULL, "Cassette id %d, %u rows.\n", IM->id, |
IM->Count - IM->CopyStart); |
_tnl_print_vert_flags("Contains at least one", orflag); |
if (IM->Count != IM->CopyStart) |
{ |
_tnl_print_vert_flags("Contains a full complement of", andflag); |
_mesa_debug(NULL, "Final begin/end state %s/%s, errors %s/%s\n", |
(state & VERT_BEGIN_0) ? "in" : "out", |
(state & VERT_BEGIN_1) ? "in" : "out", |
(state & VERT_ERROR_0) ? "y" : "n", |
(state & VERT_ERROR_1) ? "y" : "n"); |
} |
for (i = IM->CopyStart ; i <= IM->Count ; i++) { |
_mesa_debug(NULL, "%u: ", i); |
if (req & VERT_BITS_OBJ_234) { |
if (flags[i] & VERT_BIT_EVAL_C1) |
_mesa_debug(NULL, "EvalCoord %f ", |
IM->Attrib[VERT_ATTRIB_POS][i][0]); |
else if (flags[i] & VERT_BIT_EVAL_P1) |
_mesa_debug(NULL, "EvalPoint %.0f ", |
IM->Attrib[VERT_ATTRIB_POS][i][0]); |
else if (flags[i] & VERT_BIT_EVAL_C2) |
_mesa_debug(NULL, "EvalCoord %f %f ", |
IM->Attrib[VERT_ATTRIB_POS][i][0], |
IM->Attrib[VERT_ATTRIB_POS][i][1]); |
else if (flags[i] & VERT_BIT_EVAL_P2) |
_mesa_debug(NULL, "EvalPoint %.0f %.0f ", |
IM->Attrib[VERT_ATTRIB_POS][i][0], |
IM->Attrib[VERT_ATTRIB_POS][i][1]); |
else if (i < IM->Count && (flags[i] & VERT_BITS_OBJ_234)) { |
_mesa_debug(NULL, "Obj %f %f %f %f", |
IM->Attrib[VERT_ATTRIB_POS][i][0], |
IM->Attrib[VERT_ATTRIB_POS][i][1], |
IM->Attrib[VERT_ATTRIB_POS][i][2], |
IM->Attrib[VERT_ATTRIB_POS][i][3]); |
} |
} |
if (req & flags[i] & VERT_BIT_ELT) |
_mesa_debug(NULL, " Elt %u\t", IM->Elt[i]); |
if (req & flags[i] & VERT_BIT_NORMAL) |
_mesa_debug(NULL, " Norm %f %f %f ", |
IM->Attrib[VERT_ATTRIB_NORMAL][i][0], |
IM->Attrib[VERT_ATTRIB_NORMAL][i][1], |
IM->Attrib[VERT_ATTRIB_NORMAL][i][2]); |
if (req & flags[i] & VERT_BITS_TEX_ANY) { |
GLuint j; |
for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { |
if (req & flags[i] & VERT_BIT_TEX(j)) { |
_mesa_debug(NULL, "TC%d %f %f %f %f", j, |
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0], |
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1], |
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][2], |
IM->Attrib[VERT_ATTRIB_TEX0 + j][i][3]); |
} |
} |
} |
if (req & flags[i] & VERT_BIT_COLOR0) |
_mesa_debug(NULL, " Rgba %f %f %f %f ", |
IM->Attrib[VERT_ATTRIB_COLOR0][i][0], |
IM->Attrib[VERT_ATTRIB_COLOR0][i][1], |
IM->Attrib[VERT_ATTRIB_COLOR0][i][2], |
IM->Attrib[VERT_ATTRIB_COLOR0][i][3]); |
if (req & flags[i] & VERT_BIT_COLOR1) |
_mesa_debug(NULL, " Spec %f %f %f ", |
IM->Attrib[VERT_ATTRIB_COLOR1][i][0], |
IM->Attrib[VERT_ATTRIB_COLOR1][i][1], |
IM->Attrib[VERT_ATTRIB_COLOR1][i][2]); |
if (req & flags[i] & VERT_BIT_FOG) |
_mesa_debug(NULL, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]); |
if (req & flags[i] & VERT_BIT_INDEX) |
_mesa_debug(NULL, " Index %u ", IM->Index[i]); |
if (req & flags[i] & VERT_BIT_EDGEFLAG) |
_mesa_debug(NULL, " Edgeflag %d ", IM->EdgeFlag[i]); |
if (req & flags[i] & VERT_BIT_MATERIAL) |
_mesa_debug(NULL, " Material "); |
/* The order of these two is not easily knowable, but this is |
* the usually correct way to look at them. |
*/ |
if (req & flags[i] & VERT_BIT_END) |
_mesa_debug(NULL, " END "); |
if (req & flags[i] & VERT_BIT_BEGIN) |
_mesa_debug(NULL, " BEGIN(%s) (%s%s%s%s)", |
_mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], |
(IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", |
(IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", |
(IM->Primitive[i] & PRIM_END) ? "END," : "", |
(IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); |
_mesa_debug(NULL, "\n"); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_context.h |
---|
0,0 → 1,582 |
/* $Id: t_context.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file t_context.h |
* \brief TnL module datatypes and definitions. |
* \author Keith Whitwell |
*/ |
#ifndef _T_CONTEXT_H |
#define _T_CONTEXT_H |
#include "glheader.h" |
#include "mtypes.h" |
#include "math/m_matrix.h" |
#include "math/m_vector.h" |
#include "math/m_xform.h" |
#define MAX_PIPELINE_STAGES 30 |
/* Numbers for sizing immediate structs. |
*/ |
#define IMM_MAX_COPIED_VERTS 3 |
#define IMM_MAXDATA (216 + IMM_MAX_COPIED_VERTS) |
#define IMM_SIZE (IMM_MAXDATA + MAX_CLIPPED_VERTICES) |
/* Values for IM->BeginState |
*/ |
#define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */ |
#define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */ |
#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */ |
#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */ |
/* Flags to be added to the primitive enum in VB->Primitive. |
*/ |
#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */ |
#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */ |
#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */ |
#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */ |
#define PRIM_LAST 0x800 /* No more prims in the VB */ |
/** |
* Flags that describe the inputs and outputs of pipeline stages, and |
* the contents of a vertex-cassette. We reuse the VERT_BIT_* flags |
* defined in mtypes.h and add a bunch of new ones. |
*/ |
/* bits 0..5 defined in mtypes.h */ |
#define VERT_BIT_INDEX VERT_BIT_SIX /* a free vertex attrib bit */ |
#define VERT_BIT_EDGEFLAG VERT_BIT_SEVEN /* a free vertex attrib bit */ |
/* bits 8..15 defined in mtypes.h */ |
#define VERT_BIT_EVAL_C1 (1 << 16) /* imm only */ |
#define VERT_BIT_EVAL_C2 (1 << 17) /* imm only */ |
#define VERT_BIT_EVAL_P1 (1 << 18) /* imm only */ |
#define VERT_BIT_EVAL_P2 (1 << 19) /* imm only */ |
#define VERT_BIT_OBJ_3 (1 << 20) /* imm only */ |
#define VERT_BIT_OBJ_4 (1 << 21) /* imm only */ |
#define VERT_BIT_MATERIAL (1 << 22) /* imm only, but tested in vb code */ |
#define VERT_BIT_ELT (1 << 23) /* imm only */ |
#define VERT_BIT_BEGIN (1 << 24) /* imm only, but tested in vb code */ |
#define VERT_BIT_END (1 << 25) /* imm only, but tested in vb code */ |
#define VERT_BIT_END_VB (1 << 26) /* imm only, but tested in vb code */ |
#define VERT_BIT_POINT_SIZE (1 << 27) /* vb only, could reuse a bit */ |
#define VERT_BIT_EYE VERT_BIT_BEGIN /* vb only, reuse imm bit */ |
#define VERT_BIT_CLIP VERT_BIT_END /* vb only, reuse imm bit*/ |
/* Flags for IM->TexCoordSize. Enough flags for 16 units. |
*/ |
#define TEX_0_SIZE_3 (unsigned)0x1 |
#define TEX_0_SIZE_4 (unsigned)0x10001 |
#define TEX_SIZE_3(unit) (TEX_0_SIZE_3 << (unit)) |
#define TEX_SIZE_4(unit) (TEX_0_SIZE_4 << (unit)) |
/* Shorthands. |
*/ |
#define VERT_BITS_OBJ_23 (VERT_BIT_POS | VERT_BIT_OBJ_3) |
#define VERT_BITS_OBJ_234 (VERT_BIT_POS | VERT_BIT_OBJ_3 | VERT_BIT_OBJ_4) |
#define VERT_BITS_TEX_ANY (VERT_BIT_TEX0 | \ |
VERT_BIT_TEX1 | \ |
VERT_BIT_TEX2 | \ |
VERT_BIT_TEX3 | \ |
VERT_BIT_TEX4 | \ |
VERT_BIT_TEX5 | \ |
VERT_BIT_TEX6 | \ |
VERT_BIT_TEX7) |
#define VERT_BITS_EVAL_ANY (VERT_BIT_EVAL_C1 | VERT_BIT_EVAL_P1 | \ |
VERT_BIT_EVAL_C2 | VERT_BIT_EVAL_P2) |
#define VERT_BITS_FIXUP (VERT_BITS_TEX_ANY | \ |
VERT_BIT_COLOR0 | \ |
VERT_BIT_COLOR1 | \ |
VERT_BIT_FOG | \ |
VERT_BIT_INDEX | \ |
VERT_BIT_EDGEFLAG | \ |
VERT_BIT_NORMAL) |
#define VERT_BITS_CURRENT_DATA (VERT_BITS_FIXUP | \ |
VERT_BIT_MATERIAL) |
#define VERT_BITS_DATA (VERT_BITS_TEX_ANY | \ |
VERT_BIT_COLOR0 | \ |
VERT_BIT_COLOR1 | \ |
VERT_BIT_FOG | \ |
VERT_BIT_INDEX | \ |
VERT_BIT_EDGEFLAG | \ |
VERT_BIT_NORMAL | \ |
VERT_BIT_POS | \ |
VERT_BIT_MATERIAL | \ |
VERT_BIT_ELT | \ |
VERT_BITS_EVAL_ANY) |
/** |
* KW: Represents everything that can take place between a begin and |
* end, and can represent multiple begin/end pairs. Can be used to |
* losslessly encode this information in display lists. |
*/ |
struct immediate |
{ |
GLuint id, ref_count; |
/* This must be saved when immediates are shared in display lists. |
*/ |
GLuint CopyStart, Start, Count; |
GLuint LastData; /* count or count+1 */ |
GLuint AndFlag, OrFlag; |
GLuint TexSize; /* keep track of texcoord sizes */ |
GLuint BeginState, SavedBeginState; |
GLuint LastPrimitive; |
GLuint ArrayEltFlags; /* precalc'ed for glArrayElt */ |
GLuint ArrayEltIncr; |
GLuint ArrayEltFlush; |
#define FLUSH_ELT_EAGER 0x1 |
#define FLUSH_ELT_LAZY 0x2 |
GLuint FlushElt; |
GLuint MaxTextureUnits; /* precalc'ed for glMultiTexCoordARB */ |
/* Temporary values created when vertices are copied into the |
* first 3 slots of the struct: |
*/ |
GLuint CopyOrFlag; |
GLuint CopyAndFlag; |
GLuint CopyTexSize; |
GLuint Evaluated; |
/* allocate storage for these on demand: |
*/ |
struct gl_material (*Material)[2]; |
GLuint *MaterialMask; |
GLuint LastMaterial; |
GLuint MaterialOrMask; |
GLuint MaterialAndMask; |
GLuint Primitive[IMM_SIZE]; /* BEGIN/END */ |
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */ |
GLuint Flag[IMM_SIZE]; /* VERT_BIT_* flags */ |
/* All vertex attributes (position, normal, color, secondary color, |
* texcoords, fog coord) are stored in the Attrib[] arrays instead |
* of individual arrays as we did prior to Mesa 4.1. |
* |
* XXX may need to use 32-byte aligned allocation for this!!! |
*/ |
GLfloat Attrib[VERT_ATTRIB_MAX][IMM_SIZE][4]; /* GL_NV_vertex_program */ |
GLfloat *NormalLengthPtr; /* length of normal vectors (display list only) */ |
GLuint Elt[IMM_SIZE]; |
GLubyte EdgeFlag[IMM_SIZE]; |
GLuint Index[IMM_SIZE]; |
}; |
struct vertex_arrays |
{ |
/* XXX move a bunch of these fields into the Attribs[] array??? */ |
GLvector4f Obj; |
GLvector4f Normal; |
struct gl_client_array Color; |
struct gl_client_array SecondaryColor; |
GLvector1ui Index; |
GLvector1ub EdgeFlag; |
GLvector4f TexCoord[MAX_TEXTURE_UNITS]; |
GLvector1ui Elt; |
GLvector4f FogCoord; |
GLvector4f Attribs[VERT_ATTRIB_MAX]; |
}; |
/** |
* Contains the current state of a running pipeline. |
*/ |
typedef struct vertex_buffer |
{ |
/* Constant over life of the vertex_buffer. |
*/ |
GLuint Size; |
/* Constant over the pipeline. |
*/ |
GLuint Count; /* for everything except Elts */ |
GLuint FirstClipped; /* temp verts for clipping */ |
GLuint FirstPrimitive; /* usually zero */ |
/* Pointers to current data. |
*/ |
GLuint *Elts; /* VERT_BIT_ELT */ |
GLvector4f *ObjPtr; /* VERT_BIT_POS */ |
GLvector4f *EyePtr; /* VERT_BIT_EYE */ |
GLvector4f *ClipPtr; /* VERT_BIT_CLIP */ |
GLvector4f *NdcPtr; /* VERT_BIT_CLIP (2) */ |
GLubyte ClipOrMask; /* VERT_BIT_CLIP (3) */ |
GLubyte *ClipMask; /* VERT_BIT_CLIP (4) */ |
GLvector4f *NormalPtr; /* VERT_BIT_NORMAL */ |
GLfloat *NormalLengthPtr; /* VERT_BIT_NORMAL */ |
GLboolean *EdgeFlag; /* VERT_BIT_EDGEFLAG */ |
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */ |
GLvector1ui *IndexPtr[2]; /* VERT_BIT_INDEX */ |
struct gl_client_array *ColorPtr[2]; /* VERT_BIT_COLOR0 */ |
struct gl_client_array *SecondaryColorPtr[2];/* VERT_BIT_COLOR1 */ |
GLvector4f *PointSizePtr; /* VERT_BIT_POINT_SIZE */ |
GLvector4f *FogCoordPtr; /* VERT_BIT_FOG */ |
struct gl_material (*Material)[2]; /* VERT_BIT_MATERIAL, optional */ |
GLuint *MaterialMask; /* VERT_BIT_MATERIAL, optional */ |
GLuint *Flag; /* VERT_BIT_* flags, optional */ |
GLuint *Primitive; /* GL_(mode)|PRIM_* flags */ |
GLuint *PrimitiveLength; /* integers */ |
/* Inputs to the vertex program stage */ |
GLvector4f *AttribPtr[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ |
GLuint importable_data; |
void *import_source; |
void (*import_data)( GLcontext *ctx, GLuint flags, GLuint vecflags ); |
/* Callback to the provider of the untransformed input for the |
* render stage (or other stages) to call if they need to write into |
* write-protected arrays, or fixup the stride on input arrays. |
* |
* This is currently only necessary for client arrays that make it |
* as far down the pipeline as the render stage. |
*/ |
GLuint LastClipped; |
/* Private data from _tnl_render_stage that has no business being |
* in this struct. |
*/ |
} TNLvertexbuffer; |
/* Describes an individual operation on the pipeline. |
*/ |
struct gl_pipeline_stage { |
const char *name; |
GLuint check_state; /* All state referenced in check() -- |
* When is the pipeline_stage struct |
* itself invalidated? Must be |
* constant. |
*/ |
/* Usually constant or set by the 'check' callback: |
*/ |
GLuint run_state; /* All state referenced in run() -- |
* When is the cached output of the |
* stage invalidated? |
*/ |
GLboolean active; /* True if runnable in current state */ |
GLuint inputs; /* VERT_* inputs to the stage */ |
GLuint outputs; /* VERT_* outputs of the stage */ |
/* Set in _tnl_run_pipeline(): |
*/ |
GLuint changed_inputs; /* Generated value -- inputs to the |
* stage that have changed since last |
* call to 'run'. |
*/ |
/* Private data for the pipeline stage: |
*/ |
void *privatePtr; |
/* Free private data. May not be null. |
*/ |
void (*destroy)( struct gl_pipeline_stage * ); |
/* Called from _tnl_validate_pipeline(). Must update all fields in |
* the pipeline_stage struct for the current state. |
*/ |
void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); |
/* Called from _tnl_run_pipeline(). The stage.changed_inputs value |
* encodes all inputs to thee struct which have changed. If |
* non-zero, recompute all affected outputs of the stage, otherwise |
* execute any 'sideeffects' of the stage. |
* |
* Return value: GL_TRUE - keep going |
* GL_FALSE - finished pipeline |
*/ |
GLboolean (*run)( GLcontext *ctx, struct gl_pipeline_stage * ); |
}; |
struct gl_pipeline { |
GLuint build_state_trigger; /* state changes which require build */ |
GLuint build_state_changes; /* state changes since last build */ |
GLuint run_state_changes; /* state changes since last run */ |
GLuint run_input_changes; /* VERT_* changes since last run */ |
GLuint inputs; /* VERT_* inputs to pipeline */ |
struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES+1]; |
GLuint nr_stages; |
}; |
struct tnl_eval_store { |
GLuint EvalMap1Flags; |
GLuint EvalMap2Flags; |
GLuint EvalMap1AttribFlags; /* GL_NV_vertex_program */ |
GLuint EvalMap2AttribFlags; /* GL_NV_vertex_program */ |
GLuint EvalNewState; |
struct immediate *im; /* used for temporary data */ |
}; |
typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last ); |
typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 ); |
typedef void (*triangle_func)( GLcontext *ctx, |
GLuint v1, GLuint v2, GLuint v3 ); |
typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, |
GLuint v3, GLuint v4 ); |
typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count, |
GLuint flags ); |
typedef void (*interp_func)( GLcontext *ctx, |
GLfloat t, GLuint dst, GLuint out, GLuint in, |
GLboolean force_boundary ); |
typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src ); |
typedef void (*setup_func)( GLcontext *ctx, |
GLuint start, GLuint end, |
GLuint new_inputs); |
struct tnl_device_driver { |
/*** |
*** TNL Pipeline |
***/ |
void (*RunPipeline)(GLcontext *ctx); |
/* Replaces PipelineStart/PipelineFinish -- intended to allow |
* drivers to wrap _tnl_run_pipeline() with code to validate state |
* and grab/release hardware locks. |
*/ |
void (*NotifyMaterialChange)(GLcontext *ctx); |
/* Alert tnl-aware drivers of changes to material. |
*/ |
GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p); |
/* Allow drivers to hook in optimized begin/end engines. |
* Return value: GL_TRUE - driver handled the begin |
* GL_FALSE - driver didn't handle the begin |
*/ |
/*** |
*** Rendering -- These functions called only from t_vb_render.c |
***/ |
struct { |
void (*Start)(GLcontext *ctx); |
void (*Finish)(GLcontext *ctx); |
/* Called before and after all rendering operations, including DrawPixels, |
* ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. |
* These are a suitable place for grabbing/releasing hardware locks. |
*/ |
void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode); |
/* Called between RenderStart() and RenderFinish() to indicate the |
* type of primitive we're about to draw. Mode will be one of the |
* modes accepted by glBegin(). |
*/ |
interp_func Interp; |
/* The interp function is called by the clipping routines when we need |
* to generate an interpolated vertex. All pertinant vertex ancilliary |
* data should be computed by interpolating between the 'in' and 'out' |
* vertices. |
*/ |
copy_pv_func CopyPV; |
/* The copy function is used to make a copy of a vertex. All pertinant |
* vertex attributes should be copied. |
*/ |
void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n ); |
/* Render a polygon with <n> vertices whose indexes are in the <elts> |
* array. |
*/ |
void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 ); |
/* Render a line between the two vertices given by indexes v0 and v1. */ |
points_func Points; /* must now respect vb->elts */ |
line_func Line; |
triangle_func Triangle; |
quad_func Quad; |
/* These functions are called in order to render points, lines, |
* triangles and quads. These are only called via the T&L module. |
*/ |
render_func *PrimTabVerts; |
render_func *PrimTabElts; |
/* Render whole unclipped primitives (points, lines, linestrips, |
* lineloops, etc). The tables are indexed by the GL enum of the |
* primitive to be rendered. RenderTabVerts is used for non-indexed |
* arrays of vertices. RenderTabElts is used for indexed arrays of |
* vertices. |
*/ |
void (*ResetLineStipple)( GLcontext *ctx ); |
/* Reset the hardware's line stipple counter. |
*/ |
setup_func BuildVertices; |
/* This function is called whenever new vertices are required for |
* rendering. The vertices in question are those n such that start |
* <= n < end. The new_inputs parameter indicates those fields of |
* the vertex which need to be updated, if only a partial repair of |
* the vertex is required. |
* |
* This function is called only from _tnl_render_stage in tnl/t_render.c. |
*/ |
GLboolean (*Multipass)( GLcontext *ctx, GLuint passno ); |
/* Driver may request additional render passes by returning GL_TRUE |
* when this function is called. This function will be called |
* after the first pass, and passes will be made until the function |
* returns GL_FALSE. If no function is registered, only one pass |
* is made. |
* |
* This function will be first invoked with passno == 1. |
*/ |
} Render; |
}; |
typedef struct { |
/* Driver interface. |
*/ |
struct tnl_device_driver Driver; |
/* Track whether the module is active. |
*/ |
GLboolean bound_exec; |
/* Display list extensions |
*/ |
GLuint opcode_vertex_cassette; |
/* Pipeline |
*/ |
struct gl_pipeline pipeline; |
struct vertex_buffer vb; |
/* GLvectors for binding to vb: |
*/ |
struct vertex_arrays imm_inputs; |
struct vertex_arrays array_inputs; |
GLuint *tmp_primitive; |
GLuint *tmp_primitive_length; |
/* Set when executing an internally generated begin/end object. If |
* such an object is encountered in a display list, it will be |
* replayed only if the list is outside any existing begin/end |
* objects. |
*/ |
GLboolean ReplayHardBeginEnd; |
/* Note which vertices need copying over succesive immediates. |
* Will add save versions to precompute vertex copying where |
* possible. |
*/ |
struct immediate *ExecCopySource; |
GLuint ExecCopyCount; |
GLuint ExecCopyElts[IMM_MAX_COPIED_VERTS]; |
GLuint ExecCopyTexSize; |
GLuint ExecParity; |
GLuint DlistPrimitive; |
GLuint DlistPrimitiveLength; |
GLuint DlistLastPrimitive; |
/* Cache a single free immediate (refcount == 0) |
*/ |
struct immediate *freed_immediate; |
/* Probably need a better configuration mechanism: |
*/ |
GLboolean NeedNdcCoords; |
GLboolean LoopbackDListCassettes; |
GLboolean CalcDListNormalLengths; |
GLboolean IsolateMaterials; |
/* Derived state and storage for _tnl_eval_vb: |
*/ |
struct tnl_eval_store eval; |
/* Functions to be plugged into dispatch when tnl is active. |
*/ |
GLvertexformat vtxfmt; |
GLvertexformat save_vtxfmt; |
} TNLcontext; |
#define TNL_CONTEXT(ctx) ((TNLcontext *)(ctx->swtnl_context)) |
#define TNL_CURRENT_IM(ctx) ((struct immediate *)(ctx->swtnl_im)) |
#define TYPE_IDX(t) ((t) & 0xf) |
#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ |
extern void _tnl_MakeCurrent( GLcontext *ctx, |
GLframebuffer *drawBuffer, |
GLframebuffer *readBuffer ); |
/* |
* Macros for fetching current input buffer. |
*/ |
#ifdef THREADS |
#define GET_IMMEDIATE struct immediate *IM = TNL_CURRENT_IM(((GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context()))) |
#define SET_IMMEDIATE(ctx, im) ctx->swtnl_im = (void *)im |
#else |
extern struct immediate *_tnl_CurrentInput; |
#define GET_IMMEDIATE struct immediate *IM = _tnl_CurrentInput |
#define SET_IMMEDIATE(ctx, im) \ |
do { \ |
ctx->swtnl_im = (void *)im; \ |
_tnl_CurrentInput = im; \ |
} while (0) |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_texmat.c |
---|
0,0 → 1,152 |
/* $Id: t_vb_texmat.c,v 1.1 2003-02-28 11:48:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
/* Is there any real benefit seperating texmat from texgen? It means |
* we need two lots of intermediate storage. Any changes to |
* _NEW_TEXTURE will invalidate both sets -- it's only on changes to |
* *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. |
* |
* However, the seperation of this code from the complex texgen stuff |
* is very appealing. |
*/ |
struct texmat_stage_data { |
GLvector4f texcoord[MAX_TEXTURE_UNITS]; |
}; |
#define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr) |
static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
GLuint i; |
stage->active = 0; |
if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram.Enabled) { |
GLuint flags = 0; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) |
flags |= VERT_BIT_TEX(i); |
stage->active = 1; |
stage->inputs = flags; |
stage->outputs = flags; |
} |
} |
static GLboolean run_texmat_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLuint i; |
/* ENABLE_TEXMAT implies that the texture matrix is not the |
* identity, so we don't have to check that here. |
*/ |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { |
if (stage->changed_inputs & VERT_BIT_TEX(i)) |
(void) TransformRaw( &store->texcoord[i], |
ctx->TextureMatrixStack[i].Top, |
VB->TexCoordPtr[i]); |
VB->TexCoordPtr[i] = &store->texcoord[i]; |
} |
return GL_TRUE; |
} |
/* Called the first time stage->run() is invoked. |
*/ |
static GLboolean alloc_texmat_data( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct texmat_stage_data *store; |
GLuint i; |
stage->privatePtr = CALLOC(sizeof(*store)); |
store = TEXMAT_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
_mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); |
/* Now run the stage. |
*/ |
stage->run = run_texmat_stage; |
return stage->run( ctx, stage ); |
} |
static void free_texmat_data( struct gl_pipeline_stage *stage ) |
{ |
struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); |
GLuint i; |
if (store) { |
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) |
if (store->texcoord[i].data) |
_mesa_vector4f_free( &store->texcoord[i] ); |
FREE( store ); |
stage->privatePtr = 0; |
} |
} |
const struct gl_pipeline_stage _tnl_texture_transform_stage = |
{ |
"texture transform", /* name */ |
_NEW_TEXTURE|_NEW_TEXTURE_MATRIX, /* check_state */ |
_NEW_TEXTURE|_NEW_TEXTURE_MATRIX, /* run_state */ |
GL_FALSE, /* active? */ |
0, /* inputs */ |
0, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private data */ |
free_texmat_data, /* destructor */ |
check_texmat, /* check */ |
alloc_texmat_data, /* run -- initially set to init */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_eval.c |
---|
0,0 → 1,854 |
/* $Id: t_imm_eval.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
* Brian Paul - vertex program updates |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_eval.h" |
#include "t_context.h" |
#include "t_imm_debug.h" |
#include "t_imm_eval.h" |
#include "t_imm_exec.h" |
#include "t_imm_fixup.h" |
#include "t_imm_alloc.h" |
static void eval_points1( GLfloat outcoord[][4], |
GLfloat coord[][4], |
const GLuint *flags, |
GLfloat du, GLfloat u1 ) |
{ |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & VERT_BITS_EVAL_ANY) { |
outcoord[i][0] = coord[i][0]; |
outcoord[i][1] = coord[i][1]; |
if (flags[i] & VERT_BIT_EVAL_P1) |
outcoord[i][0] = coord[i][0] * du + u1; |
} |
} |
static void eval_points2( GLfloat outcoord[][4], |
GLfloat coord[][4], |
const GLuint *flags, |
GLfloat du, GLfloat u1, |
GLfloat dv, GLfloat v1 ) |
{ |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) { |
if (flags[i] & VERT_BITS_EVAL_ANY) { |
outcoord[i][0] = coord[i][0]; |
outcoord[i][1] = coord[i][1]; |
if (flags[i] & VERT_BIT_EVAL_P2) { |
outcoord[i][0] = coord[i][0] * du + u1; |
outcoord[i][1] = coord[i][1] * dv + v1; |
} |
} |
} |
} |
static const GLubyte dirty_flags[5] = { |
0, /* not possible */ |
VEC_DIRTY_0, |
VEC_DIRTY_1, |
VEC_DIRTY_2, |
VEC_DIRTY_3 |
}; |
static void eval1_4f( GLvector4f *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
GLuint dimension, |
const struct gl_1d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
GLfloat (*to)[4] = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { |
GLfloat u = (coord[i][0] - u1) * du; |
ASSIGN_4V(to[i], 0,0,0,1); |
_math_horner_bezier_curve(map->Points, to[i], u, |
dimension, map->Order); |
} |
dest->size = MAX2(dest->size, dimension); |
dest->flags |= dirty_flags[dimension]; |
} |
/* as above, but dest is a gl_client_array */ |
static void eval1_4f_ca( struct gl_client_array *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
GLuint dimension, |
const struct gl_1d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr; |
GLuint i; |
ASSERT(dest->Type == GL_FLOAT); |
ASSERT(dest->StrideB == 4 * sizeof(GLfloat)); |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { |
GLfloat u = (coord[i][0] - u1) * du; |
ASSIGN_4V(to[i], 0,0,0,1); |
_math_horner_bezier_curve(map->Points, to[i], u, |
dimension, map->Order); |
} |
dest->Size = MAX2(dest->Size, (GLint) dimension); |
} |
static void eval1_1ui( GLvector1ui *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
const struct gl_1d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
GLuint *to = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat tmp; |
_math_horner_bezier_curve(map->Points, &tmp, u, 1, map->Order); |
to[i] = (GLuint) (GLint) tmp; |
} |
} |
static void eval1_norm( GLvector4f *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
const struct gl_1d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
GLfloat (*to)[4] = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { |
GLfloat u = (coord[i][0] - u1) * du; |
_math_horner_bezier_curve(map->Points, to[i], u, 3, map->Order); |
} |
} |
static void eval2_obj_norm( GLvector4f *obj_ptr, |
GLvector4f *norm_ptr, |
GLfloat coord[][4], |
GLuint *flags, |
GLuint dimension, |
const struct gl_2d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
const GLfloat v1 = map->v1; |
const GLfloat dv = map->dv; |
GLfloat (*obj)[4] = obj_ptr->data; |
GLfloat (*normal)[4] = norm_ptr->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat v = (coord[i][1] - v1) * dv; |
GLfloat du[4], dv[4]; |
ASSIGN_4V(obj[i], 0,0,0,1); |
_math_de_casteljau_surf(map->Points, obj[i], du, dv, u, v, dimension, |
map->Uorder, map->Vorder); |
if (dimension == 4) { |
du[0] = du[0]*obj[i][3] - du[3]*obj[i][0]; |
du[1] = du[1]*obj[i][3] - du[3]*obj[i][1]; |
du[2] = du[2]*obj[i][3] - du[3]*obj[i][2]; |
dv[0] = dv[0]*obj[i][3] - dv[3]*obj[i][0]; |
dv[1] = dv[1]*obj[i][3] - dv[3]*obj[i][1]; |
dv[2] = dv[2]*obj[i][3] - dv[3]*obj[i][2]; |
} |
CROSS3(normal[i], du, dv); |
NORMALIZE_3FV(normal[i]); |
} |
obj_ptr->size = MAX2(obj_ptr->size, dimension); |
obj_ptr->flags |= dirty_flags[dimension]; |
} |
static void eval2_4f( GLvector4f *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
GLuint dimension, |
const struct gl_2d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
const GLfloat v1 = map->v1; |
const GLfloat dv = map->dv; |
GLfloat (*to)[4] = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat v = (coord[i][1] - v1) * dv; |
_math_horner_bezier_surf(map->Points, to[i], u, v, dimension, |
map->Uorder, map->Vorder); |
} |
dest->size = MAX2(dest->size, dimension); |
dest->flags |= dirty_flags[dimension]; |
} |
/* as above, but dest is a gl_client_array */ |
static void eval2_4f_ca( struct gl_client_array *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
GLuint dimension, |
const struct gl_2d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
const GLfloat v1 = map->v1; |
const GLfloat dv = map->dv; |
GLfloat (*to)[4] = (GLfloat (*)[4])dest->Ptr; |
GLuint i; |
ASSERT(dest->Type == GL_FLOAT); |
ASSERT(dest->StrideB == 4 * sizeof(GLfloat)); |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat v = (coord[i][1] - v1) * dv; |
_math_horner_bezier_surf(map->Points, to[i], u, v, dimension, |
map->Uorder, map->Vorder); |
} |
dest->Size = MAX2(dest->Size, (GLint) dimension); |
} |
static void eval2_norm( GLvector4f *dest, |
GLfloat coord[][4], |
GLuint *flags, |
const struct gl_2d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
const GLfloat v1 = map->v1; |
const GLfloat dv = map->dv; |
GLfloat (*to)[4] = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) { |
if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat v = (coord[i][1] - v1) * dv; |
_math_horner_bezier_surf(map->Points, to[i], u, v, 3, |
map->Uorder, map->Vorder); |
} |
} |
} |
static void eval2_1ui( GLvector1ui *dest, |
GLfloat coord[][4], |
const GLuint *flags, |
const struct gl_2d_map *map ) |
{ |
const GLfloat u1 = map->u1; |
const GLfloat du = map->du; |
const GLfloat v1 = map->v1; |
const GLfloat dv = map->dv; |
GLuint *to = dest->data; |
GLuint i; |
for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) |
if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { |
GLfloat u = (coord[i][0] - u1) * du; |
GLfloat v = (coord[i][1] - v1) * dv; |
GLfloat tmp; |
_math_horner_bezier_surf(map->Points, &tmp, u, v, 1, |
map->Uorder, map->Vorder); |
to[i] = (GLuint) (GLint) tmp; |
} |
} |
static void copy_4f( GLfloat to[][4], GLfloat from[][4], GLuint count ) |
{ |
MEMCPY( to, from, count * sizeof(to[0])); |
} |
static void copy_4f_stride( GLfloat to[][4], const GLfloat *from, |
GLuint stride, GLuint count ) |
{ |
if (stride == 4 * sizeof(GLfloat)) |
MEMCPY( to, from, count * sizeof(to[0])); |
else { |
GLuint i; |
for (i = 0 ; i < count ; i++, STRIDE_F(from, stride)) |
COPY_4FV( to[i], from ); |
} |
} |
static void copy_3f( GLfloat to[][4], GLfloat from[][4], GLuint count ) |
{ |
GLuint i; |
for (i = 0 ; i < count ; i++) { |
COPY_3FV(to[i], from[i]); |
} |
} |
static void copy_1ui( GLuint to[], const GLuint from[], GLuint count ) |
{ |
MEMCPY( to, from, (count) * sizeof(to[0])); |
} |
/* Translate eval enabled flags to VERT_* flags. |
*/ |
static void update_eval( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint eval1 = 0, eval2 = 0; |
GLuint i; |
if (ctx->Eval.Map1Index) |
eval1 |= VERT_BIT_INDEX; |
if (ctx->Eval.Map2Index) |
eval2 |= VERT_BIT_INDEX; |
if (ctx->Eval.Map1Color4) |
eval1 |= VERT_BIT_COLOR0; |
if (ctx->Eval.Map2Color4) |
eval2 |= VERT_BIT_COLOR0; |
if (ctx->Eval.Map1Normal) |
eval1 |= VERT_BIT_NORMAL; |
if (ctx->Eval.Map2Normal) |
eval2 |= VERT_BIT_NORMAL; |
if (ctx->Eval.Map1TextureCoord4 || |
ctx->Eval.Map1TextureCoord3 || |
ctx->Eval.Map1TextureCoord2 || |
ctx->Eval.Map1TextureCoord1) |
eval1 |= VERT_BIT_TEX0; |
if (ctx->Eval.Map2TextureCoord4 || |
ctx->Eval.Map2TextureCoord3 || |
ctx->Eval.Map2TextureCoord2 || |
ctx->Eval.Map2TextureCoord1) |
eval2 |= VERT_BIT_TEX0; |
if (ctx->Eval.Map1Vertex4) |
eval1 |= VERT_BITS_OBJ_234; |
if (ctx->Eval.Map1Vertex3) |
eval1 |= VERT_BITS_OBJ_23; |
if (ctx->Eval.Map2Vertex4) { |
if (ctx->Eval.AutoNormal) |
eval2 |= VERT_BITS_OBJ_234 | VERT_BIT_NORMAL; |
else |
eval2 |= VERT_BITS_OBJ_234; |
} |
else if (ctx->Eval.Map2Vertex3) { |
if (ctx->Eval.AutoNormal) |
eval2 |= VERT_BITS_OBJ_23 | VERT_BIT_NORMAL; |
else |
eval2 |= VERT_BITS_OBJ_23; |
} |
tnl->eval.EvalMap1Flags = eval1; |
tnl->eval.EvalMap2Flags = eval2; |
/* GL_NV_vertex_program evaluators */ |
eval1 = eval2 = 0; |
for (i = 0; i < VERT_ATTRIB_MAX; i++) { |
if (ctx->Eval.Map1Attrib[i]) |
eval1 |= (1 << i); |
if (ctx->Eval.Map2Attrib[i]) |
eval2 |= (1 << i); |
} |
tnl->eval.EvalMap1AttribFlags = eval1; |
tnl->eval.EvalMap2AttribFlags = eval2; |
tnl->eval.EvalNewState = 0; |
} |
/* This looks a lot like a pipeline stage, but for various reasons is |
* better handled outside the pipeline, and considered the final stage |
* of fixing up an immediate struct for execution. |
* |
* Really want to cache the results of this function in display lists, |
* at least for EvalMesh commands. |
*/ |
void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_arrays *tmp = &tnl->imm_inputs; |
struct immediate *store = tnl->eval.im; |
GLuint *flags = IM->Flag + IM->CopyStart; |
GLuint copycount; |
GLuint orflag = IM->OrFlag; |
GLuint any_eval1 = orflag & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1); |
GLuint any_eval2 = orflag & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2); |
GLuint req = 0; |
GLuint purge_flags = 0; |
GLfloat (*coord)[4] = IM->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; |
if (IM->AndFlag & VERT_BITS_EVAL_ANY) |
copycount = IM->Start - IM->CopyStart; /* just copy copied vertices */ |
else |
copycount = IM->Count - IM->CopyStart; /* copy all vertices */ |
if (!store) |
store = tnl->eval.im = _tnl_alloc_immediate( ctx ); |
if (tnl->eval.EvalNewState & _NEW_EVAL) |
update_eval( ctx ); |
if (any_eval1) { |
req |= tnl->pipeline.inputs |
& (tnl->eval.EvalMap1Flags | tnl->eval.EvalMap1AttribFlags); |
if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && |
!ctx->Eval.Map1Attrib[0]) |
purge_flags = (VERT_BIT_EVAL_P1|VERT_BIT_EVAL_C1); |
if (orflag & VERT_BIT_EVAL_P1) { |
eval_points1( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, |
coord, flags, |
ctx->Eval.MapGrid1du, |
ctx->Eval.MapGrid1u1); |
coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; |
} |
} |
if (any_eval2) { |
req |= tnl->pipeline.inputs |
& (tnl->eval.EvalMap2Flags | tnl->eval.EvalMap2AttribFlags); |
if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && |
!ctx->Eval.Map2Attrib[0]) |
purge_flags |= (VERT_BIT_EVAL_P2|VERT_BIT_EVAL_C2); |
if (orflag & VERT_BIT_EVAL_P2) { |
eval_points2( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, |
coord, flags, |
ctx->Eval.MapGrid2du, |
ctx->Eval.MapGrid2u1, |
ctx->Eval.MapGrid2dv, |
ctx->Eval.MapGrid2v1 ); |
coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; |
} |
} |
/* Perform the evaluations on active data elements. |
*/ |
if (req & VERT_BIT_INDEX) { |
GLuint generated = 0; |
if (copycount) |
copy_1ui( store->Index + IM->CopyStart, tmp->Index.data, copycount ); |
tmp->Index.data = store->Index + IM->CopyStart; |
tmp->Index.start = store->Index + IM->CopyStart; |
if (ctx->Eval.Map1Index && any_eval1) { |
eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
if (ctx->Eval.Map2Index && any_eval2) { |
eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
} |
if (req & VERT_BIT_COLOR0) { |
GLuint generated = 0; |
if (copycount) |
copy_4f_stride( store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart, |
(GLfloat *)tmp->Color.Ptr, |
tmp->Color.StrideB, |
copycount ); |
tmp->Color.Ptr = store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart; |
tmp->Color.StrideB = 4 * sizeof(GLfloat); |
tmp->Color.Flags = 0; |
tnl->vb.importable_data &= ~VERT_BIT_COLOR0; |
if (ctx->VertexProgram.Enabled) { |
tmp->Attribs[VERT_ATTRIB_COLOR0].data = |
store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart; |
tmp->Attribs[VERT_ATTRIB_COLOR0].start = |
(GLfloat *) tmp->Attribs[VERT_ATTRIB_COLOR0].data; |
tmp->Attribs[VERT_ATTRIB_COLOR0].size = 0; |
} |
/* Vertex program maps have priority over conventional attribs */ |
if (any_eval1) { |
if (ctx->VertexProgram.Enabled |
&& ctx->Eval.Map1Attrib[VERT_ATTRIB_COLOR0]) { |
eval1_4f_ca( &tmp->Color, coord, flags, 4, |
&ctx->EvalMap.Map1Attrib[VERT_ATTRIB_COLOR0] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1Color4) { |
eval1_4f_ca( &tmp->Color, coord, flags, 4, |
&ctx->EvalMap.Map1Color4 ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
} |
if (any_eval2) { |
if (ctx->VertexProgram.Enabled |
&& ctx->Eval.Map2Attrib[VERT_ATTRIB_COLOR0]) { |
eval2_4f_ca( &tmp->Color, coord, flags, 4, |
&ctx->EvalMap.Map2Attrib[VERT_ATTRIB_COLOR0] ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
else if (ctx->Eval.Map2Color4) { |
eval2_4f_ca( &tmp->Color, coord, flags, 4, |
&ctx->EvalMap.Map2Color4 ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
} |
} |
if (req & VERT_BIT_TEX0) { |
GLuint generated = 0; |
if (copycount) |
copy_4f( store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart, |
tmp->TexCoord[0].data, copycount ); |
else |
tmp->TexCoord[0].size = 0; |
tmp->TexCoord[0].data = store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart; |
tmp->TexCoord[0].start = (GLfloat *)tmp->TexCoord[0].data; |
if (ctx->VertexProgram.Enabled) { |
tmp->Attribs[VERT_ATTRIB_TEX0].data = |
store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart; |
tmp->Attribs[VERT_ATTRIB_TEX0].start = |
(GLfloat *) tmp->Attribs[VERT_ATTRIB_TEX0].data; |
tmp->Attribs[VERT_ATTRIB_TEX0].size = 0; |
} |
/* Vertex program maps have priority over conventional attribs */ |
if (any_eval1) { |
if (ctx->VertexProgram.Enabled |
&& ctx->Eval.Map1Attrib[VERT_ATTRIB_TEX0]) { |
eval1_4f( &tmp->TexCoord[0], coord, flags, 4, |
&ctx->EvalMap.Map1Attrib[VERT_ATTRIB_TEX0] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1TextureCoord4) { |
eval1_4f( &tmp->TexCoord[0], coord, flags, 4, |
&ctx->EvalMap.Map1Texture4 ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1TextureCoord3) { |
eval1_4f( &tmp->TexCoord[0], coord, flags, 3, |
&ctx->EvalMap.Map1Texture3 ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1TextureCoord2) { |
eval1_4f( &tmp->TexCoord[0], coord, flags, 2, |
&ctx->EvalMap.Map1Texture2 ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1TextureCoord1) { |
eval1_4f( &tmp->TexCoord[0], coord, flags, 1, |
&ctx->EvalMap.Map1Texture1 ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
} |
if (any_eval2) { |
if (ctx->VertexProgram.Enabled |
&& ctx->Eval.Map2Attrib[VERT_ATTRIB_TEX0]) { |
eval2_4f( &tmp->TexCoord[0], coord, flags, 4, |
&ctx->EvalMap.Map2Attrib[VERT_ATTRIB_TEX0] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map2TextureCoord4) { |
eval2_4f( &tmp->TexCoord[0], coord, flags, 4, |
&ctx->EvalMap.Map2Texture4 ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
else if (ctx->Eval.Map2TextureCoord3) { |
eval2_4f( &tmp->TexCoord[0], coord, flags, 3, |
&ctx->EvalMap.Map2Texture3 ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
else if (ctx->Eval.Map2TextureCoord2) { |
eval2_4f( &tmp->TexCoord[0], coord, flags, 2, |
&ctx->EvalMap.Map2Texture2 ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
else if (ctx->Eval.Map2TextureCoord1) { |
eval2_4f( &tmp->TexCoord[0], coord, flags, 1, |
&ctx->EvalMap.Map2Texture1 ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
} |
} |
if (req & VERT_BIT_NORMAL) { |
GLuint generated = 0; |
if (copycount) { |
copy_3f( store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart, |
tmp->Normal.data, copycount ); |
} |
tmp->Normal.data = store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart; |
tmp->Normal.start = (GLfloat *)tmp->Normal.data; |
if (ctx->VertexProgram.Enabled) { |
tmp->Attribs[VERT_ATTRIB_NORMAL].data = |
store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart; |
tmp->Attribs[VERT_ATTRIB_NORMAL].start = |
(GLfloat *) tmp->Attribs[VERT_ATTRIB_NORMAL].data; |
tmp->Attribs[VERT_ATTRIB_NORMAL].size = 0; |
} |
if (any_eval1) { |
if (ctx->VertexProgram.Enabled && |
ctx->Eval.Map1Attrib[VERT_ATTRIB_NORMAL]) { |
eval1_norm( &tmp->Normal, coord, flags, |
&ctx->EvalMap.Map1Attrib[VERT_ATTRIB_NORMAL] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
else if (ctx->Eval.Map1Normal) { |
eval1_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map1Normal ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
} |
if (any_eval2) { |
if (ctx->VertexProgram.Enabled && |
ctx->Eval.Map2Attrib[VERT_ATTRIB_NORMAL]) { |
eval2_norm( &tmp->Normal, coord, flags, |
&ctx->EvalMap.Map2Attrib[VERT_ATTRIB_NORMAL] ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
else if (ctx->Eval.Map2Normal) { |
eval2_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map2Normal ); |
generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; |
} |
} |
} |
/* In the AutoNormal case, the copy and assignment of tmp->NormalPtr |
* are done above. |
*/ |
if (req & VERT_BIT_POS) { |
if (copycount) { |
/* This copy may already have occurred when eliminating |
* glEvalPoint calls: |
*/ |
if (coord != store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart) { |
copy_4f( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, |
tmp->Obj.data, copycount ); |
} |
} |
else { |
tmp->Obj.size = 0; |
} |
tmp->Obj.data = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; |
tmp->Obj.start = (GLfloat *) tmp->Obj.data; |
#if 1 |
/*tmp->Attribs[0].count = count;*/ |
tmp->Attribs[0].data = store->Attrib[0] + IM->CopyStart; |
tmp->Attribs[0].start = (GLfloat *) tmp->Attribs[0].data; |
tmp->Attribs[0].size = 0; |
#endif |
/* Note: Normal data is already prepared above. |
*/ |
if (any_eval1) { |
if (ctx->VertexProgram.Enabled && |
ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]) { |
eval1_4f( &tmp->Obj, coord, flags, 4, |
&ctx->EvalMap.Map1Attrib[VERT_ATTRIB_POS] ); |
} |
else if (ctx->Eval.Map1Vertex4) { |
eval1_4f( &tmp->Obj, coord, flags, 4, |
&ctx->EvalMap.Map1Vertex4 ); |
} |
else if (ctx->Eval.Map1Vertex3) { |
eval1_4f( &tmp->Obj, coord, flags, 3, |
&ctx->EvalMap.Map1Vertex3 ); |
} |
} |
if (any_eval2) { |
if (ctx->VertexProgram.Enabled && |
ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]) { |
if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) |
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, |
&ctx->EvalMap.Map2Attrib[VERT_ATTRIB_POS] ); |
else |
eval2_4f( &tmp->Obj, coord, flags, 4, |
&ctx->EvalMap.Map2Attrib[VERT_ATTRIB_POS] ); |
} |
else if (ctx->Eval.Map2Vertex4) { |
if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) |
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, |
&ctx->EvalMap.Map2Vertex4 ); |
else |
eval2_4f( &tmp->Obj, coord, flags, 4, |
&ctx->EvalMap.Map2Vertex4 ); |
} |
else if (ctx->Eval.Map2Vertex3) { |
if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) |
eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3, |
&ctx->EvalMap.Map2Vertex3 ); |
else |
eval2_4f( &tmp->Obj, coord, flags, 3, |
&ctx->EvalMap.Map2Vertex3 ); |
} |
} |
} |
if (ctx->VertexProgram.Enabled) { |
/* We already evaluated position, normal, color and texture 0 above. |
* now evaluate any other generic attributes. |
*/ |
const GLuint skipBits = (VERT_BIT_POS | |
VERT_BIT_NORMAL | |
VERT_BIT_COLOR0 | |
VERT_BIT_TEX0); |
GLuint generated = 0; |
GLuint attr; |
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { |
if ((1 << attr) & req & ~skipBits) { |
if (any_eval1 && ctx->Eval.Map1Attrib[attr]) { |
/* evaluate 1-D vertex attrib map [i] */ |
eval1_4f( &tmp->Attribs[attr], coord, flags, 4, |
&ctx->EvalMap.Map1Attrib[attr] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
if (any_eval2 && ctx->Eval.Map2Attrib[attr]) { |
/* evaluate 2-D vertex attrib map [i] */ |
eval2_4f( &tmp->Attribs[attr], coord, flags, 4, |
&ctx->EvalMap.Map2Attrib[attr] ); |
generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; |
} |
} |
} |
} |
/* Calculate new IM->Elts, IM->Primitive, IM->PrimitiveLength for |
* the case where vertex maps are not enabled for some received |
* eval coordinates. In this case those slots in the immediate |
* must be ignored. |
*/ |
if (purge_flags) { |
const GLuint vertex = VERT_BIT_POS|(VERT_BITS_EVAL_ANY & ~purge_flags); |
GLuint last_new_prim = 0; |
GLuint new_prim_length = 0; |
GLuint next_old_prim = 0; |
struct vertex_buffer *VB = &tnl->vb; |
const GLuint count = VB->Count; |
GLuint i, j; |
for (i = 0, j = 0 ; i < count ; i++) { |
if (flags[i] & vertex) { |
store->Elt[j++] = i; |
new_prim_length++; |
} |
if (i == next_old_prim) { |
next_old_prim += VB->PrimitiveLength[i]; |
VB->PrimitiveLength[last_new_prim] = new_prim_length; |
VB->Primitive[j] = VB->Primitive[i]; |
last_new_prim = j; |
} |
} |
VB->Elts = store->Elt; |
_tnl_get_purged_copy_verts( ctx, store ); |
} |
/* Produce new flags array: |
*/ |
{ |
const GLuint count = tnl->vb.Count + 1; |
GLuint i; |
copy_1ui( store->Flag, flags, count ); |
tnl->vb.Flag = store->Flag; |
for (i = 0 ; i < count ; i++) |
store->Flag[i] |= req; |
IM->Evaluated = req; /* hack for copying. */ |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_exec.h |
---|
0,0 → 1,70 |
/* $Id: t_imm_exec.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_VBXFORM_H |
#define _T_VBXFORM_H |
#include "mtypes.h" |
#include "t_context.h" |
/* Hook for ctx->Driver.FlushVertices: |
*/ |
extern void _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags ); |
/* Called from imm_api.c and _tnl_flush_vertices: |
*/ |
extern void _tnl_flush_immediate( GLcontext *ctx, struct immediate *IM ); |
/* Called from imm_dlist.c and _tnl_flush_immediate: |
*/ |
extern void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ); |
extern void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM, |
GLuint flag, GLuint row ); |
/* Initialize some stuff: |
*/ |
extern void _tnl_imm_init( GLcontext *ctx ); |
extern void _tnl_imm_destroy( GLcontext *ctx ); |
extern void _tnl_reset_exec_input( GLcontext *ctx, |
GLuint start, |
GLuint beginstate, |
GLuint savedbeginstate ); |
extern void _tnl_reset_compile_input( GLcontext *ctx, |
GLuint start, |
GLuint beginstate, |
GLuint savedbeginstate ); |
extern void _tnl_compute_orflag( struct immediate *IM, GLuint start ); |
extern void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_elt.h |
---|
0,0 → 1,46 |
/* $Id: t_imm_elt.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _T_IMM_ELT_H_ |
#define _T_IMM_ELT_H_ |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_imm_elt_init( void ); |
extern void _tnl_translate_array_elts( GLcontext *ctx, |
struct immediate *IM, |
GLuint start, |
GLuint end ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_debug.h |
---|
0,0 → 1,39 |
/* $Id: t_imm_debug.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _T_DEBUG_H |
#define _T_DEBUG_H |
#include "mtypes.h" |
#include "t_context.h" |
void _tnl_print_cassette( struct immediate *IM ); |
void _tnl_print_vert_flags( const char *name, GLuint flags ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_light.c |
---|
0,0 → 1,350 |
/* $Id: t_vb_light.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "light.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#include "math/m_translate.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
#define LIGHT_FLAGS 0x1 /* must be first */ |
#define LIGHT_TWOSIDE 0x2 |
#define LIGHT_COLORMATERIAL 0x4 |
#define MAX_LIGHT_FUNC 0x8 |
typedef void (*light_func)( GLcontext *ctx, |
struct vertex_buffer *VB, |
struct gl_pipeline_stage *stage, |
GLvector4f *input ); |
struct light_stage_data { |
struct gl_client_array FloatColor; |
struct gl_client_array LitColor[2]; |
struct gl_client_array LitSecondary[2]; |
GLvector1ui LitIndex[2]; |
light_func *light_func_tab; |
}; |
#define LIGHT_STAGE_DATA(stage) ((struct light_stage_data *)(stage->privatePtr)) |
static void import_color_material( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct gl_client_array *to = &LIGHT_STAGE_DATA(stage)->FloatColor; |
struct gl_client_array *from = VB->ColorPtr[0]; |
GLuint count = VB->Count; |
if (!to->Ptr) { |
to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLfloat), 32 ); |
to->Type = GL_FLOAT; |
} |
/* No need to transform the same value 3000 times. |
*/ |
if (!from->StrideB) { |
to->StrideB = 0; |
count = 1; |
} |
else |
to->StrideB = 4 * sizeof(GLfloat); |
_math_trans_4f( (GLfloat (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
count); |
VB->ColorPtr[0] = to; |
} |
/* Tables for all the shading functions. |
*/ |
static light_func _tnl_light_tab[MAX_LIGHT_FUNC]; |
static light_func _tnl_light_fast_tab[MAX_LIGHT_FUNC]; |
static light_func _tnl_light_fast_single_tab[MAX_LIGHT_FUNC]; |
static light_func _tnl_light_spec_tab[MAX_LIGHT_FUNC]; |
static light_func _tnl_light_ci_tab[MAX_LIGHT_FUNC]; |
#define TAG(x) x |
#define IDX (0) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_tw |
#define IDX (LIGHT_TWOSIDE) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_fl |
#define IDX (LIGHT_FLAGS) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_tw_fl |
#define IDX (LIGHT_FLAGS|LIGHT_TWOSIDE) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_cm |
#define IDX (LIGHT_COLORMATERIAL) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_tw_cm |
#define IDX (LIGHT_TWOSIDE|LIGHT_COLORMATERIAL) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_fl_cm |
#define IDX (LIGHT_FLAGS|LIGHT_COLORMATERIAL) |
#include "t_vb_lighttmp.h" |
#define TAG(x) x##_tw_fl_cm |
#define IDX (LIGHT_FLAGS|LIGHT_TWOSIDE|LIGHT_COLORMATERIAL) |
#include "t_vb_lighttmp.h" |
static void init_lighting( void ) |
{ |
static int done; |
if (!done) { |
init_light_tab(); |
init_light_tab_tw(); |
init_light_tab_fl(); |
init_light_tab_tw_fl(); |
init_light_tab_cm(); |
init_light_tab_tw_cm(); |
init_light_tab_fl_cm(); |
init_light_tab_tw_fl_cm(); |
done = 1; |
} |
} |
static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; |
GLuint ind; |
/* _tnl_print_vert_flags( __FUNCTION__, stage->changed_inputs ); */ |
/* Make sure we can talk about elements 0..2 in the vector we are |
* lighting. |
*/ |
if (stage->changed_inputs & (VERT_BIT_EYE|VERT_BIT_POS)) { |
if (input->size <= 2) { |
if (input->flags & VEC_NOT_WRITEABLE) { |
ASSERT(VB->importable_data & VERT_BIT_POS); |
VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); |
input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; |
ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0); |
} |
_mesa_vector4f_clean_elem(input, VB->Count, 2); |
} |
} |
if (VB->Flag) |
ind = LIGHT_FLAGS; |
else |
ind = 0; |
/* The individual functions know about replaying side-effects |
* vs. full re-execution. |
*/ |
store->light_func_tab[ind]( ctx, VB, stage, input ); |
return GL_TRUE; |
} |
/* Called in place of do_lighting when the light table may have changed. |
*/ |
static GLboolean run_validate_lighting( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
GLuint ind = 0; |
light_func *tab; |
if (ctx->Visual.rgbMode) { |
if (ctx->Light._NeedVertices) { |
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) |
tab = _tnl_light_spec_tab; |
else |
tab = _tnl_light_tab; |
} |
else { |
if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) |
tab = _tnl_light_fast_single_tab; |
else |
tab = _tnl_light_fast_tab; |
} |
} |
else |
tab = _tnl_light_ci_tab; |
if (ctx->Light.ColorMaterialEnabled) |
ind |= LIGHT_COLORMATERIAL; |
if (ctx->Light.Model.TwoSide) |
ind |= LIGHT_TWOSIDE; |
LIGHT_STAGE_DATA(stage)->light_func_tab = &tab[ind]; |
/* This and the above should only be done on _NEW_LIGHT: |
*/ |
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); |
/* Now run the stage... |
*/ |
stage->run = run_lighting; |
return stage->run( ctx, stage ); |
} |
static void alloc_4chan( struct gl_client_array *a, GLuint sz ) |
{ |
a->Ptr = ALIGN_MALLOC( sz * sizeof(GLchan) * 4, 32 ); |
a->Size = 4; |
a->Type = CHAN_TYPE; |
a->Stride = 0; |
a->StrideB = sizeof(GLchan) * 4; |
a->Enabled = 0; |
a->Flags = 0; |
} |
/* Called the first time stage->run is called. In effect, don't |
* allocate data until the first time the stage is run. |
*/ |
static GLboolean run_init_lighting( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct light_stage_data *store; |
GLuint size = tnl->vb.Size; |
stage->privatePtr = MALLOC(sizeof(*store)); |
store = LIGHT_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
/* Do onetime init. |
*/ |
init_lighting(); |
store->FloatColor.Ptr = 0; |
alloc_4chan( &store->LitColor[0], size ); |
alloc_4chan( &store->LitColor[1], size ); |
alloc_4chan( &store->LitSecondary[0], size ); |
alloc_4chan( &store->LitSecondary[1], size ); |
_mesa_vector1ui_alloc( &store->LitIndex[0], 0, size, 32 ); |
_mesa_vector1ui_alloc( &store->LitIndex[1], 0, size, 32 ); |
/* Now validate the stage derived data... |
*/ |
stage->run = run_validate_lighting; |
return stage->run( ctx, stage ); |
} |
/* |
* Check if lighting is enabled. If so, configure the pipeline stage's |
* type, inputs, and outputs. |
*/ |
static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
stage->active = ctx->Light.Enabled && !ctx->VertexProgram.Enabled; |
if (stage->active) { |
if (stage->privatePtr) |
stage->run = run_validate_lighting; |
stage->inputs = VERT_BIT_NORMAL|VERT_BIT_MATERIAL; |
if (ctx->Light._NeedVertices) |
stage->inputs |= VERT_BIT_EYE; /* effectively, even when lighting in obj */ |
if (ctx->Light.ColorMaterialEnabled) |
stage->inputs |= VERT_BIT_COLOR0; |
stage->outputs = VERT_BIT_COLOR0; |
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) |
stage->outputs |= VERT_BIT_COLOR1; |
} |
} |
static void dtr( struct gl_pipeline_stage *stage ) |
{ |
struct light_stage_data *store = LIGHT_STAGE_DATA(stage); |
if (store) { |
ALIGN_FREE( store->LitColor[0].Ptr ); |
ALIGN_FREE( store->LitColor[1].Ptr ); |
ALIGN_FREE( store->LitSecondary[0].Ptr ); |
ALIGN_FREE( store->LitSecondary[1].Ptr ); |
if (store->FloatColor.Ptr) |
ALIGN_FREE( store->FloatColor.Ptr ); |
_mesa_vector1ui_free( &store->LitIndex[0] ); |
_mesa_vector1ui_free( &store->LitIndex[1] ); |
FREE( store ); |
stage->privatePtr = 0; |
} |
} |
const struct gl_pipeline_stage _tnl_lighting_stage = |
{ |
"lighting", /* name */ |
_NEW_LIGHT, /* recheck */ |
_NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency |
* otherwise not captured by inputs |
* (which may be VERT_BIT_POS) */ |
GL_FALSE, /* active? */ |
0, /* inputs */ |
0, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private_data */ |
dtr, /* destroy */ |
check_lighting, /* check */ |
run_init_lighting /* run -- initially set to ctr */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_imm_eval.h |
---|
0,0 → 1,39 |
/* $Id: t_imm_eval.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _T_IMM_EVAL_H |
#define _T_IMM_EVAL_H |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_eval_init( void ); |
extern void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_program.c |
---|
0,0 → 1,477 |
/* $Id: t_vb_program.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* -------- Regarding NV_vertex_program -------- |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are met: |
* |
* o Redistribution of the source code must contain a copyright notice |
* and this list of conditions; |
* |
* o Redistribution in binary and source code form must contain the |
* following Notice in the software and any documentation and/or other |
* materials provided with the distribution; and |
* |
* o The name of Nvidia may not be used to promote or endorse software |
* derived from the software. |
* |
* NOTICE: Nvidia hereby grants to each recipient a non-exclusive worldwide |
* royalty free patent license under patent claims that are licensable by |
* Nvidia and which are necessarily required and for which no commercially |
* viable non infringing alternative exists to make, use, sell, offer to sell, |
* import and otherwise transfer the vertex extension for the Mesa 3D Graphics |
* Library as distributed in source code and object code form. No hardware or |
* hardware implementation (including a semiconductor implementation and chips) |
* are licensed hereunder. If a recipient makes a patent claim or institutes |
* patent litigation against Nvidia or Nvidia's customers for use or sale of |
* Nvidia products, then this license grant as to such recipient shall |
* immediately terminate and recipient immediately agrees to cease use and |
* distribution of the Mesa Program and derivatives thereof. |
* |
* THE MESA 3D GRAPHICS LIBRARY IS PROVIDED ON AN "AS IS BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, |
* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-NFRINGEMENT |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
* |
* NVIDIA SHALL NOT HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION |
* LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE MESA 3D GRAPHICS |
* LIBRARY OR EVIDENCE OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDR, EVEN |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* If you do not comply with this agreement, then Nvidia may cancel the license |
* and rights granted herein. |
* --------------------------------------------- |
*/ |
/** |
* \file tnl/t_vb_program.c |
* \brief Pipeline stage for executing vertex programs |
* \author Brian Paul, Keith Whitwell |
*/ |
#include "glheader.h" |
#include "api_noop.h" |
#include "colormac.h" |
#include "context.h" |
#include "dlist.h" |
#include "hash.h" |
#include "light.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#include "vpexec.h" |
#include "math/m_translate.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
#include "t_imm_api.h" |
#include "t_imm_exec.h" |
/** |
* \warning These values _MUST_ match the values in the OutputRegisters[] |
* array in vpparse.c!!! |
*/ |
#define VERT_RESULT_HPOS 0 |
#define VERT_RESULT_COL0 1 |
#define VERT_RESULT_COL1 2 |
#define VERT_RESULT_BFC0 3 |
#define VERT_RESULT_BFC1 4 |
#define VERT_RESULT_FOGC 5 |
#define VERT_RESULT_PSIZ 6 |
#define VERT_RESULT_TEX0 7 |
#define VERT_RESULT_TEX1 8 |
#define VERT_RESULT_TEX2 9 |
#define VERT_RESULT_TEX3 10 |
#define VERT_RESULT_TEX4 11 |
#define VERT_RESULT_TEX5 12 |
#define VERT_RESULT_TEX6 13 |
#define VERT_RESULT_TEX7 14 |
/*! |
* Private storage for the vertex program pipeline stage. |
*/ |
struct vp_stage_data { |
/** The results of running the vertex program go into these arrays. */ |
GLvector4f attribs[15]; |
/* These point to the attribs[VERT_RESULT_COL0, COL1, BFC0, BFC1] arrays */ |
struct gl_client_array color0[2]; /**< diffuse front and back */ |
struct gl_client_array color1[2]; /**< specular front and back */ |
GLvector4f ndcCoords; /**< normalized device coords */ |
GLubyte *clipmask; /**< clip flags */ |
GLubyte ormask, andmask; /**< for clipping */ |
}; |
#define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr)) |
/** |
* This function executes vertex programs |
*/ |
static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vp_stage_data *store = VP_STAGE_DATA(stage); |
struct vertex_buffer *VB = &tnl->vb; |
struct vp_machine *machine = &(ctx->VertexProgram.Machine); |
struct vp_program *program = ctx->VertexProgram.Current; |
GLuint i; |
_mesa_init_tracked_matrices(ctx); /* load registers with matrices */ |
_mesa_init_vp_registers(ctx); /* init temp and result regs */ |
for (i = 0; i < VB->Count; i++) { |
GLuint attr; |
#if 0 |
printf("Input %d: %f, %f, %f, %f\n", i, |
VB->AttribPtr[0]->data[i][0], |
VB->AttribPtr[0]->data[i][1], |
VB->AttribPtr[0]->data[i][2], |
VB->AttribPtr[0]->data[i][3]); |
printf(" color: %f, %f, %f, %f\n", |
VB->AttribPtr[3]->data[i][0], |
VB->AttribPtr[3]->data[i][1], |
VB->AttribPtr[3]->data[i][2], |
VB->AttribPtr[3]->data[i][3]); |
printf(" normal: %f, %f, %f, %f\n", |
VB->AttribPtr[2]->data[i][0], |
VB->AttribPtr[2]->data[i][1], |
VB->AttribPtr[2]->data[i][2], |
VB->AttribPtr[2]->data[i][3]); |
#endif |
/* load the input attribute registers */ |
if (VB->Flag) { |
/* the traditional glBegin/glVertex/glEnd case */ |
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { |
if (attr == 0 || (VB->Flag[i] & (1 << attr))) { |
COPY_4V(machine->Registers[VP_INPUT_REG_START + attr], |
VB->AttribPtr[attr]->data[i]); |
} |
} |
} |
else { |
/* the vertex array case */ |
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { |
if (program->InputsRead & (1 << attr)) { |
const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data; |
const GLuint stride = VB->AttribPtr[attr]->stride; |
const GLfloat *data = (GLfloat *) (ptr + stride * i); |
COPY_4V(machine->Registers[VP_INPUT_REG_START + attr], data); |
/*ASSERT(VB->AttribPtr[attr]->size == 4);*/ |
ASSERT(stride == 4 * sizeof(GLfloat) || stride == 0); |
} |
} |
} |
/* execute the program */ |
ASSERT(program); |
_mesa_exec_program(ctx, program); |
#if 0 |
printf("Output %d: %f, %f, %f, %f\n", i, |
machine->Registers[VP_OUTPUT_REG_START + 0][0], |
machine->Registers[VP_OUTPUT_REG_START + 0][1], |
machine->Registers[VP_OUTPUT_REG_START + 0][2], |
machine->Registers[VP_OUTPUT_REG_START + 0][3]); |
printf(" color: %f, %f, %f, %f\n", |
machine->Registers[VP_OUTPUT_REG_START +_1][0], |
machine->Registers[VP_OUTPUT_REG_START + 1][1], |
machine->Registers[VP_OUTPUT_REG_START + 1][2], |
machine->Registers[VP_OUTPUT_REG_START + 1][3]); |
printf("PointSize[%d]: %g\n", i, |
machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_PSIZ][0]); |
#endif |
/* Fixup fog an point size results if needed */ |
if (ctx->Fog.Enabled && |
(program->OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) { |
machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_FOGC][0] = 1.0; |
} |
if (ctx->VertexProgram.PointSizeEnabled && |
(program->OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) { |
machine->Registers[VP_OUTPUT_REG_START + VERT_RESULT_PSIZ][0] |
= ctx->Point.Size; |
} |
/* copy the output registers into the VB->attribs arrays */ |
/* XXX (optimize) could use a conditional and smaller loop limit here */ |
for (attr = 0; attr < 15; attr++) { |
COPY_4V( store->attribs[attr].data[i], |
machine->Registers[VP_OUTPUT_REG_START + attr] ); |
} |
} |
/* Setup the VB pointers so that the next pipeline stages get |
* their data from the right place (the program output arrays). |
*/ |
VB->ClipPtr = &store->attribs[VERT_RESULT_HPOS]; |
VB->ClipPtr->size = 4; |
VB->ClipPtr->count = VB->Count; |
VB->ColorPtr[0] = &store->color0[0]; |
VB->ColorPtr[1] = &store->color0[1]; |
VB->SecondaryColorPtr[0] = &store->color1[0]; |
VB->SecondaryColorPtr[1] = &store->color1[1]; |
VB->FogCoordPtr = &store->attribs[VERT_RESULT_FOGC]; |
VB->PointSizePtr = &store->attribs[VERT_RESULT_PSIZ]; |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) |
VB->TexCoordPtr[i] = &store->attribs[VERT_RESULT_TEX0 + i]; |
/* Cliptest and perspective divide. Clip functions must clear |
* the clipmask. |
*/ |
store->ormask = 0; |
store->andmask = CLIP_ALL_BITS; |
if (tnl->NeedNdcCoords) { |
VB->NdcPtr = |
_mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, |
&store->ndcCoords, |
store->clipmask, |
&store->ormask, |
&store->andmask ); |
} |
else { |
VB->NdcPtr = 0; |
_mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, |
0, |
store->clipmask, |
&store->ormask, |
&store->andmask ); |
} |
if (store->andmask) /* All vertices are outside the frustum */ |
return GL_FALSE; |
/* This is where we'd do clip testing against the user-defined |
* clipping planes, but they're not supported by vertex programs. |
*/ |
VB->ClipOrMask = store->ormask; |
VB->ClipMask = store->clipmask; |
/* XXXX what's this? |
if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS)) |
VB->importable_data |= VERT_BIT_CLIP; |
*/ |
return GL_TRUE; |
} |
/** |
* This function validates stuff. |
*/ |
static GLboolean run_validate_program( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
#if 000 |
/* XXX do we need any validation for vertex programs? */ |
GLuint ind = 0; |
light_func *tab; |
if (ctx->Visual.rgbMode) { |
if (ctx->Light._NeedVertices) { |
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) |
tab = _tnl_light_spec_tab; |
else |
tab = _tnl_light_tab; |
} |
else { |
if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) |
tab = _tnl_light_fast_single_tab; |
else |
tab = _tnl_light_fast_tab; |
} |
} |
else |
tab = _tnl_light_ci_tab; |
if (ctx->Light.ColorMaterialEnabled) |
ind |= LIGHT_COLORMATERIAL; |
if (ctx->Light.Model.TwoSide) |
ind |= LIGHT_TWOSIDE; |
VP_STAGE_DATA(stage)->light_func_tab = &tab[ind]; |
/* This and the above should only be done on _NEW_LIGHT: |
*/ |
_mesa_validate_all_lighting_tables( ctx ); |
#endif |
/* Now run the stage... |
*/ |
stage->run = run_vp; |
return stage->run( ctx, stage ); |
} |
/** |
* Initialize a gl_client_array to point into a GLvector4f color vector. |
*/ |
static void init_color_array( struct gl_client_array *a, GLvector4f *vec ) |
{ |
a->Ptr = vec->data; |
a->Size = 4; |
a->Type = GL_FLOAT; |
a->Stride = 0; |
a->StrideB = sizeof(GLfloat) * 4; |
a->Enabled = 0; |
a->Flags = 0; |
} |
/** |
* Called the first time stage->run is called. In effect, don't |
* allocate data until the first time the stage is run. |
*/ |
static GLboolean run_init_vp( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &(tnl->vb); |
struct vp_stage_data *store; |
const GLuint size = VB->Size; |
GLuint i; |
stage->privatePtr = MALLOC(sizeof(*store)); |
store = VP_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
/* Allocate arrays of vertex output values */ |
for (i = 0; i < 15; i++) |
_mesa_vector4f_alloc( &store->attribs[i], 0, size, 32 ); |
/* Make the color0[] and color1[] arrays point into the attribs[] arrays */ |
init_color_array( &store->color0[0], &store->attribs[VERT_RESULT_COL0] ); |
init_color_array( &store->color0[1], &store->attribs[VERT_RESULT_COL1] ); |
init_color_array( &store->color1[0], &store->attribs[VERT_RESULT_BFC0] ); |
init_color_array( &store->color1[1], &store->attribs[VERT_RESULT_BFC1] ); |
/* a few other misc allocations */ |
_mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); |
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); |
/* Now validate the stage derived data... |
*/ |
stage->run = run_validate_program; |
return stage->run( ctx, stage ); |
} |
/** |
* Check if vertex program mode is enabled. |
* If so, configure the pipeline stage's type, inputs, and outputs. |
*/ |
static void check_vp( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
stage->active = ctx->VertexProgram.Enabled; |
if (stage->active) { |
/* I believe this is right - Keith? |
* Set stage->inputs equal to the bitmask of vertex attributes |
* which the program needs for inputs. |
*/ |
stage->inputs = ctx->VertexProgram.Current->InputsRead; |
#if 000 |
if (stage->privatePtr) |
stage->run = run_validate_program; |
stage->inputs = VERT_BIT_NORMAL|VERT_BIT_MATERIAL; |
if (ctx->Light._NeedVertices) |
stage->inputs |= VERT_BIT_EYE; /* effectively, even when lighting in obj */ |
if (ctx->Light.ColorMaterialEnabled) |
stage->inputs |= VERT_BIT_COLOR0; |
stage->outputs = VERT_BIT_COLOR0; |
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) |
stage->outputs |= VERT_BIT_COLOR1; |
#endif |
} |
} |
/** |
* Destructor for this pipeline stage. |
*/ |
static void dtr( struct gl_pipeline_stage *stage ) |
{ |
struct vp_stage_data *store = VP_STAGE_DATA(stage); |
if (store) { |
GLuint i; |
/* free the vertex program result arrays */ |
for (i = 0; i < 15; i++) |
_mesa_vector4f_free( &store->attribs[i] ); |
/* free misc arrays */ |
_mesa_vector4f_free( &store->ndcCoords ); |
ALIGN_FREE( store->clipmask ); |
FREE( store ); |
stage->privatePtr = 0; |
} |
} |
/** |
* Public description of this pipeline stage. |
*/ |
const struct gl_pipeline_stage _tnl_vertex_program_stage = |
{ |
"vertex-program", |
_NEW_ALL, /*XXX FIX */ /* recheck */ |
_NEW_ALL, /*XXX FIX */ /* recalc -- modelview dependency |
* otherwise not captured by inputs |
* (which may be VERT_BIT_POS) */ |
GL_FALSE, /* active */ |
/*0*/ VERT_BIT_POS, /* inputs XXX OK? */ |
VERT_BIT_CLIP | VERT_BIT_COLOR0, /* outputs XXX OK? */ |
0, /* changed_inputs */ |
NULL, /* private_data */ |
dtr, /* destroy */ |
check_vp, /* check */ |
run_init_vp /* run -- initially set to ctr */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_normals.c |
---|
0,0 → 1,199 |
/* $Id: t_vb_normals.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
struct normal_stage_data { |
normal_func NormalTransform; |
GLvector4f normal; |
}; |
#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) |
static GLboolean run_normal_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
ASSERT(store->NormalTransform); |
if (stage->changed_inputs) { |
/* We can only use the display list's saved normal lengths if we've |
* got a transformation matrix with uniform scaling. |
*/ |
const GLfloat *lengths; |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_FLAG_GENERAL_SCALE) |
lengths = NULL; |
else |
lengths = VB->NormalLengthPtr; |
store->NormalTransform( ctx->ModelviewMatrixStack.Top, |
ctx->_ModelViewInvScale, |
VB->NormalPtr, /* input normals */ |
lengths, |
&store->normal ); /* resulting normals */ |
} |
VB->NormalPtr = &store->normal; |
VB->NormalLengthPtr = 0; /* no longer valid */ |
return GL_TRUE; |
} |
static GLboolean run_validate_normal_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); |
ASSERT(ctx->_NeedNormals); |
if (ctx->_NeedEyeCoords) { |
GLuint transform = NORM_TRANSFORM_NO_ROT; |
if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_GENERAL | |
MAT_FLAG_ROTATION | |
MAT_FLAG_GENERAL_3D | |
MAT_FLAG_PERSPECTIVE)) |
transform = NORM_TRANSFORM; |
if (ctx->Transform.Normalize) { |
store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; |
} |
else if (ctx->Transform.RescaleNormals && |
ctx->_ModelViewInvScale != 1.0) { |
store->NormalTransform = _mesa_normal_tab[transform | NORM_RESCALE]; |
} |
else { |
store->NormalTransform = _mesa_normal_tab[transform]; |
} |
} |
else { |
if (ctx->Transform.Normalize) { |
store->NormalTransform = _mesa_normal_tab[NORM_NORMALIZE]; |
} |
else if (!ctx->Transform.RescaleNormals && |
ctx->_ModelViewInvScale != 1.0) { |
store->NormalTransform = _mesa_normal_tab[NORM_RESCALE]; |
} |
else { |
store->NormalTransform = 0; |
} |
} |
if (store->NormalTransform) { |
stage->run = run_normal_stage; |
return stage->run( ctx, stage ); |
} else { |
stage->active = GL_FALSE; /* !!! */ |
return GL_TRUE; |
} |
} |
static void check_normal_transform( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
stage->active = ctx->_NeedNormals && !ctx->VertexProgram.Enabled; |
/* Don't clobber the initialize function: |
*/ |
if (stage->privatePtr) |
stage->run = run_validate_normal_stage; |
} |
static GLboolean alloc_normal_data( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct normal_stage_data *store; |
stage->privatePtr = MALLOC(sizeof(*store)); |
store = NORMAL_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
_mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); |
/* Now run the stage. |
*/ |
stage->run = run_validate_normal_stage; |
return stage->run( ctx, stage ); |
} |
static void free_normal_data( struct gl_pipeline_stage *stage ) |
{ |
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); |
if (store) { |
_mesa_vector4f_free( &store->normal ); |
FREE( store ); |
stage->privatePtr = NULL; |
} |
} |
#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW| \ |
_NEW_TRANSFORM| \ |
_MESA_NEW_NEED_NORMALS| \ |
_MESA_NEW_NEED_EYE_COORDS) |
const struct gl_pipeline_stage _tnl_normal_transform_stage = |
{ |
"normal transform", /* name */ |
_TNL_NEW_NORMAL_TRANSFORM, /* re-check */ |
_TNL_NEW_NORMAL_TRANSFORM, /* re-run */ |
GL_FALSE, /* active? */ |
VERT_BIT_NORMAL, /* inputs */ |
VERT_BIT_NORMAL, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private data */ |
free_normal_data, /* destructor */ |
check_normal_transform, /* check */ |
alloc_normal_data /* run -- initially set to alloc */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_points.c |
---|
0,0 → 1,124 |
/* $Id: t_vb_points.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Brian Paul |
*/ |
#include "mtypes.h" |
#include "imports.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
struct point_stage_data { |
GLvector4f PointSize; |
}; |
#define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) |
/* |
* Compute attenuated point sizes |
*/ |
static GLboolean run_point_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct point_stage_data *store = POINT_STAGE_DATA(stage); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data; |
const GLfloat p0 = ctx->Point.Params[0]; |
const GLfloat p1 = ctx->Point.Params[1]; |
const GLfloat p2 = ctx->Point.Params[2]; |
const GLfloat pointSize = ctx->Point._Size; |
GLfloat (*size)[4] = store->PointSize.data; |
GLuint i; |
if (stage->changed_inputs) { |
/* XXX do threshold and min/max clamping here? */ |
for (i = 0; i < VB->Count; i++) { |
const GLfloat dist = -eye[i][2]; |
/* GLfloat dist = GL_SQRT(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);*/ |
size[i][0] = pointSize / (p0 + dist * (p1 + dist * p2)); |
} |
} |
VB->PointSizePtr = &store->PointSize; |
return GL_TRUE; |
} |
/* If point size attenuation is on we'll compute the point size for |
* each vertex in a special pipeline stage. |
*/ |
static void check_point_size( GLcontext *ctx, struct gl_pipeline_stage *d ) |
{ |
d->active = ctx->Point._Attenuated && !ctx->VertexProgram.Enabled; |
} |
static GLboolean alloc_point_data( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct point_stage_data *store; |
stage->privatePtr = MALLOC(sizeof(*store)); |
store = POINT_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
_mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); |
/* Now run the stage. |
*/ |
stage->run = run_point_stage; |
return stage->run( ctx, stage ); |
} |
static void free_point_data( struct gl_pipeline_stage *stage ) |
{ |
struct point_stage_data *store = POINT_STAGE_DATA(stage); |
if (store) { |
_mesa_vector4f_free( &store->PointSize ); |
FREE( store ); |
stage->privatePtr = 0; |
} |
} |
const struct gl_pipeline_stage _tnl_point_attenuation_stage = |
{ |
"point size attenuation", /* name */ |
_NEW_POINT, /* build_state_change */ |
_NEW_POINT, /* run_state_change */ |
GL_FALSE, /* active */ |
VERT_BIT_EYE, /* inputs */ |
VERT_BIT_POINT_SIZE, /* outputs */ |
0, /* changed_inputs (temporary value) */ |
NULL, /* stage private data */ |
free_point_data, /* destructor */ |
check_point_size, /* check */ |
alloc_point_data /* run -- initially set to alloc data */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_vb_vertex.c |
---|
0,0 → 1,323 |
/* $Id: t_vb_vertex.c,v 1.1 2003-02-28 11:48:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
struct vertex_stage_data { |
GLvector4f eye; |
GLvector4f clip; |
GLvector4f proj; |
GLubyte *clipmask; |
GLubyte ormask; |
GLubyte andmask; |
/* Need these because it's difficult to replay the sideeffects |
* analytically. |
*/ |
GLvector4f *save_eyeptr; |
GLvector4f *save_clipptr; |
GLvector4f *save_ndcptr; |
}; |
#define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) |
/* This function implements cliptesting for user-defined clip planes. |
* The clipping of primitives to these planes is implemented in |
* t_render_clip.h. |
*/ |
#define USER_CLIPTEST(NAME, SZ) \ |
static void NAME( GLcontext *ctx, \ |
GLvector4f *clip, \ |
GLubyte *clipmask, \ |
GLubyte *clipormask, \ |
GLubyte *clipandmask ) \ |
{ \ |
GLuint p; \ |
\ |
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ |
GLuint nr, i; \ |
const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ |
const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ |
const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ |
const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ |
GLfloat *coord = (GLfloat *)clip->data; \ |
GLuint stride = clip->stride; \ |
GLuint count = clip->count; \ |
\ |
for (nr = 0, i = 0 ; i < count ; i++) { \ |
GLfloat dp = coord[0] * a + coord[1] * b; \ |
if (SZ > 2) dp += coord[2] * c; \ |
if (SZ > 3) dp += coord[3] * d; else dp += d; \ |
\ |
if (dp < 0) { \ |
nr++; \ |
clipmask[i] |= CLIP_USER_BIT; \ |
} \ |
\ |
STRIDE_F(coord, stride); \ |
} \ |
\ |
if (nr > 0) { \ |
*clipormask |= CLIP_USER_BIT; \ |
if (nr == count) { \ |
*clipandmask |= CLIP_USER_BIT; \ |
return; \ |
} \ |
} \ |
} \ |
} |
USER_CLIPTEST(userclip2, 2) |
USER_CLIPTEST(userclip3, 3) |
USER_CLIPTEST(userclip4, 4) |
static void (*(usercliptab[5]))( GLcontext *, |
GLvector4f *, GLubyte *, |
GLubyte *, GLubyte * ) = |
{ |
0, |
0, |
userclip2, |
userclip3, |
userclip4 |
}; |
static GLboolean run_vertex_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
ASSERT(!ctx->VertexProgram.Enabled); |
if (stage->changed_inputs) { |
if (ctx->_NeedEyeCoords) { |
/* Separate modelview transformation: |
* Use combined ModelProject to avoid some depth artifacts |
*/ |
if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) |
VB->EyePtr = VB->ObjPtr; |
else |
VB->EyePtr = TransformRaw( &store->eye, |
ctx->ModelviewMatrixStack.Top, |
VB->ObjPtr); |
if (ctx->ProjectionMatrixStack.Top->type == MATRIX_IDENTITY) |
VB->ClipPtr = VB->EyePtr; |
else |
VB->ClipPtr = TransformRaw( &store->clip, |
&ctx->_ModelProjectMatrix, |
VB->ObjPtr ); |
} |
else { |
/* Combined modelviewproject transform: |
*/ |
if (ctx->_ModelProjectMatrix.type == MATRIX_IDENTITY) |
VB->ClipPtr = VB->ObjPtr; |
else |
VB->ClipPtr = TransformRaw( &store->clip, |
&ctx->_ModelProjectMatrix, |
VB->ObjPtr ); |
} |
/* Drivers expect this to be clean to element 4... |
*/ |
if (VB->ClipPtr->size < 4) { |
if (VB->ClipPtr->flags & VEC_NOT_WRITEABLE) { |
ASSERT(VB->ClipPtr == VB->ObjPtr); |
VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); |
VB->ClipPtr = VB->ObjPtr; |
} |
if (VB->ClipPtr->size == 2) |
_mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); |
_mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); |
} |
/* Cliptest and perspective divide. Clip functions must clear |
* the clipmask. |
*/ |
store->ormask = 0; |
store->andmask = CLIP_ALL_BITS; |
if (tnl->NeedNdcCoords) { |
VB->NdcPtr = |
_mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, |
&store->proj, |
store->clipmask, |
&store->ormask, |
&store->andmask ); |
} |
else { |
VB->NdcPtr = 0; |
_mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, |
0, |
store->clipmask, |
&store->ormask, |
&store->andmask ); |
} |
if (store->andmask) |
return GL_FALSE; |
/* Test userclip planes. This contributes to VB->ClipMask, so |
* is essentially required to be in this stage. |
*/ |
if (ctx->Transform.ClipPlanesEnabled) { |
usercliptab[VB->ClipPtr->size]( ctx, |
VB->ClipPtr, |
store->clipmask, |
&store->ormask, |
&store->andmask ); |
if (store->andmask) |
return GL_FALSE; |
} |
VB->ClipOrMask = store->ormask; |
VB->ClipMask = store->clipmask; |
if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS)) |
VB->importable_data |= VERT_BIT_CLIP; |
store->save_eyeptr = VB->EyePtr; |
store->save_clipptr = VB->ClipPtr; |
store->save_ndcptr = VB->NdcPtr; |
} |
else { |
/* Replay the sideeffects. |
*/ |
VB->EyePtr = store->save_eyeptr; |
VB->ClipPtr = store->save_clipptr; |
VB->NdcPtr = store->save_ndcptr; |
VB->ClipMask = store->clipmask; |
VB->ClipOrMask = store->ormask; |
if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS)) |
VB->importable_data |= VERT_BIT_CLIP; |
if (store->andmask) |
return GL_FALSE; |
} |
return GL_TRUE; |
} |
static void check_vertex( GLcontext *ctx, struct gl_pipeline_stage *stage ) |
{ |
stage->active = !ctx->VertexProgram.Enabled; |
} |
static GLboolean init_vertex_stage( GLcontext *ctx, |
struct gl_pipeline_stage *stage ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct vertex_stage_data *store; |
GLuint size = VB->Size; |
stage->privatePtr = CALLOC(sizeof(*store)); |
store = VERTEX_STAGE_DATA(stage); |
if (!store) |
return GL_FALSE; |
_mesa_vector4f_alloc( &store->eye, 0, size, 32 ); |
_mesa_vector4f_alloc( &store->clip, 0, size, 32 ); |
_mesa_vector4f_alloc( &store->proj, 0, size, 32 ); |
store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); |
if (!store->clipmask || |
!store->eye.data || |
!store->clip.data || |
!store->proj.data) |
return GL_FALSE; |
/* Now run the stage. |
*/ |
stage->run = run_vertex_stage; |
return stage->run( ctx, stage ); |
} |
static void dtr( struct gl_pipeline_stage *stage ) |
{ |
struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); |
if (store) { |
_mesa_vector4f_free( &store->eye ); |
_mesa_vector4f_free( &store->clip ); |
_mesa_vector4f_free( &store->proj ); |
ALIGN_FREE( store->clipmask ); |
FREE(store); |
stage->privatePtr = NULL; |
stage->run = init_vertex_stage; |
} |
} |
const struct gl_pipeline_stage _tnl_vertex_transform_stage = |
{ |
"modelview/project/cliptest/divide", |
_NEW_PROGRAM, /* check_state: only care about vertex prog */ |
_MESA_NEW_NEED_EYE_COORDS | /* run_state: when to invalidate / re-run */ |
_NEW_MODELVIEW| |
_NEW_PROJECTION| |
_NEW_PROGRAM| |
_NEW_TRANSFORM, |
GL_TRUE, /* active */ |
VERT_BIT_POS, /* inputs */ |
VERT_BIT_EYE|VERT_BIT_CLIP, /* outputs */ |
0, /* changed_inputs */ |
NULL, /* private data */ |
dtr, /* destructor */ |
check_vertex, /* check */ |
init_vertex_stage /* run -- initially set to init */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_pipeline.c |
---|
0,0 → 1,211 |
/* $Id: t_pipeline.c,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "imports.h" |
#include "mmath.h" |
#include "state.h" |
#include "mtypes.h" |
#include "math/m_translate.h" |
#include "math/m_xform.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
void _tnl_install_pipeline( GLcontext *ctx, |
const struct gl_pipeline_stage **stages ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct gl_pipeline *pipe = &tnl->pipeline; |
GLuint i; |
ASSERT(pipe->nr_stages == 0); |
pipe->run_state_changes = ~0; |
pipe->run_input_changes = ~0; |
pipe->build_state_changes = ~0; |
pipe->build_state_trigger = 0; |
pipe->inputs = 0; |
/* Create a writeable copy of each stage. |
*/ |
for (i = 0 ; i < MAX_PIPELINE_STAGES && stages[i] ; i++) { |
MEMCPY( &pipe->stages[i], stages[i], sizeof( **stages )); |
pipe->build_state_trigger |= pipe->stages[i].check_state; |
} |
MEMSET( &pipe->stages[i], 0, sizeof( **stages )); |
pipe->nr_stages = i; |
} |
void _tnl_destroy_pipeline( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint i; |
for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) |
tnl->pipeline.stages[i].destroy( &tnl->pipeline.stages[i] ); |
tnl->pipeline.nr_stages = 0; |
} |
/* TODO: merge validate with run. |
*/ |
void _tnl_validate_pipeline( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct gl_pipeline *pipe = &tnl->pipeline; |
struct gl_pipeline_stage *s = pipe->stages; |
GLuint newstate = pipe->build_state_changes; |
GLuint generated = 0; |
GLuint changed_inputs = 0; |
pipe->inputs = 0; |
pipe->build_state_changes = 0; |
for ( ; s->check ; s++) { |
s->changed_inputs |= s->inputs & changed_inputs; |
if (s->check_state & newstate) { |
if (s->active) { |
GLuint old_outputs = s->outputs; |
s->check(ctx, s); |
if (!s->active) |
changed_inputs |= old_outputs; |
} |
else |
s->check(ctx, s); |
} |
if (s->active) { |
pipe->inputs |= s->inputs & ~generated; |
generated |= s->outputs; |
} |
} |
} |
void _tnl_run_pipeline( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
struct gl_pipeline *pipe = &tnl->pipeline; |
struct gl_pipeline_stage *s = pipe->stages; |
GLuint changed_state = pipe->run_state_changes; |
GLuint changed_inputs = pipe->run_input_changes; |
GLboolean running = GL_TRUE; |
unsigned short __tmp; |
pipe->run_state_changes = 0; |
pipe->run_input_changes = 0; |
/* Done elsewhere. |
*/ |
ASSERT(pipe->build_state_changes == 0); |
START_FAST_MATH(__tmp); |
/* If something changes in the pipeline, tag all subsequent stages |
* using this value for recalculation. Inactive stages have their |
* state and inputs examined to try to keep cached data alive over |
* state-changes. |
*/ |
for ( ; s->run ; s++) { |
s->changed_inputs |= s->inputs & changed_inputs; |
if (s->run_state & changed_state) |
s->changed_inputs = s->inputs; |
if (s->active && running) { |
if (s->changed_inputs) |
changed_inputs |= s->outputs; |
running = s->run( ctx, s ); |
s->changed_inputs = 0; |
VB->importable_data &= ~s->outputs; |
} |
} |
END_FAST_MATH(__tmp); |
} |
/* The default pipeline. This is useful for software rasterizers, and |
* simple hardware rasterizers. For customization, I don't recommend |
* tampering with the internals of these stages in the way that |
* drivers did in Mesa 3.4. These stages are basically black boxes, |
* and should be left intact. |
* |
* To customize the pipeline, consider: |
* |
* - removing redundant stages (making sure that the software rasterizer |
* can cope with this on fallback paths). An example is fog |
* coordinate generation, which is not required in the FX driver. |
* |
* - replacing general-purpose machine-independent stages with |
* general-purpose machine-specific stages. There is no example of |
* this to date, though it must be borne in mind that all subsequent |
* stages that reference the output of the new stage must cope with |
* any machine-specific data introduced. This may not be easy |
* unless there are no such stages (ie the new stage is the last in |
* the pipe). |
* |
* - inserting optimized (but specialized) stages ahead of the |
* general-purpose fallback implementation. For example, the old |
* fastpath mechanism, which only works when the VERT_BIT_ELT input is |
* available, can be duplicated by placing the fastpath stage at the |
* head of this pipeline. Such specialized stages are currently |
* constrained to have no outputs (ie. they must either finish the * |
* pipeline by returning GL_FALSE from run(), or do nothing). |
* |
* Some work can be done to lift some of the restrictions in the final |
* case, if it becomes necessary to do so. |
*/ |
const struct gl_pipeline_stage *_tnl_default_pipeline[] = { |
&_tnl_vertex_transform_stage, |
&_tnl_normal_transform_stage, |
&_tnl_lighting_stage, |
&_tnl_fog_coordinate_stage, |
&_tnl_texgen_stage, |
&_tnl_texture_transform_stage, |
&_tnl_point_attenuation_stage, |
#if FEATURE_NV_vertex_program |
&_tnl_vertex_program_stage, |
#endif |
&_tnl_render_stage, |
0 |
}; |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_array_api.c |
---|
0,0 → 1,402 |
/* $Id: t_array_api.c,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file vpexec.c |
* \brief Vertex array API functions (glDrawArrays, etc) |
* \author Keith Whitwell |
*/ |
#include "glheader.h" |
#include "api_validate.h" |
#include "context.h" |
#include "imports.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "state.h" |
#include "array_cache/acache.h" |
#include "t_array_api.h" |
#include "t_array_import.h" |
#include "t_imm_api.h" |
#include "t_imm_exec.h" |
#include "t_context.h" |
#include "t_pipeline.h" |
static void fallback_drawarrays( GLcontext *ctx, GLenum mode, GLint start, |
GLsizei count ) |
{ |
if (_tnl_hard_begin( ctx, mode )) { |
GLint i; |
for (i = start; i < count; i++) |
glArrayElement( i ); |
glEnd(); |
} |
} |
static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count, |
const GLuint *indices) |
{ |
if (_tnl_hard_begin(ctx, mode)) { |
GLint i; |
for (i = 0 ; i < count ; i++) |
glArrayElement( indices[i] ); |
glEnd(); |
} |
} |
static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, const GLuint *indices ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
FLUSH_CURRENT( ctx, 0 ); |
/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ |
if (tnl->pipeline.build_state_changes) |
_tnl_validate_pipeline( ctx ); |
_tnl_vb_bind_arrays( ctx, start, end ); |
tnl->vb.FirstPrimitive = 0; |
tnl->vb.Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; |
tnl->vb.PrimitiveLength[0] = count; |
tnl->vb.Elts = (GLuint *)indices; |
if (ctx->Array.LockCount) |
tnl->Driver.RunPipeline( ctx ); |
else { |
/* Note that arrays may have changed before/after execution. |
*/ |
tnl->pipeline.run_input_changes |= ctx->Array._Enabled; |
tnl->Driver.RunPipeline( ctx ); |
tnl->pipeline.run_input_changes |= ctx->Array._Enabled; |
} |
} |
/** |
* Called via the GL API dispatcher. |
*/ |
void |
_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) |
{ |
GET_CURRENT_CONTEXT(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(NULL, "_tnl_DrawArrays %d %d\n", start, count); |
/* Check arguments, etc. |
*/ |
if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) |
return; |
if (tnl->pipeline.build_state_changes) |
_tnl_validate_pipeline( ctx ); |
if (ctx->CompileFlag) { |
fallback_drawarrays( ctx, mode, start, start + count ); |
} |
else if (!ctx->Array.LockCount && (GLuint) count < thresh) { |
/* Small primitives: attempt to share a vb (at the expense of |
* using the immediate interface). |
*/ |
fallback_drawarrays( ctx, mode, start, start + count ); |
} |
else if (ctx->Array.LockCount && |
count < (GLint) ctx->Const.MaxArrayLockSize) { |
/* Locked primitives which can fit in a single vertex buffer: |
*/ |
FLUSH_CURRENT( ctx, 0 ); |
if (start < (GLint) ctx->Array.LockFirst) |
start = ctx->Array.LockFirst; |
if (start + count > (GLint) ctx->Array.LockCount) |
count = ctx->Array.LockCount - start; |
/* Locked drawarrays. Reuse any previously transformed data. |
*/ |
_tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); |
VB->FirstPrimitive = start; |
VB->Primitive[start] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; |
VB->PrimitiveLength[start] = count; |
tnl->Driver.RunPipeline( ctx ); |
} |
else { |
int bufsz = 256; /* Use a small buffer for cache goodness */ |
int j, nr; |
int minimum, modulo, skip; |
/* Large primitives requiring decomposition to multiple vertex |
* buffers: |
*/ |
switch (mode) { |
case GL_POINTS: |
minimum = 0; |
modulo = 1; |
skip = 0; |
case GL_LINES: |
minimum = 1; |
modulo = 2; |
skip = 1; |
case GL_LINE_STRIP: |
minimum = 1; |
modulo = 1; |
skip = 0; |
break; |
case GL_TRIANGLES: |
minimum = 2; |
modulo = 3; |
skip = 2; |
break; |
case GL_TRIANGLE_STRIP: |
minimum = 2; |
modulo = 1; |
skip = 0; |
break; |
case GL_QUADS: |
minimum = 3; |
modulo = 4; |
skip = 3; |
break; |
case GL_QUAD_STRIP: |
minimum = 3; |
modulo = 2; |
skip = 0; |
break; |
case GL_LINE_LOOP: |
case GL_TRIANGLE_FAN: |
case GL_POLYGON: |
default: |
/* Primitives requiring a copied vertex (fan-like primitives) |
* must use the slow path if they cannot fit in a single |
* vertex buffer. |
*/ |
if (count < (GLint) ctx->Const.MaxArrayLockSize) { |
bufsz = ctx->Const.MaxArrayLockSize; |
minimum = 0; |
modulo = 1; |
skip = 0; |
} |
else { |
fallback_drawarrays( ctx, mode, start, start + count ); |
return; |
} |
} |
FLUSH_CURRENT( ctx, 0 ); |
bufsz -= bufsz % modulo; |
bufsz -= minimum; |
count += start; |
for (j = start + minimum ; j < count ; j += nr + skip ) { |
nr = MIN2( bufsz, count - j ); |
_tnl_vb_bind_arrays( ctx, j - minimum, j + nr ); |
VB->FirstPrimitive = 0; |
VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; |
VB->PrimitiveLength[0] = nr + minimum; |
tnl->pipeline.run_input_changes |= ctx->Array._Enabled; |
tnl->Driver.RunPipeline( ctx ); |
tnl->pipeline.run_input_changes |= ctx->Array._Enabled; |
} |
} |
} |
/** |
* Called via the GL API dispatcher. |
*/ |
void |
_tnl_DrawRangeElements(GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, GLenum type, const GLvoid *indices) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint *ui_indices; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); |
/* Check arguments, etc. |
*/ |
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, |
type, indices )) |
return; |
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, |
count, type, indices ); |
if (ctx->CompileFlag) { |
/* Can't do anything when compiling: |
*/ |
fallback_drawelements( ctx, mode, count, ui_indices ); |
} |
else if (ctx->Array.LockCount) { |
/* Are the arrays already locked? If so we currently have to look |
* at the whole locked range. |
*/ |
if (start >= ctx->Array.LockFirst && end <= ctx->Array.LockCount) |
_tnl_draw_range_elements( ctx, mode, |
ctx->Array.LockFirst, |
ctx->Array.LockCount, |
count, ui_indices ); |
else { |
/* The spec says referencing elements outside the locked |
* range is undefined. I'm going to make it a noop this time |
* round, maybe come up with something beter before 3.6. |
* |
* May be able to get away with just setting LockCount==0, |
* though this raises the problems of dependent state. May |
* have to call glUnlockArrays() directly? |
* |
* Or scan the list and replace bad indices? |
*/ |
_mesa_problem( ctx, |
"DrawRangeElements references " |
"elements outside locked range."); |
} |
} |
else if (end + 1 - start < ctx->Const.MaxArrayLockSize) { |
/* The arrays aren't locked but we can still fit them inside a |
* single vertexbuffer. |
*/ |
_tnl_draw_range_elements( ctx, mode, start, end + 1, count, ui_indices ); |
} else { |
/* Range is too big to optimize: |
*/ |
fallback_drawelements( ctx, mode, count, ui_indices ); |
} |
} |
/** |
* Called via the GL API dispatcher. |
*/ |
void |
_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint *ui_indices; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(NULL, "_tnl_DrawElements %d\n", count); |
/* Check arguments, etc. |
*/ |
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) |
return; |
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, |
count, type, indices ); |
if (ctx->CompileFlag) { |
/* Can't do anything when compiling: |
*/ |
fallback_drawelements( ctx, mode, count, ui_indices ); |
} |
else if (ctx->Array.LockCount) { |
_tnl_draw_range_elements( ctx, mode, |
ctx->Array.LockFirst, |
ctx->Array.LockCount, |
count, ui_indices ); |
} |
else { |
/* Scan the index list and see if we can use the locked path anyway. |
*/ |
GLuint max_elt = 0; |
GLint i; |
for (i = 0 ; i < count ; i++) |
if (ui_indices[i] > max_elt) |
max_elt = ui_indices[i]; |
if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */ |
max_elt < (GLuint) count) /* do we want to use it? */ |
_tnl_draw_range_elements( ctx, mode, 0, max_elt+1, count, ui_indices ); |
else |
fallback_drawelements( ctx, mode, count, ui_indices ); |
} |
} |
/** |
* Initialize context's vertex array fields. Called during T 'n L context |
* creation. |
*/ |
void _tnl_array_init( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_arrays *tmp = &tnl->array_inputs; |
GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); |
GLuint i; |
vfmt->DrawArrays = _tnl_DrawArrays; |
vfmt->DrawElements = _tnl_DrawElements; |
vfmt->DrawRangeElements = _tnl_DrawRangeElements; |
/* Setup vector pointers that will be used to bind arrays to VB's. |
*/ |
_mesa_vector4f_init( &tmp->Obj, 0, 0 ); |
_mesa_vector4f_init( &tmp->Normal, 0, 0 ); |
_mesa_vector4f_init( &tmp->FogCoord, 0, 0 ); |
_mesa_vector1ui_init( &tmp->Index, 0, 0 ); |
_mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) |
_mesa_vector4f_init( &tmp->TexCoord[i], 0, 0); |
tnl->tmp_primitive = (GLuint *)MALLOC(sizeof(GLuint)*tnl->vb.Size); |
tnl->tmp_primitive_length = (GLuint *)MALLOC(sizeof(GLuint)*tnl->vb.Size); |
} |
/** |
* Destroy the context's vertex array stuff. |
* Called during T 'n L context destruction. |
*/ |
void _tnl_array_destroy( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
if (tnl->tmp_primitive_length) FREE(tnl->tmp_primitive_length); |
if (tnl->tmp_primitive) FREE(tnl->tmp_primitive); |
} |
/shark/tags/rel_0_4/ports/mesa/src/tnl/t_pipeline.h |
---|
0,0 → 1,76 |
/* $Id: t_pipeline.h,v 1.1 2003-02-28 11:48:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _T_PIPELINE_H_ |
#define _T_PIPELINE_H_ |
#include "mtypes.h" |
#include "t_context.h" |
extern void _tnl_run_pipeline( GLcontext *ctx ); |
extern void _tnl_validate_pipeline( GLcontext *ctx ); |
extern void _tnl_destroy_pipeline( GLcontext *ctx ); |
extern void _tnl_install_pipeline( GLcontext *ctx, |
const struct gl_pipeline_stage **stages ); |
/* These are implemented in the t_vb_*.c files: |
*/ |
extern const struct gl_pipeline_stage _tnl_vertex_transform_stage; |
extern const struct gl_pipeline_stage _tnl_normal_transform_stage; |
extern const struct gl_pipeline_stage _tnl_lighting_stage; |
extern const struct gl_pipeline_stage _tnl_fog_coordinate_stage; |
extern const struct gl_pipeline_stage _tnl_texgen_stage; |
extern const struct gl_pipeline_stage _tnl_texture_transform_stage; |
extern const struct gl_pipeline_stage _tnl_point_attenuation_stage; |
extern const struct gl_pipeline_stage _tnl_vertex_program_stage; |
extern const struct gl_pipeline_stage _tnl_render_stage; |
/* Shorthand to plug in the default pipeline: |
*/ |
extern const struct gl_pipeline_stage *_tnl_default_pipeline[]; |
/* Convenience routines provided by t_vb_render.c: |
*/ |
extern render_func _tnl_render_tab_elts[]; |
extern render_func _tnl_render_tab_verts[]; |
extern void _tnl_RenderClippedPolygon( GLcontext *ctx, |
const GLuint *elts, GLuint n ); |
extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_debug_util.h |
---|
0,0 → 1,283 |
/* $Id: m_debug_util.h,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#ifndef __M_DEBUG_UTIL_H__ |
#define __M_DEBUG_UTIL_H__ |
#ifdef DEBUG /* This code only used for debugging */ |
/* Comment this out to deactivate the cycle counter. |
* NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher) |
* (hope, you don't try to debug Mesa on a 386 ;) |
*/ |
#if defined(__GNUC__) && \ |
((defined(__i386__) && defined(USE_X86_ASM)) || \ |
(defined(__sparc__) && defined(USE_SPARC_ASM))) |
#define RUN_DEBUG_BENCHMARK |
#endif |
#define TEST_COUNT 128 /* size of the tested vector array */ |
#define REQUIRED_PRECISION 10 /* allow 4 bits to miss */ |
#define MAX_PRECISION 24 /* max. precision possible */ |
#ifdef RUN_DEBUG_BENCHMARK |
/* Overhead of profiling counter in cycles. Automatically adjusted to |
* your machine at run time - counter initialization should give very |
* consistent results. |
*/ |
extern long counter_overhead; |
/* This is the value of the environment variable MESA_PROFILE, and is |
* used to determine if we should benchmark the functions as well as |
* verify their correctness. |
*/ |
extern char *mesa_profile; |
/* Modify the the number of tests if you like. |
* We take the minimum of all results, because every error should be |
* positive (time used by other processes, task switches etc). |
* It is assumed that all calculations are done in the cache. |
*/ |
#if defined(__i386__) |
#if 1 /* PPro, PII, PIII version */ |
/* Profiling on the P6 architecture requires a little more work, due to |
* the internal out-of-order execution. We must perform a serializing |
* 'cpuid' instruction before and after the 'rdtsc' instructions to make |
* sure no other uops are executed when we sample the timestamp counter. |
*/ |
#define INIT_COUNTER() \ |
do { \ |
int cycle_i; \ |
counter_overhead = LONG_MAX; \ |
for ( cycle_i = 0 ; cycle_i < 8 ; cycle_i++ ) { \ |
long cycle_tmp1 = 0, cycle_tmp2 = 0; \ |
__asm__ __volatile__ ( "push %%ebx \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"rdtsc \n" \ |
"mov %%eax, %0 \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"pop %%ebx \n" \ |
"push %%ebx \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"rdtsc \n" \ |
"mov %%eax, %1 \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"pop %%ebx \n" \ |
: "=m" (cycle_tmp1), "=m" (cycle_tmp2) \ |
: : "eax", "ecx", "edx" ); \ |
if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \ |
counter_overhead = cycle_tmp2 - cycle_tmp1; \ |
} \ |
} \ |
} while (0) |
#define BEGIN_RACE(x) \ |
x = LONG_MAX; \ |
for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \ |
long cycle_tmp1 = 0, cycle_tmp2 = 0; \ |
__asm__ __volatile__ ( "push %%ebx \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"rdtsc \n" \ |
"mov %%eax, %0 \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"pop %%ebx \n" \ |
: "=m" (cycle_tmp1) \ |
: : "eax", "ecx", "edx" ); |
#define END_RACE(x) \ |
__asm__ __volatile__ ( "push %%ebx \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"rdtsc \n" \ |
"mov %%eax, %0 \n" \ |
"xor %%eax, %%eax \n" \ |
"cpuid \n" \ |
"pop %%ebx \n" \ |
: "=m" (cycle_tmp2) \ |
: : "eax", "ecx", "edx" ); \ |
if ( x > (cycle_tmp2 - cycle_tmp1) ) { \ |
x = cycle_tmp2 - cycle_tmp1; \ |
} \ |
} \ |
x -= counter_overhead; |
#else /* PPlain, PMMX version */ |
/* To ensure accurate results, we stall the pipelines with the |
* non-pairable 'cdq' instruction. This ensures all the code being |
* profiled is complete when the 'rdtsc' instruction executes. |
*/ |
#define INIT_COUNTER(x) \ |
do { \ |
int cycle_i; \ |
x = LONG_MAX; \ |
for ( cycle_i = 0 ; cycle_i < 32 ; cycle_i++ ) { \ |
long cycle_tmp1, cycle_tmp2, dummy; \ |
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ |
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ |
if ( x > (cycle_tmp2 - cycle_tmp1) ) \ |
x = cycle_tmp2 - cycle_tmp1; \ |
} \ |
} while (0) |
#define BEGIN_RACE(x) \ |
x = LONG_MAX; \ |
for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \ |
long cycle_tmp1, cycle_tmp2, dummy; \ |
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ |
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); |
#define END_RACE(x) \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "cdq" ); \ |
__asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ |
if ( x > (cycle_tmp2 - cycle_tmp1) ) \ |
x = cycle_tmp2 - cycle_tmp1; \ |
} \ |
x -= counter_overhead; |
#endif |
#elif defined(__sparc__) |
#define INIT_COUNTER() \ |
do { counter_overhead = 5; } while(0) |
#define BEGIN_RACE(x) \ |
x = LONG_MAX; \ |
for (cycle_i = 0; cycle_i <10; cycle_i++) { \ |
register long cycle_tmp1 asm("l0"); \ |
register long cycle_tmp2 asm("l1"); \ |
/* rd %tick, %l0 */ \ |
__asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */ |
#define END_RACE(x) \ |
/* rd %tick, %l1 */ \ |
__asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \ |
if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \ |
} \ |
x -= counter_overhead; |
#else |
#error Your processor is not supported for RUN_XFORM_BENCHMARK |
#endif |
#else |
#define BEGIN_RACE(x) |
#define END_RACE(x) |
#endif |
/* ============================================================= |
* Helper functions |
*/ |
static GLfloat rnd( void ) |
{ |
GLfloat f = (GLfloat)rand() / (GLfloat)RAND_MAX; |
GLfloat gran = (GLfloat)(1 << 13); |
f = (GLfloat)(GLint)(f * gran) / gran; |
return f * 2.0 - 1.0; |
} |
static int significand_match( GLfloat a, GLfloat b ) |
{ |
GLfloat d = a - b; |
int a_ex, b_ex, d_ex; |
if ( d == 0.0F ) { |
return MAX_PRECISION; /* Exact match */ |
} |
if ( a == 0.0F || b == 0.0F ) { |
/* It would probably be better to check if the |
* non-zero number is denormalized and return |
* the index of the highest set bit here. |
*/ |
return 0; |
} |
frexp( a, &a_ex ); |
frexp( b, &b_ex ); |
frexp( d, &d_ex ); |
if ( a_ex < b_ex ) { |
return a_ex - d_ex; |
} else { |
return b_ex - d_ex; |
} |
} |
#define NIL 0 |
#define ONE 1 |
#define NEG -1 |
#define VAR 2 |
/* Ensure our arrays are correctly aligned. |
*/ |
#if defined(__GNUC__) |
# define ALIGN16 __attribute__ ((aligned (16))) |
#elif defined(__MSC__) |
# define ALIGN16 __declspec(align(16)) /* GH: Does this work? */ |
#else |
# warning "ALIGN16 will not 16-byte align!\n" |
# define ALIGN16 |
#endif |
#endif /* DEBUG */ |
#endif /* __M_DEBUG_UTIL_H__ */ |
/shark/tags/rel_0_4/ports/mesa/src/math/m_xform.c |
---|
0,0 → 1,222 |
/* $Id: m_xform.c,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Matrix/vertex/vector transformation stuff |
* |
* |
* 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 "macros.h" |
#include "mmath.h" |
#include "m_eval.h" |
#include "m_matrix.h" |
#include "m_translate.h" |
#include "m_xform.h" |
#include "mathmod.h" |
#ifdef DEBUG |
#include "m_debug.h" |
#endif |
#ifdef USE_X86_ASM |
#include "x86/common_x86_asm.h" |
#endif |
#ifdef USE_SPARC_ASM |
#include "SPARC/sparc.h" |
#endif |
clip_func _mesa_clip_tab[5]; |
clip_func _mesa_clip_np_tab[5]; |
dotprod_func _mesa_dotprod_tab[5]; |
vec_copy_func _mesa_copy_tab[0x10]; |
normal_func _mesa_normal_tab[0xf]; |
transform_func *_mesa_transform_tab[5]; |
/* Raw data format used for: |
* - Object-to-eye transform prior to culling, although this too |
* could be culled under some circumstances. |
* - Eye-to-clip transform (via the function above). |
* - Cliptesting |
* - And everything else too, if culling happens to be disabled. |
* |
* GH: It's used for everything now, as clipping/culling is done |
* elsewhere (most often by the driver itself). |
*/ |
#define TAG(x) x |
#define TAG2(x,y) x##y |
#define STRIDE_LOOP for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) |
#define LOOP for ( i = 0 ; i < n ; i++ ) |
#define ARGS |
#include "m_xform_tmp.h" |
#include "m_clip_tmp.h" |
#include "m_norm_tmp.h" |
#include "m_dotprod_tmp.h" |
#include "m_copy_tmp.h" |
#undef TAG |
#undef TAG2 |
#undef LOOP |
#undef ARGS |
GLvector4f *_mesa_project_points( GLvector4f *proj_vec, |
const GLvector4f *clip_vec ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
const GLuint count = clip_vec->count; |
GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; |
GLuint i; |
for (i = 0 ; i < count ; i++, STRIDE_F(from, stride)) |
{ |
GLfloat oow = 1.0F / from[3]; |
vProj[i][3] = oow; |
vProj[i][0] = from[0] * oow; |
vProj[i][1] = from[1] * oow; |
vProj[i][2] = from[2] * oow; |
} |
proj_vec->flags |= VEC_SIZE_4; |
proj_vec->size = 3; |
proj_vec->count = clip_vec->count; |
return proj_vec; |
} |
/* |
* Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This |
* function is used for transforming clipping plane equations and spotlight |
* directions. |
* Mathematically, u = v * m. |
* Input: v - input vector |
* m - transformation matrix |
* Output: u - transformed vector |
*/ |
void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) |
{ |
GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3]; |
#define M(row,col) m[row + col*4] |
u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); |
u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); |
u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); |
u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); |
#undef M |
} |
/* Useful for one-off point transformations, as in clipping. |
* Note that because the matrix isn't analysed we do too many |
* multiplies, and that the result is always 4-clean. |
*/ |
void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16], |
const GLfloat P[4], GLuint sz ) |
{ |
if (Q == P) |
return; |
if (sz == 4) |
{ |
Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; |
Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; |
Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; |
Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; |
} |
else if (sz == 3) |
{ |
Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; |
Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; |
Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; |
Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; |
} |
else if (sz == 2) |
{ |
Q[0] = M[0] * P[0] + M[4] * P[1] + M[12]; |
Q[1] = M[1] * P[0] + M[5] * P[1] + M[13]; |
Q[2] = M[2] * P[0] + M[6] * P[1] + M[14]; |
Q[3] = M[3] * P[0] + M[7] * P[1] + M[15]; |
} |
else if (sz == 1) |
{ |
Q[0] = M[0] * P[0] + M[12]; |
Q[1] = M[1] * P[0] + M[13]; |
Q[2] = M[2] * P[0] + M[14]; |
Q[3] = M[3] * P[0] + M[15]; |
} |
} |
/* |
* This is called only once. It initializes several tables with pointers |
* to optimized transformation functions. This is where we can test for |
* AMD 3Dnow! capability, Intel Katmai, etc. and hook in the right code. |
*/ |
void |
_math_init_transformation( void ) |
{ |
init_c_transformations(); |
init_c_norm_transform(); |
init_c_cliptest(); |
init_copy0(); |
init_dotprod(); |
#ifdef DEBUG |
_math_test_all_transform_functions( "default" ); |
_math_test_all_normal_transform_functions( "default" ); |
_math_test_all_cliptest_functions( "default" ); |
#endif |
#ifdef USE_X86_ASM |
_mesa_init_all_x86_transform_asm(); |
#endif |
#ifdef USE_SPARC_ASM |
_mesa_init_all_sparc_transform_asm(); |
#endif |
} |
void |
_math_init( void ) |
{ |
_math_init_transformation(); |
_math_init_translate(); |
_math_init_eval(); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/mathmod.h |
---|
0,0 → 1,32 |
/* $Id: mathmod.h,v 1.1 2003-02-28 11:48:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _MESA_MATH_H_ |
#define _MESA_MATH_H_ |
extern void _math_init( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_eval.c |
---|
0,0 → 1,462 |
/* $Id: m_eval.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* eval.c was written by |
* Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and |
* Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). |
* |
* My original implementation of evaluators was simplistic and didn't |
* compute surface normal vectors properly. Bernd and Volker applied |
* used more sophisticated methods to get better results. |
* |
* Thanks guys! |
*/ |
#include "glheader.h" |
#include "config.h" |
#include "m_eval.h" |
static GLfloat inv_tab[MAX_EVAL_ORDER]; |
/* |
* Horner scheme for Bezier curves |
* |
* Bezier curves can be computed via a Horner scheme. |
* Horner is numerically less stable than the de Casteljau |
* algorithm, but it is faster. For curves of degree n |
* the complexity of Horner is O(n) and de Casteljau is O(n^2). |
* Since stability is not important for displaying curve |
* points I decided to use the Horner scheme. |
* |
* A cubic Bezier curve with control points b0, b1, b2, b3 can be |
* written as |
* |
* (([3] [3] ) [3] ) [3] |
* c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 |
* |
* [n] |
* where s=1-t and the binomial coefficients [i]. These can |
* be computed iteratively using the identity: |
* |
* [n] [n ] [n] |
* [i] = (n-i+1)/i * [i-1] and [0] = 1 |
*/ |
void |
_math_horner_bezier_curve(const GLfloat * cp, GLfloat * out, GLfloat t, |
GLuint dim, GLuint order) |
{ |
GLfloat s, powert, bincoeff; |
GLuint i, k; |
if (order >= 2) { |
bincoeff = (GLfloat) (order - 1); |
s = 1.0F - t; |
for (k = 0; k < dim; k++) |
out[k] = s * cp[k] + bincoeff * t * cp[dim + k]; |
for (i = 2, cp += 2 * dim, powert = t * t; i < order; |
i++, powert *= t, cp += dim) { |
bincoeff *= (GLfloat) (order - i); |
bincoeff *= inv_tab[i]; |
for (k = 0; k < dim; k++) |
out[k] = s * out[k] + bincoeff * powert * cp[k]; |
} |
} |
else { /* order=1 -> constant curve */ |
for (k = 0; k < dim; k++) |
out[k] = cp[k]; |
} |
} |
/* |
* Tensor product Bezier surfaces |
* |
* Again the Horner scheme is used to compute a point on a |
* TP Bezier surface. First a control polygon for a curve |
* on the surface in one parameter direction is computed, |
* then the point on the curve for the other parameter |
* direction is evaluated. |
* |
* To store the curve control polygon additional storage |
* for max(uorder,vorder) points is needed in the |
* control net cn. |
*/ |
void |
_math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v, |
GLuint dim, GLuint uorder, GLuint vorder) |
{ |
GLfloat *cp = cn + uorder * vorder * dim; |
GLuint i, uinc = vorder * dim; |
if (vorder > uorder) { |
if (uorder >= 2) { |
GLfloat s, poweru, bincoeff; |
GLuint j, k; |
/* Compute the control polygon for the surface-curve in u-direction */ |
for (j = 0; j < vorder; j++) { |
GLfloat *ucp = &cn[j * dim]; |
/* Each control point is the point for parameter u on a */ |
/* curve defined by the control polygons in u-direction */ |
bincoeff = (GLfloat) (uorder - 1); |
s = 1.0F - u; |
for (k = 0; k < dim; k++) |
cp[j * dim + k] = s * ucp[k] + bincoeff * u * ucp[uinc + k]; |
for (i = 2, ucp += 2 * uinc, poweru = u * u; i < uorder; |
i++, poweru *= u, ucp += uinc) { |
bincoeff *= (GLfloat) (uorder - i); |
bincoeff *= inv_tab[i]; |
for (k = 0; k < dim; k++) |
cp[j * dim + k] = |
s * cp[j * dim + k] + bincoeff * poweru * ucp[k]; |
} |
} |
/* Evaluate curve point in v */ |
_math_horner_bezier_curve(cp, out, v, dim, vorder); |
} |
else /* uorder=1 -> cn defines a curve in v */ |
_math_horner_bezier_curve(cn, out, v, dim, vorder); |
} |
else { /* vorder <= uorder */ |
if (vorder > 1) { |
GLuint i; |
/* Compute the control polygon for the surface-curve in u-direction */ |
for (i = 0; i < uorder; i++, cn += uinc) { |
/* For constant i all cn[i][j] (j=0..vorder) are located */ |
/* on consecutive memory locations, so we can use */ |
/* horner_bezier_curve to compute the control points */ |
_math_horner_bezier_curve(cn, &cp[i * dim], v, dim, vorder); |
} |
/* Evaluate curve point in u */ |
_math_horner_bezier_curve(cp, out, u, dim, uorder); |
} |
else /* vorder=1 -> cn defines a curve in u */ |
_math_horner_bezier_curve(cn, out, u, dim, uorder); |
} |
} |
/* |
* The direct de Casteljau algorithm is used when a point on the |
* surface and the tangent directions spanning the tangent plane |
* should be computed (this is needed to compute normals to the |
* surface). In this case the de Casteljau algorithm approach is |
* nicer because a point and the partial derivatives can be computed |
* at the same time. To get the correct tangent length du and dv |
* must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. |
* Since only the directions are needed, this scaling step is omitted. |
* |
* De Casteljau needs additional storage for uorder*vorder |
* values in the control net cn. |
*/ |
void |
_math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du, |
GLfloat * dv, GLfloat u, GLfloat v, GLuint dim, |
GLuint uorder, GLuint vorder) |
{ |
GLfloat *dcn = cn + uorder * vorder * dim; |
GLfloat us = 1.0F - u, vs = 1.0F - v; |
GLuint h, i, j, k; |
GLuint minorder = uorder < vorder ? uorder : vorder; |
GLuint uinc = vorder * dim; |
GLuint dcuinc = vorder; |
/* Each component is evaluated separately to save buffer space */ |
/* This does not drasticaly decrease the performance of the */ |
/* algorithm. If additional storage for (uorder-1)*(vorder-1) */ |
/* points would be available, the components could be accessed */ |
/* in the innermost loop which could lead to less cache misses. */ |
#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] |
#define DCN(I, J) dcn[(I)*dcuinc+(J)] |
if (minorder < 3) { |
if (uorder == vorder) { |
for (k = 0; k < dim; k++) { |
/* Derivative direction in u */ |
du[k] = vs * (CN(1, 0, k) - CN(0, 0, k)) + |
v * (CN(1, 1, k) - CN(0, 1, k)); |
/* Derivative direction in v */ |
dv[k] = us * (CN(0, 1, k) - CN(0, 0, k)) + |
u * (CN(1, 1, k) - CN(1, 0, k)); |
/* bilinear de Casteljau step */ |
out[k] = us * (vs * CN(0, 0, k) + v * CN(0, 1, k)) + |
u * (vs * CN(1, 0, k) + v * CN(1, 1, k)); |
} |
} |
else if (minorder == uorder) { |
for (k = 0; k < dim; k++) { |
/* bilinear de Casteljau step */ |
DCN(1, 0) = CN(1, 0, k) - CN(0, 0, k); |
DCN(0, 0) = us * CN(0, 0, k) + u * CN(1, 0, k); |
for (j = 0; j < vorder - 1; j++) { |
/* for the derivative in u */ |
DCN(1, j + 1) = CN(1, j + 1, k) - CN(0, j + 1, k); |
DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); |
/* for the `point' */ |
DCN(0, j + 1) = us * CN(0, j + 1, k) + u * CN(1, j + 1, k); |
DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); |
} |
/* remaining linear de Casteljau steps until the second last step */ |
for (h = minorder; h < vorder - 1; h++) |
for (j = 0; j < vorder - h; j++) { |
/* for the derivative in u */ |
DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); |
/* for the `point' */ |
DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); |
} |
/* derivative direction in v */ |
dv[k] = DCN(0, 1) - DCN(0, 0); |
/* derivative direction in u */ |
du[k] = vs * DCN(1, 0) + v * DCN(1, 1); |
/* last linear de Casteljau step */ |
out[k] = vs * DCN(0, 0) + v * DCN(0, 1); |
} |
} |
else { /* minorder == vorder */ |
for (k = 0; k < dim; k++) { |
/* bilinear de Casteljau step */ |
DCN(0, 1) = CN(0, 1, k) - CN(0, 0, k); |
DCN(0, 0) = vs * CN(0, 0, k) + v * CN(0, 1, k); |
for (i = 0; i < uorder - 1; i++) { |
/* for the derivative in v */ |
DCN(i + 1, 1) = CN(i + 1, 1, k) - CN(i + 1, 0, k); |
DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); |
/* for the `point' */ |
DCN(i + 1, 0) = vs * CN(i + 1, 0, k) + v * CN(i + 1, 1, k); |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
} |
/* remaining linear de Casteljau steps until the second last step */ |
for (h = minorder; h < uorder - 1; h++) |
for (i = 0; i < uorder - h; i++) { |
/* for the derivative in v */ |
DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); |
/* for the `point' */ |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
} |
/* derivative direction in u */ |
du[k] = DCN(1, 0) - DCN(0, 0); |
/* derivative direction in v */ |
dv[k] = us * DCN(0, 1) + u * DCN(1, 1); |
/* last linear de Casteljau step */ |
out[k] = us * DCN(0, 0) + u * DCN(1, 0); |
} |
} |
} |
else if (uorder == vorder) { |
for (k = 0; k < dim; k++) { |
/* first bilinear de Casteljau step */ |
for (i = 0; i < uorder - 1; i++) { |
DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); |
for (j = 0; j < vorder - 1; j++) { |
DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* remaining bilinear de Casteljau steps until the second last step */ |
for (h = 2; h < minorder - 1; h++) |
for (i = 0; i < uorder - h; i++) { |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
for (j = 0; j < vorder - h; j++) { |
DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* derivative direction in u */ |
du[k] = vs * (DCN(1, 0) - DCN(0, 0)) + v * (DCN(1, 1) - DCN(0, 1)); |
/* derivative direction in v */ |
dv[k] = us * (DCN(0, 1) - DCN(0, 0)) + u * (DCN(1, 1) - DCN(1, 0)); |
/* last bilinear de Casteljau step */ |
out[k] = us * (vs * DCN(0, 0) + v * DCN(0, 1)) + |
u * (vs * DCN(1, 0) + v * DCN(1, 1)); |
} |
} |
else if (minorder == uorder) { |
for (k = 0; k < dim; k++) { |
/* first bilinear de Casteljau step */ |
for (i = 0; i < uorder - 1; i++) { |
DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); |
for (j = 0; j < vorder - 1; j++) { |
DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* remaining bilinear de Casteljau steps until the second last step */ |
for (h = 2; h < minorder - 1; h++) |
for (i = 0; i < uorder - h; i++) { |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
for (j = 0; j < vorder - h; j++) { |
DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* last bilinear de Casteljau step */ |
DCN(2, 0) = DCN(1, 0) - DCN(0, 0); |
DCN(0, 0) = us * DCN(0, 0) + u * DCN(1, 0); |
for (j = 0; j < vorder - 1; j++) { |
/* for the derivative in u */ |
DCN(2, j + 1) = DCN(1, j + 1) - DCN(0, j + 1); |
DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); |
/* for the `point' */ |
DCN(0, j + 1) = us * DCN(0, j + 1) + u * DCN(1, j + 1); |
DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); |
} |
/* remaining linear de Casteljau steps until the second last step */ |
for (h = minorder; h < vorder - 1; h++) |
for (j = 0; j < vorder - h; j++) { |
/* for the derivative in u */ |
DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); |
/* for the `point' */ |
DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); |
} |
/* derivative direction in v */ |
dv[k] = DCN(0, 1) - DCN(0, 0); |
/* derivative direction in u */ |
du[k] = vs * DCN(2, 0) + v * DCN(2, 1); |
/* last linear de Casteljau step */ |
out[k] = vs * DCN(0, 0) + v * DCN(0, 1); |
} |
} |
else { /* minorder == vorder */ |
for (k = 0; k < dim; k++) { |
/* first bilinear de Casteljau step */ |
for (i = 0; i < uorder - 1; i++) { |
DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); |
for (j = 0; j < vorder - 1; j++) { |
DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* remaining bilinear de Casteljau steps until the second last step */ |
for (h = 2; h < minorder - 1; h++) |
for (i = 0; i < uorder - h; i++) { |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
for (j = 0; j < vorder - h; j++) { |
DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); |
DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); |
} |
} |
/* last bilinear de Casteljau step */ |
DCN(0, 2) = DCN(0, 1) - DCN(0, 0); |
DCN(0, 0) = vs * DCN(0, 0) + v * DCN(0, 1); |
for (i = 0; i < uorder - 1; i++) { |
/* for the derivative in v */ |
DCN(i + 1, 2) = DCN(i + 1, 1) - DCN(i + 1, 0); |
DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); |
/* for the `point' */ |
DCN(i + 1, 0) = vs * DCN(i + 1, 0) + v * DCN(i + 1, 1); |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
} |
/* remaining linear de Casteljau steps until the second last step */ |
for (h = minorder; h < uorder - 1; h++) |
for (i = 0; i < uorder - h; i++) { |
/* for the derivative in v */ |
DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); |
/* for the `point' */ |
DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); |
} |
/* derivative direction in u */ |
du[k] = DCN(1, 0) - DCN(0, 0); |
/* derivative direction in v */ |
dv[k] = us * DCN(0, 2) + u * DCN(1, 2); |
/* last linear de Casteljau step */ |
out[k] = us * DCN(0, 0) + u * DCN(1, 0); |
} |
} |
#undef DCN |
#undef CN |
} |
/* |
* Do one-time initialization for evaluators. |
*/ |
void |
_math_init_eval(void) |
{ |
GLuint i; |
/* KW: precompute 1/x for useful x. |
*/ |
for (i = 1; i < MAX_EVAL_ORDER; i++) |
inv_tab[i] = 1.0F / i; |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_debug.h |
---|
0,0 → 1,43 |
/* $Id: m_debug.h,v 1.1 2003-02-28 11:48:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#ifndef __M_DEBUG_H__ |
#define __M_DEBUG_H__ |
extern void _math_test_all_transform_functions( char *description ); |
extern void _math_test_all_normal_transform_functions( char *description ); |
extern void _math_test_all_cliptest_functions( char *description ); |
/* Deprecated? |
*/ |
extern void _math_test_all_vertex_functions( char *description ); |
extern char *mesa_profile; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_eval.h |
---|
0,0 → 1,104 |
/* $Id: m_eval.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _M_EVAL_H |
#define _M_EVAL_H |
#include "glheader.h" |
void _math_init_eval( void ); |
/* |
* Horner scheme for Bezier curves |
* |
* Bezier curves can be computed via a Horner scheme. |
* Horner is numerically less stable than the de Casteljau |
* algorithm, but it is faster. For curves of degree n |
* the complexity of Horner is O(n) and de Casteljau is O(n^2). |
* Since stability is not important for displaying curve |
* points I decided to use the Horner scheme. |
* |
* A cubic Bezier curve with control points b0, b1, b2, b3 can be |
* written as |
* |
* (([3] [3] ) [3] ) [3] |
* c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 |
* |
* [n] |
* where s=1-t and the binomial coefficients [i]. These can |
* be computed iteratively using the identity: |
* |
* [n] [n ] [n] |
* [i] = (n-i+1)/i * [i-1] and [0] = 1 |
*/ |
void |
_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, |
GLuint dim, GLuint order); |
/* |
* Tensor product Bezier surfaces |
* |
* Again the Horner scheme is used to compute a point on a |
* TP Bezier surface. First a control polygon for a curve |
* on the surface in one parameter direction is computed, |
* then the point on the curve for the other parameter |
* direction is evaluated. |
* |
* To store the curve control polygon additional storage |
* for max(uorder,vorder) points is needed in the |
* control net cn. |
*/ |
void |
_math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v, |
GLuint dim, GLuint uorder, GLuint vorder); |
/* |
* The direct de Casteljau algorithm is used when a point on the |
* surface and the tangent directions spanning the tangent plane |
* should be computed (this is needed to compute normals to the |
* surface). In this case the de Casteljau algorithm approach is |
* nicer because a point and the partial derivatives can be computed |
* at the same time. To get the correct tangent length du and dv |
* must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. |
* Since only the directions are needed, this scaling step is omitted. |
* |
* De Casteljau needs additional storage for uorder*vorder |
* values in the control net cn. |
*/ |
void |
_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, |
GLfloat u, GLfloat v, GLuint dim, |
GLuint uorder, GLuint vorder); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_translate.c |
---|
0,0 → 1,662 |
/* $Id: m_translate.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
#include "glheader.h" |
#include "mtypes.h" /* GLchan hack */ |
#include "colormac.h" |
#include "mmath.h" |
#include "m_translate.h" |
typedef void (*trans_1f_func)(GLfloat *to, |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_1ui_func)(GLuint *to, |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_1ub_func)(GLubyte *to, |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_4ub_func)(GLubyte (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_4us_func)(GLushort (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_4f_func)(GLfloat (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
typedef void (*trans_3f_func)(GLfloat (*to)[3], |
CONST void *ptr, |
GLuint stride, |
GLuint start, |
GLuint n ); |
#define TYPE_IDX(t) ((t) & 0xf) |
#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ |
/* This macro is used on other systems, so undefine it for this module */ |
#undef CHECK |
static trans_1f_func _math_trans_1f_tab[MAX_TYPES]; |
static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES]; |
static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES]; |
static trans_3f_func _math_trans_3f_tab[MAX_TYPES]; |
static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; |
static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; |
static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; |
#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) |
#define TAB(x) _math_trans##x##_tab |
#define ARGS GLuint start, GLuint n |
#define SRC_START start |
#define DST_START 0 |
#define STRIDE stride |
#define NEXT_F f += stride |
#define NEXT_F2 |
#define CHECK |
/* GL_BYTE |
*/ |
#define SRC GLbyte |
#define SRC_IDX TYPE_IDX(GL_BYTE) |
#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) |
#define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) ) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLbyte_raw |
#define DEST_4F trans_4_GLbyte_4f_raw |
#define DEST_4UB trans_4_GLbyte_4ub_raw |
#define DEST_4US trans_4_GLbyte_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLbyte_raw |
#define DEST_4F trans_3_GLbyte_4f_raw |
#define DEST_4UB trans_3_GLbyte_4ub_raw |
#define DEST_4US trans_3_GLbyte_4us_raw |
#define DEST_3F trans_3_GLbyte_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLbyte_raw |
#define DEST_4F trans_2_GLbyte_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLbyte_raw |
#define DEST_4F trans_1_GLbyte_4f_raw |
#define DEST_1UB trans_1_GLbyte_1ub_raw |
#define DEST_1UI trans_1_GLbyte_1ui_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
#undef SRC_IDX |
/* GL_UNSIGNED_BYTE |
*/ |
#define SRC GLubyte |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) |
#define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
#define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) |
#define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n)) |
#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) |
/* 4ub->4ub handled in special case below. |
*/ |
#define SZ 4 |
#define INIT init_trans_4_GLubyte_raw |
#define DEST_4F trans_4_GLubyte_4f_raw |
#define DEST_4US trans_4_GLubyte_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLubyte_raw |
#define DEST_4UB trans_3_GLubyte_4ub_raw |
#define DEST_4US trans_3_GLubyte_4us_raw |
#define DEST_3F trans_3_GLubyte_3f_raw |
#define DEST_4F trans_3_GLubyte_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLubyte_raw |
#define DEST_1UI trans_1_GLubyte_1ui_raw |
#define DEST_1UB trans_1_GLubyte_1ub_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_SHORT |
*/ |
#define SRC GLshort |
#define SRC_IDX TYPE_IDX(GL_SHORT) |
#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) |
#define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLshort_raw |
#define DEST_4F trans_4_GLshort_4f_raw |
#define DEST_4UB trans_4_GLshort_4ub_raw |
#define DEST_4US trans_4_GLshort_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLshort_raw |
#define DEST_4F trans_3_GLshort_4f_raw |
#define DEST_4UB trans_3_GLshort_4ub_raw |
#define DEST_4US trans_3_GLshort_4us_raw |
#define DEST_3F trans_3_GLshort_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLshort_raw |
#define DEST_4F trans_2_GLshort_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLshort_raw |
#define DEST_4F trans_1_GLshort_4f_raw |
#define DEST_1UB trans_1_GLshort_1ub_raw |
#define DEST_1UI trans_1_GLshort_1ui_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_UNSIGNED_SHORT |
*/ |
#define SRC GLushort |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) |
#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) |
#define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8) |
#define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLushort_raw |
#define DEST_4F trans_4_GLushort_4f_raw |
#define DEST_4UB trans_4_GLushort_4ub_raw |
#define DEST_4US trans_4_GLushort_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLushort_raw |
#define DEST_4F trans_3_GLushort_4f_raw |
#define DEST_4UB trans_3_GLushort_4ub_raw |
#define DEST_4US trans_3_GLushort_4us_raw |
#define DEST_3F trans_3_GLushort_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLushort_raw |
#define DEST_4F trans_2_GLushort_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLushort_raw |
#define DEST_4F trans_1_GLushort_4f_raw |
#define DEST_1UB trans_1_GLushort_1ub_raw |
#define DEST_1UI trans_1_GLushort_1ui_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_INT |
*/ |
#define SRC GLint |
#define SRC_IDX TYPE_IDX(GL_INT) |
#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) |
#define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) |
#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
#define SZ 4 |
#define INIT init_trans_4_GLint_raw |
#define DEST_4F trans_4_GLint_4f_raw |
#define DEST_4UB trans_4_GLint_4ub_raw |
#define DEST_4US trans_4_GLint_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLint_raw |
#define DEST_4F trans_3_GLint_4f_raw |
#define DEST_4UB trans_3_GLint_4ub_raw |
#define DEST_4US trans_3_GLint_4us_raw |
#define DEST_3F trans_3_GLint_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLint_raw |
#define DEST_4F trans_2_GLint_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLint_raw |
#define DEST_4F trans_1_GLint_4f_raw |
#define DEST_1UB trans_1_GLint_1ub_raw |
#define DEST_1UI trans_1_GLint_1ui_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_UNSIGNED_INT |
*/ |
#define SRC GLuint |
#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) |
#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) |
#define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16) |
#define TRX_UI(f,n) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLuint_raw |
#define DEST_4F trans_4_GLuint_4f_raw |
#define DEST_4UB trans_4_GLuint_4ub_raw |
#define DEST_4US trans_4_GLuint_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLuint_raw |
#define DEST_4F trans_3_GLuint_4f_raw |
#define DEST_4UB trans_3_GLuint_4ub_raw |
#define DEST_4US trans_3_GLuint_4us_raw |
#define DEST_3F trans_3_GLuint_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLuint_raw |
#define DEST_4F trans_2_GLuint_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLuint_raw |
#define DEST_4F trans_1_GLuint_4f_raw |
#define DEST_1UB trans_1_GLuint_1ub_raw |
#define DEST_1UI trans_1_GLuint_1ui_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
/* GL_DOUBLE |
*/ |
#define SRC GLdouble |
#define SRC_IDX TYPE_IDX(GL_DOUBLE) |
#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) |
#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) |
#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) |
#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) |
#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) |
#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) |
#define SZ 4 |
#define INIT init_trans_4_GLdouble_raw |
#define DEST_4F trans_4_GLdouble_4f_raw |
#define DEST_4UB trans_4_GLdouble_4ub_raw |
#define DEST_4US trans_4_GLdouble_4us_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLdouble_raw |
#define DEST_4F trans_3_GLdouble_4f_raw |
#define DEST_4UB trans_3_GLdouble_4ub_raw |
#define DEST_4US trans_3_GLdouble_4us_raw |
#define DEST_3F trans_3_GLdouble_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLdouble_raw |
#define DEST_4F trans_2_GLdouble_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLdouble_raw |
#define DEST_4F trans_1_GLdouble_4f_raw |
#define DEST_1UB trans_1_GLdouble_1ub_raw |
#define DEST_1UI trans_1_GLdouble_1ui_raw |
#define DEST_1F trans_1_GLdouble_1f_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
/* GL_FLOAT |
*/ |
#define SRC GLfloat |
#define SRC_IDX TYPE_IDX(GL_FLOAT) |
#define SZ 4 |
#define INIT init_trans_4_GLfloat_raw |
#define DEST_4UB trans_4_GLfloat_4ub_raw |
#define DEST_4US trans_4_GLfloat_4us_raw |
#define DEST_4F trans_4_GLfloat_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 3 |
#define INIT init_trans_3_GLfloat_raw |
#define DEST_4F trans_3_GLfloat_4f_raw |
#define DEST_4UB trans_3_GLfloat_4ub_raw |
#define DEST_4US trans_3_GLfloat_4us_raw |
#define DEST_3F trans_3_GLfloat_3f_raw |
#include "m_trans_tmp.h" |
#define SZ 2 |
#define INIT init_trans_2_GLfloat_raw |
#define DEST_4F trans_2_GLfloat_4f_raw |
#include "m_trans_tmp.h" |
#define SZ 1 |
#define INIT init_trans_1_GLfloat_raw |
#define DEST_4F trans_1_GLfloat_4f_raw |
#define DEST_1UB trans_1_GLfloat_1ub_raw |
#define DEST_1UI trans_1_GLfloat_1ui_raw |
#define DEST_1F trans_1_GLfloat_1f_raw |
#include "m_trans_tmp.h" |
#undef SRC |
#undef SRC_IDX |
#undef TRX_3F |
#undef TRX_4F |
#undef TRX_UB |
#undef TRX_US |
#undef TRX_UI |
static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4], |
CONST void *Ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; |
GLuint i; |
if (((((long) f | (long) stride)) & 3L) == 0L) { |
/* Aligned. |
*/ |
for (i = DST_START ; i < n ; i++, f += stride) { |
COPY_4UBV( t[i], f ); |
} |
} else { |
for (i = DST_START ; i < n ; i++, f += stride) { |
t[i][0] = f[0]; |
t[i][1] = f[1]; |
t[i][2] = f[2]; |
t[i][3] = f[3]; |
} |
} |
} |
static void init_translate_raw(void) |
{ |
MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); |
MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); |
MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); |
MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); |
MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); |
MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); |
init_trans_4_GLbyte_raw(); |
init_trans_3_GLbyte_raw(); |
init_trans_2_GLbyte_raw(); |
init_trans_1_GLbyte_raw(); |
init_trans_1_GLubyte_raw(); |
init_trans_3_GLubyte_raw(); |
init_trans_4_GLubyte_raw(); |
init_trans_4_GLshort_raw(); |
init_trans_3_GLshort_raw(); |
init_trans_2_GLshort_raw(); |
init_trans_1_GLshort_raw(); |
init_trans_4_GLushort_raw(); |
init_trans_3_GLushort_raw(); |
init_trans_2_GLushort_raw(); |
init_trans_1_GLushort_raw(); |
init_trans_4_GLint_raw(); |
init_trans_3_GLint_raw(); |
init_trans_2_GLint_raw(); |
init_trans_1_GLint_raw(); |
init_trans_4_GLuint_raw(); |
init_trans_3_GLuint_raw(); |
init_trans_2_GLuint_raw(); |
init_trans_1_GLuint_raw(); |
init_trans_4_GLdouble_raw(); |
init_trans_3_GLdouble_raw(); |
init_trans_2_GLdouble_raw(); |
init_trans_1_GLdouble_raw(); |
init_trans_4_GLfloat_raw(); |
init_trans_3_GLfloat_raw(); |
init_trans_2_GLfloat_raw(); |
init_trans_1_GLfloat_raw(); |
TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw; |
} |
#undef TAB |
#undef CLASS |
#undef ARGS |
#undef CHECK |
#undef SRC_START |
#undef DST_START |
#undef NEXT_F |
#undef NEXT_F2 |
void _math_init_translate( void ) |
{ |
init_translate_raw(); |
} |
void _math_trans_1f(GLfloat *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_1ui(GLuint *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_1ub(GLubyte *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_4ub(GLubyte (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_4chan( GLchan (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ) |
{ |
#if CHAN_TYPE == GL_UNSIGNED_BYTE |
_math_trans_4ub( to, ptr, stride, type, size, start, n ); |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
_math_trans_4us( to, ptr, stride, type, size, start, n ); |
#elif CHAN_TYPE == GL_FLOAT |
_math_trans_4f( to, ptr, stride, type, size, start, n ); |
#endif |
} |
void _math_trans_4us(GLushort (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_4f(GLfloat (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
void _math_trans_3f(GLfloat (*to)[3], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ) |
{ |
_math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_debug_clip.c |
---|
0,0 → 1,367 |
/* $Id: m_debug_clip.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "m_matrix.h" |
#include "m_xform.h" |
#include "m_debug.h" |
#include "m_debug_util.h" |
#ifdef DEBUG /* This code only used for debugging */ |
static clip_func *clip_tab[2] = { |
_mesa_clip_tab, |
_mesa_clip_np_tab |
}; |
static char *cnames[2] = { |
"_mesa_clip_tab", |
"_mesa_clip_np_tab" |
}; |
#ifdef RUN_DEBUG_BENCHMARK |
static char *cstrings[2] = { |
"clip, perspective divide", |
"clip, no divide" |
}; |
#endif |
/* ============================================================= |
* Reference cliptests |
*/ |
static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLuint c = 0; |
GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; |
GLubyte tmpAndMask = *andMask; |
GLubyte tmpOrMask = *orMask; |
GLuint i; |
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { |
const GLfloat cx = from[0]; |
const GLfloat cy = from[1]; |
const GLfloat cz = from[2]; |
const GLfloat cw = from[3]; |
GLubyte mask = 0; |
if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT; |
if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT; |
if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT; |
if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT; |
if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT; |
if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT; |
clipMask[i] = mask; |
if ( mask ) { |
c++; |
tmpAndMask &= mask; |
tmpOrMask |= mask; |
vProj[i][0] = 0; |
vProj[i][1] = 0; |
vProj[i][2] = 0; |
vProj[i][3] = 1; |
} else { |
GLfloat oow = 1.0F / cw; |
vProj[i][0] = cx * oow; |
vProj[i][1] = cy * oow; |
vProj[i][2] = cz * oow; |
vProj[i][3] = oow; |
} |
} |
*orMask = tmpOrMask; |
*andMask = (GLubyte) (c < count ? 0 : tmpAndMask); |
proj_vec->flags |= VEC_SIZE_4; |
proj_vec->size = 4; |
proj_vec->count = clip_vec->count; |
return proj_vec; |
} |
/* Keep these here for now, even though we don't use them... |
*/ |
static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLubyte tmpOrMask = *orMask; |
GLubyte tmpAndMask = *andMask; |
GLuint i; |
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { |
const GLfloat cx = from[0], cy = from[1], cz = from[2]; |
GLubyte mask = 0; |
if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; |
else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; |
if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; |
else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; |
if ( cz > 1.0 ) mask |= CLIP_FAR_BIT; |
else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT; |
clipMask[i] = mask; |
tmpOrMask |= mask; |
tmpAndMask &= mask; |
} |
*orMask = tmpOrMask; |
*andMask = tmpAndMask; |
return clip_vec; |
} |
static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLubyte tmpOrMask = *orMask; |
GLubyte tmpAndMask = *andMask; |
GLuint i; |
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { |
const GLfloat cx = from[0], cy = from[1]; |
GLubyte mask = 0; |
if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; |
else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; |
if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; |
else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; |
clipMask[i] = mask; |
tmpOrMask |= mask; |
tmpAndMask &= mask; |
} |
*orMask = tmpOrMask; |
*andMask = tmpAndMask; |
return clip_vec; |
} |
static clip_func ref_cliptest[5] = { |
0, |
0, |
ref_cliptest_points2, |
ref_cliptest_points3, |
ref_cliptest_points4 |
}; |
/* ============================================================= |
* Cliptest tests |
*/ |
static GLfloat s[TEST_COUNT][4] ALIGN16; |
static GLfloat d[TEST_COUNT][4] ALIGN16; |
static GLfloat r[TEST_COUNT][4] ALIGN16; |
static int test_cliptest_function( clip_func func, int np, |
int psize, long *cycles ) |
{ |
GLvector4f source[1], dest[1], ref[1]; |
GLubyte dm[TEST_COUNT], dco, dca; |
GLubyte rm[TEST_COUNT], rco, rca; |
int i, j; |
#ifdef RUN_DEBUG_BENCHMARK |
int cycle_i; /* the counter for the benchmarks we run */ |
#endif |
(void) cycles; |
if ( psize > 4 ) { |
_mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" ); |
return 0; |
} |
for ( i = 0 ; i < TEST_COUNT ; i++) { |
ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); |
ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); |
for ( j = 0 ; j < psize ; j++ ) |
s[i][j] = rnd(); |
} |
source->data = (GLfloat(*)[4])s; |
source->start = (GLfloat *)s; |
source->count = TEST_COUNT; |
source->stride = sizeof(s[0]); |
source->size = 4; |
source->flags = 0; |
dest->data = (GLfloat(*)[4])d; |
dest->start = (GLfloat *)d; |
dest->count = TEST_COUNT; |
dest->stride = sizeof(float[4]); |
dest->size = 0; |
dest->flags = 0; |
ref->data = (GLfloat(*)[4])r; |
ref->start = (GLfloat *)r; |
ref->count = TEST_COUNT; |
ref->stride = sizeof(float[4]); |
ref->size = 0; |
ref->flags = 0; |
dco = rco = 0; |
dca = rca = CLIP_ALL_BITS; |
ref_cliptest[psize]( source, ref, rm, &rco, &rca ); |
if ( mesa_profile ) { |
BEGIN_RACE( *cycles ); |
func( source, dest, dm, &dco, &dca ); |
END_RACE( *cycles ); |
} |
else { |
func( source, dest, dm, &dco, &dca ); |
} |
if ( dco != rco ) { |
_mesa_printf(NULL, "\n-----------------------------\n" ); |
_mesa_printf(NULL, "dco = 0x%02x rco = 0x%02x\n", dco, rco ); |
return 0; |
} |
if ( dca != rca ) { |
_mesa_printf(NULL, "\n-----------------------------\n" ); |
_mesa_printf(NULL, "dca = 0x%02x rca = 0x%02x\n", dca, rca ); |
return 0; |
} |
for ( i = 0 ; i < TEST_COUNT ; i++ ) { |
if ( dm[i] != rm[i] ) { |
_mesa_printf(NULL, "\n-----------------------------\n" ); |
_mesa_printf(NULL, "(i = %i)\n", i ); |
_mesa_printf(NULL, "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); |
return 0; |
} |
} |
/* Only verify output on projected points4 case. FIXME: Do we need |
* to test other cases? |
*/ |
if ( np || psize < 4 ) |
return 1; |
for ( i = 0 ; i < TEST_COUNT ; i++ ) { |
for ( j = 0 ; j < 4 ; j++ ) { |
if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { |
_mesa_printf(NULL, "\n-----------------------------\n" ); |
_mesa_printf(NULL, "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", |
i, j, dm[i], rm[i] ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][0], r[i][0], r[i][0]-d[i][0], |
MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][1], r[i][1], r[i][1]-d[i][1], |
MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][2], r[i][2], r[i][2]-d[i][2], |
MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][3], r[i][3], r[i][3]-d[i][3], |
MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); |
return 0; |
} |
} |
} |
return 1; |
} |
void _math_test_all_cliptest_functions( char *description ) |
{ |
int np, psize; |
long benchmark_tab[2][4]; |
static int first_time = 1; |
if ( first_time ) { |
first_time = 0; |
mesa_profile = _mesa_getenv( "MESA_PROFILE" ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
if ( !counter_overhead ) { |
INIT_COUNTER(); |
_mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); |
} |
_mesa_printf(NULL, "cliptest results after hooking in %s functions:\n", description ); |
} |
#endif |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
_mesa_printf(NULL, "\n\t" ); |
for ( psize = 2 ; psize <= 4 ; psize++ ) { |
_mesa_printf(NULL, " p%d\t", psize ); |
} |
_mesa_printf(NULL, "\n--------------------------------------------------------\n\t" ); |
} |
#endif |
for ( np = 0 ; np < 2 ; np++ ) { |
for ( psize = 2 ; psize <= 4 ; psize++ ) { |
clip_func func = clip_tab[np][psize]; |
long *cycles = &(benchmark_tab[np][psize-1]); |
if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { |
char buf[100]; |
_mesa_sprintf(NULL, buf, "%s[%d] failed test (%s)", |
cnames[np], psize, description ); |
_mesa_problem( NULL, buf ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, " %li\t", benchmark_tab[np][psize-1] ); |
#endif |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, " | [%s]\n\t", cstrings[np] ); |
#endif |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, "\n" ); |
#endif |
} |
#endif /* DEBUG */ |
/shark/tags/rel_0_4/ports/mesa/src/math/m_copy_tmp.h |
---|
0,0 → 1,87 |
/* $Id: m_copy_tmp.h,v 1.1 2003-02-28 11:48:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
#define COPY_FUNC( BITS ) \ |
static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ |
{ \ |
GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ |
GLfloat *from = f->start; \ |
GLuint stride = f->stride; \ |
GLuint count = f->count; \ |
GLuint i; \ |
\ |
if (BITS) \ |
STRIDE_LOOP { \ |
if (BITS&1) t[i][0] = from[0]; \ |
if (BITS&2) t[i][1] = from[1]; \ |
if (BITS&4) t[i][2] = from[2]; \ |
if (BITS&8) t[i][3] = from[3]; \ |
} \ |
} |
/* We got them all here: |
*/ |
COPY_FUNC( 0x0 ) /* noop */ |
COPY_FUNC( 0x1 ) |
COPY_FUNC( 0x2 ) |
COPY_FUNC( 0x3 ) |
COPY_FUNC( 0x4 ) |
COPY_FUNC( 0x5 ) |
COPY_FUNC( 0x6 ) |
COPY_FUNC( 0x7 ) |
COPY_FUNC( 0x8 ) |
COPY_FUNC( 0x9 ) |
COPY_FUNC( 0xa ) |
COPY_FUNC( 0xb ) |
COPY_FUNC( 0xc ) |
COPY_FUNC( 0xd ) |
COPY_FUNC( 0xe ) |
COPY_FUNC( 0xf ) |
static void TAG2(init_copy, 0)( void ) |
{ |
_mesa_copy_tab[0x0] = TAG2(copy, 0x0); |
_mesa_copy_tab[0x1] = TAG2(copy, 0x1); |
_mesa_copy_tab[0x2] = TAG2(copy, 0x2); |
_mesa_copy_tab[0x3] = TAG2(copy, 0x3); |
_mesa_copy_tab[0x4] = TAG2(copy, 0x4); |
_mesa_copy_tab[0x5] = TAG2(copy, 0x5); |
_mesa_copy_tab[0x6] = TAG2(copy, 0x6); |
_mesa_copy_tab[0x7] = TAG2(copy, 0x7); |
_mesa_copy_tab[0x8] = TAG2(copy, 0x8); |
_mesa_copy_tab[0x9] = TAG2(copy, 0x9); |
_mesa_copy_tab[0xa] = TAG2(copy, 0xa); |
_mesa_copy_tab[0xb] = TAG2(copy, 0xb); |
_mesa_copy_tab[0xc] = TAG2(copy, 0xc); |
_mesa_copy_tab[0xd] = TAG2(copy, 0xd); |
_mesa_copy_tab[0xe] = TAG2(copy, 0xe); |
_mesa_copy_tab[0xf] = TAG2(copy, 0xf); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_norm_tmp.h |
---|
0,0 → 1,391 |
/* $Id: m_norm_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
/* Functions to tranform a vector of normals. This includes applying |
* the transformation matrix, rescaling and normalization. |
*/ |
/* |
* mat - the 4x4 transformation matrix |
* scale - uniform scale factor of the transformation matrix (not always used) |
* in - the source vector of normals |
* lengths - length of each incoming normal (may be NULL) (a display list |
* optimization) |
* dest - the destination vector of normals |
*/ |
static void _XFORMAPI |
TAG(transform_normalize_normals)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
const GLfloat *m = mat->inv; |
GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; |
GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; |
GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; |
GLuint i; |
if (!lengths) { |
STRIDE_LOOP { |
GLfloat tx, ty, tz; |
{ |
const GLfloat ux = from[0], uy = from[1], uz = from[2]; |
tx = ux * m0 + uy * m1 + uz * m2; |
ty = ux * m4 + uy * m5 + uz * m6; |
tz = ux * m8 + uy * m9 + uz * m10; |
} |
{ |
GLdouble len = tx*tx + ty*ty + tz*tz; |
if (len > 1e-20) { |
GLdouble scale = 1.0 / GL_SQRT(len); |
out[i][0] = (GLfloat) (tx * scale); |
out[i][1] = (GLfloat) (ty * scale); |
out[i][2] = (GLfloat) (tz * scale); |
} |
else { |
out[i][0] = out[i][1] = out[i][2] = 0; |
} |
} |
} |
} |
else { |
if (scale != 1.0) { |
m0 *= scale, m4 *= scale, m8 *= scale; |
m1 *= scale, m5 *= scale, m9 *= scale; |
m2 *= scale, m6 *= scale, m10 *= scale; |
} |
STRIDE_LOOP { |
GLfloat tx, ty, tz; |
{ |
const GLfloat ux = from[0], uy = from[1], uz = from[2]; |
tx = ux * m0 + uy * m1 + uz * m2; |
ty = ux * m4 + uy * m5 + uz * m6; |
tz = ux * m8 + uy * m9 + uz * m10; |
} |
{ |
GLfloat len = lengths[i]; |
out[i][0] = tx * len; |
out[i][1] = ty * len; |
out[i][2] = tz * len; |
} |
} |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
const GLfloat *m = mat->inv; |
GLfloat m0 = m[0]; |
GLfloat m5 = m[5]; |
GLfloat m10 = m[10]; |
GLuint i; |
if (!lengths) { |
STRIDE_LOOP { |
GLfloat tx, ty, tz; |
{ |
const GLfloat ux = from[0], uy = from[1], uz = from[2]; |
tx = ux * m0 ; |
ty = uy * m5 ; |
tz = uz * m10; |
} |
{ |
GLdouble len = tx*tx + ty*ty + tz*tz; |
if (len > 1e-20) { |
GLdouble scale = 1.0 / GL_SQRT(len); |
out[i][0] = (GLfloat) (tx * scale); |
out[i][1] = (GLfloat) (ty * scale); |
out[i][2] = (GLfloat) (tz * scale); |
} |
else { |
out[i][0] = out[i][1] = out[i][2] = 0; |
} |
} |
} |
} |
else { |
m0 *= scale; |
m5 *= scale; |
m10 *= scale; |
STRIDE_LOOP { |
GLfloat tx, ty, tz; |
{ |
const GLfloat ux = from[0], uy = from[1], uz = from[2]; |
tx = ux * m0 ; |
ty = uy * m5 ; |
tz = uz * m10; |
} |
{ |
GLfloat len = lengths[i]; |
out[i][0] = tx * len; |
out[i][1] = ty * len; |
out[i][2] = tz * len; |
} |
} |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
const GLfloat *m = mat->inv; |
const GLfloat m0 = scale*m[0]; |
const GLfloat m5 = scale*m[5]; |
const GLfloat m10 = scale*m[10]; |
GLuint i; |
(void) lengths; |
STRIDE_LOOP { |
GLfloat ux = from[0], uy = from[1], uz = from[2]; |
out[i][0] = ux * m0; |
out[i][1] = uy * m5; |
out[i][2] = uz * m10; |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(transform_rescale_normals)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
/* Since we are unlikely to have < 3 vertices in the buffer, |
* it makes sense to pre-multiply by scale. |
*/ |
const GLfloat *m = mat->inv; |
const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; |
const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; |
const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; |
GLuint i; |
(void) lengths; |
STRIDE_LOOP { |
GLfloat ux = from[0], uy = from[1], uz = from[2]; |
out[i][0] = ux * m0 + uy * m1 + uz * m2; |
out[i][1] = ux * m4 + uy * m5 + uz * m6; |
out[i][2] = ux * m8 + uy * m9 + uz * m10; |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(transform_normals_no_rot)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
const GLfloat *m = mat->inv; |
const GLfloat m0 = m[0]; |
const GLfloat m5 = m[5]; |
const GLfloat m10 = m[10]; |
GLuint i; |
(void) scale; |
(void) lengths; |
STRIDE_LOOP { |
GLfloat ux = from[0], uy = from[1], uz = from[2]; |
out[i][0] = ux * m0; |
out[i][1] = uy * m5; |
out[i][2] = uz * m10; |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(transform_normals)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
const GLfloat *m = mat->inv; |
const GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; |
const GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; |
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; |
GLuint i; |
(void) scale; |
(void) lengths; |
STRIDE_LOOP { |
GLfloat ux = from[0], uy = from[1], uz = from[2]; |
out[i][0] = ux * m0 + uy * m1 + uz * m2; |
out[i][1] = ux * m4 + uy * m5 + uz * m6; |
out[i][2] = ux * m8 + uy * m9 + uz * m10; |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(normalize_normals)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
GLuint i; |
(void) mat; |
(void) scale; |
if (lengths) { |
STRIDE_LOOP { |
const GLfloat x = from[0], y = from[1], z = from[2]; |
GLfloat invlen = lengths[i]; |
out[i][0] = x * invlen; |
out[i][1] = y * invlen; |
out[i][2] = z * invlen; |
} |
} |
else { |
STRIDE_LOOP { |
const GLfloat x = from[0], y = from[1], z = from[2]; |
GLdouble len = x * x + y * y + z * z; |
if (len > 1e-50) { |
len = 1.0 / GL_SQRT(len); |
out[i][0] = (GLfloat) (x * len); |
out[i][1] = (GLfloat) (y * len); |
out[i][2] = (GLfloat) (z * len); |
} |
else { |
out[i][0] = x; |
out[i][1] = y; |
out[i][2] = z; |
} |
} |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(rescale_normals)( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; |
const GLfloat *from = in->start; |
const GLuint stride = in->stride; |
const GLuint count = in->count; |
GLuint i; |
(void) mat; |
(void) lengths; |
STRIDE_LOOP { |
SCALE_SCALAR_3V( out[i], scale, from ); |
} |
dest->count = in->count; |
} |
static void _XFORMAPI |
TAG(init_c_norm_transform)( void ) |
{ |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = |
TAG(transform_normals_no_rot); |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = |
TAG(transform_rescale_normals_no_rot); |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = |
TAG(transform_normalize_normals_no_rot); |
_mesa_normal_tab[NORM_TRANSFORM] = |
TAG(transform_normals); |
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = |
TAG(transform_rescale_normals); |
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = |
TAG(transform_normalize_normals); |
_mesa_normal_tab[NORM_RESCALE] = |
TAG(rescale_normals); |
_mesa_normal_tab[NORM_NORMALIZE] = |
TAG(normalize_normals); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_dotprod_tmp.h |
---|
0,0 → 1,103 |
/* $Id: m_dotprod_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
/* Note - respects the stride of the output vector. |
*/ |
static void TAG(dotprod_vec2)( GLfloat *out, |
GLuint outstride, |
const GLvector4f *coord_vec, |
const GLfloat plane[4] ) |
{ |
GLuint stride = coord_vec->stride; |
GLfloat *coord = coord_vec->start; |
GLuint count = coord_vec->count; |
GLuint i; |
const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; |
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { |
*out = (coord[0] * plane0 + |
coord[1] * plane1 + |
plane3); |
} |
} |
static void TAG(dotprod_vec3)( GLfloat *out, |
GLuint outstride, |
const GLvector4f *coord_vec, |
const GLfloat plane[4] ) |
{ |
GLuint stride = coord_vec->stride; |
GLfloat *coord = coord_vec->start; |
GLuint count = coord_vec->count; |
GLuint i; |
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; |
const GLfloat plane3 = plane[3]; |
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { |
*out = (coord[0] * plane0 + |
coord[1] * plane1 + |
coord[2] * plane2 + |
plane3); |
} |
} |
static void TAG(dotprod_vec4)( GLfloat *out, |
GLuint outstride, |
const GLvector4f *coord_vec, |
const GLfloat plane[4] ) |
{ |
GLuint stride = coord_vec->stride; |
GLfloat *coord = coord_vec->start; |
GLuint count = coord_vec->count; |
GLuint i; |
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; |
const GLfloat plane3 = plane[3]; |
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { |
*out = (coord[0] * plane0 + |
coord[1] * plane1 + |
coord[2] * plane2 + |
coord[3] * plane3); |
} |
} |
static void TAG(init_dotprod)( void ) |
{ |
_mesa_dotprod_tab[2] = TAG(dotprod_vec2); |
_mesa_dotprod_tab[3] = TAG(dotprod_vec3); |
_mesa_dotprod_tab[4] = TAG(dotprod_vec4); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_xform.h |
---|
0,0 → 1,217 |
/* $Id: m_xform.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _M_XFORM_H |
#define _M_XFORM_H |
#include "glheader.h" |
#include "config.h" |
#include "math/m_vector.h" |
#include "math/m_matrix.h" |
#ifdef USE_X86_ASM |
#define _XFORMAPI _ASMAPI |
#define _XFORMAPIP _ASMAPIP |
#else |
#define _XFORMAPI |
#define _XFORMAPIP * |
#endif |
/* |
* Transform a point (column vector) by a matrix: Q = M * P |
*/ |
#define TRANSFORM_POINT( Q, M, P ) \ |
Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; \ |
Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; \ |
Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; \ |
Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; |
#define TRANSFORM_POINT3( Q, M, P ) \ |
Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; \ |
Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; \ |
Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; \ |
Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; |
/* |
* Transform a normal (row vector) by a matrix: [NX NY NZ] = N * MAT |
*/ |
#define TRANSFORM_NORMAL( TO, N, MAT ) \ |
do { \ |
TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2]; \ |
TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6]; \ |
TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10]; \ |
} while (0) |
extern void _mesa_transform_vector( GLfloat u[4], |
CONST GLfloat v[4], |
CONST GLfloat m[16] ); |
extern void |
_math_init_transformation( void ); |
/* KW: Clip functions now do projective divide as well. The projected |
* coordinates are very useful to us because they let us cull |
* backfaces and eliminate vertices from lighting, fogging, etc |
* calculations. Despite the fact that this divide could be done one |
* day in hardware, we would still have a reason to want to do it here |
* as long as those other calculations remain in software. |
* |
* Clipping is a convenient place to do the divide on x86 as it should be |
* possible to overlap with integer outcode calculations. |
* |
* There are two cases where we wouldn't want to do the divide in cliptest: |
* - When we aren't clipping. We still might want to cull backfaces |
* so the divide should be done elsewhere. This currently never |
* happens. |
* |
* - When culling isn't likely to help us, such as when the GL culling |
* is disabled and we not lighting or are only lighting |
* one-sided. In this situation, backface determination provides |
* us with no useful information. A tricky case to detect is when |
* all input data is already culled, although hopefully the |
* application wouldn't turn on culling in such cases. |
* |
* We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which |
* are the result of the projection. This is only used in the |
* 4-vector case - in other cases, we just use the clip coordinates |
* as the projected coordinates - they are identical. |
* |
* This is doubly convenient because it means the Win[] array is now |
* of the same stride as all the others, so I can now turn map_vertices |
* into a straight-forward matrix transformation, with asm acceleration |
* automatically available. |
*/ |
/* Vertex buffer clipping flags |
*/ |
#define CLIP_RIGHT_SHIFT 0 |
#define CLIP_LEFT_SHIFT 1 |
#define CLIP_TOP_SHIFT 2 |
#define CLIP_BOTTOM_SHIFT 3 |
#define CLIP_NEAR_SHIFT 4 |
#define CLIP_FAR_SHIFT 5 |
#define CLIP_RIGHT_BIT 0x01 |
#define CLIP_LEFT_BIT 0x02 |
#define CLIP_TOP_BIT 0x04 |
#define CLIP_BOTTOM_BIT 0x08 |
#define CLIP_NEAR_BIT 0x10 |
#define CLIP_FAR_BIT 0x20 |
#define CLIP_USER_BIT 0x40 |
#define CLIP_ALL_BITS 0x3f |
typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, |
GLvector4f *vProj, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ); |
typedef void (*dotprod_func)( GLfloat *out, |
GLuint out_stride, |
CONST GLvector4f *coord_vec, |
CONST GLfloat plane[4] ); |
typedef void (*vec_copy_func)( GLvector4f *to, |
CONST GLvector4f *from ); |
/* |
* Functions for transformation of normals in the VB. |
*/ |
typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, |
GLfloat scale, |
CONST GLvector4f *in, |
CONST GLfloat lengths[], |
GLvector4f *dest ); |
/* Flags for selecting a normal transformation function. |
*/ |
#define NORM_RESCALE 0x1 /* apply the scale factor */ |
#define NORM_NORMALIZE 0x2 /* normalize */ |
#define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ |
#define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ |
/* KW: New versions of the transform function allow a mask array |
* specifying that individual vector transform should be skipped |
* when the mask byte is zero. This is always present as a |
* parameter, to allow a unified interface. |
*/ |
typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, |
CONST GLfloat m[16], |
CONST GLvector4f *from_vec ); |
extern GLvector4f *_mesa_project_points( GLvector4f *to, |
CONST GLvector4f *from ); |
extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask, |
CONST GLfloat m[16], |
CONST GLfloat src[][3] ); |
extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, |
CONST GLfloat m[16], |
CONST GLfloat src[][3] ); |
extern dotprod_func _mesa_dotprod_tab[5]; |
extern vec_copy_func _mesa_copy_tab[0x10]; |
extern vec_copy_func _mesa_copy_clean_tab[5]; |
extern clip_func _mesa_clip_tab[5]; |
extern clip_func _mesa_clip_np_tab[5]; |
extern normal_func _mesa_normal_tab[0xf]; |
/* Use of 2 layers of linked 1-dimensional arrays to reduce |
* cost of lookup. |
*/ |
extern transform_func *_mesa_transform_tab[5]; |
extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], |
CONST GLfloat P[4], GLuint sz ); |
#define TransformRaw( to, mat, from ) \ |
( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ |
(to) ) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_debug_xform.c |
---|
0,0 → 1,335 |
/* $Id: m_debug_xform.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Updated for P6 architecture by Gareth Hughes. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "m_matrix.h" |
#include "m_xform.h" |
#include "m_debug.h" |
#include "m_debug_util.h" |
#ifdef DEBUG /* This code only used for debugging */ |
/* Overhead of profiling counter in cycles. Automatically adjusted to |
* your machine at run time - counter initialization should give very |
* consistent results. |
*/ |
long counter_overhead = 0; |
/* This is the value of the environment variable MESA_PROFILE, and is |
* used to determine if we should benchmark the functions as well as |
* verify their correctness. |
*/ |
char *mesa_profile = NULL; |
static int m_general[16] = { |
VAR, VAR, VAR, VAR, |
VAR, VAR, VAR, VAR, |
VAR, VAR, VAR, VAR, |
VAR, VAR, VAR, VAR |
}; |
static int m_identity[16] = { |
ONE, NIL, NIL, NIL, |
NIL, ONE, NIL, NIL, |
NIL, NIL, ONE, NIL, |
NIL, NIL, NIL, ONE |
}; |
static int m_2d[16] = { |
VAR, VAR, NIL, VAR, |
VAR, VAR, NIL, VAR, |
NIL, NIL, ONE, NIL, |
NIL, NIL, NIL, ONE |
}; |
static int m_2d_no_rot[16] = { |
VAR, NIL, NIL, VAR, |
NIL, VAR, NIL, VAR, |
NIL, NIL, ONE, NIL, |
NIL, NIL, NIL, ONE |
}; |
static int m_3d[16] = { |
VAR, VAR, VAR, VAR, |
VAR, VAR, VAR, VAR, |
VAR, VAR, VAR, VAR, |
NIL, NIL, NIL, ONE |
}; |
static int m_3d_no_rot[16] = { |
VAR, NIL, NIL, VAR, |
NIL, VAR, NIL, VAR, |
NIL, NIL, VAR, VAR, |
NIL, NIL, NIL, ONE |
}; |
static int m_perspective[16] = { |
VAR, NIL, VAR, NIL, |
NIL, VAR, VAR, NIL, |
NIL, NIL, VAR, VAR, |
NIL, NIL, NEG, NIL |
}; |
static int *templates[7] = { |
m_general, |
m_identity, |
m_3d_no_rot, |
m_perspective, |
m_2d, |
m_2d_no_rot, |
m_3d |
}; |
static int mtypes[7] = { |
MATRIX_GENERAL, |
MATRIX_IDENTITY, |
MATRIX_3D_NO_ROT, |
MATRIX_PERSPECTIVE, |
MATRIX_2D, |
MATRIX_2D_NO_ROT, |
MATRIX_3D |
}; |
static char *mstrings[7] = { |
"MATRIX_GENERAL", |
"MATRIX_IDENTITY", |
"MATRIX_3D_NO_ROT", |
"MATRIX_PERSPECTIVE", |
"MATRIX_2D", |
"MATRIX_2D_NO_ROT", |
"MATRIX_3D" |
}; |
/* ============================================================= |
* Reference transformations |
*/ |
static void ref_transform( GLvector4f *dst, |
const GLmatrix *mat, |
const GLvector4f *src ) |
{ |
GLuint i; |
GLfloat *s = (GLfloat *)src->start; |
GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; |
const GLfloat *m = mat->m; |
for ( i = 0 ; i < src->count ; i++ ) { |
TRANSFORM_POINT( d[i], m, s ); |
s = (GLfloat *)((char *)s + src->stride); |
} |
} |
/* ============================================================= |
* Vertex transformation tests |
*/ |
static void init_matrix( GLfloat *m ) |
{ |
m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; |
m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; |
m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; |
m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; |
} |
static GLfloat s[TEST_COUNT][4] ALIGN16; |
static GLfloat d[TEST_COUNT][4] ALIGN16; |
static GLfloat r[TEST_COUNT][4] ALIGN16; |
static int test_transform_function( transform_func func, int psize, |
int mtype, long *cycles ) |
{ |
GLvector4f source[1], dest[1], ref[1]; |
GLmatrix mat[1]; |
GLfloat *m; |
int i, j; |
#ifdef RUN_DEBUG_BENCHMARK |
int cycle_i; /* the counter for the benchmarks we run */ |
#endif |
(void) cycles; |
if ( psize > 4 ) { |
_mesa_problem( NULL, "test_transform_function called with psize > 4\n" ); |
return 0; |
} |
mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); |
mat->type = mtypes[mtype]; |
m = mat->m; |
ASSERT( ((GLuint)m & 15) == 0 ); |
init_matrix( m ); |
for ( i = 0 ; i < 4 ; i++ ) { |
for ( j = 0 ; j < 4 ; j++ ) { |
switch ( templates[mtype][i * 4 + j] ) { |
case NIL: |
m[j * 4 + i] = 0.0; |
break; |
case ONE: |
m[j * 4 + i] = 1.0; |
break; |
case NEG: |
m[j * 4 + i] = -1.0; |
break; |
case VAR: |
break; |
default: |
abort(); |
} |
} |
} |
for ( i = 0 ; i < TEST_COUNT ; i++) { |
ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); |
ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); |
for ( j = 0 ; j < psize ; j++ ) |
s[i][j] = rnd(); |
} |
source->data = (GLfloat(*)[4])s; |
source->start = (GLfloat *)s; |
source->count = TEST_COUNT; |
source->stride = sizeof(s[0]); |
source->size = 4; |
source->flags = 0; |
dest->data = (GLfloat(*)[4])d; |
dest->start = (GLfloat *)d; |
dest->count = TEST_COUNT; |
dest->stride = sizeof(float[4]); |
dest->size = 0; |
dest->flags = 0; |
ref->data = (GLfloat(*)[4])r; |
ref->start = (GLfloat *)r; |
ref->count = TEST_COUNT; |
ref->stride = sizeof(float[4]); |
ref->size = 0; |
ref->flags = 0; |
ref_transform( ref, mat, source ); |
if ( mesa_profile ) { |
BEGIN_RACE( *cycles ); |
func( dest, mat->m, source ); |
END_RACE( *cycles ); |
} |
else { |
func( dest, mat->m, source ); |
} |
for ( i = 0 ; i < TEST_COUNT ; i++ ) { |
for ( j = 0 ; j < 4 ; j++ ) { |
if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { |
_mesa_printf(NULL, "-----------------------------\n" ); |
_mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][0], r[i][0], r[i][0]-d[i][0], |
MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][1], r[i][1], r[i][1]-d[i][1], |
MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][2], r[i][2], r[i][2]-d[i][2], |
MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); |
_mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", |
d[i][3], r[i][3], r[i][3]-d[i][3], |
MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); |
return 0; |
} |
} |
} |
ALIGN_FREE( mat->m ); |
return 1; |
} |
void _math_test_all_transform_functions( char *description ) |
{ |
int psize, mtype; |
long benchmark_tab[4][7]; |
static int first_time = 1; |
if ( first_time ) { |
first_time = 0; |
mesa_profile = getenv( "MESA_PROFILE" ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
if ( !counter_overhead ) { |
INIT_COUNTER(); |
_mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); |
} |
_mesa_printf(NULL, "transform results after hooking in %s functions:\n", description ); |
} |
#endif |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
_mesa_printf(NULL, "\n" ); |
for ( psize = 1 ; psize <= 4 ; psize++ ) { |
_mesa_printf(NULL, " p%d\t", psize ); |
} |
_mesa_printf(NULL, "\n--------------------------------------------------------\n" ); |
} |
#endif |
for ( mtype = 0 ; mtype < 7 ; mtype++ ) { |
for ( psize = 1 ; psize <= 4 ; psize++ ) { |
transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; |
long *cycles = &(benchmark_tab[psize-1][mtype]); |
if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { |
char buf[100]; |
_mesa_sprintf(NULL, buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", |
psize, mstrings[mtype], description ); |
_mesa_problem( NULL, buf ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, " %li\t", benchmark_tab[psize-1][mtype] ); |
#endif |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, " | [%s]\n", mstrings[mtype] ); |
#endif |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) |
_mesa_printf(NULL, "\n" ); |
#endif |
} |
#endif /* DEBUG */ |
/shark/tags/rel_0_4/ports/mesa/src/math/m_vector.c |
---|
0,0 → 1,430 |
/* $Id: m_vector.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "macros.h" |
#include "imports.h" |
#include "m_vector.h" |
/* |
* Given a vector [count][4] of floats, set all the [][elt] values |
* to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). |
*/ |
void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) |
{ |
static const GLubyte elem_bits[4] = { |
VEC_DIRTY_0, |
VEC_DIRTY_1, |
VEC_DIRTY_2, |
VEC_DIRTY_3 |
}; |
static const GLfloat clean[4] = { 0, 0, 0, 1 }; |
const GLfloat v = clean[elt]; |
GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; |
GLuint i; |
for (i = 0 ; i < count ; i++) |
data[i][elt] = v; |
vec->flags &= ~elem_bits[elt]; |
} |
static const GLubyte size_bits[5] = { |
0, |
VEC_SIZE_1, |
VEC_SIZE_2, |
VEC_SIZE_3, |
VEC_SIZE_4, |
}; |
/* |
* Initialize GLvector objects. |
* Input: v - the vector object to initialize. |
* flags - bitwise-OR of VEC_* flags |
* storage - pointer to storage for the vector's data |
*/ |
void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) |
{ |
v->stride = 4 * sizeof(GLfloat); |
v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ |
v->data = storage; |
v->start = (GLfloat *) storage; |
v->count = 0; |
v->flags = size_bits[4] | flags ; |
} |
void _mesa_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) |
{ |
v->stride = 3 * sizeof(GLfloat); |
v->data = storage; |
v->start = (GLfloat *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) |
{ |
v->stride = 1*sizeof(GLfloat); |
v->data = storage; |
v->start = (GLfloat *)storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) |
{ |
v->stride = 4 * sizeof(GLubyte); |
v->data = storage; |
v->start = (GLubyte *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector4chan_init( GLvector4chan *v, GLuint flags, GLchan (*storage)[4] ) |
{ |
v->stride = 4 * sizeof(GLchan); |
v->data = storage; |
v->start = (GLchan *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector4us_init( GLvector4us *v, GLuint flags, GLushort (*storage)[4] ) |
{ |
v->stride = 4 * sizeof(GLushort); |
v->data = storage; |
v->start = (GLushort *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) |
{ |
v->stride = 1 * sizeof(GLubyte); |
v->data = storage; |
v->start = (GLubyte *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
void _mesa_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) |
{ |
v->stride = 1 * sizeof(GLuint); |
v->data = storage; |
v->start = (GLuint *) storage; |
v->count = 0; |
v->flags = flags ; |
} |
/* |
* Initialize GLvector objects and allocate storage. |
* Input: v - the vector object |
* sz - unused???? |
* flags - bitwise-OR of VEC_* flags |
* count - number of elements to allocate in vector |
* alignment - desired memory alignment for the data (in bytes) |
*/ |
void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 4 * sizeof(GLfloat); |
v->size = 2; |
v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment ); |
v->start = (GLfloat *) v->storage; |
v->data = (GLfloat (*)[4]) v->storage; |
v->count = 0; |
v->flags = size_bits[4] | flags | VEC_MALLOC ; |
} |
void _mesa_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 3 * sizeof(GLfloat); |
v->storage = ALIGN_MALLOC( count * 3 * sizeof(GLfloat), alignment ); |
v->start = (GLfloat *) v->storage; |
v->data = (GLfloat (*)[3]) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = sizeof(GLfloat); |
v->storage = v->start = (GLfloat *) |
ALIGN_MALLOC( count * sizeof(GLfloat), alignment ); |
v->data = v->start; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 4 * sizeof(GLubyte); |
v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLubyte), alignment ); |
v->start = (GLubyte *) v->storage; |
v->data = (GLubyte (*)[4]) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 4 * sizeof(GLchan); |
v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLchan), alignment ); |
v->start = (GLchan *) v->storage; |
v->data = (GLchan (*)[4]) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 4 * sizeof(GLushort); |
v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLushort), alignment ); |
v->start = (GLushort *) v->storage; |
v->data = (GLushort (*)[4]) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 1 * sizeof(GLubyte); |
v->storage = ALIGN_MALLOC( count * sizeof(GLubyte), alignment ); |
v->start = (GLubyte *) v->storage; |
v->data = (GLubyte *) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
void _mesa_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, |
GLuint alignment ) |
{ |
v->stride = 1 * sizeof(GLuint); |
v->storage = ALIGN_MALLOC( count * sizeof(GLuint), alignment ); |
v->start = (GLuint *) v->storage; |
v->data = (GLuint *) v->storage; |
v->count = 0; |
v->flags = flags | VEC_MALLOC ; |
} |
/* |
* Vector deallocation. Free whatever memory is pointed to by the |
* vector's storage field if the VEC_MALLOC flag is set. |
* DO NOT free the GLvector object itself, though. |
*/ |
void _mesa_vector4f_free( GLvector4f *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector3f_free( GLvector3f *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = 0; |
v->start = 0; |
v->storage = 0; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector1f_free( GLvector1f *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector4ub_free( GLvector4ub *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector4chan_free( GLvector4chan *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector4us_free( GLvector4us *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector1ub_free( GLvector1ub *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
void _mesa_vector1ui_free( GLvector1ui *v ) |
{ |
if (v->flags & VEC_MALLOC) { |
ALIGN_FREE( v->storage ); |
v->data = NULL; |
v->start = NULL; |
v->storage = NULL; |
v->flags &= ~VEC_MALLOC; |
} |
} |
/* |
* For debugging |
*/ |
void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) |
{ |
GLfloat c[4] = { 0, 0, 0, 1 }; |
const char *templates[5] = { |
"%d:\t0, 0, 0, 1\n", |
"%d:\t%f, 0, 0, 1\n", |
"%d:\t%f, %f, 0, 1\n", |
"%d:\t%f, %f, %f, 1\n", |
"%d:\t%f, %f, %f, %f\n" |
}; |
const char *t = templates[v->size]; |
GLfloat *d = (GLfloat *)v->data; |
GLuint j, i = 0, count; |
_mesa_printf(NULL, "data-start\n"); |
for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) |
_mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); |
_mesa_printf(NULL, "start-count(%u)\n", v->count); |
count = i + v->count; |
if (culling) { |
for ( ; i < count ; STRIDE_F(d, v->stride), i++) |
if (cullmask[i]) |
_mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); |
} |
else { |
for ( ; i < count ; STRIDE_F(d, v->stride), i++) |
_mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); |
} |
for (j = v->size ; j < 4; j++) { |
if ((v->flags & (1<<j)) == 0) { |
_mesa_printf(NULL, "checking col %u is clean as advertised ", j); |
for (i = 0, d = (GLfloat *) v->data ; |
i < count && d[j] == c[j] ; |
i++, STRIDE_F(d, v->stride)) {}; |
if (i == count) |
_mesa_printf(NULL, " --> ok\n"); |
else |
_mesa_printf(NULL, " --> Failed at %u ******\n", i); |
} |
} |
} |
/* |
* For debugging |
*/ |
void _mesa_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling ) |
{ |
GLfloat *d = (GLfloat *)v->data; |
GLuint i = 0, count; |
_mesa_printf(NULL, "data-start\n"); |
for ( ; d != v->start ; STRIDE_F(d,v->stride), i++) |
_mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); |
_mesa_printf(NULL, "start-count(%u)\n", v->count); |
count = i + v->count; |
if (culling) { |
for ( ; i < count ; STRIDE_F(d,v->stride), i++) |
if (cullmask[i]) |
_mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); |
} |
else { |
for ( ; i < count ; STRIDE_F(d,v->stride), i++) |
_mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_translate.h |
---|
0,0 → 1,99 |
/* $Id: m_translate.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _M_TRANSLATE_H_ |
#define _M_TRANSLATE_H_ |
#include "config.h" |
#include "mtypes.h" /* hack for GLchan */ |
extern void _math_trans_1f(GLfloat *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ); |
extern void _math_trans_1ui(GLuint *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ); |
extern void _math_trans_1ub(GLubyte *to, |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ); |
extern void _math_trans_4ub(GLubyte (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ); |
extern void _math_trans_4chan( GLchan (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ); |
extern void _math_trans_4us(GLushort (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ); |
extern void _math_trans_4f(GLfloat (*to)[4], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint size, |
GLuint start, |
GLuint n ); |
extern void _math_trans_3f(GLfloat (*to)[3], |
CONST void *ptr, |
GLuint stride, |
GLenum type, |
GLuint start, |
GLuint n ); |
extern void _math_init_translate( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_matrix.c |
---|
0,0 → 1,1181 |
/* $Id: m_matrix.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* 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" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "m_matrix.h" |
static const char *types[] = { |
"MATRIX_GENERAL", |
"MATRIX_IDENTITY", |
"MATRIX_3D_NO_ROT", |
"MATRIX_PERSPECTIVE", |
"MATRIX_2D", |
"MATRIX_2D_NO_ROT", |
"MATRIX_3D" |
}; |
static GLfloat Identity[16] = { |
1.0, 0.0, 0.0, 0.0, |
0.0, 1.0, 0.0, 0.0, |
0.0, 0.0, 1.0, 0.0, |
0.0, 0.0, 0.0, 1.0 |
}; |
/* |
* 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] |
static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) |
{ |
GLint i; |
for (i = 0; i < 4; i++) { |
const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); |
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); |
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); |
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); |
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); |
} |
} |
/* Multiply two matrices known to occupy only the top three rows, such |
* as typical model matrices, and ortho matrices. |
*/ |
static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) |
{ |
GLint i; |
for (i = 0; i < 3; i++) { |
const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); |
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); |
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); |
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); |
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; |
} |
P(3,0) = 0; |
P(3,1) = 0; |
P(3,2) = 0; |
P(3,3) = 1; |
} |
#undef A |
#undef B |
#undef P |
/* |
* Multiply a matrix by an array of floats with known properties. |
*/ |
static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags ) |
{ |
mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); |
if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) |
matmul34( mat->m, mat->m, m ); |
else |
matmul4( mat->m, mat->m, m ); |
} |
static void print_matrix_floats( const GLfloat m[16] ) |
{ |
int i; |
for (i=0;i<4;i++) { |
_mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); |
} |
} |
void |
_math_matrix_print( const GLmatrix *m ) |
{ |
_mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); |
print_matrix_floats(m->m); |
_mesa_debug(NULL, "Inverse: \n"); |
if (m->inv) { |
GLfloat prod[16]; |
print_matrix_floats(m->inv); |
matmul4(prod, m->m, m->inv); |
_mesa_debug(NULL, "Mat * Inverse:\n"); |
print_matrix_floats(prod); |
} |
else { |
_mesa_debug(NULL, " - not available\n"); |
} |
} |
#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } |
#define MAT(m,r,c) (m)[(c)*4+(r)] |
/* |
* Compute inverse of 4x4 transformation matrix. |
* Code contributed by Jacques Leroy jle@star.be |
* Return GL_TRUE for success, GL_FALSE for failure (singular matrix) |
*/ |
static GLboolean invert_matrix_general( GLmatrix *mat ) |
{ |
const GLfloat *m = mat->m; |
GLfloat *out = mat->inv; |
GLfloat wtmp[4][8]; |
GLfloat m0, m1, m2, m3, s; |
GLfloat *r0, *r1, *r2, *r3; |
r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; |
r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1), |
r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3), |
r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, |
r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1), |
r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3), |
r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, |
r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1), |
r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3), |
r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, |
r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1), |
r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3), |
r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; |
/* choose pivot - or die */ |
if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2); |
if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1); |
if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0); |
if (0.0 == r0[0]) return GL_FALSE; |
/* eliminate first variable */ |
m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; |
s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; |
s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; |
s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; |
s = r0[4]; |
if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } |
s = r0[5]; |
if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } |
s = r0[6]; |
if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } |
s = r0[7]; |
if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } |
/* choose pivot - or die */ |
if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2); |
if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1); |
if (0.0 == r1[1]) return GL_FALSE; |
/* eliminate second variable */ |
m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1]; |
r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; |
r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; |
s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } |
s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } |
s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } |
s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } |
/* choose pivot - or die */ |
if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2); |
if (0.0 == r2[2]) return GL_FALSE; |
/* eliminate third variable */ |
m3 = r3[2]/r2[2]; |
r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], |
r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], |
r3[7] -= m3 * r2[7]; |
/* last check */ |
if (0.0 == r3[3]) return GL_FALSE; |
s = 1.0F/r3[3]; /* now back substitute row 3 */ |
r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; |
m2 = r2[3]; /* now back substitute row 2 */ |
s = 1.0F/r2[2]; |
r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), |
r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); |
m1 = r1[3]; |
r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, |
r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; |
m0 = r0[3]; |
r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, |
r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; |
m1 = r1[2]; /* now back substitute row 1 */ |
s = 1.0F/r1[1]; |
r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), |
r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); |
m0 = r0[2]; |
r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, |
r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; |
m0 = r0[1]; /* now back substitute row 0 */ |
s = 1.0F/r0[0]; |
r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), |
r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); |
MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5], |
MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7], |
MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5], |
MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7], |
MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5], |
MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7], |
MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5], |
MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7]; |
return GL_TRUE; |
} |
#undef SWAP_ROWS |
/* Adapted from graphics gems II. |
*/ |
static GLboolean invert_matrix_3d_general( GLmatrix *mat ) |
{ |
const GLfloat *in = mat->m; |
GLfloat *out = mat->inv; |
GLfloat pos, neg, t; |
GLfloat det; |
/* Calculate the determinant of upper left 3x3 submatrix and |
* determine if the matrix is singular. |
*/ |
pos = neg = 0.0; |
t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2); |
if (t >= 0.0) pos += t; else neg += t; |
t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2); |
if (t >= 0.0) pos += t; else neg += t; |
t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2); |
if (t >= 0.0) pos += t; else neg += t; |
t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2); |
if (t >= 0.0) pos += t; else neg += t; |
t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2); |
if (t >= 0.0) pos += t; else neg += t; |
t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2); |
if (t >= 0.0) pos += t; else neg += t; |
det = pos + neg; |
if (det*det < 1e-25) |
return GL_FALSE; |
det = 1.0F / det; |
MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det); |
MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det); |
MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det); |
MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det); |
MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det); |
MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det); |
MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det); |
MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det); |
MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det); |
/* Do the translation part */ |
MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + |
MAT(in,1,3) * MAT(out,0,1) + |
MAT(in,2,3) * MAT(out,0,2) ); |
MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + |
MAT(in,1,3) * MAT(out,1,1) + |
MAT(in,2,3) * MAT(out,1,2) ); |
MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + |
MAT(in,1,3) * MAT(out,2,1) + |
MAT(in,2,3) * MAT(out,2,2) ); |
return GL_TRUE; |
} |
static GLboolean invert_matrix_3d( GLmatrix *mat ) |
{ |
const GLfloat *in = mat->m; |
GLfloat *out = mat->inv; |
if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) { |
return invert_matrix_3d_general( mat ); |
} |
if (mat->flags & MAT_FLAG_UNIFORM_SCALE) { |
GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) + |
MAT(in,0,1) * MAT(in,0,1) + |
MAT(in,0,2) * MAT(in,0,2)); |
if (scale == 0.0) |
return GL_FALSE; |
scale = 1.0F / scale; |
/* Transpose and scale the 3 by 3 upper-left submatrix. */ |
MAT(out,0,0) = scale * MAT(in,0,0); |
MAT(out,1,0) = scale * MAT(in,0,1); |
MAT(out,2,0) = scale * MAT(in,0,2); |
MAT(out,0,1) = scale * MAT(in,1,0); |
MAT(out,1,1) = scale * MAT(in,1,1); |
MAT(out,2,1) = scale * MAT(in,1,2); |
MAT(out,0,2) = scale * MAT(in,2,0); |
MAT(out,1,2) = scale * MAT(in,2,1); |
MAT(out,2,2) = scale * MAT(in,2,2); |
} |
else if (mat->flags & MAT_FLAG_ROTATION) { |
/* Transpose the 3 by 3 upper-left submatrix. */ |
MAT(out,0,0) = MAT(in,0,0); |
MAT(out,1,0) = MAT(in,0,1); |
MAT(out,2,0) = MAT(in,0,2); |
MAT(out,0,1) = MAT(in,1,0); |
MAT(out,1,1) = MAT(in,1,1); |
MAT(out,2,1) = MAT(in,1,2); |
MAT(out,0,2) = MAT(in,2,0); |
MAT(out,1,2) = MAT(in,2,1); |
MAT(out,2,2) = MAT(in,2,2); |
} |
else { |
/* pure translation */ |
MEMCPY( out, Identity, sizeof(Identity) ); |
MAT(out,0,3) = - MAT(in,0,3); |
MAT(out,1,3) = - MAT(in,1,3); |
MAT(out,2,3) = - MAT(in,2,3); |
return GL_TRUE; |
} |
if (mat->flags & MAT_FLAG_TRANSLATION) { |
/* Do the translation part */ |
MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + |
MAT(in,1,3) * MAT(out,0,1) + |
MAT(in,2,3) * MAT(out,0,2) ); |
MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + |
MAT(in,1,3) * MAT(out,1,1) + |
MAT(in,2,3) * MAT(out,1,2) ); |
MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + |
MAT(in,1,3) * MAT(out,2,1) + |
MAT(in,2,3) * MAT(out,2,2) ); |
} |
else { |
MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0; |
} |
return GL_TRUE; |
} |
static GLboolean invert_matrix_identity( GLmatrix *mat ) |
{ |
MEMCPY( mat->inv, Identity, sizeof(Identity) ); |
return GL_TRUE; |
} |
static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat ) |
{ |
const GLfloat *in = mat->m; |
GLfloat *out = mat->inv; |
if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 ) |
return GL_FALSE; |
MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); |
MAT(out,0,0) = 1.0F / MAT(in,0,0); |
MAT(out,1,1) = 1.0F / MAT(in,1,1); |
MAT(out,2,2) = 1.0F / MAT(in,2,2); |
if (mat->flags & MAT_FLAG_TRANSLATION) { |
MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); |
MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); |
MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2)); |
} |
return GL_TRUE; |
} |
static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) |
{ |
const GLfloat *in = mat->m; |
GLfloat *out = mat->inv; |
if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0) |
return GL_FALSE; |
MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); |
MAT(out,0,0) = 1.0F / MAT(in,0,0); |
MAT(out,1,1) = 1.0F / MAT(in,1,1); |
if (mat->flags & MAT_FLAG_TRANSLATION) { |
MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); |
MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); |
} |
return GL_TRUE; |
} |
#if 0 |
/* broken */ |
static GLboolean invert_matrix_perspective( GLmatrix *mat ) |
{ |
const GLfloat *in = mat->m; |
GLfloat *out = mat->inv; |
if (MAT(in,2,3) == 0) |
return GL_FALSE; |
MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); |
MAT(out,0,0) = 1.0F / MAT(in,0,0); |
MAT(out,1,1) = 1.0F / MAT(in,1,1); |
MAT(out,0,3) = MAT(in,0,2); |
MAT(out,1,3) = MAT(in,1,2); |
MAT(out,2,2) = 0; |
MAT(out,2,3) = -1; |
MAT(out,3,2) = 1.0F / MAT(in,2,3); |
MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2); |
return GL_TRUE; |
} |
#endif |
typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); |
static inv_mat_func inv_mat_tab[7] = { |
invert_matrix_general, |
invert_matrix_identity, |
invert_matrix_3d_no_rot, |
#if 0 |
/* Don't use this function for now - it fails when the projection matrix |
* is premultiplied by a translation (ala Chromium's tilesort SPU). |
*/ |
invert_matrix_perspective, |
#else |
invert_matrix_general, |
#endif |
invert_matrix_3d, /* lazy! */ |
invert_matrix_2d_no_rot, |
invert_matrix_3d |
}; |
static GLboolean matrix_invert( GLmatrix *mat ) |
{ |
if (inv_mat_tab[mat->type](mat)) { |
mat->flags &= ~MAT_FLAG_SINGULAR; |
return GL_TRUE; |
} else { |
mat->flags |= MAT_FLAG_SINGULAR; |
MEMCPY( mat->inv, Identity, sizeof(Identity) ); |
return GL_FALSE; |
} |
} |
/* |
* 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). |
*/ |
void |
_math_matrix_rotate( GLmatrix *mat, |
GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) |
{ |
GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; |
GLfloat m[16]; |
GLboolean optimized; |
s = (GLfloat) sin( angle * DEG2RAD ); |
c = (GLfloat) cos( angle * DEG2RAD ); |
MEMCPY(m, Identity, sizeof(GLfloat)*16); |
optimized = GL_FALSE; |
#define M(row,col) m[col*4+row] |
if (x == 0.0F) { |
if (y == 0.0F) { |
if (z != 0.0F) { |
optimized = GL_TRUE; |
/* rotate only around z-axis */ |
M(0,0) = c; |
M(1,1) = c; |
if (z < 0.0F) { |
M(0,1) = s; |
M(1,0) = -s; |
} |
else { |
M(0,1) = -s; |
M(1,0) = s; |
} |
} |
} |
else if (z == 0.0F) { |
optimized = GL_TRUE; |
/* rotate only around y-axis */ |
M(0,0) = c; |
M(2,2) = c; |
if (y < 0.0F) { |
M(0,2) = -s; |
M(2,0) = s; |
} |
else { |
M(0,2) = s; |
M(2,0) = -s; |
} |
} |
} |
else if (y == 0.0F) { |
if (z == 0.0F) { |
optimized = GL_TRUE; |
/* rotate only around x-axis */ |
M(1,1) = c; |
M(2,2) = c; |
if (y < 0.0F) { |
M(1,2) = s; |
M(2,1) = -s; |
} |
else { |
M(1,2) = -s; |
M(2,1) = s; |
} |
} |
} |
if (!optimized) { |
const GLfloat mag = (GLfloat) GL_SQRT(x * x + y * y + z * z); |
if (mag <= 1.0e-4) { |
/* no rotation, leave mat as-is */ |
return; |
} |
x /= mag; |
y /= mag; |
z /= mag; |
/* |
* Arbitrary axis rotation matrix. |
* |
* This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied |
* like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation |
* (which is about the X-axis), and the two composite transforms |
* Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary |
* from the arbitrary axis to the X-axis then back. They are |
* all elementary rotations. |
* |
* Rz' is a rotation about the Z-axis, to bring the axis vector |
* into the x-z plane. Then Ry' is applied, rotating about the |
* Y-axis to bring the axis vector parallel with the X-axis. The |
* rotation about the X-axis is then performed. Ry and Rz are |
* simply the respective inverse transforms to bring the arbitrary |
* axis back to it's original orientation. The first transforms |
* Rz' and Ry' are considered inverses, since the data from the |
* arbitrary axis gives you info on how to get to it, not how |
* to get away from it, and an inverse must be applied. |
* |
* The basic calculation used is to recognize that the arbitrary |
* axis vector (x, y, z), since it is of unit length, actually |
* represents the sines and cosines of the angles to rotate the |
* X-axis to the same orientation, with theta being the angle about |
* Z and phi the angle about Y (in the order described above) |
* as follows: |
* |
* cos ( theta ) = x / sqrt ( 1 - z^2 ) |
* sin ( theta ) = y / sqrt ( 1 - z^2 ) |
* |
* cos ( phi ) = sqrt ( 1 - z^2 ) |
* sin ( phi ) = z |
* |
* Note that cos ( phi ) can further be inserted to the above |
* formulas: |
* |
* cos ( theta ) = x / cos ( phi ) |
* sin ( theta ) = y / sin ( phi ) |
* |
* ...etc. Because of those relations and the standard trigonometric |
* relations, it is pssible to reduce the transforms down to what |
* is used below. It may be that any primary axis chosen will give the |
* same results (modulo a sign convention) using thie method. |
* |
* Particularly nice is to notice that all divisions that might |
* have caused trouble when parallel to certain planes or |
* axis go away with care paid to reducing the expressions. |
* After checking, it does perform correctly under all cases, since |
* in all the cases of division where the denominator would have |
* been zero, the numerator would have been zero as well, giving |
* the expected result. |
*/ |
xx = x * x; |
yy = y * y; |
zz = z * z; |
xy = x * y; |
yz = y * z; |
zx = z * x; |
xs = x * s; |
ys = y * s; |
zs = z * s; |
one_c = 1.0F - c; |
/* We already hold the identity-matrix so we can skip some statements */ |
M(0,0) = (one_c * xx) + c; |
M(0,1) = (one_c * xy) - zs; |
M(0,2) = (one_c * zx) + ys; |
/* M(0,3) = 0.0F; */ |
M(1,0) = (one_c * xy) + zs; |
M(1,1) = (one_c * yy) + c; |
M(1,2) = (one_c * yz) - xs; |
/* M(1,3) = 0.0F; */ |
M(2,0) = (one_c * zx) - ys; |
M(2,1) = (one_c * yz) + xs; |
M(2,2) = (one_c * zz) + c; |
/* M(2,3) = 0.0F; */ |
/* |
M(3,0) = 0.0F; |
M(3,1) = 0.0F; |
M(3,2) = 0.0F; |
M(3,3) = 1.0F; |
*/ |
} |
#undef M |
matrix_multf( mat, m, MAT_FLAG_ROTATION ); |
} |
void |
_math_matrix_frustum( GLmatrix *mat, |
GLfloat left, GLfloat right, |
GLfloat bottom, GLfloat top, |
GLfloat nearval, GLfloat farval ) |
{ |
GLfloat x, y, a, b, c, d; |
GLfloat m[16]; |
x = (2.0F*nearval) / (right-left); |
y = (2.0F*nearval) / (top-bottom); |
a = (right+left) / (right-left); |
b = (top+bottom) / (top-bottom); |
c = -(farval+nearval) / ( farval-nearval); |
d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ |
#define M(row,col) m[col*4+row] |
M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; |
M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; |
M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; |
M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; |
#undef M |
matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); |
} |
void |
_math_matrix_ortho( GLmatrix *mat, |
GLfloat left, GLfloat right, |
GLfloat bottom, GLfloat top, |
GLfloat nearval, GLfloat farval ) |
{ |
GLfloat x, y, z; |
GLfloat tx, ty, tz; |
GLfloat m[16]; |
x = 2.0F / (right-left); |
y = 2.0F / (top-bottom); |
z = -2.0F / (farval-nearval); |
tx = -(right+left) / (right-left); |
ty = -(top+bottom) / (top-bottom); |
tz = -(farval+nearval) / (farval-nearval); |
#define M(row,col) m[col*4+row] |
M(0,0) = x; M(0,1) = 0.0F; M(0,2) = 0.0F; M(0,3) = tx; |
M(1,0) = 0.0F; M(1,1) = y; M(1,2) = 0.0F; M(1,3) = ty; |
M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = z; M(2,3) = tz; |
M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = 0.0F; M(3,3) = 1.0F; |
#undef M |
matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION)); |
} |
#define ZERO(x) (1<<x) |
#define ONE(x) (1<<(x+16)) |
#define MASK_NO_TRX (ZERO(12) | ZERO(13) | ZERO(14)) |
#define MASK_NO_2D_SCALE ( ONE(0) | ONE(5)) |
#define MASK_IDENTITY ( ONE(0) | ZERO(4) | ZERO(8) | ZERO(12) |\ |
ZERO(1) | ONE(5) | ZERO(9) | ZERO(13) |\ |
ZERO(2) | ZERO(6) | ONE(10) | ZERO(14) |\ |
ZERO(3) | ZERO(7) | ZERO(11) | ONE(15) ) |
#define MASK_2D_NO_ROT ( ZERO(4) | ZERO(8) | \ |
ZERO(1) | ZERO(9) | \ |
ZERO(2) | ZERO(6) | ONE(10) | ZERO(14) |\ |
ZERO(3) | ZERO(7) | ZERO(11) | ONE(15) ) |
#define MASK_2D ( ZERO(8) | \ |
ZERO(9) | \ |
ZERO(2) | ZERO(6) | ONE(10) | ZERO(14) |\ |
ZERO(3) | ZERO(7) | ZERO(11) | ONE(15) ) |
#define MASK_3D_NO_ROT ( ZERO(4) | ZERO(8) | \ |
ZERO(1) | ZERO(9) | \ |
ZERO(2) | ZERO(6) | \ |
ZERO(3) | ZERO(7) | ZERO(11) | ONE(15) ) |
#define MASK_3D ( \ |
\ |
\ |
ZERO(3) | ZERO(7) | ZERO(11) | ONE(15) ) |
#define MASK_PERSPECTIVE ( ZERO(4) | ZERO(12) |\ |
ZERO(1) | ZERO(13) |\ |
ZERO(2) | ZERO(6) | \ |
ZERO(3) | ZERO(7) | ZERO(15) ) |
#define SQ(x) ((x)*(x)) |
/* Determine type and flags from scratch. This is expensive enough to |
* only want to do it once. |
*/ |
static void analyse_from_scratch( GLmatrix *mat ) |
{ |
const GLfloat *m = mat->m; |
GLuint mask = 0; |
GLuint i; |
for (i = 0 ; i < 16 ; i++) { |
if (m[i] == 0.0) mask |= (1<<i); |
} |
if (m[0] == 1.0F) mask |= (1<<16); |
if (m[5] == 1.0F) mask |= (1<<21); |
if (m[10] == 1.0F) mask |= (1<<26); |
if (m[15] == 1.0F) mask |= (1<<31); |
mat->flags &= ~MAT_FLAGS_GEOMETRY; |
/* Check for translation - no-one really cares |
*/ |
if ((mask & MASK_NO_TRX) != MASK_NO_TRX) |
mat->flags |= MAT_FLAG_TRANSLATION; |
/* Do the real work |
*/ |
if (mask == (GLuint) MASK_IDENTITY) { |
mat->type = MATRIX_IDENTITY; |
} |
else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) { |
mat->type = MATRIX_2D_NO_ROT; |
if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) |
mat->flags = MAT_FLAG_GENERAL_SCALE; |
} |
else if ((mask & MASK_2D) == (GLuint) MASK_2D) { |
GLfloat mm = DOT2(m, m); |
GLfloat m4m4 = DOT2(m+4,m+4); |
GLfloat mm4 = DOT2(m,m+4); |
mat->type = MATRIX_2D; |
/* Check for scale */ |
if (SQ(mm-1) > SQ(1e-6) || |
SQ(m4m4-1) > SQ(1e-6)) |
mat->flags |= MAT_FLAG_GENERAL_SCALE; |
/* Check for rotation */ |
if (SQ(mm4) > SQ(1e-6)) |
mat->flags |= MAT_FLAG_GENERAL_3D; |
else |
mat->flags |= MAT_FLAG_ROTATION; |
} |
else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) { |
mat->type = MATRIX_3D_NO_ROT; |
/* Check for scale */ |
if (SQ(m[0]-m[5]) < SQ(1e-6) && |
SQ(m[0]-m[10]) < SQ(1e-6)) { |
if (SQ(m[0]-1.0) > SQ(1e-6)) { |
mat->flags |= MAT_FLAG_UNIFORM_SCALE; |
} |
} |
else { |
mat->flags |= MAT_FLAG_GENERAL_SCALE; |
} |
} |
else if ((mask & MASK_3D) == (GLuint) MASK_3D) { |
GLfloat c1 = DOT3(m,m); |
GLfloat c2 = DOT3(m+4,m+4); |
GLfloat c3 = DOT3(m+8,m+8); |
GLfloat d1 = DOT3(m, m+4); |
GLfloat cp[3]; |
mat->type = MATRIX_3D; |
/* Check for scale */ |
if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) { |
if (SQ(c1-1.0) > SQ(1e-6)) |
mat->flags |= MAT_FLAG_UNIFORM_SCALE; |
/* else no scale at all */ |
} |
else { |
mat->flags |= MAT_FLAG_GENERAL_SCALE; |
} |
/* Check for rotation */ |
if (SQ(d1) < SQ(1e-6)) { |
CROSS3( cp, m, m+4 ); |
SUB_3V( cp, cp, (m+8) ); |
if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) |
mat->flags |= MAT_FLAG_ROTATION; |
else |
mat->flags |= MAT_FLAG_GENERAL_3D; |
} |
else { |
mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ |
} |
} |
else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) { |
mat->type = MATRIX_PERSPECTIVE; |
mat->flags |= MAT_FLAG_GENERAL; |
} |
else { |
mat->type = MATRIX_GENERAL; |
mat->flags |= MAT_FLAG_GENERAL; |
} |
} |
/* Analyse a matrix given that its flags are accurate - this is the |
* more common operation, hopefully. |
*/ |
static void analyse_from_flags( GLmatrix *mat ) |
{ |
const GLfloat *m = mat->m; |
if (TEST_MAT_FLAGS(mat, 0)) { |
mat->type = MATRIX_IDENTITY; |
} |
else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION | |
MAT_FLAG_UNIFORM_SCALE | |
MAT_FLAG_GENERAL_SCALE))) { |
if ( m[10]==1.0F && m[14]==0.0F ) { |
mat->type = MATRIX_2D_NO_ROT; |
} |
else { |
mat->type = MATRIX_3D_NO_ROT; |
} |
} |
else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) { |
if ( m[ 8]==0.0F |
&& m[ 9]==0.0F |
&& m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) { |
mat->type = MATRIX_2D; |
} |
else { |
mat->type = MATRIX_3D; |
} |
} |
else if ( m[4]==0.0F && m[12]==0.0F |
&& m[1]==0.0F && m[13]==0.0F |
&& m[2]==0.0F && m[6]==0.0F |
&& m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) { |
mat->type = MATRIX_PERSPECTIVE; |
} |
else { |
mat->type = MATRIX_GENERAL; |
} |
} |
void |
_math_matrix_analyse( GLmatrix *mat ) |
{ |
if (mat->flags & MAT_DIRTY_TYPE) { |
if (mat->flags & MAT_DIRTY_FLAGS) |
analyse_from_scratch( mat ); |
else |
analyse_from_flags( mat ); |
} |
if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { |
matrix_invert( mat ); |
} |
mat->flags &= ~(MAT_DIRTY_FLAGS| |
MAT_DIRTY_TYPE| |
MAT_DIRTY_INVERSE); |
} |
void |
_math_matrix_copy( GLmatrix *to, const GLmatrix *from ) |
{ |
MEMCPY( to->m, from->m, sizeof(Identity) ); |
to->flags = from->flags; |
to->type = from->type; |
if (to->inv != 0) { |
if (from->inv == 0) { |
matrix_invert( to ); |
} |
else { |
MEMCPY(to->inv, from->inv, sizeof(GLfloat)*16); |
} |
} |
} |
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 ) |
{ |
MEMCPY( mat->m, m, 16*sizeof(GLfloat) ); |
mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY); |
} |
void |
_math_matrix_ctr( GLmatrix *m ) |
{ |
m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); |
if (m->m) |
MEMCPY( m->m, Identity, sizeof(Identity) ); |
m->inv = NULL; |
m->type = MATRIX_IDENTITY; |
m->flags = 0; |
} |
void |
_math_matrix_dtr( GLmatrix *m ) |
{ |
if (m->m) { |
ALIGN_FREE( m->m ); |
m->m = NULL; |
} |
if (m->inv) { |
ALIGN_FREE( m->inv ); |
m->inv = NULL; |
} |
} |
void |
_math_matrix_alloc_inv( GLmatrix *m ) |
{ |
if (!m->inv) { |
m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); |
if (m->inv) |
MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); |
} |
} |
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); |
} |
void |
_math_transposef( GLfloat to[16], const GLfloat from[16] ) |
{ |
to[0] = from[0]; |
to[1] = from[4]; |
to[2] = from[8]; |
to[3] = from[12]; |
to[4] = from[1]; |
to[5] = from[5]; |
to[6] = from[9]; |
to[7] = from[13]; |
to[8] = from[2]; |
to[9] = from[6]; |
to[10] = from[10]; |
to[11] = from[14]; |
to[12] = from[3]; |
to[13] = from[7]; |
to[14] = from[11]; |
to[15] = from[15]; |
} |
void |
_math_transposed( GLdouble to[16], const GLdouble from[16] ) |
{ |
to[0] = from[0]; |
to[1] = from[4]; |
to[2] = from[8]; |
to[3] = from[12]; |
to[4] = from[1]; |
to[5] = from[5]; |
to[6] = from[9]; |
to[7] = from[13]; |
to[8] = from[2]; |
to[9] = from[6]; |
to[10] = from[10]; |
to[11] = from[14]; |
to[12] = from[3]; |
to[13] = from[7]; |
to[14] = from[11]; |
to[15] = from[15]; |
} |
void |
_math_transposefd( GLfloat to[16], const GLdouble from[16] ) |
{ |
to[0] = (GLfloat) from[0]; |
to[1] = (GLfloat) from[4]; |
to[2] = (GLfloat) from[8]; |
to[3] = (GLfloat) from[12]; |
to[4] = (GLfloat) from[1]; |
to[5] = (GLfloat) from[5]; |
to[6] = (GLfloat) from[9]; |
to[7] = (GLfloat) from[13]; |
to[8] = (GLfloat) from[2]; |
to[9] = (GLfloat) from[6]; |
to[10] = (GLfloat) from[10]; |
to[11] = (GLfloat) from[14]; |
to[12] = (GLfloat) from[3]; |
to[13] = (GLfloat) from[7]; |
to[14] = (GLfloat) from[11]; |
to[15] = (GLfloat) from[15]; |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_vector.h |
---|
0,0 → 1,222 |
/* $Id: m_vector.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
#ifndef _M_VECTOR_H_ |
#define _M_VECTOR_H_ |
#include "glheader.h" |
#include "mtypes.h" /* hack for GLchan */ |
#define VEC_DIRTY_0 0x1 |
#define VEC_DIRTY_1 0x2 |
#define VEC_DIRTY_2 0x4 |
#define VEC_DIRTY_3 0x8 |
#define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/ |
#define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */ |
#define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */ |
#define VEC_SIZE_1 VEC_DIRTY_0 |
#define VEC_SIZE_2 (VEC_DIRTY_0|VEC_DIRTY_1) |
#define VEC_SIZE_3 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2) |
#define VEC_SIZE_4 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2|VEC_DIRTY_3) |
/* Wrap all the information about vectors up in a struct. Has |
* additional fields compared to the other vectors to help us track of |
* different vertex sizes, and whether we need to clean columns out |
* because they contain non-(0,0,0,1) values. |
* |
* The start field is used to reserve data for copied vertices at the |
* end of _mesa_transform_vb, and avoids the need for a multiplication in |
* the transformation routines. |
*/ |
typedef struct { |
GLfloat (*data)[4]; /* may be malloc'd or point to client data */ |
GLfloat *start; /* points somewhere inside of <data> */ |
GLuint count; /* size of the vector (in elements) */ |
GLuint stride; /* stride from one element to the next (in bytes) */ |
GLuint size; /* 2-4 for vertices and 1-4 for texcoords */ |
GLuint flags; /* which columns are dirty */ |
void *storage; /* self-allocated storage */ |
} GLvector4f; |
extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags, |
GLfloat (*storage)[4] ); |
extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, |
GLuint count, GLuint alignment ); |
extern void _mesa_vector4f_free( GLvector4f *v ); |
extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean ); |
extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt ); |
/* Could use a single vector type for normals and vertices, but |
* this way avoids some casts. |
*/ |
typedef struct { |
GLfloat (*data)[3]; |
GLfloat *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector3f; |
extern void _mesa_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*)[3] ); |
extern void _mesa_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector3f_free( GLvector3f *v ); |
extern void _mesa_vector3f_print( GLvector3f *v, GLubyte *, GLboolean ); |
typedef struct { |
GLfloat *data; |
GLfloat *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector1f; |
extern void _mesa_vector1f_free( GLvector1f *v ); |
extern void _mesa_vector1f_init( GLvector1f *v, GLuint flags, GLfloat * ); |
extern void _mesa_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, |
GLuint alignment ); |
/* For 4ub rgba values. |
*/ |
typedef struct { |
GLubyte (*data)[4]; |
GLubyte *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector4ub; |
extern void _mesa_vector4ub_init( GLvector4ub *v, GLuint flags, |
GLubyte (*storage)[4] ); |
extern void _mesa_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector4ub_free( GLvector4ub * ); |
/* For 4 * GLchan values. |
*/ |
typedef struct { |
GLchan (*data)[4]; |
GLchan *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector4chan; |
extern void _mesa_vector4chan_init( GLvector4chan *v, GLuint flags, |
GLchan (*storage)[4] ); |
extern void _mesa_vector4chan_alloc( GLvector4chan *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector4chan_free( GLvector4chan * ); |
/* For 4 * GLushort rgba values. |
*/ |
typedef struct { |
GLushort (*data)[4]; |
GLushort *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector4us; |
extern void _mesa_vector4us_init( GLvector4us *v, GLuint flags, |
GLushort (*storage)[4] ); |
extern void _mesa_vector4us_alloc( GLvector4us *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector4us_free( GLvector4us * ); |
/* For 1ub values, eg edgeflag. |
*/ |
typedef struct { |
GLubyte *data; |
GLubyte *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector1ub; |
extern void _mesa_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage); |
extern void _mesa_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector1ub_free( GLvector1ub * ); |
/* For, eg Index, Array element. |
*/ |
typedef struct { |
GLuint *data; |
GLuint *start; |
GLuint count; |
GLuint stride; |
GLuint flags; |
void *storage; |
} GLvector1ui; |
extern void _mesa_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ); |
extern void _mesa_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, |
GLuint alignment ); |
extern void _mesa_vector1ui_free( GLvector1ui * ); |
/* |
* Given vector <v>, return a pointer (cast to <type *> to the <i>-th element. |
* |
* End up doing a lot of slow imuls if not careful. |
*/ |
#define VEC_ELT( v, type, i ) \ |
( (type *) ( ((GLbyte *) ((v)->data)) + (i) * (v)->stride) ) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_matrix.h |
---|
0,0 → 1,176 |
/* $Id: m_matrix.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _M_MATRIX_H |
#define _M_MATRIX_H |
/* 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 |
#define MAT_SY 5 |
#define MAT_SZ 10 |
#define MAT_TX 12 |
#define MAT_TY 13 |
#define MAT_TZ 14 |
/* |
* 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 */ |
#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_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ |
MAT_FLAG_TRANSLATION | \ |
MAT_FLAG_UNIFORM_SCALE) |
#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ |
MAT_FLAG_TRANSLATION) |
#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ |
MAT_FLAG_TRANSLATION | \ |
MAT_FLAG_UNIFORM_SCALE | \ |
MAT_FLAG_GENERAL_SCALE | \ |
MAT_FLAG_GENERAL_3D) |
#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ |
MAT_FLAG_ROTATION | \ |
MAT_FLAG_TRANSLATION | \ |
MAT_FLAG_UNIFORM_SCALE | \ |
MAT_FLAG_GENERAL_SCALE | \ |
MAT_FLAG_GENERAL_3D | \ |
MAT_FLAG_PERSPECTIVE | \ |
MAT_FLAG_SINGULAR) |
#define MAT_DIRTY (MAT_DIRTY_TYPE | \ |
MAT_DIRTY_FLAGS | \ |
MAT_DIRTY_INVERSE) |
#define TEST_MAT_FLAGS(mat, a) \ |
((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) |
typedef struct { |
GLfloat *m; /* 16-byte aligned */ |
GLfloat *inv; /* optional, 16-byte aligned */ |
GLuint flags; |
GLuint type; /* one of the MATRIX_* values */ |
} GLmatrix; |
extern void |
_math_matrix_ctr( GLmatrix *m ); |
extern void |
_math_matrix_dtr( GLmatrix *m ); |
extern void |
_math_matrix_alloc_inv( GLmatrix *m ); |
extern void |
_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ); |
extern void |
_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *b ); |
extern void |
_math_matrix_loadf( GLmatrix *mat, const GLfloat *m ); |
extern void |
_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_math_matrix_rotate( GLmatrix *m, GLfloat angle, |
GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_math_matrix_ortho( GLmatrix *mat, |
GLfloat left, GLfloat right, |
GLfloat bottom, GLfloat top, |
GLfloat nearval, GLfloat farval ); |
extern void |
_math_matrix_frustum( GLmatrix *mat, |
GLfloat left, GLfloat right, |
GLfloat bottom, GLfloat top, |
GLfloat nearval, GLfloat farval ); |
extern void |
_math_matrix_set_identity( GLmatrix *dest ); |
extern void |
_math_matrix_copy( GLmatrix *to, const GLmatrix *from ); |
extern void |
_math_matrix_analyse( GLmatrix *mat ); |
extern void |
_math_matrix_print( const GLmatrix *m ); |
/* Related functions that don't actually operate on GLmatrix structs: |
*/ |
extern void |
_math_transposef( GLfloat to[16], const GLfloat from[16] ); |
extern void |
_math_transposed( GLdouble to[16], const GLdouble from[16] ); |
extern void |
_math_transposefd( GLfloat to[16], const GLdouble from[16] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/math/m_trans_tmp.h |
---|
0,0 → 1,236 |
/* $Id: m_trans_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.2 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
/* KW: This file also included by tnl/trans_elt.c to build code |
* specific to the implementation of array-elements in the |
* tnl module. |
*/ |
#ifdef DEST_4F |
static void DEST_4F( GLfloat (*t)[4], |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) first; |
(void) start; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
if (SZ >= 1) t[i][0] = TRX_4F(f, 0); |
if (SZ >= 2) t[i][1] = TRX_4F(f, 1); |
if (SZ >= 3) t[i][2] = TRX_4F(f, 2); |
if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0; |
} |
} |
} |
#endif |
#ifdef DEST_3F |
static void DEST_3F( GLfloat (*t)[3], |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) first; |
(void) start; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
t[i][0] = TRX_3F(f, 0); |
t[i][1] = TRX_3F(f, 1); |
t[i][2] = TRX_3F(f, 2); |
} |
} |
} |
#endif |
#ifdef DEST_1F |
static void DEST_1F( GLfloat *t, |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) first; |
(void) start; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
t[i] = TRX_1F(f, 0); |
} |
} |
} |
#endif |
#ifdef DEST_4UB |
static void DEST_4UB( GLubyte (*t)[4], |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) start; |
(void) first; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
if (SZ >= 1) TRX_UB(t[i][0], f, 0); |
if (SZ >= 2) TRX_UB(t[i][1], f, 1); |
if (SZ >= 3) TRX_UB(t[i][2], f, 2); |
if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255; |
} |
} |
} |
#endif |
#ifdef DEST_4US |
static void DEST_4US( GLushort (*t)[4], |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride); |
const GLubyte *first = f; |
GLuint i; |
(void) start; |
(void) first; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
if (SZ >= 1) TRX_US(t[i][0], f, 0); |
if (SZ >= 2) TRX_US(t[i][1], f, 1); |
if (SZ >= 3) TRX_US(t[i][2], f, 2); |
if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535; |
} |
} |
} |
#endif |
#ifdef DEST_1UB |
static void DEST_1UB( GLubyte *t, |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) start; |
(void) first; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
TRX_UB(t[i], f, 0); |
} |
} |
} |
#endif |
#ifdef DEST_1UI |
static void DEST_1UI( GLuint *t, |
CONST void *ptr, |
GLuint stride, |
ARGS ) |
{ |
const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; |
const GLubyte *first = f; |
GLuint i; |
(void) start; |
(void) first; |
for (i = DST_START ; i < n ; i++, NEXT_F) { |
CHECK { |
NEXT_F2; |
t[i] = TRX_UI(f, 0); |
} |
} |
} |
#endif |
static void INIT(void) |
{ |
#ifdef DEST_1UI |
ASSERT(SZ == 1); |
TAB(_1ui)[SRC_IDX] = DEST_1UI; |
#endif |
#ifdef DEST_1UB |
ASSERT(SZ == 1); |
TAB(_1ub)[SRC_IDX] = DEST_1UB; |
#endif |
#ifdef DEST_1F |
ASSERT(SZ == 1); |
TAB(_1f)[SRC_IDX] = DEST_1F; |
#endif |
#ifdef DEST_3F |
ASSERT(SZ == 3); |
TAB(_3f)[SRC_IDX] = DEST_3F; |
#endif |
#ifdef DEST_4UB |
TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB; |
#endif |
#ifdef DEST_4US |
TAB(_4us)[SZ][SRC_IDX] = DEST_4US; |
#endif |
#ifdef DEST_4F |
TAB(_4f)[SZ][SRC_IDX] = DEST_4F; |
#endif |
} |
#undef INIT |
#undef DEST_1UI |
#undef DEST_1UB |
#undef DEST_4UB |
#undef DEST_4US |
#undef DEST_3F |
#undef DEST_4F |
#undef DEST_1F |
#undef SZ |
#undef TAG |
/shark/tags/rel_0_4/ports/mesa/src/math/m_clip_tmp.h |
---|
0,0 → 1,229 |
/* $Id: m_clip_tmp.h,v 1.1 2003-02-28 11:48:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.3 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
/* KW: a clever asm implementation would nestle integer versions |
* of the outcode calculation underneath the division. Gcc won't |
* do this, strangely enough, so I only do the divide in |
* the case where the cliptest passes. This isn't essential, |
* and an asm implementation needn't replicate that behaviour. |
*/ |
static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
const GLuint count = clip_vec->count; |
GLuint c = 0; |
GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; |
GLubyte tmpAndMask = *andMask; |
GLubyte tmpOrMask = *orMask; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat cx = from[0]; |
const GLfloat cy = from[1]; |
const GLfloat cz = from[2]; |
const GLfloat cw = from[3]; |
#if defined(macintosh) || defined(__powerpc__) |
/* on powerpc cliptest is 17% faster in this way. */ |
GLuint mask; |
mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); |
mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); |
mask |= (((cw < cy) << CLIP_TOP_SHIFT)); |
mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); |
mask |= (((cw < cz) << CLIP_FAR_SHIFT)); |
mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); |
#else /* !defined(macintosh)) */ |
GLubyte mask = 0; |
if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; |
if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; |
if (-cy + cw < 0) mask |= CLIP_TOP_BIT; |
if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; |
if (-cz + cw < 0) mask |= CLIP_FAR_BIT; |
if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; |
#endif /* defined(macintosh) */ |
clipMask[i] = mask; |
if (mask) { |
c++; |
tmpAndMask &= mask; |
tmpOrMask |= mask; |
vProj[i][0] = 0; |
vProj[i][1] = 0; |
vProj[i][2] = 0; |
vProj[i][3] = 1; |
} else { |
GLfloat oow = 1.0F / cw; |
vProj[i][0] = cx * oow; |
vProj[i][1] = cy * oow; |
vProj[i][2] = cz * oow; |
vProj[i][3] = oow; |
} |
} |
*orMask = tmpOrMask; |
*andMask = (GLubyte) (c < count ? 0 : tmpAndMask); |
proj_vec->flags |= VEC_SIZE_4; |
proj_vec->size = 4; |
proj_vec->count = clip_vec->count; |
return proj_vec; |
} |
static GLvector4f * _XFORMAPI TAG(cliptest_np_points4)( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLuint c = 0; |
GLubyte tmpAndMask = *andMask; |
GLubyte tmpOrMask = *orMask; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat cx = from[0]; |
const GLfloat cy = from[1]; |
const GLfloat cz = from[2]; |
const GLfloat cw = from[3]; |
#if defined(macintosh) || defined(__powerpc__) |
/* on powerpc cliptest is 17% faster in this way. */ |
GLuint mask; |
mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); |
mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); |
mask |= (((cw < cy) << CLIP_TOP_SHIFT)); |
mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); |
mask |= (((cw < cz) << CLIP_FAR_SHIFT)); |
mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); |
#else /* !defined(macintosh)) */ |
GLubyte mask = 0; |
if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; |
if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; |
if (-cy + cw < 0) mask |= CLIP_TOP_BIT; |
if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; |
if (-cz + cw < 0) mask |= CLIP_FAR_BIT; |
if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; |
#endif /* defined(macintosh) */ |
clipMask[i] = mask; |
if (mask) { |
c++; |
tmpAndMask &= mask; |
tmpOrMask |= mask; |
} |
} |
*orMask = tmpOrMask; |
*andMask = (GLubyte) (c < count ? 0 : tmpAndMask); |
return clip_vec; |
} |
static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLubyte tmpOrMask = *orMask; |
GLubyte tmpAndMask = *andMask; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat cx = from[0], cy = from[1], cz = from[2]; |
GLubyte mask = 0; |
if (cx > 1.0) mask |= CLIP_RIGHT_BIT; |
else if (cx < -1.0) mask |= CLIP_LEFT_BIT; |
if (cy > 1.0) mask |= CLIP_TOP_BIT; |
else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; |
if (cz > 1.0) mask |= CLIP_FAR_BIT; |
else if (cz < -1.0) mask |= CLIP_NEAR_BIT; |
clipMask[i] = mask; |
tmpOrMask |= mask; |
tmpAndMask &= mask; |
} |
*orMask = tmpOrMask; |
*andMask = tmpAndMask; |
return clip_vec; |
} |
static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ) |
{ |
const GLuint stride = clip_vec->stride; |
const GLuint count = clip_vec->count; |
const GLfloat *from = (GLfloat *)clip_vec->start; |
GLubyte tmpOrMask = *orMask; |
GLubyte tmpAndMask = *andMask; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat cx = from[0], cy = from[1]; |
GLubyte mask = 0; |
if (cx > 1.0) mask |= CLIP_RIGHT_BIT; |
else if (cx < -1.0) mask |= CLIP_LEFT_BIT; |
if (cy > 1.0) mask |= CLIP_TOP_BIT; |
else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; |
clipMask[i] = mask; |
tmpOrMask |= mask; |
tmpAndMask &= mask; |
} |
*orMask = tmpOrMask; |
*andMask = tmpAndMask; |
return clip_vec; |
} |
static void TAG(init_c_cliptest)( void ) |
{ |
_mesa_clip_tab[4] = TAG(cliptest_points4); |
_mesa_clip_tab[3] = TAG(cliptest_points3); |
_mesa_clip_tab[2] = TAG(cliptest_points2); |
_mesa_clip_np_tab[4] = TAG(cliptest_np_points4); |
_mesa_clip_np_tab[3] = TAG(cliptest_points3); |
_mesa_clip_np_tab[2] = TAG(cliptest_points2); |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_xform_tmp.h |
---|
0,0 → 1,807 |
/* $Id: m_xform_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* New (3.1) transformation code written by Keith Whitwell. |
*/ |
/*---------------------------------------------------------------------- |
* Begin Keith's new code |
* |
*---------------------------------------------------------------------- |
*/ |
/* KW: Fixed stride, now measured in bytes as is the OpenGL array stride. |
*/ |
/* KW: These are now parameterized to produce two versions, one |
* which transforms all incoming points, and a second which |
* takes notice of a cullmask array, and only transforms |
* unculled vertices. |
*/ |
/* KW: 1-vectors can sneak into the texture pipeline via the array |
* interface. These functions are here because I want consistant |
* treatment of the vertex sizes and a lazy strategy for |
* cleaning unused parts of the vector, and so as not to exclude |
* them from the vertex array interface. |
* |
* Under our current analysis of matrices, there is no way that |
* the product of a matrix and a 1-vector can remain a 1-vector, |
* with the exception of the identity transform. |
*/ |
/* KW: No longer zero-pad outgoing vectors. Now that external |
* vectors can get into the pipeline we cannot ever assume |
* that there is more to a vector than indicated by its |
* size. |
*/ |
/* KW: Now uses clipmask and a flag to allow us to skip both/either |
* cliped and/or culled vertices. |
*/ |
/* GH: Not any more -- it's easier (and faster) to just process the |
* entire vector. Clipping and culling are handled further down |
* the pipe, most often during or after the conversion to some |
* driver-specific vertex format. |
*/ |
static void _XFORMAPI |
TAG(transform_points1_general)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m12 = m[12]; |
const GLfloat m1 = m[1], m13 = m[13]; |
const GLfloat m2 = m[2], m14 = m[14]; |
const GLfloat m3 = m[3], m15 = m[15]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m1 * ox + m13; |
to[i][2] = m2 * ox + m14; |
to[i][3] = m3 * ox + m15; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_identity)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLuint count = from_vec->count; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint i; |
if (to_vec == from_vec) return; |
STRIDE_LOOP { |
to[i][0] = from[0]; |
} |
to_vec->size = 1; |
to_vec->flags |= VEC_SIZE_1; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_2d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1]; |
const GLfloat m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m1 * ox + m13; |
} |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m13; |
} |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_3d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2]; |
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m1 * ox + m13; |
to[i][2] = m2 * ox + m14; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0]; |
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m13; |
to[i][2] = m14; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points1_perspective)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0]; |
to[i][0] = m0 * ox ; |
to[i][1] = 0 ; |
to[i][2] = m14; |
to[i][3] = 0; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
/* 2-vectors, which are a lot more relevant than 1-vectors, are |
* present early in the geometry pipeline and throughout the |
* texture pipeline. |
*/ |
static void _XFORMAPI |
TAG(transform_points2_general)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m4 = m[4], m12 = m[12]; |
const GLfloat m1 = m[1], m5 = m[5], m13 = m[13]; |
const GLfloat m2 = m[2], m6 = m[6], m14 = m[14]; |
const GLfloat m3 = m[3], m7 = m[7], m15 = m[15]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox + m4 * oy + m12; |
to[i][1] = m1 * ox + m5 * oy + m13; |
to[i][2] = m2 * ox + m6 * oy + m14; |
to[i][3] = m3 * ox + m7 * oy + m15; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points2_identity)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
GLuint i; |
if (to_vec == from_vec) return; |
STRIDE_LOOP { |
to[i][0] = from[0]; |
to[i][1] = from[1]; |
} |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points2_2d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; |
const GLfloat m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox + m4 * oy + m12; |
to[i][1] = m1 * ox + m5 * oy + m13; |
} |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m5 * oy + m13; |
} |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points2_3d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; |
const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox + m4 * oy + m12; |
to[i][1] = m1 * ox + m5 * oy + m13; |
to[i][2] = m2 * ox + m6 * oy + m14; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
/* I would actually say this was a fairly important function, from |
* a texture transformation point of view. |
*/ |
static void _XFORMAPI |
TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5]; |
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox + m12; |
to[i][1] = m5 * oy + m13; |
to[i][2] = m14; |
} |
if (m14 == 0) { |
to_vec->size = 2; |
to_vec->flags |= VEC_SIZE_2; |
} else { |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
} |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points2_perspective)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1]; |
to[i][0] = m0 * ox ; |
to[i][1] = m5 * oy ; |
to[i][2] = m14; |
to[i][3] = 0; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_general)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; |
const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; |
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; |
const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12; |
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13; |
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14; |
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_identity)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
GLuint i; |
if (to_vec == from_vec) return; |
STRIDE_LOOP { |
to[i][0] = from[0]; |
to[i][1] = from[1]; |
to[i][2] = from[2]; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_2d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; |
const GLfloat m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m4 * oy + m12 ; |
to[i][1] = m1 * ox + m5 * oy + m13 ; |
to[i][2] = + oz ; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m12 ; |
to[i][1] = m5 * oy + m13 ; |
to[i][2] = + oz ; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_3d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; |
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; |
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ; |
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ; |
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
/* previously known as ortho... |
*/ |
static void _XFORMAPI |
TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5]; |
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m12 ; |
to[i][1] = m5 * oy + m13 ; |
to[i][2] = m10 * oz + m14 ; |
} |
to_vec->size = 3; |
to_vec->flags |= VEC_SIZE_3; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points3_perspective)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; |
const GLfloat m10 = m[10], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2]; |
to[i][0] = m0 * ox + m8 * oz ; |
to[i][1] = m5 * oy + m9 * oz ; |
to[i][2] = m10 * oz + m14 ; |
to[i][3] = -oz ; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_general)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; |
const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; |
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; |
const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; |
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; |
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; |
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_identity)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
GLuint i; |
if (to_vec == from_vec) return; |
STRIDE_LOOP { |
to[i][0] = from[0]; |
to[i][1] = from[1]; |
to[i][2] = from[2]; |
to[i][3] = from[3]; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_2d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; |
const GLfloat m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m4 * oy + m12 * ow; |
to[i][1] = m1 * ox + m5 * oy + m13 * ow; |
to[i][2] = + oz ; |
to[i][3] = ow; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m12 * ow; |
to[i][1] = m5 * oy + m13 * ow; |
to[i][2] = + oz ; |
to[i][3] = ow; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_3d)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; |
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; |
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; |
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; |
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; |
to[i][3] = ow; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5]; |
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m12 * ow; |
to[i][1] = m5 * oy + m13 * ow; |
to[i][2] = m10 * oz + m14 * ow; |
to[i][3] = ow; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static void _XFORMAPI |
TAG(transform_points4_perspective)( GLvector4f *to_vec, |
const GLfloat m[16], |
const GLvector4f *from_vec ) |
{ |
const GLuint stride = from_vec->stride; |
GLfloat *from = from_vec->start; |
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; |
GLuint count = from_vec->count; |
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; |
const GLfloat m10 = m[10], m14 = m[14]; |
GLuint i; |
STRIDE_LOOP { |
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; |
to[i][0] = m0 * ox + m8 * oz ; |
to[i][1] = m5 * oy + m9 * oz ; |
to[i][2] = m10 * oz + m14 * ow ; |
to[i][3] = -oz ; |
} |
to_vec->size = 4; |
to_vec->flags |= VEC_SIZE_4; |
to_vec->count = from_vec->count; |
} |
static transform_func _XFORMAPI TAG(transform_tab_1)[7]; |
static transform_func _XFORMAPI TAG(transform_tab_2)[7]; |
static transform_func _XFORMAPI TAG(transform_tab_3)[7]; |
static transform_func _XFORMAPI TAG(transform_tab_4)[7]; |
/* Similar functions could be called several times, with more highly |
* optimized routines overwriting the arrays. This only occurs during |
* startup. |
*/ |
static void _XFORMAPI TAG(init_c_transformations)( void ) |
{ |
#define TAG_TAB _mesa_transform_tab |
#define TAG_TAB_1 TAG(transform_tab_1) |
#define TAG_TAB_2 TAG(transform_tab_2) |
#define TAG_TAB_3 TAG(transform_tab_3) |
#define TAG_TAB_4 TAG(transform_tab_4) |
TAG_TAB[1] = TAG_TAB_1; |
TAG_TAB[2] = TAG_TAB_2; |
TAG_TAB[3] = TAG_TAB_3; |
TAG_TAB[4] = TAG_TAB_4; |
/* 1-D points (ie texcoords) */ |
TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general); |
TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity); |
TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot); |
TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective); |
TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d); |
TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot); |
TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d); |
/* 2-D points */ |
TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general); |
TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity); |
TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot); |
TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective); |
TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d); |
TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot); |
TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d); |
/* 3-D points */ |
TAG_TAB_3[MATRIX_GENERAL] = TAG(transform_points3_general); |
TAG_TAB_3[MATRIX_IDENTITY] = TAG(transform_points3_identity); |
TAG_TAB_3[MATRIX_3D_NO_ROT] = TAG(transform_points3_3d_no_rot); |
TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective); |
TAG_TAB_3[MATRIX_2D] = TAG(transform_points3_2d); |
TAG_TAB_3[MATRIX_2D_NO_ROT] = TAG(transform_points3_2d_no_rot); |
TAG_TAB_3[MATRIX_3D] = TAG(transform_points3_3d); |
/* 4-D points */ |
TAG_TAB_4[MATRIX_GENERAL] = TAG(transform_points4_general); |
TAG_TAB_4[MATRIX_IDENTITY] = TAG(transform_points4_identity); |
TAG_TAB_4[MATRIX_3D_NO_ROT] = TAG(transform_points4_3d_no_rot); |
TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective); |
TAG_TAB_4[MATRIX_2D] = TAG(transform_points4_2d); |
TAG_TAB_4[MATRIX_2D_NO_ROT] = TAG(transform_points4_2d_no_rot); |
TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d); |
#undef TAG_TAB |
#undef TAG_TAB_1 |
#undef TAG_TAB_2 |
#undef TAG_TAB_3 |
#undef TAG_TAB_4 |
} |
/shark/tags/rel_0_4/ports/mesa/src/math/m_debug_norm.c |
---|
0,0 → 1,381 |
/* $Id: m_debug_norm.c,v 1.1 2003-02-28 11:48:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "m_matrix.h" |
#include "m_xform.h" |
#include "m_debug.h" |
#include "m_debug_util.h" |
#ifdef DEBUG /* This code only used for debugging */ |
static int m_norm_identity[16] = { |
ONE, NIL, NIL, NIL, |
NIL, ONE, NIL, NIL, |
NIL, NIL, ONE, NIL, |
NIL, NIL, NIL, NIL |
}; |
static int m_norm_general[16] = { |
VAR, VAR, VAR, NIL, |
VAR, VAR, VAR, NIL, |
VAR, VAR, VAR, NIL, |
NIL, NIL, NIL, NIL |
}; |
static int m_norm_no_rot[16] = { |
VAR, NIL, NIL, NIL, |
NIL, VAR, NIL, NIL, |
NIL, NIL, VAR, NIL, |
NIL, NIL, NIL, NIL |
}; |
static int *norm_templates[8] = { |
m_norm_no_rot, |
m_norm_no_rot, |
m_norm_no_rot, |
m_norm_general, |
m_norm_general, |
m_norm_general, |
m_norm_identity, |
m_norm_identity |
}; |
static int norm_types[8] = { |
NORM_TRANSFORM_NO_ROT, |
NORM_TRANSFORM_NO_ROT | NORM_RESCALE, |
NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE, |
NORM_TRANSFORM, |
NORM_TRANSFORM | NORM_RESCALE, |
NORM_TRANSFORM | NORM_NORMALIZE, |
NORM_RESCALE, |
NORM_NORMALIZE |
}; |
static int norm_scale_types[8] = { /* rescale factor */ |
NIL, /* NIL disables rescaling */ |
VAR, |
NIL, |
NIL, |
VAR, |
NIL, |
VAR, |
NIL |
}; |
static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */ |
0, |
0, |
1, |
0, |
0, |
1, |
0, |
1 |
}; |
static char *norm_strings[8] = { |
"NORM_TRANSFORM_NO_ROT", |
"NORM_TRANSFORM_NO_ROT | NORM_RESCALE", |
"NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE", |
"NORM_TRANSFORM", |
"NORM_TRANSFORM | NORM_RESCALE", |
"NORM_TRANSFORM | NORM_NORMALIZE", |
"NORM_RESCALE", |
"NORM_NORMALIZE" |
}; |
/* ============================================================= |
* Reference transformations |
*/ |
static void ref_norm_transform_rescale( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLuint i; |
const GLfloat *s = in->start; |
const GLfloat *m = mat->inv; |
GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; |
(void) lengths; |
for ( i = 0 ; i < in->count ; i++ ) { |
GLfloat t[3]; |
TRANSFORM_NORMAL( t, s, m ); |
SCALE_SCALAR_3V( out[i], scale, t ); |
s = (GLfloat *)((char *)s + in->stride); |
} |
} |
static void ref_norm_transform_normalize( const GLmatrix *mat, |
GLfloat scale, |
const GLvector4f *in, |
const GLfloat *lengths, |
GLvector4f *dest ) |
{ |
GLuint i; |
const GLfloat *s = in->start; |
const GLfloat *m = mat->inv; |
GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; |
for ( i = 0 ; i < in->count ; i++ ) { |
GLfloat t[3]; |
TRANSFORM_NORMAL( t, s, m ); |
if ( !lengths ) { |
GLfloat len = LEN_SQUARED_3FV( t ); |
if ( len > 1e-20 ) { |
/* Hmmm, don't know how we could test the precalculated |
* length case... |
*/ |
scale = 1.0 / sqrt( len ); |
SCALE_SCALAR_3V( out[i], scale, t ); |
} else { |
out[i][0] = out[i][1] = out[i][2] = 0; |
} |
} else { |
scale = lengths[i];; |
SCALE_SCALAR_3V( out[i], scale, t ); |
} |
s = (GLfloat *)((char *)s + in->stride); |
} |
} |
/* ============================================================= |
* Normal transformation tests |
*/ |
static void init_matrix( GLfloat *m ) |
{ |
m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; |
m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; |
m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; |
m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; |
} |
static int test_norm_function( normal_func func, int mtype, long *cycles ) |
{ |
GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; |
GLmatrix mat[1]; |
GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; |
GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; |
GLfloat scale; |
GLfloat *m; |
int i, j; |
#ifdef RUN_DEBUG_BENCHMARK |
int cycle_i; /* the counter for the benchmarks we run */ |
#endif |
(void) cycles; |
mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); |
mat->inv = m = mat->m; |
init_matrix( m ); |
scale = 1.0F + rnd () * norm_scale_types[mtype]; |
for ( i = 0 ; i < 4 ; i++ ) { |
for ( j = 0 ; j < 4 ; j++ ) { |
switch ( norm_templates[mtype][i * 4 + j] ) { |
case NIL: |
m[j * 4 + i] = 0.0; |
break; |
case ONE: |
m[j * 4 + i] = 1.0; |
break; |
case NEG: |
m[j * 4 + i] = -1.0; |
break; |
case VAR: |
break; |
default: |
abort(); |
} |
} |
} |
for ( i = 0 ; i < TEST_COUNT ; i++ ) { |
ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); |
ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); |
ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); |
for ( j = 0 ; j < 3 ; j++ ) |
s[i][j] = rnd(); |
length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) ); |
} |
source->data = (GLfloat(*)[4]) s; |
source->start = (GLfloat *) s; |
source->count = TEST_COUNT; |
source->stride = sizeof(s[0]); |
source->flags = 0; |
dest->data = d; |
dest->start = (GLfloat *) d; |
dest->count = TEST_COUNT; |
dest->stride = sizeof(float[4]); |
dest->flags = 0; |
dest2->data = d2; |
dest2->start = (GLfloat *) d2; |
dest2->count = TEST_COUNT; |
dest2->stride = sizeof(float[4]); |
dest2->flags = 0; |
ref->data = r; |
ref->start = (GLfloat *) r; |
ref->count = TEST_COUNT; |
ref->stride = sizeof(float[4]); |
ref->flags = 0; |
ref2->data = r2; |
ref2->start = (GLfloat *) r2; |
ref2->count = TEST_COUNT; |
ref2->stride = sizeof(float[4]); |
ref2->flags = 0; |
if ( norm_normalize_types[mtype] == 0 ) { |
ref_norm_transform_rescale( mat, scale, source, NULL, ref ); |
} else { |
ref_norm_transform_normalize( mat, scale, source, NULL, ref ); |
ref_norm_transform_normalize( mat, scale, source, length, ref2 ); |
} |
if ( mesa_profile ) { |
BEGIN_RACE( *cycles ); |
func( mat, scale, source, NULL, dest ); |
END_RACE( *cycles ); |
func( mat, scale, source, length, dest2 ); |
} else { |
func( mat, scale, source, NULL, dest ); |
func( mat, scale, source, length, dest2 ); |
} |
for ( i = 0 ; i < TEST_COUNT ; i++ ) { |
for ( j = 0 ; j < 3 ; j++ ) { |
if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { |
_mesa_printf(NULL, "-----------------------------\n" ); |
_mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d[i][0], r[i][0], r[i][0]/d[i][0], |
MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d[i][1], r[i][1], r[i][1]/d[i][1], |
MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d[i][2], r[i][2], r[i][2]/d[i][2], |
MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); |
return 0; |
} |
if ( norm_normalize_types[mtype] != 0 ) { |
if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { |
_mesa_printf(NULL, "------------------- precalculated length case ------\n" ); |
_mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d2[i][0], r2[i][0], r2[i][0]/d2[i][0], |
MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d2[i][1], r2[i][1], r2[i][1]/d2[i][1], |
MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); |
_mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", |
d2[i][2], r2[i][2], r2[i][2]/d2[i][2], |
MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); |
return 0; |
} |
} |
} |
} |
ALIGN_FREE( mat->m ); |
return 1; |
} |
void _math_test_all_normal_transform_functions( char *description ) |
{ |
int mtype; |
long benchmark_tab[0xf]; |
static int first_time = 1; |
if ( first_time ) { |
first_time = 0; |
mesa_profile = getenv( "MESA_PROFILE" ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
if ( !counter_overhead ) { |
INIT_COUNTER(); |
_mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); |
} |
_mesa_printf(NULL, "normal transform results after hooking in %s functions:\n", |
description ); |
_mesa_printf(NULL, "\n-------------------------------------------------------\n" ); |
} |
#endif |
for ( mtype = 0 ; mtype < 8 ; mtype++ ) { |
normal_func func = _mesa_normal_tab[norm_types[mtype]]; |
long *cycles = &benchmark_tab[mtype]; |
if ( test_norm_function( func, mtype, cycles ) == 0 ) { |
char buf[100]; |
_mesa_sprintf(NULL, buf, "_mesa_normal_tab[0][%s] failed test (%s)", |
norm_strings[mtype], description ); |
_mesa_problem( NULL, buf ); |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
_mesa_printf(NULL, " %li\t", benchmark_tab[mtype] ); |
_mesa_printf(NULL, " | [%s]\n", norm_strings[mtype] ); |
} |
#endif |
} |
#ifdef RUN_DEBUG_BENCHMARK |
if ( mesa_profile ) { |
_mesa_printf(NULL, "\n" ); |
fflush( stdout ); |
} |
#endif |
} |
#endif /* DEBUG */ |
/shark/tags/rel_0_4/ports/mesa/src/mmath.h |
---|
0,0 → 1,678 |
/* $Id: mmath.h,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Faster arithmetic functions. If the FAST_MATH preprocessor symbol is |
* defined on the command line (-DFAST_MATH) then we'll use some (hopefully) |
* faster functions for sqrt(), etc. |
*/ |
#ifndef MMATH_H |
#define MMATH_H |
#include "glheader.h" |
#include "imports.h" |
/* Do not reference mtypes.h from this file. |
*/ |
/* |
* Set the x86 FPU control word to guarentee only 32 bits of presision |
* are stored in registers. Allowing the FPU to store more introduces |
* differences between situations where numbers are pulled out of memory |
* vs. situations where the compiler is able to optimize register usage. |
* |
* In the worst case, we force the compiler to use a memory access to |
* truncate the float, by specifying the 'volatile' keyword. |
*/ |
#if defined(__GNUC__) && defined(__i386__) |
/* Hardware default: All exceptions masked, extended double precision, |
* round to nearest. IEEE compliant. |
*/ |
#define DEFAULT_X86_FPU 0x037f |
/* All exceptions masked, single precision, round to nearest. |
*/ |
#define FAST_X86_FPU 0x003f |
/* Set it up how we want it. The fldcw instruction will cause any |
* pending FP exceptions to be raised prior to entering the block, and |
* we clear any pending exceptions before exiting the block. Hence, asm |
* code has free reign over the FPU while in the fast math block. |
*/ |
#if defined(NO_FAST_MATH) |
#define START_FAST_MATH(x) \ |
do { \ |
static GLuint mask = DEFAULT_X86_FPU; \ |
__asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ |
__asm__ ( "fldcw %0" : : "m" (mask) ); \ |
} while (0) |
#else |
#define START_FAST_MATH(x) \ |
do { \ |
static GLuint mask = FAST_X86_FPU; \ |
__asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ |
__asm__ ( "fldcw %0" : : "m" (mask) ); \ |
} while (0) |
#endif |
/* Put it back how the application had it, and clear any exceptions that |
* may have occurred in the FAST_MATH block. |
*/ |
#define END_FAST_MATH(x) \ |
do { \ |
__asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ |
} while (0) |
#define HAVE_FAST_MATH |
#elif defined(__WATCOMC__) && !defined(NO_FAST_MATH) |
/* This is the watcom specific inline assembly version of setcw and getcw */ |
void START_FAST_MATH2(unsigned short *x); |
#pragma aux START_FAST_MATH2 = \ |
"fstcw word ptr [esi]" \ |
"or word ptr [esi], 0x3f" \ |
"fldcw word ptr [esi]" \ |
parm [esi] \ |
modify exact []; |
void END_FAST_MATH2(unsigned short *x); |
#pragma aux END_FAST_MATH2 = \ |
"fldcw word ptr [esi]" \ |
parm [esi] \ |
modify exact []; |
#define START_FAST_MATH(x) START_FAST_MATH2(& x) |
#define END_FAST_MATH(x) END_FAST_MATH2(& x) |
/* |
__inline START_FAST_MATH(unsigned short x) |
{ |
_asm { |
fstcw ax |
mov x , ax |
or ax, 0x3f |
fldcw ax |
} |
} |
__inline END_FAST_MATH(unsigned short x) |
{ |
_asm { |
fldcw x |
} |
} |
*/ |
#define HAVE_FAST_MATH |
#else |
#define START_FAST_MATH(x) x = 0 |
#define END_FAST_MATH(x) (void)(x) |
/* The mac float really is a float, with the same precision as a |
* single precision 387 float. |
*/ |
#if defined(macintosh) || defined(__powerpc__) |
#define HAVE_FAST_MATH |
#endif |
#endif |
/* |
* Square root |
*/ |
extern float gl_sqrt(float x); |
#ifdef FAST_MATH |
#if defined(__WATCOMC__) && defined(USE_X86_ASM) |
# define GL_SQRT(X) asm_sqrt(X) |
#else |
# define GL_SQRT(X) gl_sqrt(X) |
#endif |
#else |
# define GL_SQRT(X) sqrt(X) |
#endif |
/* |
* Normalize a 3-element vector to unit length. |
*/ |
#define NORMALIZE_3FV( V ) \ |
do { \ |
GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ |
if (len) { \ |
len = (GLfloat) (1.0 / GL_SQRT(len)); \ |
(V)[0] = (GLfloat) ((V)[0] * len); \ |
(V)[1] = (GLfloat) ((V)[1] * len); \ |
(V)[2] = (GLfloat) ((V)[2] * len); \ |
} \ |
} while(0) |
#define LEN_3FV( V ) (GL_SQRT((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])) |
#define LEN_2FV( V ) (GL_SQRT((V)[0]*(V)[0]+(V)[1]*(V)[1])) |
#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]) |
#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]) |
/* |
* Single precision ceiling, floor, and absolute value functions |
*/ |
#if defined(__sparc__) /* XXX this probably isn't the ideal test */ |
#define CEILF(x) ceil(x) |
#define FLOORF(x) floor(x) |
#define FABSF(x) fabs(x) |
#elif defined(__WIN32__) |
#define CEILF(x) ((GLfloat)ceil(x)) |
#define FLOORF(x) ((GLfloat)floor(x)) |
#define FABSF(x) ((GLfloat)fabs(x)) |
#else |
#define CEILF(x) ceilf(x) |
#define FLOORF(x) floorf(x) |
#define FABSF(x) ((GLfloat)fabs(x)) |
#endif |
#if defined(__i386__) || defined(__sparc__) || defined(__s390x__) || \ |
defined(__powerpc__) || \ |
( defined(__alpha__) && ( defined(__IEEE_FLOAT) || !defined(VMS) ) ) |
#define USE_IEEE |
#endif |
#define GET_FLOAT_BITS(x) ((fi_type *) &(x))->i |
/* |
* Float -> Int conversions (rounding, floor, ceiling) |
*/ |
#if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__) |
static INLINE int iround(float f) |
{ |
int r; |
__asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f)); |
return r; |
} |
#define IROUND(x) iround(x) |
#elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) |
static INLINE int iround(float f) |
{ |
int r; |
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); |
return r; |
} |
#define IROUND(x) iround(x) |
/* |
* IEEE floor for computers that round to nearest or even. |
* 'f' must be between -4194304 and 4194303. |
* This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1", |
* but uses some IEEE specific tricks for better speed. |
* Contributed by Josh Vanderhoof |
*/ |
static INLINE int ifloor(float f) |
{ |
int ai, bi; |
double af, bf; |
af = (3 << 22) + 0.5 + (double)f; |
bf = (3 << 22) + 0.5 - (double)f; |
/* GCC generates an extra fstp/fld without this. */ |
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); |
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); |
return (ai - bi) >> 1; |
} |
#define IFLOOR(x) ifloor(x) |
/* |
* IEEE ceil for computers that round to nearest or even. |
* 'f' must be between -4194304 and 4194303. |
* This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1", |
* but uses some IEEE specific tricks for better speed. |
* Contributed by Josh Vanderhoof |
*/ |
static INLINE int iceil(float f) |
{ |
int ai, bi; |
double af, bf; |
af = (3 << 22) + 0.5 + (double)f; |
bf = (3 << 22) + 0.5 - (double)f; |
/* GCC generates an extra fstp/fld without this. */ |
__asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); |
__asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); |
return (ai - bi + 1) >> 1; |
} |
#define ICEIL(x) iceil(x) |
#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__) |
static INLINE int iround(float f) |
{ |
int r; |
_asm { |
fld f |
fistp r |
} |
return r; |
} |
#define IROUND(x) iround(x) |
#elif defined(USE_X86_ASM) && defined(__WATCOMC__) |
long iround(float f); |
#pragma aux iround = \ |
"push eax" \ |
"fistp dword ptr [esp]" \ |
"pop eax" \ |
parm [8087] \ |
value [eax] \ |
modify exact [eax]; |
#define IROUND(x) iround(x) |
float asm_sqrt (float x); |
#pragma aux asm_sqrt = \ |
"fsqrt" \ |
parm [8087] \ |
value [8087] \ |
modify exact []; |
#endif /* assembly/optimized IROUND, IROUND_POS, IFLOOR, ICEIL macros */ |
/* default IROUND macro */ |
#ifndef IROUND |
#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F))) |
#endif |
/* default IROUND_POS macro */ |
#ifndef IROUND_POS |
#ifdef DEBUG |
#define IROUND_POS(f) (IROUND(f)) |
#else |
#define IROUND_POS(f) (IROUND(f)) |
#endif |
#endif /* IROUND_POS */ |
/* default IFLOOR macro */ |
#ifndef IFLOOR |
static INLINE int ifloor(float f) |
{ |
#ifdef USE_IEEE |
int ai, bi; |
double af, bf; |
union { int i; float f; } u; |
af = (3 << 22) + 0.5 + (double)f; |
bf = (3 << 22) + 0.5 - (double)f; |
u.f = af; ai = u.i; |
u.f = bf; bi = u.i; |
return (ai - bi) >> 1; |
#else |
int i = IROUND(f); |
return (i > f) ? i - 1 : i; |
#endif |
} |
#define IFLOOR(x) ifloor(x) |
#endif /* IFLOOR */ |
/* default ICEIL macro */ |
#ifndef ICEIL |
static INLINE int iceil(float f) |
{ |
#ifdef USE_IEEE |
int ai, bi; |
double af, bf; |
union { int i; float f; } u; |
af = (3 << 22) + 0.5 + (double)f; |
bf = (3 << 22) + 0.5 - (double)f; |
u.f = af; ai = u.i; |
u.f = bf; bi = u.i; |
return (ai - bi + 1) >> 1; |
#else |
int i = IROUND(f); |
return (i < f) ? i + 1 : i; |
#endif |
} |
#define ICEIL(x) iceil(x) |
#endif /* ICEIL */ |
/* |
* Convert unclamped or clamped ([0,1]) floats to ubytes for color |
* conversion only. These functions round to the nearest int. |
*/ |
#define IEEE_ONE 0x3f800000 |
#define IEEE_0996 0x3f7f0000 /* 0.996 or something??? used in macro |
below only */ |
#if defined(USE_IEEE) && !defined(DEBUG) |
/* |
* This function/macro is sensitive to precision. Test carefully |
* if you change it. |
*/ |
#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ |
do { \ |
union { GLfloat r; GLuint i; } __tmp; \ |
__tmp.r = (f); \ |
ub = ((__tmp.i >= IEEE_0996) \ |
? ((GLint)__tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \ |
: (__tmp.r = __tmp.r*(255.0F/256.0F) + 32768.0F, \ |
(GLubyte)__tmp.i)); \ |
} while (0) |
#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ |
UNCLAMPED_FLOAT_TO_UBYTE(ub, f) |
#define COPY_FLOAT( dst, src ) \ |
((fi_type *) &(dst))->i = ((fi_type *) &(src))->i |
#else /* USE_IEEE */ |
#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ |
ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) |
#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ |
ub = ((GLubyte) IROUND((f) * 255.0F)) |
#define COPY_FLOAT( dst, src ) (dst) = (src) |
#endif /* USE_IEEE */ |
/* |
* Integer / float conversion for colors, normals, etc. |
*/ |
/* Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */ |
extern float _mesa_ubyte_to_float_color_tab[256]; |
#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)] |
/* Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */ |
#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) |
/* Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */ |
#define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F)) |
/* Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */ |
#define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) |
/* Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */ |
#define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) |
/* Convert GLfloat in [0.0,1.0] to GLushort in [0,65536] */ |
#define FLOAT_TO_USHORT(X) ((GLushort) (GLint) ((X) * 65535.0F)) |
/* Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ |
#define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) |
/* Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */ |
#define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) |
/* Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ |
#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) |
/* Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ |
#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) |
/* Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ |
#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) |
/* Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ |
/* causes overflow: |
#define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) |
*/ |
/* a close approximation: */ |
#define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) |
#define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) |
#define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7))) |
#define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8)) |
#define INT_TO_UBYTE(i) ((GLubyte) ((i) < 0 ? 0 : (GLubyte) ((i) >> 23))) |
#define UINT_TO_UBYTE(i) ((GLubyte) ((i) >> 24)) |
#define BYTE_TO_USHORT(b) ((b) < 0 ? 0 : ((GLushort) (((b) * 65535) / 255))) |
#define UBYTE_TO_USHORT(b) (((GLushort) (b) << 8) | (GLushort) (b)) |
#define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767)))) |
#define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) |
#define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) |
#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \ |
us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) ) |
#define CLAMPED_FLOAT_TO_USHORT(us, f) \ |
us = ( (GLushort) IROUND( (f) * 65535.0F) ) |
/* |
* Linear interpolation |
* NOTE: OUT argument is evaluated twice! |
* NOTE: Be wary of using *coord++ as an argument to any of these macros! |
*/ |
#define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) |
/* Can do better with integer math: |
*/ |
#define INTERP_UB( t, dstub, outub, inub ) \ |
do { \ |
GLfloat inf = UBYTE_TO_FLOAT( inub ); \ |
GLfloat outf = UBYTE_TO_FLOAT( outub ); \ |
GLfloat dstf = LINTERP( t, outf, inf ); \ |
UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \ |
} while (0) |
#define INTERP_CHAN( t, dstc, outc, inc ) \ |
do { \ |
GLfloat inf = CHAN_TO_FLOAT( inc ); \ |
GLfloat outf = CHAN_TO_FLOAT( outc ); \ |
GLfloat dstf = LINTERP( t, outf, inf ); \ |
UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ |
} while (0) |
#define INTERP_UI( t, dstui, outui, inui ) \ |
dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) ) |
#define INTERP_F( t, dstf, outf, inf ) \ |
dstf = LINTERP( t, outf, inf ) |
#define INTERP_4F( t, dst, out, in ) \ |
do { \ |
dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ |
dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ |
dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ |
dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ |
} while (0) |
#define INTERP_3F( t, dst, out, in ) \ |
do { \ |
dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ |
dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ |
dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ |
} while (0) |
#define INTERP_4CHAN( t, dst, out, in ) \ |
do { \ |
INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ |
INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ |
INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ |
INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ |
} while (0) |
#define INTERP_3CHAN( t, dst, out, in ) \ |
do { \ |
INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ |
INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ |
INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ |
} while (0) |
#define INTERP_SZ( t, vec, to, out, in, sz ) \ |
do { \ |
switch (sz) { \ |
case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ |
case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ |
case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ |
case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ |
} \ |
} while(0) |
/* |
* Fixed point arithmetic macros |
*/ |
#ifdef FIXED_14 |
#define FIXED_ONE 0x00004000 |
#define FIXED_HALF 0x00002000 |
#define FIXED_FRAC_MASK 0x00003FFF |
#define FIXED_SCALE 16384.0f |
#define FIXED_SHIFT 14 |
#else |
#define FIXED_ONE 0x00000800 |
#define FIXED_HALF 0x00000400 |
#define FIXED_FRAC_MASK 0x000007FF |
#define FIXED_SCALE 2048.0f |
#define FIXED_SHIFT 11 |
#endif |
#define FIXED_INT_MASK (~FIXED_FRAC_MASK) |
#define FIXED_EPSILON 1 |
#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) |
#define IntToFixed(I) ((I) << FIXED_SHIFT) |
#define FixedToInt(X) ((X) >> FIXED_SHIFT) |
#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) |
#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) |
#define FixedFloor(X) ((X) & FIXED_INT_MASK) |
#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) |
#define PosFloatToFixed(X) FloatToFixed(X) |
#define SignedFloatToFixed(X) FloatToFixed(X) |
/* Returns TRUE for x == Inf or x == NaN. */ |
#ifdef USE_IEEE |
static INLINE int IS_INF_OR_NAN( float x ) |
{ |
union {float f; int i;} tmp; |
tmp.f = x; |
return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); |
} |
#elif defined(isfinite) |
#define IS_INF_OR_NAN(x) (!isfinite(x)) |
#elif defined(finite) |
#define IS_INF_OR_NAN(x) (!finite(x)) |
#elif __VMS |
#define IS_INF_OR_NAN(x) (!finite(x)) |
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
#define IS_INF_OR_NAN(x) (!isfinite(x)) |
#else |
#define IS_INF_OR_NAN(x) (!finite(x)) |
#endif |
/* |
* Return log_base_2(x). |
*/ |
#ifdef USE_IEEE |
#if 0 |
/* This is pretty fast, but not accurate enough (only 2 fractional bits). |
* Based on code from http://www.stereopsis.com/log2.html |
*/ |
static INLINE GLfloat LOG2(GLfloat x) |
{ |
const GLfloat y = x * x * x * x; |
const GLuint ix = *((GLuint *) &y); |
const GLuint exp = (ix >> 23) & 0xFF; |
const GLint log2 = ((GLint) exp) - 127; |
return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */ |
} |
#endif |
/* Pretty fast, and accurate. |
* Based on code from http://www.flipcode.com/totd/ |
*/ |
static INLINE GLfloat LOG2(GLfloat val) |
{ |
GLint *exp_ptr = (GLint *) &val; |
GLint x = *exp_ptr; |
const GLint log_2 = ((x >> 23) & 255) - 128; |
x &= ~(255 << 23); |
x += 127 << 23; |
*exp_ptr = x; |
val = ((-1.0f/3) * val + 2) * val - 2.0f/3; |
return val + log_2; |
} |
#else /* USE_IEEE */ |
/* Slow, portable solution. |
* NOTE: log_base_2(x) = log(x) / log(2) |
* NOTE: 1.442695 = 1/log(2). |
*/ |
#define LOG2(x) ((GLfloat) (log(x) * 1.442695F)) |
#endif /* USE_IEEE */ |
extern void |
_mesa_init_math(void); |
extern GLuint |
_mesa_bitcount(GLuint n); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/imports.c |
---|
0,0 → 1,681 |
/* $Id: imports.c,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Imports are services which the device driver or window system or |
* operating system provides to the core renderer. The core renderer (Mesa) |
* will call these functions in order to do memory allocation, simple I/O, |
* etc. |
* |
* Some drivers will want to override/replace this file with something |
* specialized, but that'll be rare. |
* |
* Eventually, I want to move roll the glheader.h file into this. |
* |
* The OpenGL SI's __GLimports structure allows per-context specification of |
* replacements for the standard C lib functions. In practice that's probably |
* never needed; compile-time replacements are far more likely. |
* |
* The _mesa_foo() functions defined here don't in general take a context |
* parameter. I guess we can change that someday, if need be. |
* So for now, the __GLimports stuff really isn't used. |
*/ |
#include "glheader.h" |
#include "mtypes.h" |
#include "context.h" |
#include "imports.h" |
#define MAXSTRING 4000 /* for vsnprintf() */ |
#ifdef WIN32 |
#define vsnprintf _vsnprintf |
#endif |
/**********************************************************************/ |
/* Wrappers for standard C library functions */ |
/**********************************************************************/ |
/* |
* Functions still needed: |
* scanf |
* qsort |
* bsearch |
* rand and RAND_MAX |
*/ |
void * |
_mesa_malloc(size_t bytes) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86malloc(bytes); |
#else |
return malloc(bytes); |
#endif |
} |
void * |
_mesa_calloc(size_t bytes) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86calloc(1, bytes); |
#else |
return calloc(1, bytes); |
#endif |
} |
void |
_mesa_free(void *ptr) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86free(ptr); |
#else |
free(ptr); |
#endif |
} |
void * |
_mesa_align_malloc(size_t bytes, unsigned long alignment) |
{ |
unsigned long ptr, buf; |
ASSERT( alignment > 0 ); |
/* Allocate extra memory to accomodate rounding up the address for |
* alignment and to record the real malloc address. |
*/ |
ptr = (unsigned long) _mesa_malloc(bytes + alignment + sizeof(void *)); |
if (!ptr) |
return NULL; |
buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1); |
*(unsigned long *)(buf - sizeof(void *)) = ptr; |
#ifdef DEBUG |
/* mark the non-aligned area */ |
while ( ptr < buf - sizeof(void *) ) { |
*(unsigned long *)ptr = 0xcdcdcdcd; |
ptr += sizeof(unsigned long); |
} |
#endif |
return (void *) buf; |
} |
void * |
_mesa_align_calloc(size_t bytes, unsigned long alignment) |
{ |
unsigned long ptr, buf; |
ASSERT( alignment > 0 ); |
ptr = (unsigned long) _mesa_calloc(bytes + alignment + sizeof(void *)); |
if (!ptr) |
return NULL; |
buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1); |
*(unsigned long *)(buf - sizeof(void *)) = ptr; |
#ifdef DEBUG |
/* mark the non-aligned area */ |
while ( ptr < buf - sizeof(void *) ) { |
*(unsigned long *)ptr = 0xcdcdcdcd; |
ptr += sizeof(unsigned long); |
} |
#endif |
return (void *)buf; |
} |
void |
_mesa_align_free(void *ptr) |
{ |
#if 0 |
_mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); |
#else |
/* The actuall address to free is stuffed in the word immediately |
* before the address the client sees. |
*/ |
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); |
void *realAddr = *cubbyHole; |
_mesa_free(realAddr); |
#endif |
} |
void * |
_mesa_memcpy(void *dest, const void *src, size_t n) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86memcpy(dest, src, n); |
#elif defined(SUNOS4) |
return memcpy((char *) dest, (char *) src, (int) n); |
#else |
return memcpy(dest, src, n); |
#endif |
} |
void |
_mesa_memset( void *dst, int val, size_t n ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86memset( dst, val, n ); |
#elif defined(SUNOS4) |
memset( (char *) dst, (int) val, (int) n ); |
#else |
memset(dst, val, n); |
#endif |
} |
void |
_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) |
{ |
while (n-- > 0) |
*dst++ = val; |
} |
void |
_mesa_bzero( void *dst, size_t n ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86memset( dst, 0, n ); |
#elif defined(__FreeBSD__) |
bzero( dst, n ); |
#else |
memset( dst, 0, n ); |
#endif |
} |
double |
_mesa_sin(double a) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86sin(a); |
#else |
return sin(a); |
#endif |
} |
double |
_mesa_cos(double a) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86cos(a); |
#else |
return cos(a); |
#endif |
} |
double |
_mesa_sqrt(double x) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86sqrt(x); |
#else |
return sqrt(x); |
#endif |
} |
double |
_mesa_pow(double x, double y) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86pow(x, y); |
#else |
return pow(x, y); |
#endif |
} |
char * |
_mesa_getenv( const char *var ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86getenv(var); |
#else |
cprintf("Called _mesa_getenv\n"); |
return getenv(var); |
#endif |
} |
char * |
_mesa_strstr( const char *haystack, const char *needle ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strstr(haystack, needle); |
#else |
return strstr(haystack, needle); |
#endif |
} |
char * |
_mesa_strncat( char *dest, const char *src, size_t n ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strncat(dest, src, n); |
#else |
return strncat(dest, src, n); |
#endif |
} |
char * |
_mesa_strcpy( char *dest, const char *src ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strcpy(dest, src); |
#else |
return strcpy(dest, src); |
#endif |
} |
char * |
_mesa_strncpy( char *dest, const char *src, size_t n ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strncpy(dest, src, n); |
#else |
return strncpy(dest, src, n); |
#endif |
} |
size_t |
_mesa_strlen( const char *s ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strlen(s); |
#else |
return strlen(s); |
#endif |
} |
int |
_mesa_strcmp( const char *s1, const char *s2 ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strcmp(s1, s2); |
#else |
return strcmp(s1, s2); |
#endif |
} |
int |
_mesa_strncmp( const char *s1, const char *s2, size_t n ) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86strncmp(s1, s2, n); |
#else |
return strncmp(s1, s2, n); |
#endif |
} |
int |
_mesa_atoi(const char *s) |
{ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86atoi(s); |
#else |
return (int)atoi((char *)s); |
#endif |
} |
int |
_mesa_sprintf( char *str, const char *fmt, ... ) |
{ |
int r; |
va_list args; |
va_start( args, fmt ); |
va_end( args ); |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
r = xf86vsprintf( str, fmt, args ); |
#else |
cprintf("Called _mesa_sprintf\n"); |
sprintf(str,"ERROR"); |
r = 0; |
#endif |
return r; |
} |
void |
_mesa_printf( const char *fmtString, ... ) |
{ |
char s[MAXSTRING]; |
//va_list args; |
//va_start( args, fmtString ); |
//vsnprintf(s, MAXSTRING, fmtString, args); |
//va_end( args ); |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86printf("%s", s); |
#else |
cprintf("Called _mesa_printf\n"); |
cprintf("%s\n",fmtString); |
#endif |
} |
void |
_mesa_warning( GLcontext *ctx, const char *fmtString, ... ) |
{ |
GLboolean debug; |
char str[MAXSTRING]; |
//va_list args; |
(void) ctx; |
//va_start( args, fmtString ); |
//(void) vsnprintf( str, MAXSTRING, fmtString, args ); |
//va_end( args ); |
#ifdef DEBUG |
debug = GL_TRUE; /* always print warning */ |
#else |
debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; |
#endif |
if (debug) { |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86fprintf(stderr, "Mesa warning: %s\n", str); |
#else |
cprintf("Called _mesa_warning\n"); |
cprintf("ERROR: %s\n", fmtString); |
#endif |
} |
} |
/* |
* This function is called when the Mesa user has stumbled into a code |
* path which may not be implemented fully or correctly. |
*/ |
void |
_mesa_problem( const GLcontext *ctx, const char *s ) |
{ |
(void) ctx; |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86fprintf(stderr, "Mesa implementation error: %s\n", s); |
xf86fprintf(stderr, "Please report to the DRI project at dri.sourceforge.net\n"); |
#else |
cprintf("Mesa implementation error: %s\n", s); |
cprintf("Please report to the Mesa bug database at www.mesa3d.org\n" ); |
#endif |
} |
/* |
* If in debug mode, print error message to stdout. |
* Also, record the error code by calling _mesa_record_error(). |
* Input: ctx - the GL context |
* error - the error value |
* fmtString - printf-style format string, followed by optional args |
*/ |
void |
_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) |
{ |
const char *debugEnv; |
GLboolean debug; |
debugEnv = _mesa_getenv("MESA_DEBUG"); |
#ifdef DEBUG |
debug = GL_TRUE; |
#else |
if (debugEnv) |
debug = GL_TRUE; |
else |
debug = GL_FALSE; |
#endif |
if (debug) { |
/* |
va_list args; |
char where[MAXSTRING];*/ |
const char *errstr; |
/* |
va_start( args, fmtString ); |
vsnprintf( where, MAXSTRING, fmtString, args ); |
va_end( args ); |
*/ |
switch (error) { |
case GL_NO_ERROR: |
errstr = "GL_NO_ERROR"; |
break; |
case GL_INVALID_VALUE: |
errstr = "GL_INVALID_VALUE"; |
break; |
case GL_INVALID_ENUM: |
errstr = "GL_INVALID_ENUM"; |
break; |
case GL_INVALID_OPERATION: |
errstr = "GL_INVALID_OPERATION"; |
break; |
case GL_STACK_OVERFLOW: |
errstr = "GL_STACK_OVERFLOW"; |
break; |
case GL_STACK_UNDERFLOW: |
errstr = "GL_STACK_UNDERFLOW"; |
break; |
case GL_OUT_OF_MEMORY: |
errstr = "GL_OUT_OF_MEMORY"; |
break; |
case GL_TABLE_TOO_LARGE: |
errstr = "GL_TABLE_TOO_LARGE"; |
break; |
default: |
errstr = "unknown"; |
break; |
} |
_mesa_debug(ctx, "Mesa user error: %s in %s\n", errstr); |
} |
_mesa_record_error(ctx, error); |
} |
/* |
* Call this to report debug information. Uses stderr. |
*/ |
void |
_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) |
{ |
char s[MAXSTRING]; |
va_list args; |
/* |
va_start(args, fmtString); |
vsnprintf(s, MAXSTRING, fmtString, args); |
va_end(args);*/ |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
xf86fprintf(stderr, "Mesa: %s", s); |
#else |
cprintf("Called _mesa_debug\n"); |
cprintf("ERROR: %s\n", fmtString); |
#endif |
} |
/**********************************************************************/ |
/* Default Imports Wrapper */ |
/**********************************************************************/ |
static void * |
default_malloc(__GLcontext *gc, size_t size) |
{ |
(void) gc; |
return _mesa_malloc(size); |
} |
static void * |
default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) |
{ |
(void) gc; |
return _mesa_calloc(numElem * elemSize); |
} |
static void * |
default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) |
{ |
(void) gc; |
#if defined(XFree86LOADER) && defined(IN_MODULE) |
return xf86realloc(oldAddr, newSize); |
#else |
return realloc(oldAddr, newSize); |
#endif |
} |
static void |
default_free(__GLcontext *gc, void *addr) |
{ |
(void) gc; |
_mesa_free(addr); |
} |
static char * CAPI |
default_getenv( __GLcontext *gc, const char *var ) |
{ |
(void) gc; |
return _mesa_getenv(var); |
} |
static void |
default_warning(__GLcontext *gc, char *str) |
{ |
_mesa_warning(gc, str); |
} |
static void |
default_fatal(__GLcontext *gc, char *str) |
{ |
_mesa_problem(gc, str); |
abort(); |
} |
static int CAPI |
default_atoi(__GLcontext *gc, const char *str) |
{ |
(void) gc; |
return (int)atoi((char *)str); |
} |
static int CAPI |
default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) |
{ |
int r; |
//va_list args; |
//va_start( args, fmt ); |
//r = vsprintf( str, fmt, args ); |
//va_end( args ); |
cprintf("Called default_sprintf\n"); |
sprintf(str, "ERROR"); |
r = 0; |
return r; |
} |
static void * CAPI |
default_fopen(__GLcontext *gc, const char *path, const char *mode) |
{ |
return NULL;//fopen(path, mode); |
} |
static int CAPI |
default_fclose(__GLcontext *gc, void *stream) |
{ |
return 0;//fclose((FILE *) stream); |
} |
static int CAPI |
default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) |
{ |
int r; |
char s[200]; |
/* |
va_list args; |
va_start( args, fmt ); |
r = vsprintf(s, fmt, args ); |
va_end( args ); |
*/ |
cprintf("Called default_fprintf\n"); |
cprintf("ERROR: %s\n",fmt); |
r = 0; |
return r; |
} |
/* XXX this really is driver-specific and can't be here */ |
static __GLdrawablePrivate * |
default_GetDrawablePrivate(__GLcontext *gc) |
{ |
return NULL; |
} |
/* |
* Initialize a __GLimports object to point to the functions in |
* this file. This is to be called from device drivers. |
* Input: imports - the object to init |
* driverCtx - pointer to device driver-specific data |
*/ |
void |
_mesa_init_default_imports(__GLimports *imports, void *driverCtx) |
{ |
imports->malloc = default_malloc; |
imports->calloc = default_calloc; |
imports->realloc = default_realloc; |
imports->free = default_free; |
imports->warning = default_warning; |
imports->fatal = default_fatal; |
imports->getenv = default_getenv; /* not used for now */ |
imports->atoi = default_atoi; |
imports->sprintf = default_sprintf; |
imports->fopen = default_fopen; |
imports->fclose = default_fclose; |
imports->fprintf = default_fprintf; |
imports->getDrawablePrivate = default_GetDrawablePrivate; |
imports->other = driverCtx; |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_blend.c |
---|
0,0 → 1,807 |
/* $Id: s_blend.c,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "colormac.h" |
#include "macros.h" |
#include "s_alphabuf.h" |
#include "s_blend.h" |
#include "s_context.h" |
#include "s_span.h" |
#if defined(USE_MMX_ASM) |
#include "x86/mmx.h" |
#include "x86/common_x86_asm.h" |
#define _BLENDAPI _ASMAPI |
#else |
#define _BLENDAPI |
#endif |
/* |
* Special case for glBlendFunc(GL_ZERO, GL_ONE) |
*/ |
static void _BLENDAPI |
blend_noop( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT); |
ASSERT(ctx->Color.BlendSrcRGB==GL_ZERO); |
ASSERT(ctx->Color.BlendDstRGB==GL_ONE); |
(void) ctx; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
COPY_CHAN4( rgba[i], dest[i] ); |
} |
} |
} |
/* |
* Special case for glBlendFunc(GL_ONE, GL_ZERO) |
*/ |
static void _BLENDAPI |
blend_replace( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT); |
ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); |
ASSERT(ctx->Color.BlendDstRGB==GL_ZERO); |
(void) ctx; |
(void) n; |
(void) mask; |
(void) rgba; |
(void) dest; |
} |
/* |
* Common transparency blending mode. |
*/ |
static void _BLENDAPI |
blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT); |
ASSERT(ctx->Color.BlendSrcRGB==GL_SRC_ALPHA); |
ASSERT(ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA); |
(void) ctx; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
const GLchan t = rgba[i][ACOMP]; /* t in [0, CHAN_MAX] */ |
if (t == 0) { |
/* 0% alpha */ |
rgba[i][RCOMP] = dest[i][RCOMP]; |
rgba[i][GCOMP] = dest[i][GCOMP]; |
rgba[i][BCOMP] = dest[i][BCOMP]; |
rgba[i][ACOMP] = dest[i][ACOMP]; |
} |
else if (t == CHAN_MAX) { |
/* 100% alpha, no-op */ |
} |
else { |
#if 0 |
/* This is pretty close, but Glean complains */ |
const GLint s = CHAN_MAX - t; |
const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s + 1) >> 8; |
const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s + 1) >> 8; |
const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s + 1) >> 8; |
const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s + 1) >> 8; |
#elif 0 |
/* This is slower but satisfies Glean */ |
const GLint s = CHAN_MAX - t; |
const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / 255; |
const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / 255; |
const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / 255; |
const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / 255; |
#else |
#if CHAN_BITS == 8 |
/* This satisfies Glean and should be reasonably fast */ |
/* Contributed by Nathan Hand */ |
#if 0 |
#define DIV255(X) (((X) << 8) + (X) + 256) >> 16 |
#else |
GLint temp; |
#define DIV255(X) (temp = (X), ((temp << 8) + temp + 256) >> 16) |
#endif |
const GLint r = DIV255((rgba[i][RCOMP] - dest[i][RCOMP]) * t) + dest[i][RCOMP]; |
const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP]; |
const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP]; |
const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP]; |
#undef DIV255 |
#elif CHAN_BITS == 16 |
const GLfloat tt = (GLfloat) t / CHAN_MAXF; |
const GLint r = (GLint) ((rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]); |
const GLint g = (GLint) ((rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]); |
const GLint b = (GLint) ((rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]); |
const GLint a = (GLint) ((rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP]); |
#else /* CHAN_BITS == 32 */ |
const GLfloat tt = (GLfloat) t / CHAN_MAXF; |
const GLfloat r = (rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]; |
const GLfloat g = (rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]; |
const GLfloat b = (rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]; |
const GLfloat a = CLAMP( rgba[i][ACOMP], 0.0F, CHAN_MAXF ) * t + |
CLAMP( dest[i][ACOMP], 0.0F, CHAN_MAXF ) * (1.0F - t); |
#endif |
#endif |
ASSERT(r <= CHAN_MAX); |
ASSERT(g <= CHAN_MAX); |
ASSERT(b <= CHAN_MAX); |
ASSERT(a <= CHAN_MAX); |
rgba[i][RCOMP] = (GLchan) r; |
rgba[i][GCOMP] = (GLchan) g; |
rgba[i][BCOMP] = (GLchan) b; |
rgba[i][ACOMP] = (GLchan) a; |
} |
} |
} |
} |
/* |
* Add src and dest. |
*/ |
static void _BLENDAPI |
blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
ASSERT(ctx->Color.BlendEquation==GL_FUNC_ADD_EXT); |
ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); |
ASSERT(ctx->Color.BlendDstRGB==GL_ONE); |
(void) ctx; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
#if CHAN_TYPE == GL_FLOAT |
/* don't RGB clamp to max */ |
GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF) + dest[i][ACOMP]; |
rgba[i][RCOMP] += dest[i][RCOMP]; |
rgba[i][GCOMP] += dest[i][GCOMP]; |
rgba[i][BCOMP] += dest[i][BCOMP]; |
rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAXF ); |
#else |
GLint r = rgba[i][RCOMP] + dest[i][RCOMP]; |
GLint g = rgba[i][GCOMP] + dest[i][GCOMP]; |
GLint b = rgba[i][BCOMP] + dest[i][BCOMP]; |
GLint a = rgba[i][ACOMP] + dest[i][ACOMP]; |
rgba[i][RCOMP] = (GLchan) MIN2( r, CHAN_MAX ); |
rgba[i][GCOMP] = (GLchan) MIN2( g, CHAN_MAX ); |
rgba[i][BCOMP] = (GLchan) MIN2( b, CHAN_MAX ); |
rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAX ); |
#endif |
} |
} |
} |
/* |
* Blend min function (for GL_EXT_blend_minmax) |
*/ |
static void _BLENDAPI |
blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
ASSERT(ctx->Color.BlendEquation==GL_MIN_EXT); |
(void) ctx; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
rgba[i][RCOMP] = (GLchan) MIN2( rgba[i][RCOMP], dest[i][RCOMP] ); |
rgba[i][GCOMP] = (GLchan) MIN2( rgba[i][GCOMP], dest[i][GCOMP] ); |
rgba[i][BCOMP] = (GLchan) MIN2( rgba[i][BCOMP], dest[i][BCOMP] ); |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (GLchan) MIN2(CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF), |
dest[i][ACOMP]); |
#else |
rgba[i][ACOMP] = (GLchan) MIN2( rgba[i][ACOMP], dest[i][ACOMP] ); |
#endif |
} |
} |
} |
/* |
* Blend max function (for GL_EXT_blend_minmax) |
*/ |
static void _BLENDAPI |
blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
ASSERT(ctx->Color.BlendEquation==GL_MAX_EXT); |
(void) ctx; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
rgba[i][RCOMP] = (GLchan) MAX2( rgba[i][RCOMP], dest[i][RCOMP] ); |
rgba[i][GCOMP] = (GLchan) MAX2( rgba[i][GCOMP], dest[i][GCOMP] ); |
rgba[i][BCOMP] = (GLchan) MAX2( rgba[i][BCOMP], dest[i][BCOMP] ); |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (GLchan) MAX2(CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF), |
dest[i][ACOMP]); |
#else |
rgba[i][ACOMP] = (GLchan) MAX2( rgba[i][ACOMP], dest[i][ACOMP] ); |
#endif |
} |
} |
} |
/* |
* Modulate: result = src * dest |
*/ |
static void _BLENDAPI |
blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
GLuint i; |
(void) ctx; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = rgba[i][RCOMP] * dest[i][RCOMP]; |
rgba[i][GCOMP] = rgba[i][GCOMP] * dest[i][GCOMP]; |
rgba[i][BCOMP] = rgba[i][BCOMP] * dest[i][BCOMP]; |
rgba[i][ACOMP] = rgba[i][ACOMP] * dest[i][ACOMP]; |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 65535) >> 16; |
GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 65535) >> 16; |
GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 65535) >> 16; |
GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 65535) >> 16; |
rgba[i][RCOMP] = (GLchan) r; |
rgba[i][GCOMP] = (GLchan) g; |
rgba[i][BCOMP] = (GLchan) b; |
rgba[i][ACOMP] = (GLchan) a; |
#else |
GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 255) >> 8; |
GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 255) >> 8; |
GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 255) >> 8; |
GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 255) >> 8; |
rgba[i][RCOMP] = (GLchan) r; |
rgba[i][GCOMP] = (GLchan) g; |
rgba[i][BCOMP] = (GLchan) b; |
rgba[i][ACOMP] = (GLchan) a; |
#endif |
} |
} |
} |
/* |
* General case blend pixels. |
* Input: n - number of pixels |
* mask - the usual write mask |
* In/Out: rgba - the incoming and modified pixels |
* Input: dest - the pixels from the dest color buffer |
*/ |
static void _BLENDAPI |
blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan rgba[][4], CONST GLchan dest[][4] ) |
{ |
const GLfloat rscale = 1.0F / CHAN_MAXF; |
const GLfloat gscale = 1.0F / CHAN_MAXF; |
const GLfloat bscale = 1.0F / CHAN_MAXF; |
const GLfloat ascale = 1.0F / CHAN_MAXF; |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
#if CHAN_TYPE == GL_FLOAT |
GLfloat Rs, Gs, Bs, As; /* Source colors */ |
GLfloat Rd, Gd, Bd, Ad; /* Dest colors */ |
#else |
GLint Rs, Gs, Bs, As; /* Source colors */ |
GLint Rd, Gd, Bd, Ad; /* Dest colors */ |
#endif |
GLfloat sR, sG, sB, sA; /* Source scaling */ |
GLfloat dR, dG, dB, dA; /* Dest scaling */ |
GLfloat r, g, b, a; /* result color */ |
/* Incoming/source Color */ |
Rs = rgba[i][RCOMP]; |
Gs = rgba[i][GCOMP]; |
Bs = rgba[i][BCOMP]; |
As = rgba[i][ACOMP]; |
#if CHAN_TYPE == GL_FLOAT |
/* clamp */ |
Rs = MIN2(Rs, CHAN_MAXF); |
Gs = MIN2(Gs, CHAN_MAXF); |
Bs = MIN2(Bs, CHAN_MAXF); |
As = MIN2(As, CHAN_MAXF); |
#endif |
/* Frame buffer/dest color */ |
Rd = dest[i][RCOMP]; |
Gd = dest[i][GCOMP]; |
Bd = dest[i][BCOMP]; |
Ad = dest[i][ACOMP]; |
#if CHAN_TYPE == GL_FLOAT |
/* clamp */ |
Rd = MIN2(Rd, CHAN_MAXF); |
Gd = MIN2(Gd, CHAN_MAXF); |
Bd = MIN2(Bd, CHAN_MAXF); |
Ad = MIN2(Ad, CHAN_MAXF); |
#endif |
/* Source RGB factor */ |
switch (ctx->Color.BlendSrcRGB) { |
case GL_ZERO: |
sR = sG = sB = 0.0F; |
break; |
case GL_ONE: |
sR = sG = sB = 1.0F; |
break; |
case GL_DST_COLOR: |
sR = (GLfloat) Rd * rscale; |
sG = (GLfloat) Gd * gscale; |
sB = (GLfloat) Bd * bscale; |
break; |
case GL_ONE_MINUS_DST_COLOR: |
sR = 1.0F - (GLfloat) Rd * rscale; |
sG = 1.0F - (GLfloat) Gd * gscale; |
sB = 1.0F - (GLfloat) Bd * bscale; |
break; |
case GL_SRC_ALPHA: |
sR = sG = sB = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_ALPHA: |
sR = sG = sB = 1.0F - (GLfloat) As * ascale; |
break; |
case GL_DST_ALPHA: |
sR = sG = sB = (GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_ALPHA: |
sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; |
break; |
case GL_SRC_ALPHA_SATURATE: |
if (As < CHAN_MAX - Ad) { |
sR = sG = sB = (GLfloat) As * ascale; |
} |
else { |
sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; |
} |
break; |
case GL_CONSTANT_COLOR: |
sR = ctx->Color.BlendColor[0]; |
sG = ctx->Color.BlendColor[1]; |
sB = ctx->Color.BlendColor[2]; |
break; |
case GL_ONE_MINUS_CONSTANT_COLOR: |
sR = 1.0F - ctx->Color.BlendColor[0]; |
sG = 1.0F - ctx->Color.BlendColor[1]; |
sB = 1.0F - ctx->Color.BlendColor[2]; |
break; |
case GL_CONSTANT_ALPHA: |
sR = sG = sB = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
sR = sG = sB = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_SRC_COLOR: /* GL_NV_blend_square */ |
sR = (GLfloat) Rs * rscale; |
sG = (GLfloat) Gs * gscale; |
sB = (GLfloat) Bs * bscale; |
break; |
case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ |
sR = 1.0F - (GLfloat) Rs * rscale; |
sG = 1.0F - (GLfloat) Gs * gscale; |
sB = 1.0F - (GLfloat) Bs * bscale; |
break; |
default: |
/* this should never happen */ |
_mesa_problem(ctx, "Bad blend source RGB factor in do_blend"); |
return; |
} |
/* Source Alpha factor */ |
switch (ctx->Color.BlendSrcA) { |
case GL_ZERO: |
sA = 0.0F; |
break; |
case GL_ONE: |
sA = 1.0F; |
break; |
case GL_DST_COLOR: |
sA = (GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_COLOR: |
sA = 1.0F - (GLfloat) Ad * ascale; |
break; |
case GL_SRC_ALPHA: |
sA = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_ALPHA: |
sA = 1.0F - (GLfloat) As * ascale; |
break; |
case GL_DST_ALPHA: |
sA =(GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_ALPHA: |
sA = 1.0F - (GLfloat) Ad * ascale; |
break; |
case GL_SRC_ALPHA_SATURATE: |
sA = 1.0; |
break; |
case GL_CONSTANT_COLOR: |
sA = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_COLOR: |
sA = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_CONSTANT_ALPHA: |
sA = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
sA = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_SRC_COLOR: /* GL_NV_blend_square */ |
sA = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ |
sA = 1.0F - (GLfloat) As * ascale; |
break; |
default: |
/* this should never happen */ |
sA = 0.0F; |
_mesa_problem(ctx, "Bad blend source A factor in do_blend"); |
} |
/* Dest RGB factor */ |
switch (ctx->Color.BlendDstRGB) { |
case GL_ZERO: |
dR = dG = dB = 0.0F; |
break; |
case GL_ONE: |
dR = dG = dB = 1.0F; |
break; |
case GL_SRC_COLOR: |
dR = (GLfloat) Rs * rscale; |
dG = (GLfloat) Gs * gscale; |
dB = (GLfloat) Bs * bscale; |
break; |
case GL_ONE_MINUS_SRC_COLOR: |
dR = 1.0F - (GLfloat) Rs * rscale; |
dG = 1.0F - (GLfloat) Gs * gscale; |
dB = 1.0F - (GLfloat) Bs * bscale; |
break; |
case GL_SRC_ALPHA: |
dR = dG = dB = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_ALPHA: |
dR = dG = dB = 1.0F - (GLfloat) As * ascale; |
break; |
case GL_DST_ALPHA: |
dR = dG = dB = (GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_ALPHA: |
dR = dG = dB = 1.0F - (GLfloat) Ad * ascale; |
break; |
case GL_CONSTANT_COLOR: |
dR = ctx->Color.BlendColor[0]; |
dG = ctx->Color.BlendColor[1]; |
dB = ctx->Color.BlendColor[2]; |
break; |
case GL_ONE_MINUS_CONSTANT_COLOR: |
dR = 1.0F - ctx->Color.BlendColor[0]; |
dG = 1.0F - ctx->Color.BlendColor[1]; |
dB = 1.0F - ctx->Color.BlendColor[2]; |
break; |
case GL_CONSTANT_ALPHA: |
dR = dG = dB = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
dR = dG = dB = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_DST_COLOR: /* GL_NV_blend_square */ |
dR = (GLfloat) Rd * rscale; |
dG = (GLfloat) Gd * gscale; |
dB = (GLfloat) Bd * bscale; |
break; |
case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ |
dR = 1.0F - (GLfloat) Rd * rscale; |
dG = 1.0F - (GLfloat) Gd * gscale; |
dB = 1.0F - (GLfloat) Bd * bscale; |
break; |
default: |
/* this should never happen */ |
dR = dG = dB = 0.0F; |
_mesa_problem(ctx, "Bad blend dest RGB factor in do_blend"); |
} |
/* Dest Alpha factor */ |
switch (ctx->Color.BlendDstA) { |
case GL_ZERO: |
dA = 0.0F; |
break; |
case GL_ONE: |
dA = 1.0F; |
break; |
case GL_SRC_COLOR: |
dA = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_COLOR: |
dA = 1.0F - (GLfloat) As * ascale; |
break; |
case GL_SRC_ALPHA: |
dA = (GLfloat) As * ascale; |
break; |
case GL_ONE_MINUS_SRC_ALPHA: |
dA = 1.0F - (GLfloat) As * ascale; |
break; |
case GL_DST_ALPHA: |
dA = (GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_ALPHA: |
dA = 1.0F - (GLfloat) Ad * ascale; |
break; |
case GL_CONSTANT_COLOR: |
dA = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_COLOR: |
dA = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_CONSTANT_ALPHA: |
dA = ctx->Color.BlendColor[3]; |
break; |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
dA = 1.0F - ctx->Color.BlendColor[3]; |
break; |
case GL_DST_COLOR: /* GL_NV_blend_square */ |
dA = (GLfloat) Ad * ascale; |
break; |
case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ |
dA = 1.0F - (GLfloat) Ad * ascale; |
break; |
default: |
/* this should never happen */ |
dA = 0.0F; |
_mesa_problem(ctx, "Bad blend dest A factor in do_blend"); |
return; |
} |
/* Due to round-off problems we have to clamp against zero. */ |
/* Optimization: we don't have to do this for all src & dst factors */ |
if (dA < 0.0F) dA = 0.0F; |
if (dR < 0.0F) dR = 0.0F; |
if (dG < 0.0F) dG = 0.0F; |
if (dB < 0.0F) dB = 0.0F; |
if (sA < 0.0F) sA = 0.0F; |
if (sR < 0.0F) sR = 0.0F; |
if (sG < 0.0F) sG = 0.0F; |
if (sB < 0.0F) sB = 0.0F; |
ASSERT( sR <= 1.0 ); |
ASSERT( sG <= 1.0 ); |
ASSERT( sB <= 1.0 ); |
ASSERT( sA <= 1.0 ); |
ASSERT( dR <= 1.0 ); |
ASSERT( dG <= 1.0 ); |
ASSERT( dB <= 1.0 ); |
ASSERT( dA <= 1.0 ); |
/* compute blended color */ |
#if CHAN_TYPE == GL_FLOAT |
if (ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { |
r = Rs * sR + Rd * dR; |
g = Gs * sG + Gd * dG; |
b = Bs * sB + Bd * dB; |
a = As * sA + Ad * dA; |
} |
else if (ctx->Color.BlendEquation==GL_FUNC_SUBTRACT_EXT) { |
r = Rs * sR - Rd * dR; |
g = Gs * sG - Gd * dG; |
b = Bs * sB - Bd * dB; |
a = As * sA - Ad * dA; |
} |
else if (ctx->Color.BlendEquation==GL_FUNC_REVERSE_SUBTRACT_EXT) { |
r = Rd * dR - Rs * sR; |
g = Gd * dG - Gs * sG; |
b = Bd * dB - Bs * sB; |
a = Ad * dA - As * sA; |
} |
else { |
/* should never get here */ |
r = g = b = a = 0.0F; /* silence uninitialized var warning */ |
_mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); |
} |
/* final clamping */ |
rgba[i][RCOMP] = MAX2( r, 0.0F ); |
rgba[i][GCOMP] = MAX2( g, 0.0F ); |
rgba[i][BCOMP] = MAX2( b, 0.0F ); |
rgba[i][ACOMP] = CLAMP( a, 0.0F, CHAN_MAXF ); |
#else |
if (ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { |
r = Rs * sR + Rd * dR + 0.5F; |
g = Gs * sG + Gd * dG + 0.5F; |
b = Bs * sB + Bd * dB + 0.5F; |
a = As * sA + Ad * dA + 0.5F; |
} |
else if (ctx->Color.BlendEquation==GL_FUNC_SUBTRACT_EXT) { |
r = Rs * sR - Rd * dR + 0.5F; |
g = Gs * sG - Gd * dG + 0.5F; |
b = Bs * sB - Bd * dB + 0.5F; |
a = As * sA - Ad * dA + 0.5F; |
} |
else if (ctx->Color.BlendEquation==GL_FUNC_REVERSE_SUBTRACT_EXT) { |
r = Rd * dR - Rs * sR + 0.5F; |
g = Gd * dG - Gs * sG + 0.5F; |
b = Bd * dB - Bs * sB + 0.5F; |
a = Ad * dA - As * sA + 0.5F; |
} |
else { |
/* should never get here */ |
r = g = b = a = 0.0F; /* silence uninitialized var warning */ |
_mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); |
} |
/* final clamping */ |
rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF ); |
rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF ); |
rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF ); |
rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF ); |
#endif |
} |
} |
} |
/* |
* Analyze current blending parameters to pick fastest blending function. |
* Result: the ctx->Color.BlendFunc pointer is updated. |
*/ |
void _swrast_choose_blend_func( GLcontext *ctx ) |
{ |
const GLenum eq = ctx->Color.BlendEquation; |
const GLenum srcRGB = ctx->Color.BlendSrcRGB; |
const GLenum dstRGB = ctx->Color.BlendDstRGB; |
const GLenum srcA = ctx->Color.BlendSrcA; |
const GLenum dstA = ctx->Color.BlendDstA; |
if (srcRGB != srcA || dstRGB != dstA) { |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; |
} |
else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_SRC_ALPHA |
&& dstRGB==GL_ONE_MINUS_SRC_ALPHA) { |
#if defined(USE_MMX_ASM) |
if ( cpu_has_mmx ) { |
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency; |
} |
else |
#endif |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_transparency; |
} |
else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_ONE && dstRGB==GL_ONE) { |
#if defined(USE_MMX_ASM) |
if ( cpu_has_mmx ) { |
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_add; |
} |
else |
#endif |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_add; |
} |
else if (((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_REVERSE_SUBTRACT_EXT) |
&& (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR)) |
|| |
((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_SUBTRACT_EXT) |
&& (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) { |
#if defined(USE_MMX_ASM) |
if ( cpu_has_mmx ) { |
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_modulate; |
} |
else |
#endif |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_modulate; |
} |
else if (eq==GL_MIN_EXT) { |
#if defined(USE_MMX_ASM) |
if ( cpu_has_mmx ) { |
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_min; |
} |
else |
#endif |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_min; |
} |
else if (eq==GL_MAX_EXT) { |
#if defined(USE_MMX_ASM) |
if ( cpu_has_mmx ) { |
SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_max; |
} |
else |
#endif |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_max; |
} |
else if (eq==GL_FUNC_ADD_EXT && srcRGB == GL_ZERO && dstRGB == GL_ONE) { |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_noop; |
} |
else if (eq==GL_FUNC_ADD_EXT && srcRGB == GL_ONE && dstRGB == GL_ZERO) { |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_replace; |
} |
else { |
SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; |
} |
} |
/* |
* Apply the blending operator to a span of pixels. |
* We can handle horizontal runs of pixels (spans) or arrays of x/y |
* pixel coordinates. |
*/ |
void |
_mesa_blend_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan framebuffer[MAX_WIDTH][4]; |
ASSERT(span->end <= MAX_WIDTH); |
ASSERT(span->arrayMask & SPAN_RGBA); |
ASSERT(!ctx->Color.ColorLogicOpEnabled); |
/* Read span of current frame buffer pixels */ |
if (span->arrayMask & SPAN_XY) { |
/* array of x/y pixel coords */ |
(*swrast->Driver.ReadRGBAPixels)( ctx, span->end, |
span->array->x, span->array->y, |
framebuffer, span->array->mask ); |
if (swrast->_RasterMask & ALPHABUF_BIT) { |
_mesa_read_alpha_pixels( ctx, span->end, |
span->array->x, span->array->y, |
framebuffer, span->array->mask ); |
} |
} |
else { |
/* horizontal run of pixels */ |
_mesa_read_rgba_span( ctx, ctx->DrawBuffer, span->end, |
span->x, span->y, framebuffer ); |
} |
SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba, |
(const GLchan (*)[4]) framebuffer ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_points.c |
---|
0,0 → 1,278 |
/* $Id: s_points.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "texstate.h" |
#include "s_context.h" |
#include "s_feedback.h" |
#include "s_points.h" |
#include "s_span.h" |
#define RGBA 0x1 |
#define INDEX 0x2 |
#define SMOOTH 0x4 |
#define TEXTURE 0x8 |
#define SPECULAR 0x10 |
#define LARGE 0x20 |
#define ATTENUATE 0x40 |
#define SPRITE 0x80 |
/* |
* CI points with size == 1.0 |
*/ |
#define FLAGS (INDEX) |
#define NAME size1_ci_point |
#include "s_pointtemp.h" |
/* |
* General CI points. |
*/ |
#define FLAGS (INDEX | LARGE) |
#define NAME general_ci_point |
#include "s_pointtemp.h" |
/* |
* Antialiased CI points. |
*/ |
#define FLAGS (INDEX | SMOOTH) |
#define NAME antialiased_ci_point |
#include "s_pointtemp.h" |
/* |
* Distance attenuated, general CI points. |
*/ |
#define FLAGS (INDEX | ATTENUATE) |
#define NAME atten_general_ci_point |
#include "s_pointtemp.h" |
/* |
* RGBA points with size == 1.0 |
*/ |
#define FLAGS (RGBA) |
#define NAME size1_rgba_point |
#include "s_pointtemp.h" |
/* |
* General RGBA points. |
*/ |
#define FLAGS (RGBA | LARGE) |
#define NAME general_rgba_point |
#include "s_pointtemp.h" |
/* |
* Antialiased RGBA points. |
*/ |
#define FLAGS (RGBA | SMOOTH) |
#define NAME antialiased_rgba_point |
#include "s_pointtemp.h" |
/* |
* Textured RGBA points. |
*/ |
#define FLAGS (RGBA | LARGE | TEXTURE | SPECULAR) |
#define NAME textured_rgba_point |
#include "s_pointtemp.h" |
/* |
* Antialiased points with texture mapping. |
*/ |
#define FLAGS (RGBA | SMOOTH | TEXTURE | SPECULAR) |
#define NAME antialiased_tex_rgba_point |
#include "s_pointtemp.h" |
/* |
* Distance attenuated, general RGBA points. |
*/ |
#define FLAGS (RGBA | ATTENUATE) |
#define NAME atten_general_rgba_point |
#include "s_pointtemp.h" |
/* |
* Distance attenuated, textured RGBA points. |
*/ |
#define FLAGS (RGBA | ATTENUATE | TEXTURE | SPECULAR) |
#define NAME atten_textured_rgba_point |
#include "s_pointtemp.h" |
/* |
* Distance attenuated, antialiased points with or without texture mapping. |
*/ |
#define FLAGS (RGBA | ATTENUATE | TEXTURE | SMOOTH) |
#define NAME atten_antialiased_rgba_point |
#include "s_pointtemp.h" |
/* |
* Sprite (textured point) |
*/ |
#define FLAGS (RGBA | SPRITE) |
#define NAME sprite_point |
#include "s_pointtemp.h" |
#define FLAGS (RGBA | ATTENUATE | SPRITE) |
#define NAME atten_sprite_point |
#include "s_pointtemp.h" |
void _swrast_add_spec_terms_point( GLcontext *ctx, |
const SWvertex *v0 ) |
{ |
SWvertex *ncv0 = (SWvertex *)v0; |
GLchan c[1][4]; |
COPY_CHAN4( c[0], ncv0->color ); |
ACC_3V( ncv0->color, ncv0->specular ); |
SWRAST_CONTEXT(ctx)->SpecPoint( ctx, ncv0 ); |
COPY_CHAN4( ncv0->color, c[0] ); |
} |
/* record the current point function name */ |
#ifdef DEBUG |
static const char *pntFuncName = NULL; |
#define USE(pntFunc) \ |
do { \ |
pntFuncName = #pntFunc; \ |
/*printf("%s\n", pntFuncName);*/ \ |
swrast->Point = pntFunc; \ |
} while (0) |
#else |
#define USE(pntFunc) swrast->Point = pntFunc |
#endif |
/* |
* Examine the current context to determine which point drawing function |
* should be used. |
*/ |
void |
_swrast_choose_point( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLboolean rgbMode = ctx->Visual.rgbMode; |
if (ctx->RenderMode==GL_RENDER) { |
if (ctx->Point.PointSprite) { |
/* GL_NV_point_sprite */ |
/* XXX this might not be good enough */ |
if (ctx->Point._Attenuated) |
USE(atten_sprite_point); |
else |
USE(sprite_point); |
} |
else if (ctx->Point.SmoothFlag) { |
/* Smooth points */ |
if (rgbMode) { |
if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { |
USE(atten_antialiased_rgba_point); |
} |
else if (ctx->Texture._EnabledUnits) { |
USE(antialiased_tex_rgba_point); |
} |
else { |
USE(antialiased_rgba_point); |
} |
} |
else { |
USE(antialiased_ci_point); |
} |
} |
else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { |
if (rgbMode) { |
if (ctx->Texture._EnabledUnits) { |
if (ctx->Point.SmoothFlag) { |
USE(atten_antialiased_rgba_point); |
} |
else { |
USE(atten_textured_rgba_point); |
} |
} |
else { |
USE(atten_general_rgba_point); |
} |
} |
else { |
/* ci, atten */ |
USE(atten_general_ci_point); |
} |
} |
else if (ctx->Texture._EnabledUnits && rgbMode) { |
/* textured */ |
USE(textured_rgba_point); |
} |
else if (ctx->Point.Size != 1.0) { |
/* large points */ |
if (rgbMode) { |
USE(general_rgba_point); |
} |
else { |
USE(general_ci_point); |
} |
} |
else { |
/* single pixel points */ |
if (rgbMode) { |
USE(size1_rgba_point); |
} |
else { |
USE(size1_ci_point); |
} |
} |
} |
else if (ctx->RenderMode==GL_FEEDBACK) { |
USE(_mesa_feedback_point); |
} |
else { |
/* GL_SELECT mode */ |
USE(_mesa_select_point); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_texstore.c |
---|
0,0 → 1,429 |
/* $Id: s_texstore.c,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Authors: |
* Brian Paul |
*/ |
/* |
* The functions in this file are mostly related to software texture fallbacks. |
* This includes texture image transfer/packing and texel fetching. |
* Hardware drivers will likely override most of this. |
*/ |
#include "colormac.h" |
#include "context.h" |
#include "convolve.h" |
#include "image.h" |
#include "imports.h" |
#include "macros.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "texstore.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_span.h" |
/* |
* Read an RGBA image from the frame buffer. |
* This is used by glCopyTex[Sub]Image[12]D(). |
* Input: ctx - the context |
* x, y - lower left corner |
* width, height - size of region to read |
* Return: pointer to block of GL_RGBA, GLchan data. |
*/ |
static GLchan * |
read_color_image( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLint stride, i; |
GLchan *image, *dst; |
image = (GLchan *) MALLOC(width * height * 4 * sizeof(GLchan)); |
if (!image) |
return NULL; |
/* Select buffer to read from */ |
_swrast_use_read_buffer(ctx); |
RENDER_START(swrast,ctx); |
dst = image; |
stride = width * 4; |
for (i = 0; i < height; i++) { |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y + i, |
(GLchan (*)[4]) dst ); |
dst += stride; |
} |
RENDER_FINISH(swrast,ctx); |
/* Read from draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
return image; |
} |
/* |
* As above, but read data from depth buffer. |
*/ |
static GLfloat * |
read_depth_image( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLfloat *image, *dst; |
GLint i; |
image = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); |
if (!image) |
return NULL; |
RENDER_START(swrast,ctx); |
dst = image; |
for (i = 0; i < height; i++) { |
_mesa_read_depth_span_float(ctx, width, x, y + i, dst); |
dst += width; |
} |
RENDER_FINISH(swrast,ctx); |
return image; |
} |
static GLboolean |
is_depth_format(GLenum format) |
{ |
switch (format) { |
case GL_DEPTH_COMPONENT: |
case GL_DEPTH_COMPONENT16_SGIX: |
case GL_DEPTH_COMPONENT24_SGIX: |
case GL_DEPTH_COMPONENT32_SGIX: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
} |
/* |
* Fallback for Driver.CopyTexImage1D(). |
*/ |
void |
_swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLint border ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
ASSERT(texObj); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
ASSERT(texImage); |
ASSERT(ctx->Driver.TexImage1D); |
if (is_depth_format(internalFormat)) { |
/* read depth image from framebuffer */ |
GLfloat *image = read_depth_image(ctx, x, y, width, 1); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); |
return; |
} |
/* call glTexImage1D to redefine the texture */ |
(*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, |
width, border, |
GL_DEPTH_COMPONENT, GL_FLOAT, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
else { |
/* read RGBA image from framebuffer */ |
GLchan *image = read_color_image(ctx, x, y, width, 1); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); |
return; |
} |
/* call glTexImage1D to redefine the texture */ |
(*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, |
width, border, |
GL_RGBA, CHAN_TYPE, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, texUnit, texObj); |
} |
} |
/* |
* Fallback for Driver.CopyTexImage2D(). |
*/ |
void |
_swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLsizei height, |
GLint border ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
ASSERT(texObj); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
ASSERT(texImage); |
ASSERT(ctx->Driver.TexImage2D); |
if (is_depth_format(internalFormat)) { |
/* read depth image from framebuffer */ |
GLfloat *image = read_depth_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); |
return; |
} |
/* call glTexImage2D to redefine the texture */ |
(*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, |
width, height, border, |
GL_DEPTH_COMPONENT, GL_FLOAT, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
else { |
/* read RGBA image from framebuffer */ |
GLchan *image = read_color_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); |
return; |
} |
/* call glTexImage2D to redefine the texture */ |
(*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, |
width, height, border, |
GL_RGBA, CHAN_TYPE, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, texUnit, texObj); |
} |
} |
/* |
* Fallback for Driver.CopyTexSubImage1D(). |
*/ |
void |
_swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint x, GLint y, GLsizei width ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
ASSERT(texObj); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
ASSERT(texImage); |
ASSERT(ctx->Driver.TexImage1D); |
if (texImage->Format == GL_DEPTH_COMPONENT) { |
/* read depth image from framebuffer */ |
GLfloat *image = read_depth_image(ctx, x, y, width, 1); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); |
return; |
} |
/* call glTexSubImage1D to redefine the texture */ |
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, |
GL_DEPTH_COMPONENT, GL_FLOAT, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
else { |
/* read RGBA image from framebuffer */ |
GLchan *image = read_color_image(ctx, x, y, width, 1); |
if (!image) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); |
return; |
} |
/* now call glTexSubImage1D to do the real work */ |
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, |
GL_RGBA, CHAN_TYPE, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, texUnit, texObj); |
} |
} |
/* |
* Fallback for Driver.CopyTexSubImage2D(). |
*/ |
void |
_swrast_copy_texsubimage2d( GLcontext *ctx, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
ASSERT(texObj); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
ASSERT(texImage); |
ASSERT(ctx->Driver.TexImage2D); |
if (texImage->Format == GL_DEPTH_COMPONENT) { |
/* read depth image from framebuffer */ |
GLfloat *image = read_depth_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); |
return; |
} |
/* call glTexImage1D to redefine the texture */ |
(*ctx->Driver.TexSubImage2D)(ctx, target, level, |
xoffset, yoffset, width, height, |
GL_DEPTH_COMPONENT, GL_FLOAT, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
else { |
/* read RGBA image from framebuffer */ |
GLchan *image = read_color_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); |
return; |
} |
/* now call glTexSubImage2D to do the real work */ |
(*ctx->Driver.TexSubImage2D)(ctx, target, level, |
xoffset, yoffset, width, height, |
GL_RGBA, CHAN_TYPE, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, texUnit, texObj); |
} |
} |
/* |
* Fallback for Driver.CopyTexSubImage3D(). |
*/ |
void |
_swrast_copy_texsubimage3d( GLcontext *ctx, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
ASSERT(texObj); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
ASSERT(texImage); |
ASSERT(ctx->Driver.TexImage3D); |
if (texImage->Format == GL_DEPTH_COMPONENT) { |
/* read depth image from framebuffer */ |
GLfloat *image = read_depth_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); |
return; |
} |
/* call glTexImage1D to redefine the texture */ |
(*ctx->Driver.TexSubImage3D)(ctx, target, level, |
xoffset, yoffset, zoffset, width, height, 1, |
GL_DEPTH_COMPONENT, GL_FLOAT, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
else { |
/* read RGBA image from framebuffer */ |
GLchan *image = read_color_image(ctx, x, y, width, height); |
if (!image) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); |
return; |
} |
/* now call glTexSubImage3D to do the real work */ |
(*ctx->Driver.TexSubImage3D)(ctx, target, level, |
xoffset, yoffset, zoffset, width, height, 1, |
GL_RGBA, CHAN_TYPE, image, |
&_mesa_native_packing, texObj, texImage); |
FREE(image); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, texUnit, texObj); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_drawpix.c |
---|
0,0 → 1,957 |
/* $Id: s_drawpix.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "convolve.h" |
#include "image.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "pixel.h" |
#include "s_context.h" |
#include "s_drawpix.h" |
#include "s_pixeltex.h" |
#include "s_span.h" |
#include "s_stencil.h" |
#include "s_texture.h" |
#include "s_zoom.h" |
/* |
* Given the dest position, size and skipPixels and skipRows values |
* for a glDrawPixels command, perform clipping of the image bounds |
* so the result lies withing the context's buffer bounds. |
* Return: GL_TRUE if image is ready for drawing |
* GL_FALSE if image was completely clipped away (draw nothing) |
*/ |
GLboolean |
_mesa_clip_pixelrect(const GLcontext *ctx, |
GLint *destX, GLint *destY, |
GLsizei *width, GLsizei *height, |
GLint *skipPixels, GLint *skipRows) |
{ |
const GLframebuffer *buffer = ctx->DrawBuffer; |
/* left clipping */ |
if (*destX < buffer->_Xmin) { |
*skipPixels += (buffer->_Xmin - *destX); |
*width -= (buffer->_Xmin - *destX); |
*destX = buffer->_Xmin; |
} |
/* right clipping */ |
if (*destX + *width > buffer->_Xmax) |
*width -= (*destX + *width - buffer->_Xmax); |
if (*width <= 0) |
return GL_FALSE; |
/* bottom clipping */ |
if (*destY < buffer->_Ymin) { |
*skipRows += (buffer->_Ymin - *destY); |
*height -= (buffer->_Ymin - *destY); |
*destY = buffer->_Ymin; |
} |
/* top clipping */ |
if (*destY + *height > buffer->_Ymax) |
*height -= (*destY + *height - buffer->_Ymax); |
if (*height <= 0) |
return GL_TRUE; |
return GL_TRUE; |
} |
/* |
* Try to do a fast and simple RGB(a) glDrawPixels. |
* Return: GL_TRUE if success, GL_FALSE if slow path must be used instead |
*/ |
static GLboolean |
fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, const GLvoid *pixels) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); |
if (!ctx->Current.RasterPosValid) { |
return GL_TRUE; /* no-op */ |
} |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0 |
&& ctx->Texture._EnabledUnits == 0 |
&& unpack->Alignment == 1 |
&& !unpack->SwapBytes |
&& !unpack->LsbFirst) { |
GLint destX = x; |
GLint destY = y; |
GLint drawWidth = width; /* actual width drawn */ |
GLint drawHeight = height; /* actual height drawn */ |
GLint skipPixels = unpack->SkipPixels; |
GLint skipRows = unpack->SkipRows; |
GLint rowLength; |
GLdepth zSpan[MAX_WIDTH]; /* only used when zooming */ |
GLint zoomY0 = 0; |
if (unpack->RowLength > 0) |
rowLength = unpack->RowLength; |
else |
rowLength = width; |
/* If we're not using pixel zoom then do all clipping calculations |
* now. Otherwise, we'll let the _mesa_write_zoomed_*_span() functions |
* handle the clipping. |
*/ |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* horizontal clipping */ |
if (destX < ctx->DrawBuffer->_Xmin) { |
skipPixels += (ctx->DrawBuffer->_Xmin - destX); |
drawWidth -= (ctx->DrawBuffer->_Xmin - destX); |
destX = ctx->DrawBuffer->_Xmin; |
} |
if (destX + drawWidth > ctx->DrawBuffer->_Xmax) |
drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); |
if (drawWidth <= 0) |
return GL_TRUE; |
/* vertical clipping */ |
if (destY < ctx->DrawBuffer->_Ymin) { |
skipRows += (ctx->DrawBuffer->_Ymin - destY); |
drawHeight -= (ctx->DrawBuffer->_Ymin - destY); |
destY = ctx->DrawBuffer->_Ymin; |
} |
if (destY + drawHeight > ctx->DrawBuffer->_Ymax) |
drawHeight -= (destY + drawHeight - ctx->DrawBuffer->_Ymax); |
if (drawHeight <= 0) |
return GL_TRUE; |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down image */ |
/* horizontal clipping */ |
if (destX < ctx->DrawBuffer->_Xmin) { |
skipPixels += (ctx->DrawBuffer->_Xmin - destX); |
drawWidth -= (ctx->DrawBuffer->_Xmin - destX); |
destX = ctx->DrawBuffer->_Xmin; |
} |
if (destX + drawWidth > ctx->DrawBuffer->_Xmax) |
drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); |
if (drawWidth <= 0) |
return GL_TRUE; |
/* vertical clipping */ |
if (destY > ctx->DrawBuffer->_Ymax) { |
skipRows += (destY - ctx->DrawBuffer->_Ymax); |
drawHeight -= (destY - ctx->DrawBuffer->_Ymax); |
destY = ctx->DrawBuffer->_Ymax; |
} |
if (destY - drawHeight < ctx->DrawBuffer->_Ymin) |
drawHeight -= (ctx->DrawBuffer->_Ymin - (destY - drawHeight)); |
if (drawHeight <= 0) |
return GL_TRUE; |
} |
else { |
/* setup array of fragment Z value to pass to zoom function */ |
GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF); |
GLint i; |
ASSERT(drawWidth < MAX_WIDTH); |
for (i=0; i<drawWidth; i++) |
zSpan[i] = z; |
/* save Y value of first row */ |
zoomY0 = IROUND(ctx->Current.RasterPos[1]); |
} |
/* |
* Ready to draw! |
* The window region at (destX, destY) of size (drawWidth, drawHeight) |
* will be written to. |
* We'll take pixel data from buffer pointed to by "pixels" but we'll |
* skip "skipRows" rows and skip "skipPixels" pixels/row. |
*/ |
if (format == GL_RGBA && type == CHAN_TYPE |
&& ctx->_ImageTransferState==0) { |
if (ctx->Visual.rgbMode) { |
GLchan *src = (GLchan *) pixels |
+ (skipRows * rowLength + skipPixels) * 4; |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* no zooming */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[4]) src, NULL); |
src += rowLength * 4; |
destY++; |
} |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
destY--; |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[4]) src, NULL); |
src += rowLength * 4; |
} |
} |
else { |
/* with zooming */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
span.x = destX; |
span.y = destY; |
span.end = drawWidth; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4]) src, zoomY0); |
src += rowLength * 4; |
destY++; |
} |
} |
} |
return GL_TRUE; |
} |
else if (format == GL_RGB && type == CHAN_TYPE |
&& ctx->_ImageTransferState == 0) { |
if (ctx->Visual.rgbMode) { |
GLchan *src = (GLchan *) pixels |
+ (skipRows * rowLength + skipPixels) * 3; |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
GLint row; |
for (row=0; row<drawHeight; row++) { |
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[3]) src, NULL); |
src += rowLength * 3; |
destY++; |
} |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
destY--; |
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[3]) src, NULL); |
src += rowLength * 3; |
} |
} |
else { |
/* with zooming */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
span.x = destX; |
span.y = destY; |
span.end = drawWidth; |
_mesa_write_zoomed_rgb_span(ctx, &span, |
(CONST GLchan (*)[3]) src, zoomY0); |
src += rowLength * 3; |
destY++; |
} |
} |
} |
return GL_TRUE; |
} |
else if (format == GL_LUMINANCE && type == CHAN_TYPE |
&& ctx->_ImageTransferState==0) { |
if (ctx->Visual.rgbMode) { |
GLchan *src = (GLchan *) pixels |
+ (skipRows * rowLength + skipPixels); |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* no zooming */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLint i; |
for (i=0;i<drawWidth;i++) { |
span.array->rgb[i][0] = src[i]; |
span.array->rgb[i][1] = src[i]; |
span.array->rgb[i][2] = src[i]; |
} |
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[3]) span.array->rgb, NULL); |
src += rowLength; |
destY++; |
} |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLint i; |
for (i=0;i<drawWidth;i++) { |
span.array->rgb[i][0] = src[i]; |
span.array->rgb[i][1] = src[i]; |
span.array->rgb[i][2] = src[i]; |
} |
destY--; |
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[3]) span.array->rgb, NULL); |
src += rowLength; |
} |
} |
else { |
/* with zooming */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLint i; |
for (i=0;i<drawWidth;i++) { |
span.array->rgb[i][0] = src[i]; |
span.array->rgb[i][1] = src[i]; |
span.array->rgb[i][2] = src[i]; |
} |
span.x = destX; |
span.y = destY; |
span.end = drawWidth; |
_mesa_write_zoomed_rgb_span(ctx, &span, |
(CONST GLchan (*)[3]) span.array->rgb, zoomY0); |
src += rowLength; |
destY++; |
} |
} |
} |
return GL_TRUE; |
} |
else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE |
&& ctx->_ImageTransferState == 0) { |
if (ctx->Visual.rgbMode) { |
GLchan *src = (GLchan *) pixels |
+ (skipRows * rowLength + skipPixels)*2; |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* no zooming */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLint i; |
GLchan *ptr = src; |
for (i=0;i<drawWidth;i++) { |
span.array->rgba[i][0] = *ptr; |
span.array->rgba[i][1] = *ptr; |
span.array->rgba[i][2] = *ptr++; |
span.array->rgba[i][3] = *ptr++; |
} |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[4]) span.array->rgba, NULL); |
src += rowLength*2; |
destY++; |
} |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLint i; |
GLchan *ptr = src; |
for (i=0;i<drawWidth;i++) { |
span.array->rgba[i][0] = *ptr; |
span.array->rgba[i][1] = *ptr; |
span.array->rgba[i][2] = *ptr++; |
span.array->rgba[i][3] = *ptr++; |
} |
destY--; |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[4]) span.array->rgba, NULL); |
src += rowLength*2; |
} |
} |
else { |
/* with zooming */ |
GLint row; |
ASSERT(drawWidth < MAX_WIDTH); |
for (row=0; row<drawHeight; row++) { |
GLchan *ptr = src; |
GLint i; |
for (i=0;i<drawWidth;i++) { |
span.array->rgba[i][0] = *ptr; |
span.array->rgba[i][1] = *ptr; |
span.array->rgba[i][2] = *ptr++; |
span.array->rgba[i][3] = *ptr++; |
} |
span.x = destX; |
span.y = destY; |
span.end = drawWidth; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4]) span.array->rgba, zoomY0); |
src += rowLength*2; |
destY++; |
} |
} |
} |
return GL_TRUE; |
} |
else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { |
GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels; |
if (ctx->Visual.rgbMode) { |
/* convert CI data to RGBA */ |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* no zooming */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
ASSERT(drawWidth < MAX_WIDTH); |
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(const GLchan (*)[4]) span.array->rgba, NULL); |
src += rowLength; |
destY++; |
} |
return GL_TRUE; |
} |
else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { |
/* upside-down */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
ASSERT(drawWidth < MAX_WIDTH); |
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); |
destY--; |
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, |
(CONST GLchan (*)[4]) span.array->rgba, NULL); |
src += rowLength; |
} |
return GL_TRUE; |
} |
else { |
/* with zooming */ |
GLint row; |
for (row=0; row<drawHeight; row++) { |
ASSERT(drawWidth < MAX_WIDTH); |
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); |
span.x = destX; |
span.y = destY; |
span.end = drawWidth; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4]) span.array->rgba, zoomY0); |
src += rowLength; |
destY++; |
} |
return GL_TRUE; |
} |
} |
else if (ctx->_ImageTransferState==0) { |
/* write CI data to CI frame buffer */ |
GLint row; |
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { |
/* no zooming */ |
for (row=0; row<drawHeight; row++) { |
(*swrast->Driver.WriteCI8Span)(ctx, drawWidth, destX, destY, |
src, NULL); |
src += rowLength; |
destY++; |
} |
return GL_TRUE; |
} |
else { |
/* with zooming */ |
return GL_FALSE; |
} |
} |
} |
else { |
/* can't handle this pixel format and/or data type here */ |
return GL_FALSE; |
} |
} |
/* can't do a simple draw, have to use slow path */ |
return GL_FALSE; |
} |
/* |
* Do glDrawPixels of index pixels. |
*/ |
static void |
draw_index_pixels( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, const GLvoid *pixels ) |
{ |
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; |
const GLint desty = y; |
GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX); |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
/* |
* General solution |
*/ |
for (row = 0; row < height; row++, y++) { |
const GLvoid *source = _mesa_image_address(&ctx->Unpack, |
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); |
_mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, |
span.array->index, |
type, source, &ctx->Unpack, |
ctx->_ImageTransferState); |
span.x = x; |
span.y = y; |
span.end = drawWidth; |
if (zoom) |
_mesa_write_zoomed_index_span(ctx, &span, desty); |
else |
_mesa_write_index_span(ctx, &span); |
} |
} |
/* |
* Do glDrawPixels of stencil image. The image datatype may either |
* be GLubyte or GLbitmap. |
*/ |
static void |
draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, const GLvoid *pixels ) |
{ |
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; |
const GLint desty = y; |
GLint row, drawWidth; |
if (type != GL_BYTE && |
type != GL_UNSIGNED_BYTE && |
type != GL_SHORT && |
type != GL_UNSIGNED_SHORT && |
type != GL_INT && |
type != GL_UNSIGNED_INT && |
type != GL_FLOAT && |
type != GL_BITMAP) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)"); |
return; |
} |
if (ctx->Visual.stencilBits == 0) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); |
return; |
} |
drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
for (row = 0; row < height; row++, y++) { |
GLstencil values[MAX_WIDTH]; |
GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) |
? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; |
const GLvoid *source = _mesa_image_address(&ctx->Unpack, |
pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); |
_mesa_unpack_index_span(ctx, drawWidth, destType, values, |
type, source, &ctx->Unpack, |
ctx->_ImageTransferState); |
if (ctx->_ImageTransferState & IMAGE_SHIFT_OFFSET_BIT) { |
_mesa_shift_and_offset_stencil( ctx, drawWidth, values ); |
} |
if (ctx->Pixel.MapStencilFlag) { |
_mesa_map_stencil( ctx, drawWidth, values ); |
} |
if (zoom) { |
_mesa_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y, |
values, desty ); |
} |
else { |
_mesa_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); |
} |
} |
} |
/* |
* Do a glDrawPixels of depth values. |
*/ |
static void |
draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, const GLvoid *pixels ) |
{ |
const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; |
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; |
const GLint desty = y; |
GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z); |
if (type != GL_BYTE |
&& type != GL_UNSIGNED_BYTE |
&& type != GL_SHORT |
&& type != GL_UNSIGNED_SHORT |
&& type != GL_INT |
&& type != GL_UNSIGNED_INT |
&& type != GL_FLOAT) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)"); |
return; |
} |
_mesa_span_default_color(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if (ctx->Texture._EnabledUnits) |
_mesa_span_default_texcoords(ctx, &span); |
if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16 |
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) { |
/* Special case: directly write 16-bit depth values */ |
GLint row; |
span.x = x; |
span.y = y; |
span.end = drawWidth; |
for (row = 0; row < height; row++, span.y++) { |
const GLushort *zptr = (const GLushort *) |
_mesa_image_address(&ctx->Unpack, pixels, width, height, |
GL_DEPTH_COMPONENT, type, 0, row, 0); |
GLint i; |
for (i = 0; i < drawWidth; i++) |
span.array->z[i] = zptr[i]; |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32 |
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) { |
/* Special case: directly write 32-bit depth values */ |
GLint row; |
span.x = x; |
span.y = y; |
span.end = drawWidth; |
for (row = 0; row < height; row++, span.y++) { |
const GLuint *zptr = (const GLuint *) |
_mesa_image_address(&ctx->Unpack, pixels, width, height, |
GL_DEPTH_COMPONENT, type, 0, row, 0); |
MEMCPY(span.array->z, zptr, drawWidth * sizeof(GLdepth)); |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
else { |
/* General case */ |
GLint row; |
span.x = x; |
span.y = y; |
span.end = drawWidth; |
for (row = 0; row < height; row++, span.y++) { |
GLfloat fspan[MAX_WIDTH]; |
const GLvoid *src = _mesa_image_address(&ctx->Unpack, |
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); |
_mesa_unpack_depth_span( ctx, drawWidth, fspan, type, src, |
&ctx->Unpack ); |
/* clamp depth values to [0,1] and convert from floats to integers */ |
{ |
const GLfloat zs = ctx->DepthMaxF; |
GLint i; |
for (i = 0; i < drawWidth; i++) { |
span.array->z[i] = (GLdepth) (fspan[i] * zs + 0.5F); |
} |
} |
if (ctx->Visual.rgbMode) { |
if (zoom) { |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(const GLchan (*)[4]) span.array->rgba, desty); |
} |
else |
_mesa_write_rgba_span(ctx, &span); |
} |
else { |
if (zoom) |
_mesa_write_zoomed_index_span(ctx, &span, desty); |
else |
_mesa_write_index_span(ctx, &span); |
} |
} |
} |
} |
/* |
* Do glDrawPixels of RGBA pixels. |
*/ |
static void |
draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, const GLvoid *pixels ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; |
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; |
const GLint desty = y; |
GLboolean quickDraw; |
GLfloat *convImage = NULL; |
GLuint transferOps = ctx->_ImageTransferState; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); |
return; |
} |
/* Try an optimized glDrawPixels first */ |
if (fast_draw_pixels(ctx, x, y, width, height, format, type, pixels)) |
return; |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if (ctx->Texture._EnabledUnits) |
_mesa_span_default_texcoords(ctx, &span); |
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0 |
&& x + width <= (GLint) ctx->DrawBuffer->Width |
&& y + height <= (GLint) ctx->DrawBuffer->Height) { |
quickDraw = GL_TRUE; |
} |
else { |
quickDraw = GL_FALSE; |
} |
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { |
/* Convolution has to be handled specially. We'll create an |
* intermediate image, applying all pixel transfer operations |
* up to convolution. Then we'll convolve the image. Then |
* we'll proceed with the rest of the transfer operations and |
* rasterize the image. |
*/ |
GLint row; |
GLfloat *dest, *tmpImage; |
tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!tmpImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); |
return; |
} |
convImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!convImage) { |
FREE(tmpImage); |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); |
return; |
} |
/* Unpack the image and apply transfer ops up to convolution */ |
dest = tmpImage; |
for (row = 0; row < height; row++) { |
const GLvoid *source = _mesa_image_address(unpack, |
pixels, width, height, format, type, 0, row, 0); |
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, (GLfloat *) dest, |
format, type, source, unpack, |
transferOps & IMAGE_PRE_CONVOLUTION_BITS, |
GL_FALSE); |
dest += width * 4; |
} |
/* do convolution */ |
if (ctx->Pixel.Convolution2DEnabled) { |
_mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); |
} |
else { |
ASSERT(ctx->Pixel.Separable2DEnabled); |
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); |
} |
FREE(tmpImage); |
/* continue transfer ops and draw the convolved image */ |
unpack = &_mesa_native_packing; |
pixels = convImage; |
format = GL_RGBA; |
type = GL_FLOAT; |
transferOps &= IMAGE_POST_CONVOLUTION_BITS; |
} |
/* |
* General solution |
*/ |
{ |
GLint row; |
if (width > MAX_WIDTH) |
width = MAX_WIDTH; |
for (row = 0; row < height; row++, y++) { |
const GLvoid *source = _mesa_image_address(unpack, |
pixels, width, height, format, type, 0, row, 0); |
_mesa_unpack_chan_color_span(ctx, width, GL_RGBA, |
(GLchan *) span.array->rgba, |
format, type, source, unpack, |
transferOps); |
if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) || |
(ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink)) |
continue; |
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { |
span.end = width; |
_swrast_pixel_texture(ctx, &span); |
} |
if (quickDraw) { |
(*swrast->Driver.WriteRGBASpan)(ctx, width, x, y, |
(CONST GLchan (*)[4]) span.array->rgba, NULL); |
} |
else if (zoom) { |
span.x = x; |
span.y = y; |
span.end = width; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4]) span.array->rgba, desty); |
} |
else { |
span.x = x; |
span.y = y; |
span.end = width; |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
} |
if (convImage) { |
FREE(convImage); |
} |
} |
/* |
* Execute glDrawPixels |
*/ |
void |
_swrast_DrawPixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *unpack, |
const GLvoid *pixels ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
(void) unpack; |
if (swrast->NewState) |
_swrast_validate_derived( ctx ); |
RENDER_START(swrast,ctx); |
switch (format) { |
case GL_STENCIL_INDEX: |
draw_stencil_pixels( ctx, x, y, width, height, type, pixels ); |
break; |
case GL_DEPTH_COMPONENT: |
draw_depth_pixels( ctx, x, y, width, height, type, pixels ); |
break; |
case GL_COLOR_INDEX: |
if (ctx->Visual.rgbMode) |
draw_rgba_pixels(ctx, x,y, width, height, format, type, pixels); |
else |
draw_index_pixels(ctx, x, y, width, height, type, pixels); |
break; |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_LUMINANCE: |
case GL_LUMINANCE_ALPHA: |
case GL_RGB: |
case GL_BGR: |
case GL_RGBA: |
case GL_BGRA: |
case GL_ABGR_EXT: |
draw_rgba_pixels(ctx, x, y, width, height, format, type, pixels); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" ); |
} |
RENDER_FINISH(swrast,ctx); |
} |
#if 0 /* experimental */ |
/* |
* Execute glDrawDepthPixelsMESA(). |
*/ |
void |
_swrast_DrawDepthPixelsMESA( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum colorFormat, GLenum colorType, |
const GLvoid *colors, |
GLenum depthType, const GLvoid *depths, |
const struct gl_pixelstore_attrib *unpack ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
(void) unpack; |
if (swrast->NewState) |
_swrast_validate_derived( ctx ); |
RENDER_START(swrast,ctx); |
switch (colorFormat) { |
case GL_COLOR_INDEX: |
if (ctx->Visual.rgbMode) |
draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, colors); |
else |
draw_index_pixels(ctx, x, y, width, height, colorType, colors); |
break; |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_LUMINANCE: |
case GL_LUMINANCE_ALPHA: |
case GL_RGB: |
case GL_BGR: |
case GL_RGBA: |
case GL_BGRA: |
case GL_ABGR_EXT: |
draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, colors); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, |
"glDrawDepthPixelsMESA(colorFormat)" ); |
} |
RENDER_FINISH(swrast,ctx); |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_points.h |
---|
0,0 → 1,40 |
/* $Id: s_points.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_POINTS_H |
#define S_POINTS_H |
#include "mtypes.h" |
extern void |
_swrast_choose_point( GLcontext *ctx ); |
extern void |
_swrast_add_spec_terms_point( GLcontext *ctx, |
const SWvertex *v0 ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_linetemp.h |
---|
0,0 → 1,626 |
/* $Id: s_linetemp.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Line Rasterizer Template |
* |
* This file is #include'd to generate custom line rasterizers. |
* |
* The following macros may be defined to indicate what auxillary information |
* must be interplated along the line: |
* INTERP_Z - if defined, interpolate Z values |
* INTERP_FOG - if defined, interpolate FOG values |
* INTERP_RGB - if defined, interpolate RGB values |
* INTERP_SPEC - if defined, interpolate specular RGB values |
* INTERP_ALPHA - if defined, interpolate Alpha values |
* INTERP_INDEX - if defined, interpolate color index values |
* INTERP_TEX - if defined, interpolate unit 0 texcoords |
* INTERP_MULTITEX - if defined, interpolate multi-texcoords |
* |
* When one can directly address pixels in the color buffer the following |
* macros can be defined and used to directly compute pixel addresses during |
* rasterization (see pixelPtr): |
* PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) |
* BYTES_PER_ROW - number of bytes per row in the color buffer |
* PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where |
* Y==0 at bottom of screen and increases upward. |
* |
* Similarly, for direct depth buffer access, this type is used for depth |
* buffer addressing: |
* DEPTH_TYPE - either GLushort or GLuint |
* |
* Optionally, one may provide one-time setup code |
* SETUP_CODE - code which is to be executed once per line |
* |
* To actually "plot" each pixel the PLOT macro must be defined... |
* PLOT(X,Y) - code to plot a pixel. Example: |
* if (Z < *zPtr) { |
* *zPtr = Z; |
* color = pack_rgb( FixedToInt(r0), FixedToInt(g0), |
* FixedToInt(b0) ); |
* put_pixel( X, Y, color ); |
* } |
* |
* This code was designed for the origin to be in the lower-left corner. |
* |
*/ |
/*void line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )*/ |
{ |
GLint x0 = (GLint) vert0->win[0]; |
GLint x1 = (GLint) vert1->win[0]; |
GLint y0 = (GLint) vert0->win[1]; |
GLint y1 = (GLint) vert1->win[1]; |
GLint dx, dy; |
#ifdef INTERP_XY |
GLint xstep, ystep; |
#endif |
#ifdef INTERP_Z |
GLint z0, z1, dz; |
const GLint depthBits = ctx->Visual.depthBits; |
const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; |
# define FixedToDepth(F) ((F) >> fixedToDepthShift) |
# ifdef DEPTH_TYPE |
GLint zPtrXstep, zPtrYstep; |
DEPTH_TYPE *zPtr; |
# endif |
#endif |
#ifdef INTERP_FOG |
GLfloat fog0 = vert0->fog; |
GLfloat dfog = vert1->fog - fog0; |
#endif |
#ifdef INTERP_RGB |
GLfixed r0 = ChanToFixed(vert0->color[0]); |
GLfixed dr = ChanToFixed(vert1->color[0]) - r0; |
GLfixed g0 = ChanToFixed(vert0->color[1]); |
GLfixed dg = ChanToFixed(vert1->color[1]) - g0; |
GLfixed b0 = ChanToFixed(vert0->color[2]); |
GLfixed db = ChanToFixed(vert1->color[2]) - b0; |
#endif |
#ifdef INTERP_SPEC |
GLfixed sr0 = ChanToFixed(vert0->specular[0]); |
GLfixed dsr = ChanToFixed(vert1->specular[0]) - sr0; |
GLfixed sg0 = ChanToFixed(vert0->specular[1]); |
GLfixed dsg = ChanToFixed(vert1->specular[1]) - sg0; |
GLfixed sb0 = ChanToFixed(vert0->specular[2]); |
GLfixed dsb = ChanToFixed(vert1->specular[2]) - sb0; |
#endif |
#ifdef INTERP_ALPHA |
GLfixed a0 = ChanToFixed(vert0->color[3]); |
GLfixed da = ChanToFixed(vert1->color[3]) - a0; |
#endif |
#ifdef INTERP_INDEX |
GLint i0 = vert0->index << 8; |
GLint di = (GLint) (vert1->index << 8) - i0; |
#endif |
#ifdef INTERP_TEX |
const GLfloat invw0 = vert0->win[3]; |
const GLfloat invw1 = vert1->win[3]; |
GLfloat tex[4]; |
GLfloat dtex[4]; |
GLfloat fragTexcoord[4]; |
#endif |
#ifdef INTERP_MULTITEX |
const GLfloat invw0 = vert0->win[3]; |
const GLfloat invw1 = vert1->win[3]; |
GLfloat tex[MAX_TEXTURE_UNITS][4]; |
GLfloat dtex[MAX_TEXTURE_UNITS][4]; |
GLfloat fragTexcoord[MAX_TEXTURE_UNITS][4]; |
#endif |
#ifdef PIXEL_ADDRESS |
PIXEL_TYPE *pixelPtr; |
GLint pixelXstep, pixelYstep; |
#endif |
#ifdef INTERP_TEX |
{ |
tex[0] = invw0 * vert0->texcoord[0][0]; |
dtex[0] = invw1 * vert1->texcoord[0][0] - tex[0]; |
tex[1] = invw0 * vert0->texcoord[0][1]; |
dtex[1] = invw1 * vert1->texcoord[0][1] - tex[1]; |
tex[2] = invw0 * vert0->texcoord[0][2]; |
dtex[2] = invw1 * vert1->texcoord[0][2] - tex[2]; |
tex[3] = invw0 * vert0->texcoord[0][3]; |
dtex[3] = invw1 * vert1->texcoord[0][3] - tex[3]; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
tex[u][0] = invw0 * vert0->texcoord[u][0]; |
dtex[u][0] = invw1 * vert1->texcoord[u][0] - tex[u][0]; |
tex[u][1] = invw0 * vert0->texcoord[u][1]; |
dtex[u][1] = invw1 * vert1->texcoord[u][1] - tex[u][1]; |
tex[u][2] = invw0 * vert0->texcoord[u][2]; |
dtex[u][2] = invw1 * vert1->texcoord[u][2] - tex[u][2]; |
tex[u][3] = invw0 * vert0->texcoord[u][3]; |
dtex[u][3] = invw1 * vert1->texcoord[u][3] - tex[u][3]; |
} |
} |
} |
#endif |
/* Cull primitives with malformed coordinates. |
*/ |
{ |
float tmp = vert0->win[0] + vert0->win[1] + vert1->win[0] + vert1->win[1]; |
if (IS_INF_OR_NAN(tmp)) |
return; |
} |
/* |
printf("%s():\n", __FUNCTION__); |
printf(" (%f, %f, %f) -> (%f, %f, %f)\n", |
vert0->win[0], vert0->win[1], vert0->win[2], |
vert1->win[0], vert1->win[1], vert1->win[2]); |
printf(" (%d, %d, %d) -> (%d, %d, %d)\n", |
vert0->color[0], vert0->color[1], vert0->color[2], |
vert1->color[0], vert1->color[1], vert1->color[2]); |
printf(" (%d, %d, %d) -> (%d, %d, %d)\n", |
vert0->specular[0], vert0->specular[1], vert0->specular[2], |
vert1->specular[0], vert1->specular[1], vert1->specular[2]); |
*/ |
/* |
* Despite being clipped to the view volume, the line's window coordinates |
* may just lie outside the window bounds. That is, if the legal window |
* coordinates are [0,W-1][0,H-1], it's possible for x==W and/or y==H. |
* This quick and dirty code nudges the endpoints inside the window if |
* necessary. |
*/ |
#ifdef CLIP_HACK |
{ |
GLint w = ctx->DrawBuffer->Width; |
GLint h = ctx->DrawBuffer->Height; |
if ((x0==w) | (x1==w)) { |
if ((x0==w) & (x1==w)) |
return; |
x0 -= x0==w; |
x1 -= x1==w; |
} |
if ((y0==h) | (y1==h)) { |
if ((y0==h) & (y1==h)) |
return; |
y0 -= y0==h; |
y1 -= y1==h; |
} |
} |
#endif |
dx = x1 - x0; |
dy = y1 - y0; |
if (dx==0 && dy==0) { |
return; |
} |
/* |
* Setup |
*/ |
#ifdef SETUP_CODE |
SETUP_CODE |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
zPtr = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, x0, y0); |
# endif |
if (depthBits <= 16) { |
z0 = FloatToFixed(vert0->win[2]) + FIXED_HALF; |
z1 = FloatToFixed(vert1->win[2]) + FIXED_HALF; |
} |
else { |
z0 = (int) vert0->win[2]; |
z1 = (int) vert1->win[2]; |
} |
#endif |
#ifdef PIXEL_ADDRESS |
pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0); |
#endif |
if (dx<0) { |
dx = -dx; /* make positive */ |
#ifdef INTERP_XY |
xstep = -1; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtrXstep = -((GLint)sizeof(DEPTH_TYPE)); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelXstep = -((GLint)sizeof(PIXEL_TYPE)); |
#endif |
} |
else { |
#ifdef INTERP_XY |
xstep = 1; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtrXstep = ((GLint)sizeof(DEPTH_TYPE)); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelXstep = ((GLint)sizeof(PIXEL_TYPE)); |
#endif |
} |
if (dy<0) { |
dy = -dy; /* make positive */ |
#ifdef INTERP_XY |
ystep = -1; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE))); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelYstep = BYTES_PER_ROW; |
#endif |
} |
else { |
#ifdef INTERP_XY |
ystep = 1; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelYstep = -(BYTES_PER_ROW); |
#endif |
} |
/* |
* Draw |
*/ |
if (dx>dy) { |
/*** X-major line ***/ |
GLint i; |
GLint errorInc = dy+dy; |
GLint error = errorInc-dx; |
GLint errorDec = error-dx; |
#ifdef SET_XMAJOR |
xMajor = GL_TRUE; |
#endif |
#ifdef INTERP_Z |
dz = (z1-z0) / dx; |
#endif |
#ifdef INTERP_FOG |
dfog /= dx; |
#endif |
#ifdef INTERP_RGB |
dr /= dx; /* convert from whole line delta to per-pixel delta */ |
dg /= dx; |
db /= dx; |
#endif |
#ifdef INTERP_SPEC |
dsr /= dx; /* convert from whole line delta to per-pixel delta */ |
dsg /= dx; |
dsb /= dx; |
#endif |
#ifdef INTERP_ALPHA |
da /= dx; |
#endif |
#ifdef INTERP_INDEX |
di /= dx; |
#endif |
#ifdef INTERP_TEX |
{ |
const GLfloat invDx = 1.0F / (GLfloat) dx; |
dtex[0] *= invDx; |
dtex[1] *= invDx; |
dtex[2] *= invDx; |
dtex[3] *= invDx; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
const GLfloat invDx = 1.0F / (GLfloat) dx; |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
dtex[u][0] *= invDx; |
dtex[u][1] *= invDx; |
dtex[u][2] *= invDx; |
dtex[u][3] *= invDx; |
} |
} |
} |
#endif |
for (i=0;i<dx;i++) { |
#ifdef INTERP_Z |
GLdepth Z = FixedToDepth(z0); |
#endif |
#ifdef INTERP_INDEX |
GLint I = i0 >> 8; |
#endif |
#ifdef INTERP_TEX |
{ |
const GLfloat invQ = tex[3] ? (1.0F / tex[3]) : 1.0F; |
fragTexcoord[0] = tex[0] * invQ; |
fragTexcoord[1] = tex[1] * invQ; |
fragTexcoord[2] = tex[2] * invQ; |
fragTexcoord[3] = tex[3]; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const GLfloat invQ = 1.0F / tex[u][3]; |
fragTexcoord[u][0] = tex[u][0] * invQ; |
fragTexcoord[u][1] = tex[u][1] * invQ; |
fragTexcoord[u][2] = tex[u][2] * invQ; |
fragTexcoord[u][3] = tex[u][3]; |
} |
} |
} |
#endif |
PLOT( x0, y0 ); |
#ifdef INTERP_XY |
x0 += xstep; |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); |
# endif |
z0 += dz; |
#endif |
#ifdef INTERP_FOG |
fog0 += dfog; |
#endif |
#ifdef INTERP_RGB |
r0 += dr; |
g0 += dg; |
b0 += db; |
#endif |
#ifdef INTERP_SPEC |
sr0 += dsr; |
sg0 += dsg; |
sb0 += dsb; |
#endif |
#ifdef INTERP_ALPHA |
a0 += da; |
#endif |
#ifdef INTERP_INDEX |
i0 += di; |
#endif |
#ifdef INTERP_TEX |
tex[0] += dtex[0]; |
tex[1] += dtex[1]; |
tex[2] += dtex[2]; |
tex[3] += dtex[3]; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
tex[u][0] += dtex[u][0]; |
tex[u][1] += dtex[u][1]; |
tex[u][2] += dtex[u][2]; |
tex[u][3] += dtex[u][3]; |
} |
} |
} |
#endif |
#ifdef PIXEL_ADDRESS |
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); |
#endif |
if (error<0) { |
error += errorInc; |
} |
else { |
error += errorDec; |
#ifdef INTERP_XY |
y0 += ystep; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); |
#endif |
} |
} |
} |
else { |
/*** Y-major line ***/ |
GLint i; |
GLint errorInc = dx+dx; |
GLint error = errorInc-dy; |
GLint errorDec = error-dy; |
#ifdef INTERP_Z |
dz = (z1-z0) / dy; |
#endif |
#ifdef INTERP_FOG |
dfog /= dy; |
#endif |
#ifdef INTERP_RGB |
dr /= dy; /* convert from whole line delta to per-pixel delta */ |
dg /= dy; |
db /= dy; |
#endif |
#ifdef INTERP_SPEC |
dsr /= dy; /* convert from whole line delta to per-pixel delta */ |
dsg /= dy; |
dsb /= dy; |
#endif |
#ifdef INTERP_ALPHA |
da /= dy; |
#endif |
#ifdef INTERP_INDEX |
di /= dy; |
#endif |
#ifdef INTERP_TEX |
{ |
const GLfloat invDy = 1.0F / (GLfloat) dy; |
dtex[0] *= invDy; |
dtex[1] *= invDy; |
dtex[2] *= invDy; |
dtex[3] *= invDy; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
const GLfloat invDy = 1.0F / (GLfloat) dy; |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
dtex[u][0] *= invDy; |
dtex[u][1] *= invDy; |
dtex[u][2] *= invDy; |
dtex[u][3] *= invDy; |
} |
} |
} |
#endif |
for (i=0;i<dy;i++) { |
#ifdef INTERP_Z |
GLdepth Z = FixedToDepth(z0); |
#endif |
#ifdef INTERP_INDEX |
GLint I = i0 >> 8; |
#endif |
#ifdef INTERP_TEX |
{ |
const GLfloat invQ = tex[3] ? (1.0F / tex[3]) : 1.0F; |
fragTexcoord[0] = tex[0] * invQ; |
fragTexcoord[1] = tex[1] * invQ; |
fragTexcoord[2] = tex[2] * invQ; |
fragTexcoord[3] = tex[3]; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const GLfloat invQ = 1.0F / tex[u][3]; |
fragTexcoord[u][0] = tex[u][0] * invQ; |
fragTexcoord[u][1] = tex[u][1] * invQ; |
fragTexcoord[u][2] = tex[u][2] * invQ; |
fragTexcoord[u][3] = tex[u][3]; |
} |
} |
} |
#endif |
PLOT( x0, y0 ); |
#ifdef INTERP_XY |
y0 += ystep; |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); |
# endif |
z0 += dz; |
#endif |
#ifdef INTERP_FOG |
fog0 += dfog; |
#endif |
#ifdef INTERP_RGB |
r0 += dr; |
g0 += dg; |
b0 += db; |
#endif |
#ifdef INTERP_SPEC |
sr0 += dsr; |
sg0 += dsg; |
sb0 += dsb; |
#endif |
#ifdef INTERP_ALPHA |
a0 += da; |
#endif |
#ifdef INTERP_INDEX |
i0 += di; |
#endif |
#ifdef INTERP_TEX |
tex[0] += dtex[0]; |
tex[1] += dtex[1]; |
tex[2] += dtex[2]; |
tex[3] += dtex[3]; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
tex[u][0] += dtex[u][0]; |
tex[u][1] += dtex[u][1]; |
tex[u][2] += dtex[u][2]; |
tex[u][3] += dtex[u][3]; |
} |
} |
} |
#endif |
#ifdef PIXEL_ADDRESS |
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); |
#endif |
if (error<0) { |
error += errorInc; |
} |
else { |
error += errorDec; |
#ifdef INTERP_XY |
x0 += xstep; |
#endif |
#if defined(INTERP_Z) && defined(DEPTH_TYPE) |
zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); |
#endif |
#ifdef PIXEL_ADDRESS |
pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); |
#endif |
} |
} |
} |
} |
#undef INTERP_XY |
#undef INTERP_Z |
#undef INTERP_FOG |
#undef INTERP_RGB |
#undef INTERP_SPEC |
#undef INTERP_ALPHA |
#undef INTERP_TEX |
#undef INTERP_MULTITEX |
#undef INTERP_INDEX |
#undef PIXEL_ADDRESS |
#undef PIXEL_TYPE |
#undef DEPTH_TYPE |
#undef BYTES_PER_ROW |
#undef SETUP_CODE |
#undef PLOT |
#undef CLIP_HACK |
#undef FixedToDepth |
#undef SET_XMAJOR |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_drawpix.h |
---|
0,0 → 1,42 |
/* $Id: s_drawpix.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_DRAWPIXELS_H |
#define S_DRAWPIXELS_H |
#include "mtypes.h" |
#include "swrast.h" |
extern GLboolean |
_mesa_clip_pixelrect(const GLcontext *ctx, |
GLint *destX, GLint *destY, |
GLsizei *width, GLsizei *height, |
GLint *skipPixels, GLint *skipRows); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_alpha.c |
---|
0,0 → 1,226 |
/* $Id: s_alpha.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file swrast/s_alpha.c |
* \brief Functions to apply alpha test. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "colormac.h" |
#include "macros.h" |
#include "mmath.h" |
#include "s_alpha.h" |
#include "s_context.h" |
/** |
* \fn GLint _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ) |
* \brief Apply the alpha test to a span of pixels. |
* \return |
* - "0" = all pixels in the span failed the alpha test. |
* - "1" = one or more pixels passed the alpha test. |
*/ |
GLint |
_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ) |
{ |
const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba; |
GLchan ref; |
const GLuint n = span->end; |
GLubyte *mask = span->array->mask; |
GLuint i; |
CLAMPED_FLOAT_TO_CHAN(ref, ctx->Color.AlphaRef); |
if (span->arrayMask & SPAN_RGBA) { |
/* Use the array values */ |
switch (ctx->Color.AlphaFunc) { |
case GL_LESS: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] < ref); |
break; |
case GL_LEQUAL: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] <= ref); |
break; |
case GL_GEQUAL: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] >= ref); |
break; |
case GL_GREATER: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] > ref); |
break; |
case GL_NOTEQUAL: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] != ref); |
break; |
case GL_EQUAL: |
for (i = 0; i < n; i++) |
mask[i] &= (rgba[i][ACOMP] == ref); |
break; |
case GL_ALWAYS: |
/* do nothing */ |
return 1; |
case GL_NEVER: |
/* caller should check for zero! */ |
span->writeAll = GL_FALSE; |
return 0; |
default: |
_mesa_problem( ctx, "Invalid alpha test in _mesa_alpha_test" ); |
return 0; |
} |
} |
else { |
/* Use the interpolation values */ |
#if CHAN_TYPE == GL_FLOAT |
const GLfloat alphaStep = span->alphaStep; |
GLfloat alpha = span->alpha; |
ASSERT(span->interpMask & SPAN_RGBA); |
switch (ctx->Color.AlphaFunc) { |
case GL_LESS: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha < ref); |
alpha += alphaStep; |
} |
break; |
case GL_LEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha <= ref); |
alpha += alphaStep; |
} |
break; |
case GL_GEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha >= ref); |
alpha += alphaStep; |
} |
break; |
case GL_GREATER: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha > ref); |
alpha += alphaStep; |
} |
break; |
case GL_NOTEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha != ref); |
alpha += alphaStep; |
} |
break; |
case GL_EQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (alpha == ref); |
alpha += alphaStep; |
} |
break; |
case GL_ALWAYS: |
/* do nothing */ |
return 1; |
case GL_NEVER: |
/* caller should check for zero! */ |
span->writeAll = GL_FALSE; |
return 0; |
default: |
_mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); |
return 0; |
} |
#else |
/* 8 or 16-bit channel interpolation */ |
const GLfixed alphaStep = span->alphaStep; |
GLfixed alpha = span->alpha; |
ASSERT(span->interpMask & SPAN_RGBA); |
switch (ctx->Color.AlphaFunc) { |
case GL_LESS: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) < ref); |
alpha += alphaStep; |
} |
break; |
case GL_LEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) <= ref); |
alpha += alphaStep; |
} |
break; |
case GL_GEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) >= ref); |
alpha += alphaStep; |
} |
break; |
case GL_GREATER: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) > ref); |
alpha += alphaStep; |
} |
break; |
case GL_NOTEQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) != ref); |
alpha += alphaStep; |
} |
break; |
case GL_EQUAL: |
for (i = 0; i < n; i++) { |
mask[i] &= (FixedToChan(alpha) == ref); |
alpha += alphaStep; |
} |
break; |
case GL_ALWAYS: |
/* do nothing */ |
return 1; |
case GL_NEVER: |
/* caller should check for zero! */ |
span->writeAll = GL_FALSE; |
return 0; |
default: |
_mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); |
return 0; |
} |
#endif /* CHAN_TYPE */ |
} |
#if 0 |
/* XXXX This causes conformance failures!!!! */ |
while ((span->start <= span->end) && |
(mask[span->start] == 0)) |
span->start ++; |
while ((span->end >= span->start) && |
(mask[span->end] == 0)) |
span->end --; |
#endif |
span->writeAll = GL_FALSE; |
if (span->start >= span->end) |
return 0; |
else |
return 1; |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_trispan.h |
---|
0,0 → 1,32 |
/* $Id: s_trispan.h,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_TRISPAN_H |
#define S_TRISPAN_H |
#endif /* S_TRISPAN_H */ |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_accum.c |
---|
0,0 → 1,529 |
/* $Id: s_accum.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "imports.h" |
#include "s_accum.h" |
#include "s_alphabuf.h" |
#include "s_context.h" |
#include "s_masking.h" |
#include "s_span.h" |
/* |
* Accumulation buffer notes |
* |
* Normally, accumulation buffer values are GLshorts with values in |
* [-32767, 32767] which represent floating point colors in [-1, 1], |
* as suggested by the OpenGL specification. |
* |
* We optimize for the common case used for full-scene antialiasing: |
* // start with accum buffer cleared to zero |
* glAccum(GL_LOAD, w); // or GL_ACCUM the first image |
* glAccum(GL_ACCUM, w); |
* ... |
* glAccum(GL_ACCUM, w); |
* glAccum(GL_RETURN, 1.0); |
* That is, we start with an empty accumulation buffer and accumulate |
* n images, each with weight w = 1/n. |
* In this scenario, we can simply store unscaled integer values in |
* the accum buffer instead of scaled integers. We'll also keep track |
* of the w value so when we do GL_RETURN we simply divide the accumulated |
* values by n (=1/w). |
* This lets us avoid _many_ int->float->int conversions. |
*/ |
#if CHAN_BITS == 8 && ACCUM_BITS < 32 |
#define USE_OPTIMIZED_ACCUM /* enable the optimization */ |
#endif |
void |
_mesa_alloc_accum_buffer( GLframebuffer *buffer ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint n; |
if (buffer->Accum) { |
MESA_PBUFFER_FREE( buffer->Accum ); |
buffer->Accum = NULL; |
} |
/* allocate accumulation buffer if not already present */ |
n = buffer->Width * buffer->Height * 4 * sizeof(GLaccum); |
buffer->Accum = (GLaccum *) MESA_PBUFFER_ALLOC( n ); |
if (!buffer->Accum) { |
/* unable to setup accumulation buffer */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, "glAccum" ); |
} |
if (ctx) { |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
/* XXX these fields should probably be in the GLframebuffer */ |
#ifdef USE_OPTIMIZED_ACCUM |
swrast->_IntegerAccumMode = GL_TRUE; |
#else |
swrast->_IntegerAccumMode = GL_FALSE; |
#endif |
swrast->_IntegerAccumScaler = 0.0; |
} |
} |
/* |
* This is called when we fall out of optimized/unscaled accum buffer mode. |
* That is, we convert each unscaled accum buffer value into a scaled value |
* representing the range[-1, 1]. |
*/ |
static void rescale_accum( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height * 4; |
const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF); |
GLaccum *accum = ctx->DrawBuffer->Accum; |
GLuint i; |
assert(swrast->_IntegerAccumMode); |
assert(accum); |
for (i = 0; i < n; i++) { |
accum[i] = (GLaccum) (accum[i] * s); |
} |
swrast->_IntegerAccumMode = GL_FALSE; |
} |
/* |
* Clear the accumulation Buffer. |
*/ |
void |
_mesa_clear_accum_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint buffersize; |
GLfloat acc_scale; |
if (ctx->Visual.accumRedBits==0) { |
/* No accumulation buffer! */ |
return; |
} |
if (sizeof(GLaccum)==1) { |
acc_scale = 127.0; |
} |
else if (sizeof(GLaccum)==2) { |
acc_scale = 32767.0; |
} |
else { |
acc_scale = 1.0F; |
} |
/* number of pixels */ |
buffersize = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
if (!ctx->DrawBuffer->Accum) { |
/* try to alloc accumulation buffer */ |
ctx->DrawBuffer->Accum = (GLaccum *) |
MALLOC( buffersize * 4 * sizeof(GLaccum) ); |
} |
if (ctx->DrawBuffer->Accum) { |
if (ctx->Scissor.Enabled) { |
/* Limit clear to scissor box */ |
const GLaccum r = (GLaccum) (ctx->Accum.ClearColor[0] * acc_scale); |
const GLaccum g = (GLaccum) (ctx->Accum.ClearColor[1] * acc_scale); |
const GLaccum b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale); |
const GLaccum a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale); |
GLint i, j; |
GLint width, height; |
GLaccum *row; |
/* size of region to clear */ |
width = 4 * (ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin); |
height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
/* ptr to first element to clear */ |
row = ctx->DrawBuffer->Accum |
+ 4 * (ctx->DrawBuffer->_Ymin * ctx->DrawBuffer->Width |
+ ctx->DrawBuffer->_Xmin); |
for (j=0;j<height;j++) { |
for (i=0;i<width;i+=4) { |
row[i+0] = r; |
row[i+1] = g; |
row[i+2] = b; |
row[i+3] = a; |
} |
row += 4 * ctx->DrawBuffer->Width; |
} |
} |
else { |
/* clear whole buffer */ |
if (ctx->Accum.ClearColor[0]==0.0 && |
ctx->Accum.ClearColor[1]==0.0 && |
ctx->Accum.ClearColor[2]==0.0 && |
ctx->Accum.ClearColor[3]==0.0) { |
/* Black */ |
_mesa_bzero( ctx->DrawBuffer->Accum, |
buffersize * 4 * sizeof(GLaccum) ); |
} |
else { |
/* Not black */ |
const GLaccum r = (GLaccum) (ctx->Accum.ClearColor[0] * acc_scale); |
const GLaccum g = (GLaccum) (ctx->Accum.ClearColor[1] * acc_scale); |
const GLaccum b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale); |
const GLaccum a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale); |
GLaccum *acc = ctx->DrawBuffer->Accum; |
GLuint i; |
for (i=0;i<buffersize;i++) { |
*acc++ = r; |
*acc++ = g; |
*acc++ = b; |
*acc++ = a; |
} |
} |
} |
/* update optimized accum state vars */ |
if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 && |
ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) { |
#ifdef USE_OPTIMIZED_ACCUM |
swrast->_IntegerAccumMode = GL_TRUE; |
#else |
swrast->_IntegerAccumMode = GL_FALSE; |
#endif |
swrast->_IntegerAccumScaler = 0.0; /* denotes empty accum buffer */ |
} |
else { |
swrast->_IntegerAccumMode = GL_FALSE; |
} |
} |
} |
void |
_swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, |
GLint xpos, GLint ypos, |
GLint width, GLint height ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint width4; |
GLfloat acc_scale; |
GLchan rgba[MAX_WIDTH][4]; |
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); |
if (SWRAST_CONTEXT(ctx)->NewState) |
_swrast_validate_derived( ctx ); |
if (!ctx->DrawBuffer->Accum) { |
_mesa_warning(ctx, |
"Calling glAccum() without an accumulation " |
"buffer (low memory?)"); |
return; |
} |
if (sizeof(GLaccum)==1) { |
acc_scale = 127.0; |
} |
else if (sizeof(GLaccum)==2) { |
acc_scale = 32767.0; |
} |
else { |
acc_scale = 1.0F; |
} |
width4 = 4 * width; |
switch (op) { |
case GL_ADD: |
if (value != 0.0F) { |
const GLaccum val = (GLaccum) (value * acc_scale); |
GLint j; |
/* Leave optimized accum buffer mode */ |
if (swrast->_IntegerAccumMode) |
rescale_accum(ctx); |
for (j = 0; j < height; j++) { |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + 4*xpos; |
GLuint i; |
for (i = 0; i < width4; i++) { |
acc[i] += val; |
} |
ypos++; |
} |
} |
break; |
case GL_MULT: |
if (value != 1.0F) { |
GLint j; |
/* Leave optimized accum buffer mode */ |
if (swrast->_IntegerAccumMode) |
rescale_accum(ctx); |
for (j = 0; j < height; j++) { |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + 4 * xpos; |
GLuint i; |
for (i = 0; i < width4; i++) { |
acc[i] = (GLaccum) ( (GLfloat) acc[i] * value ); |
} |
ypos++; |
} |
} |
break; |
case GL_ACCUM: |
if (value == 0.0F) |
return; |
_swrast_use_read_buffer(ctx); |
/* May have to leave optimized accum buffer mode */ |
if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0) |
swrast->_IntegerAccumScaler = value; |
if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler) |
rescale_accum(ctx); |
RENDER_START(swrast,ctx); |
if (swrast->_IntegerAccumMode) { |
/* simply add integer color values into accum buffer */ |
GLint j; |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4; |
assert(swrast->_IntegerAccumScaler > 0.0); |
assert(swrast->_IntegerAccumScaler <= 1.0); |
for (j = 0; j < height; j++) { |
GLint i, i4; |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba); |
for (i = i4 = 0; i < width; i++, i4+=4) { |
acc[i4+0] += rgba[i][RCOMP]; |
acc[i4+1] += rgba[i][GCOMP]; |
acc[i4+2] += rgba[i][BCOMP]; |
acc[i4+3] += rgba[i][ACOMP]; |
} |
acc += width4; |
ypos++; |
} |
} |
else { |
/* scaled integer (or float) accum buffer */ |
const GLfloat rscale = value * acc_scale / CHAN_MAXF; |
const GLfloat gscale = value * acc_scale / CHAN_MAXF; |
const GLfloat bscale = value * acc_scale / CHAN_MAXF; |
const GLfloat ascale = value * acc_scale / CHAN_MAXF; |
GLint j; |
for (j=0;j<height;j++) { |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4; |
GLint i; |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba); |
for (i=0;i<width;i++) { |
acc[0] += (GLaccum) ( (GLfloat) rgba[i][RCOMP] * rscale ); |
acc[1] += (GLaccum) ( (GLfloat) rgba[i][GCOMP] * gscale ); |
acc[2] += (GLaccum) ( (GLfloat) rgba[i][BCOMP] * bscale ); |
acc[3] += (GLaccum) ( (GLfloat) rgba[i][ACOMP] * ascale ); |
acc += 4; |
} |
ypos++; |
} |
} |
/* restore read buffer = draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
RENDER_FINISH(swrast,ctx); |
break; |
case GL_LOAD: |
_swrast_use_read_buffer(ctx); |
/* This is a change to go into optimized accum buffer mode */ |
if (value > 0.0 && value <= 1.0) { |
#ifdef USE_OPTIMIZED_ACCUM |
swrast->_IntegerAccumMode = GL_TRUE; |
#else |
swrast->_IntegerAccumMode = GL_FALSE; |
#endif |
swrast->_IntegerAccumScaler = value; |
} |
else { |
swrast->_IntegerAccumMode = GL_FALSE; |
swrast->_IntegerAccumScaler = 0.0; |
} |
RENDER_START(swrast,ctx); |
if (swrast->_IntegerAccumMode) { |
/* just copy values into accum buffer */ |
GLint j; |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4; |
assert(swrast->_IntegerAccumScaler > 0.0); |
assert(swrast->_IntegerAccumScaler <= 1.0); |
for (j = 0; j < height; j++) { |
GLint i, i4; |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba); |
for (i = i4 = 0; i < width; i++, i4 += 4) { |
acc[i4+0] = rgba[i][RCOMP]; |
acc[i4+1] = rgba[i][GCOMP]; |
acc[i4+2] = rgba[i][BCOMP]; |
acc[i4+3] = rgba[i][ACOMP]; |
} |
acc += width4; |
ypos++; |
} |
} |
else { |
/* scaled integer (or float) accum buffer */ |
const GLfloat rscale = value * acc_scale / CHAN_MAXF; |
const GLfloat gscale = value * acc_scale / CHAN_MAXF; |
const GLfloat bscale = value * acc_scale / CHAN_MAXF; |
const GLfloat ascale = value * acc_scale / CHAN_MAXF; |
#if 0 |
const GLfloat d = 3.0 / acc_scale; /* XXX what's this? */ |
#endif |
GLint i, j; |
for (j = 0; j < height; j++) { |
GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4; |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba); |
for (i=0;i<width;i++) { |
#if 0 |
*acc++ = (GLaccum) ((GLfloat) rgba[i][RCOMP] * rscale + d); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][GCOMP] * gscale + d); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][BCOMP] * bscale + d); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][ACOMP] * ascale + d); |
#else |
*acc++ = (GLaccum) ((GLfloat) rgba[i][RCOMP] * rscale); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][GCOMP] * gscale); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][BCOMP] * bscale); |
*acc++ = (GLaccum) ((GLfloat) rgba[i][ACOMP] * ascale); |
#endif |
} |
ypos++; |
} |
} |
/* restore read buffer = draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
RENDER_FINISH(swrast,ctx); |
break; |
case GL_RETURN: |
/* May have to leave optimized accum buffer mode */ |
if (swrast->_IntegerAccumMode && value != 1.0) |
rescale_accum(ctx); |
RENDER_START(swrast,ctx); |
#ifdef USE_OPTIMIZED_ACCUM |
if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) { |
/* build lookup table to avoid many floating point multiplies */ |
static GLchan multTable[32768]; |
static GLfloat prevMult = 0.0; |
const GLfloat mult = swrast->_IntegerAccumScaler; |
const GLint max = MIN2((GLint) (256 / mult), 32767); |
GLint j; |
if (mult != prevMult) { |
for (j = 0; j < max; j++) |
multTable[j] = IROUND((GLfloat) j * mult); |
prevMult = mult; |
} |
assert(swrast->_IntegerAccumScaler > 0.0); |
assert(swrast->_IntegerAccumScaler <= 1.0); |
for (j = 0; j < height; j++) { |
const GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos*4; |
GLint i, i4; |
for (i = i4 = 0; i < width; i++, i4 += 4) { |
ASSERT(acc[i4+0] < max); |
ASSERT(acc[i4+1] < max); |
ASSERT(acc[i4+2] < max); |
ASSERT(acc[i4+3] < max); |
rgba[i][RCOMP] = multTable[acc[i4+0]]; |
rgba[i][GCOMP] = multTable[acc[i4+1]]; |
rgba[i][BCOMP] = multTable[acc[i4+2]]; |
rgba[i][ACOMP] = multTable[acc[i4+3]]; |
} |
if (colorMask != 0xffffffff) { |
_mesa_mask_rgba_array( ctx, width, xpos, ypos, rgba ); |
} |
(*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, |
(const GLchan (*)[4])rgba, NULL ); |
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers |
&& ctx->Color.ColorMask[ACOMP]) { |
_mesa_write_alpha_span(ctx, width, xpos, ypos, |
(CONST GLchan (*)[4]) rgba, NULL); |
} |
ypos++; |
} |
} |
else |
#endif /* USE_OPTIMIZED_ACCUM */ |
{ |
/* scaled integer (or float) accum buffer */ |
const GLfloat rscale = value / acc_scale * CHAN_MAXF; |
const GLfloat gscale = value / acc_scale * CHAN_MAXF; |
const GLfloat bscale = value / acc_scale * CHAN_MAXF; |
const GLfloat ascale = value / acc_scale * CHAN_MAXF; |
GLint i, j; |
for (j=0;j<height;j++) { |
const GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos*4; |
for (i=0;i<width;i++) { |
GLint r = IROUND( (GLfloat) (acc[0]) * rscale ); |
GLint g = IROUND( (GLfloat) (acc[1]) * gscale ); |
GLint b = IROUND( (GLfloat) (acc[2]) * bscale ); |
GLint a = IROUND( (GLfloat) (acc[3]) * ascale ); |
acc += 4; |
rgba[i][RCOMP] = CLAMP( r, 0, CHAN_MAX ); |
rgba[i][GCOMP] = CLAMP( g, 0, CHAN_MAX ); |
rgba[i][BCOMP] = CLAMP( b, 0, CHAN_MAX ); |
rgba[i][ACOMP] = CLAMP( a, 0, CHAN_MAX ); |
} |
if (colorMask != 0xffffffff) { |
_mesa_mask_rgba_array( ctx, width, xpos, ypos, rgba ); |
} |
(*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, |
(const GLchan (*)[4])rgba, NULL ); |
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers |
&& ctx->Color.ColorMask[ACOMP]) { |
_mesa_write_alpha_span(ctx, width, xpos, ypos, |
(CONST GLchan (*)[4]) rgba, NULL); |
} |
ypos++; |
} |
} |
RENDER_FINISH(swrast,ctx); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glAccum" ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_blend.h |
---|
0,0 → 1,46 |
/* $Id: s_blend.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_BLEND_H |
#define S_BLEND_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_blend_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ); |
extern void |
_swrast_choose_blend_func( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aaline.c |
---|
0,0 → 1,537 |
/* $Id: s_aaline.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "swrast/s_aaline.h" |
#include "swrast/s_context.h" |
#include "swrast/s_span.h" |
#include "swrast/swrast.h" |
#include "mtypes.h" |
#include "mmath.h" |
#define SUB_PIXEL 4 |
/* |
* Info about the AA line we're rendering |
*/ |
struct LineInfo |
{ |
GLfloat x0, y0; /* start */ |
GLfloat x1, y1; /* end */ |
GLfloat dx, dy; /* direction vector */ |
GLfloat len; /* length */ |
GLfloat halfWidth; /* half of line width */ |
GLfloat xAdj, yAdj; /* X and Y adjustment for quad corners around line */ |
/* for coverage computation */ |
GLfloat qx0, qy0; /* quad vertices */ |
GLfloat qx1, qy1; |
GLfloat qx2, qy2; |
GLfloat qx3, qy3; |
GLfloat ex0, ey0; /* quad edge vectors */ |
GLfloat ex1, ey1; |
GLfloat ex2, ey2; |
GLfloat ex3, ey3; |
/* DO_Z */ |
GLfloat zPlane[4]; |
/* DO_FOG */ |
GLfloat fPlane[4]; |
/* DO_RGBA */ |
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; |
/* DO_INDEX */ |
GLfloat iPlane[4]; |
/* DO_SPEC */ |
GLfloat srPlane[4], sgPlane[4], sbPlane[4]; |
/* DO_TEX or DO_MULTITEX */ |
GLfloat sPlane[MAX_TEXTURE_UNITS][4]; |
GLfloat tPlane[MAX_TEXTURE_UNITS][4]; |
GLfloat uPlane[MAX_TEXTURE_UNITS][4]; |
GLfloat vPlane[MAX_TEXTURE_UNITS][4]; |
GLfloat lambda[MAX_TEXTURE_UNITS]; |
GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; |
struct sw_span span; |
}; |
/* |
* Compute the equation of a plane used to interpolate line fragment data |
* such as color, Z, texture coords, etc. |
* Input: (x0, y0) and (x1,y1) are the endpoints of the line. |
* z0, and z1 are the end point values to interpolate. |
* Output: plane - the plane equation. |
* |
* Note: we don't really have enough parameters to specify a plane. |
* We take the endpoints of the line and compute a plane such that |
* the cross product of the line vector and the plane normal is |
* parallel to the projection plane. |
*/ |
static void |
compute_plane(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, |
GLfloat z0, GLfloat z1, GLfloat plane[4]) |
{ |
#if 0 |
/* original */ |
const GLfloat px = x1 - x0; |
const GLfloat py = y1 - y0; |
const GLfloat pz = z1 - z0; |
const GLfloat qx = -py; |
const GLfloat qy = px; |
const GLfloat qz = 0; |
const GLfloat a = py * qz - pz * qy; |
const GLfloat b = pz * qx - px * qz; |
const GLfloat c = px * qy - py * qx; |
const GLfloat d = -(a * x0 + b * y0 + c * z0); |
plane[0] = a; |
plane[1] = b; |
plane[2] = c; |
plane[3] = d; |
#else |
/* simplified */ |
const GLfloat px = x1 - x0; |
const GLfloat py = y1 - y0; |
const GLfloat pz = z0 - z1; |
const GLfloat a = pz * px; |
const GLfloat b = pz * py; |
const GLfloat c = px * px + py * py; |
const GLfloat d = -(a * x0 + b * y0 + c * z0); |
if (a == 0.0 && b == 0.0 && c == 0.0 && d == 0.0) { |
plane[0] = 0.0; |
plane[1] = 0.0; |
plane[2] = 1.0; |
plane[3] = 0.0; |
} |
else { |
plane[0] = a; |
plane[1] = b; |
plane[2] = c; |
plane[3] = d; |
} |
#endif |
} |
static INLINE void |
constant_plane(GLfloat value, GLfloat plane[4]) |
{ |
plane[0] = 0.0; |
plane[1] = 0.0; |
plane[2] = -1.0; |
plane[3] = value; |
} |
static INLINE GLfloat |
solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; |
return z; |
} |
#define SOLVE_PLANE(X, Y, PLANE) \ |
((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) |
/* |
* Return 1 / solve_plane(). |
*/ |
static INLINE GLfloat |
solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; |
if (denom == 0.0) |
return 0.0; |
else |
return -plane[2] / denom; |
} |
/* |
* Solve plane and return clamped GLchan value. |
*/ |
static INLINE GLchan |
solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F; |
if (z < 0.0F) |
return 0; |
else if (z > CHAN_MAXF) |
return (GLchan) CHAN_MAXF; |
return (GLchan) (GLint) z; |
} |
/* |
* Compute mipmap level of detail. |
*/ |
static INLINE GLfloat |
compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], |
GLfloat invQ, GLfloat width, GLfloat height) |
{ |
GLfloat dudx = sPlane[0] / sPlane[2] * invQ * width; |
GLfloat dudy = sPlane[1] / sPlane[2] * invQ * width; |
GLfloat dvdx = tPlane[0] / tPlane[2] * invQ * height; |
GLfloat dvdy = tPlane[1] / tPlane[2] * invQ * height; |
GLfloat r1 = dudx * dudx + dudy * dudy; |
GLfloat r2 = dvdx * dvdx + dvdy * dvdy; |
GLfloat rho2 = r1 + r2; |
/* return log base 2 of rho */ |
if (rho2 == 0.0F) |
return 0.0; |
else |
return (GLfloat) (log(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ |
} |
/* |
* Fill in the samples[] array with the (x,y) subpixel positions of |
* xSamples * ySamples sample positions. |
* Note that the four corner samples are put into the first four |
* positions of the array. This allows us to optimize for the common |
* case of all samples being inside the polygon. |
*/ |
static void |
make_sample_table(GLint xSamples, GLint ySamples, GLfloat samples[][2]) |
{ |
const GLfloat dx = 1.0F / (GLfloat) xSamples; |
const GLfloat dy = 1.0F / (GLfloat) ySamples; |
GLint x, y; |
GLint i; |
i = 4; |
for (x = 0; x < xSamples; x++) { |
for (y = 0; y < ySamples; y++) { |
GLint j; |
if (x == 0 && y == 0) { |
/* lower left */ |
j = 0; |
} |
else if (x == xSamples - 1 && y == 0) { |
/* lower right */ |
j = 1; |
} |
else if (x == 0 && y == ySamples - 1) { |
/* upper left */ |
j = 2; |
} |
else if (x == xSamples - 1 && y == ySamples - 1) { |
/* upper right */ |
j = 3; |
} |
else { |
j = i++; |
} |
samples[j][0] = x * dx + 0.5F * dx; |
samples[j][1] = y * dy + 0.5F * dy; |
} |
} |
} |
/* |
* Compute how much of the given pixel's area is inside the rectangle |
* defined by vertices v0, v1, v2, v3. |
* Vertices MUST be specified in counter-clockwise order. |
* Return: coverage in [0, 1]. |
*/ |
static GLfloat |
compute_coveragef(const struct LineInfo *info, |
GLint winx, GLint winy) |
{ |
static GLfloat samples[SUB_PIXEL * SUB_PIXEL][2]; |
static GLboolean haveSamples = GL_FALSE; |
const GLfloat x = (GLfloat) winx; |
const GLfloat y = (GLfloat) winy; |
GLint stop = 4, i; |
GLfloat insideCount = SUB_PIXEL * SUB_PIXEL; |
if (!haveSamples) { |
make_sample_table(SUB_PIXEL, SUB_PIXEL, samples); |
haveSamples = GL_TRUE; |
} |
#if 0 /*DEBUG*/ |
{ |
const GLfloat area = dx0 * dy1 - dx1 * dy0; |
assert(area >= 0.0); |
} |
#endif |
for (i = 0; i < stop; i++) { |
const GLfloat sx = x + samples[i][0]; |
const GLfloat sy = y + samples[i][1]; |
const GLfloat fx0 = sx - info->qx0; |
const GLfloat fy0 = sy - info->qy0; |
const GLfloat fx1 = sx - info->qx1; |
const GLfloat fy1 = sy - info->qy1; |
const GLfloat fx2 = sx - info->qx2; |
const GLfloat fy2 = sy - info->qy2; |
const GLfloat fx3 = sx - info->qx3; |
const GLfloat fy3 = sy - info->qy3; |
/* cross product determines if sample is inside or outside each edge */ |
GLfloat cross0 = (info->ex0 * fy0 - info->ey0 * fx0); |
GLfloat cross1 = (info->ex1 * fy1 - info->ey1 * fx1); |
GLfloat cross2 = (info->ex2 * fy2 - info->ey2 * fx2); |
GLfloat cross3 = (info->ex3 * fy3 - info->ey3 * fx3); |
/* Check if the sample is exactly on an edge. If so, let cross be a |
* positive or negative value depending on the direction of the edge. |
*/ |
if (cross0 == 0.0F) |
cross0 = info->ex0 + info->ey0; |
if (cross1 == 0.0F) |
cross1 = info->ex1 + info->ey1; |
if (cross2 == 0.0F) |
cross2 = info->ex2 + info->ey2; |
if (cross3 == 0.0F) |
cross3 = info->ex3 + info->ey3; |
if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F || cross3 < 0.0F) { |
/* point is outside quadrilateral */ |
insideCount -= 1.0F; |
stop = SUB_PIXEL * SUB_PIXEL; |
} |
} |
if (stop == 4) |
return 1.0F; |
else |
return insideCount * (1.0F / (SUB_PIXEL * SUB_PIXEL)); |
} |
typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, |
int ix, int iy); |
/* |
* Draw an AA line segment (called many times per line when stippling) |
*/ |
static void |
segment(GLcontext *ctx, |
struct LineInfo *line, |
plot_func plot, |
GLfloat t0, GLfloat t1) |
{ |
const GLfloat absDx = (line->dx < 0.0F) ? -line->dx : line->dx; |
const GLfloat absDy = (line->dy < 0.0F) ? -line->dy : line->dy; |
/* compute the actual segment's endpoints */ |
const GLfloat x0 = line->x0 + t0 * line->dx; |
const GLfloat y0 = line->y0 + t0 * line->dy; |
const GLfloat x1 = line->x0 + t1 * line->dx; |
const GLfloat y1 = line->y0 + t1 * line->dy; |
/* compute vertices of the line-aligned quadrilateral */ |
line->qx0 = x0 - line->yAdj; |
line->qy0 = y0 + line->xAdj; |
line->qx1 = x0 + line->yAdj; |
line->qy1 = y0 - line->xAdj; |
line->qx2 = x1 + line->yAdj; |
line->qy2 = y1 - line->xAdj; |
line->qx3 = x1 - line->yAdj; |
line->qy3 = y1 + line->xAdj; |
/* compute the quad's edge vectors (for coverage calc) */ |
line->ex0 = line->qx1 - line->qx0; |
line->ey0 = line->qy1 - line->qy0; |
line->ex1 = line->qx2 - line->qx1; |
line->ey1 = line->qy2 - line->qy1; |
line->ex2 = line->qx3 - line->qx2; |
line->ey2 = line->qy3 - line->qy2; |
line->ex3 = line->qx0 - line->qx3; |
line->ey3 = line->qy0 - line->qy3; |
if (absDx > absDy) { |
/* X-major line */ |
GLfloat dydx = line->dy / line->dx; |
GLfloat xLeft, xRight, yBot, yTop; |
GLint ix, ixRight; |
if (x0 < x1) { |
xLeft = x0 - line->halfWidth; |
xRight = x1 + line->halfWidth; |
if (line->dy >= 0.0) { |
yBot = y0 - 3.0F * line->halfWidth; |
yTop = y0 + line->halfWidth; |
} |
else { |
yBot = y0 - line->halfWidth; |
yTop = y0 + 3.0F * line->halfWidth; |
} |
} |
else { |
xLeft = x1 - line->halfWidth; |
xRight = x0 + line->halfWidth; |
if (line->dy <= 0.0) { |
yBot = y1 - 3.0F * line->halfWidth; |
yTop = y1 + line->halfWidth; |
} |
else { |
yBot = y1 - line->halfWidth; |
yTop = y1 + 3.0F * line->halfWidth; |
} |
} |
/* scan along the line, left-to-right */ |
ixRight = (GLint) (xRight + 1.0F); |
/*printf("avg span height: %g\n", yTop - yBot);*/ |
for (ix = (GLint) xLeft; ix < ixRight; ix++) { |
const GLint iyBot = (GLint) yBot; |
const GLint iyTop = (GLint) (yTop + 1.0F); |
GLint iy; |
/* scan across the line, bottom-to-top */ |
for (iy = iyBot; iy < iyTop; iy++) { |
(*plot)(ctx, line, ix, iy); |
} |
yBot += dydx; |
yTop += dydx; |
} |
} |
else { |
/* Y-major line */ |
GLfloat dxdy = line->dx / line->dy; |
GLfloat yBot, yTop, xLeft, xRight; |
GLint iy, iyTop; |
if (y0 < y1) { |
yBot = y0 - line->halfWidth; |
yTop = y1 + line->halfWidth; |
if (line->dx >= 0.0) { |
xLeft = x0 - 3.0F * line->halfWidth; |
xRight = x0 + line->halfWidth; |
} |
else { |
xLeft = x0 - line->halfWidth; |
xRight = x0 + 3.0F * line->halfWidth; |
} |
} |
else { |
yBot = y1 - line->halfWidth; |
yTop = y0 + line->halfWidth; |
if (line->dx <= 0.0) { |
xLeft = x1 - 3.0F * line->halfWidth; |
xRight = x1 + line->halfWidth; |
} |
else { |
xLeft = x1 - line->halfWidth; |
xRight = x1 + 3.0F * line->halfWidth; |
} |
} |
/* scan along the line, bottom-to-top */ |
iyTop = (GLint) (yTop + 1.0F); |
/*printf("avg span width: %g\n", xRight - xLeft);*/ |
for (iy = (GLint) yBot; iy < iyTop; iy++) { |
const GLint ixLeft = (GLint) xLeft; |
const GLint ixRight = (GLint) (xRight + 1.0F); |
GLint ix; |
/* scan across the line, left-to-right */ |
for (ix = ixLeft; ix < ixRight; ix++) { |
(*plot)(ctx, line, ix, iy); |
} |
xLeft += dxdy; |
xRight += dxdy; |
} |
} |
} |
#define NAME(x) aa_ci_##x |
#define DO_Z |
#define DO_FOG |
#define DO_INDEX |
#include "s_aalinetemp.h" |
#define NAME(x) aa_rgba_##x |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#include "s_aalinetemp.h" |
#define NAME(x) aa_tex_rgba_##x |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_TEX |
#include "s_aalinetemp.h" |
#define NAME(x) aa_multitex_rgba_##x |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_MULTITEX |
#include "s_aalinetemp.h" |
#define NAME(x) aa_multitex_spec_##x |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_MULTITEX |
#define DO_SPEC |
#include "s_aalinetemp.h" |
void |
_swrast_choose_aa_line_function(GLcontext *ctx) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
ASSERT(ctx->Line.SmoothFlag); |
if (ctx->Visual.rgbMode) { |
/* RGBA */ |
if (ctx->Texture._EnabledUnits != 0) { |
if (ctx->Texture._EnabledUnits > 1) { |
/* Multitextured! */ |
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || |
ctx->Fog.ColorSumEnabled) |
swrast->Line = aa_multitex_spec_line; |
else |
swrast->Line = aa_multitex_rgba_line; |
} |
else { |
swrast->Line = aa_tex_rgba_line; |
} |
} |
else { |
swrast->Line = aa_rgba_line; |
} |
} |
else { |
/* Color Index */ |
swrast->Line = aa_ci_line; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_alpha.h |
---|
0,0 → 1,40 |
/* $Id: s_alpha.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_ALPHA_H |
#define S_ALPHA_H |
#include "mtypes.h" |
#include "swrast.h" |
extern GLint |
_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aatritemp.h |
---|
0,0 → 1,554 |
/* $Id: s_aatritemp.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Antialiased Triangle Rasterizer Template |
* |
* This file is #include'd to generate custom AA triangle rasterizers. |
* NOTE: this code hasn't been optimized yet. That'll come after it |
* works correctly. |
* |
* The following macros may be defined to indicate what auxillary information |
* must be copmuted across the triangle: |
* DO_Z - if defined, compute Z values |
* DO_RGBA - if defined, compute RGBA values |
* DO_INDEX - if defined, compute color index values |
* DO_SPEC - if defined, compute specular RGB values |
* DO_TEX - if defined, compute unit 0 STRQ texcoords |
* DO_MULTITEX - if defined, compute all unit's STRQ texcoords |
*/ |
/*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ |
{ |
const GLfloat *p0 = v0->win; |
const GLfloat *p1 = v1->win; |
const GLfloat *p2 = v2->win; |
const SWvertex *vMin, *vMid, *vMax; |
GLint iyMin, iyMax; |
GLfloat yMin, yMax; |
GLboolean ltor; |
GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ |
struct sw_span span; |
#ifdef DO_Z |
GLfloat zPlane[4]; |
#endif |
#ifdef DO_FOG |
GLfloat fogPlane[4]; |
#else |
GLfloat *fog = NULL; |
#endif |
#ifdef DO_RGBA |
GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; |
#endif |
#ifdef DO_INDEX |
GLfloat iPlane[4]; |
#endif |
#ifdef DO_SPEC |
GLfloat srPlane[4], sgPlane[4], sbPlane[4]; |
#endif |
#ifdef DO_TEX |
GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; |
GLfloat texWidth, texHeight; |
#elif defined(DO_MULTITEX) |
GLfloat sPlane[MAX_TEXTURE_UNITS][4]; /* texture S */ |
GLfloat tPlane[MAX_TEXTURE_UNITS][4]; /* texture T */ |
GLfloat uPlane[MAX_TEXTURE_UNITS][4]; /* texture R */ |
GLfloat vPlane[MAX_TEXTURE_UNITS][4]; /* texture Q */ |
GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; |
#endif |
GLfloat bf = SWRAST_CONTEXT(ctx)->_backface_sign; |
INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); |
/* determine bottom to top order of vertices */ |
{ |
GLfloat y0 = v0->win[1]; |
GLfloat y1 = v1->win[1]; |
GLfloat y2 = v2->win[1]; |
if (y0 <= y1) { |
if (y1 <= y2) { |
vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ |
} |
else if (y2 <= y0) { |
vMin = v2; vMid = v0; vMax = v1; /* y2<=y0<=y1 */ |
} |
else { |
vMin = v0; vMid = v2; vMax = v1; bf = -bf; /* y0<=y2<=y1 */ |
} |
} |
else { |
if (y0 <= y2) { |
vMin = v1; vMid = v0; vMax = v2; bf = -bf; /* y1<=y0<=y2 */ |
} |
else if (y2 <= y1) { |
vMin = v2; vMid = v1; vMax = v0; bf = -bf; /* y2<=y1<=y0 */ |
} |
else { |
vMin = v1; vMid = v2; vMax = v0; /* y1<=y2<=y0 */ |
} |
} |
} |
majDx = vMax->win[0] - vMin->win[0]; |
majDy = vMax->win[1] - vMin->win[1]; |
{ |
const GLfloat botDx = vMid->win[0] - vMin->win[0]; |
const GLfloat botDy = vMid->win[1] - vMin->win[1]; |
const GLfloat area = majDx * botDy - botDx * majDy; |
ltor = (GLboolean) (area < 0.0F); |
/* Do backface culling */ |
if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) |
return; |
} |
#ifndef DO_OCCLUSION_TEST |
ctx->OcclusionResult = GL_TRUE; |
#endif |
/* Plane equation setup: |
* We evaluate plane equations at window (x,y) coordinates in order |
* to compute color, Z, fog, texcoords, etc. This isn't terribly |
* efficient but it's easy and reliable. |
*/ |
#ifdef DO_Z |
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane); |
span.arrayMask |= SPAN_Z; |
#endif |
#ifdef DO_FOG |
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane); |
span.arrayMask |= SPAN_FOG; |
#endif |
#ifdef DO_RGBA |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(p0, p1, p2, v0->color[0], v1->color[0], v2->color[0], rPlane); |
compute_plane(p0, p1, p2, v0->color[1], v1->color[1], v2->color[1], gPlane); |
compute_plane(p0, p1, p2, v0->color[2], v1->color[2], v2->color[2], bPlane); |
compute_plane(p0, p1, p2, v0->color[3], v1->color[3], v2->color[3], aPlane); |
} |
else { |
constant_plane(v2->color[RCOMP], rPlane); |
constant_plane(v2->color[GCOMP], gPlane); |
constant_plane(v2->color[BCOMP], bPlane); |
constant_plane(v2->color[ACOMP], aPlane); |
} |
span.arrayMask |= SPAN_RGBA; |
#endif |
#ifdef DO_INDEX |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(p0, p1, p2, (GLfloat) v0->index, |
(GLfloat) v1->index, (GLfloat) v2->index, iPlane); |
} |
else { |
constant_plane((GLfloat) v2->index, iPlane); |
} |
span.arrayMask |= SPAN_INDEX; |
#endif |
#ifdef DO_SPEC |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(p0, p1, p2, v0->specular[0], v1->specular[0], v2->specular[0],srPlane); |
compute_plane(p0, p1, p2, v0->specular[1], v1->specular[1], v2->specular[1],sgPlane); |
compute_plane(p0, p1, p2, v0->specular[2], v1->specular[2], v2->specular[2],sbPlane); |
} |
else { |
constant_plane(v2->specular[RCOMP], srPlane); |
constant_plane(v2->specular[GCOMP], sgPlane); |
constant_plane(v2->specular[BCOMP], sbPlane); |
} |
span.arrayMask |= SPAN_SPEC; |
#endif |
#ifdef DO_TEX |
{ |
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; |
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; |
const GLfloat invW0 = v0->win[3]; |
const GLfloat invW1 = v1->win[3]; |
const GLfloat invW2 = v2->win[3]; |
const GLfloat s0 = v0->texcoord[0][0] * invW0; |
const GLfloat s1 = v1->texcoord[0][0] * invW1; |
const GLfloat s2 = v2->texcoord[0][0] * invW2; |
const GLfloat t0 = v0->texcoord[0][1] * invW0; |
const GLfloat t1 = v1->texcoord[0][1] * invW1; |
const GLfloat t2 = v2->texcoord[0][1] * invW2; |
const GLfloat r0 = v0->texcoord[0][2] * invW0; |
const GLfloat r1 = v1->texcoord[0][2] * invW1; |
const GLfloat r2 = v2->texcoord[0][2] * invW2; |
const GLfloat q0 = v0->texcoord[0][3] * invW0; |
const GLfloat q1 = v1->texcoord[0][3] * invW1; |
const GLfloat q2 = v2->texcoord[0][3] * invW2; |
compute_plane(p0, p1, p2, s0, s1, s2, sPlane); |
compute_plane(p0, p1, p2, t0, t1, t2, tPlane); |
compute_plane(p0, p1, p2, r0, r1, r2, uPlane); |
compute_plane(p0, p1, p2, q0, q1, q2, vPlane); |
texWidth = (GLfloat) texImage->Width; |
texHeight = (GLfloat) texImage->Height; |
} |
span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); |
#elif defined(DO_MULTITEX) |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; |
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; |
const GLfloat invW0 = v0->win[3]; |
const GLfloat invW1 = v1->win[3]; |
const GLfloat invW2 = v2->win[3]; |
const GLfloat s0 = v0->texcoord[u][0] * invW0; |
const GLfloat s1 = v1->texcoord[u][0] * invW1; |
const GLfloat s2 = v2->texcoord[u][0] * invW2; |
const GLfloat t0 = v0->texcoord[u][1] * invW0; |
const GLfloat t1 = v1->texcoord[u][1] * invW1; |
const GLfloat t2 = v2->texcoord[u][1] * invW2; |
const GLfloat r0 = v0->texcoord[u][2] * invW0; |
const GLfloat r1 = v1->texcoord[u][2] * invW1; |
const GLfloat r2 = v2->texcoord[u][2] * invW2; |
const GLfloat q0 = v0->texcoord[u][3] * invW0; |
const GLfloat q1 = v1->texcoord[u][3] * invW1; |
const GLfloat q2 = v2->texcoord[u][3] * invW2; |
compute_plane(p0, p1, p2, s0, s1, s2, sPlane[u]); |
compute_plane(p0, p1, p2, t0, t1, t2, tPlane[u]); |
compute_plane(p0, p1, p2, r0, r1, r2, uPlane[u]); |
compute_plane(p0, p1, p2, q0, q1, q2, vPlane[u]); |
texWidth[u] = (GLfloat) texImage->Width; |
texHeight[u] = (GLfloat) texImage->Height; |
} |
} |
} |
span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); |
#endif |
/* Begin bottom-to-top scan over the triangle. |
* The long edge will either be on the left or right side of the |
* triangle. We always scan from the long edge toward the shorter |
* edges, stopping when we find that coverage = 0. If the long edge |
* is on the left we scan left-to-right. Else, we scan right-to-left. |
*/ |
yMin = vMin->win[1]; |
yMax = vMax->win[1]; |
iyMin = (GLint) yMin; |
iyMax = (GLint) yMax + 1; |
if (ltor) { |
/* scan left to right */ |
const GLfloat *pMin = vMin->win; |
const GLfloat *pMid = vMid->win; |
const GLfloat *pMax = vMax->win; |
const GLfloat dxdy = majDx / majDy; |
const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; |
GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; |
GLint iy; |
for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { |
GLint ix, startX = (GLint) (x - xAdj); |
GLuint count; |
GLfloat coverage = 0.0F; |
/* skip over fragments with zero coverage */ |
while (startX < MAX_WIDTH) { |
coverage = compute_coveragef(pMin, pMid, pMax, startX, iy); |
if (coverage > 0.0F) |
break; |
startX++; |
} |
/* enter interior of triangle */ |
ix = startX; |
count = 0; |
while (coverage > 0.0F) { |
/* (cx,cy) = center of fragment */ |
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; |
struct span_arrays *array = span.array; |
#ifdef DO_INDEX |
array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy); |
#else |
array->coverage[count] = coverage; |
#endif |
#ifdef DO_Z |
array->z[count] = (GLdepth) solve_plane(cx, cy, zPlane); |
#endif |
#ifdef DO_FOG |
array->fog[count] = solve_plane(cx, cy, fogPlane); |
#endif |
#ifdef DO_RGBA |
array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); |
array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane); |
array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane); |
array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane); |
#endif |
#ifdef DO_INDEX |
array->index[count] = (GLint) solve_plane(cx, cy, iPlane); |
#endif |
#ifdef DO_SPEC |
array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane); |
array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); |
array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); |
#endif |
#ifdef DO_TEX |
{ |
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); |
array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ; |
array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ; |
array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ; |
array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane, |
cx, cy, invQ, |
texWidth, texHeight); |
} |
#elif defined(DO_MULTITEX) |
{ |
GLuint unit; |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); |
array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; |
array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; |
array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; |
array->lambda[unit][count] = compute_lambda(sPlane[unit], |
tPlane[unit], vPlane[unit], cx, cy, invQ, |
texWidth[unit], texHeight[unit]); |
} |
} |
} |
#endif |
ix++; |
count++; |
coverage = compute_coveragef(pMin, pMid, pMax, ix, iy); |
} |
if (ix <= startX) |
continue; |
span.x = startX; |
span.y = iy; |
span.end = (GLuint) ix - (GLuint) startX; |
ASSERT(span.interpMask == 0); |
#if defined(DO_MULTITEX) || defined(DO_TEX) |
_mesa_write_texture_span(ctx, &span); |
#elif defined(DO_RGBA) |
_mesa_write_rgba_span(ctx, &span); |
#elif defined(DO_INDEX) |
_mesa_write_index_span(ctx, &span); |
#endif |
} |
} |
else { |
/* scan right to left */ |
const GLfloat *pMin = vMin->win; |
const GLfloat *pMid = vMid->win; |
const GLfloat *pMax = vMax->win; |
const GLfloat dxdy = majDx / majDy; |
const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; |
GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; |
GLint iy; |
for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { |
GLint ix, left, startX = (GLint) (x + xAdj); |
GLuint count, n; |
GLfloat coverage = 0.0F; |
/* make sure we're not past the window edge */ |
if (startX >= ctx->DrawBuffer->_Xmax) { |
startX = ctx->DrawBuffer->_Xmax - 1; |
} |
/* skip fragments with zero coverage */ |
while (startX >= 0) { |
coverage = compute_coveragef(pMin, pMax, pMid, startX, iy); |
if (coverage > 0.0F) |
break; |
startX--; |
} |
/* enter interior of triangle */ |
ix = startX; |
count = 0; |
while (coverage > 0.0F) { |
/* (cx,cy) = center of fragment */ |
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; |
struct span_arrays *array = span.array; |
#ifdef DO_INDEX |
array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); |
#else |
array->coverage[ix] = coverage; |
#endif |
#ifdef DO_Z |
array->z[ix] = (GLdepth) solve_plane(cx, cy, zPlane); |
#endif |
#ifdef DO_FOG |
array->fog[ix] = solve_plane(cx, cy, fogPlane); |
#endif |
#ifdef DO_RGBA |
array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); |
array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane); |
array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane); |
array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane); |
#endif |
#ifdef DO_INDEX |
array->index[ix] = (GLint) solve_plane(cx, cy, iPlane); |
#endif |
#ifdef DO_SPEC |
array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane); |
array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); |
array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); |
#endif |
#ifdef DO_TEX |
{ |
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); |
array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ; |
array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ; |
array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ; |
array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane, |
cx, cy, invQ, texWidth, texHeight); |
} |
#elif defined(DO_MULTITEX) |
{ |
GLuint unit; |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); |
array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; |
array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; |
array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; |
array->lambda[unit][ix] = compute_lambda(sPlane[unit], |
tPlane[unit], |
vPlane[unit], |
cx, cy, invQ, |
texWidth[unit], |
texHeight[unit]); |
} |
} |
} |
#endif |
ix--; |
count++; |
coverage = compute_coveragef(pMin, pMax, pMid, ix, iy); |
} |
if (startX <= ix) |
continue; |
n = (GLuint) startX - (GLuint) ix; |
left = ix + 1; |
/* shift all values to the left */ |
/* XXX this is temporary */ |
{ |
struct span_arrays *array = span.array; |
GLint j; |
for (j = 0; j < (GLint) n; j++) { |
#ifdef DO_RGBA |
COPY_4V(array->rgba[j], array->rgba[j + left]); |
#endif |
#ifdef DO_SPEC |
COPY_4V(array->spec[j], array->spec[j + left]); |
#endif |
#ifdef DO_INDEX |
array->index[j] = array->index[j + left]; |
#endif |
#ifdef DO_Z |
array->z[j] = array->z[j + left]; |
#endif |
#ifdef DO_FOG |
array->fog[j] = array->fog[j + left]; |
#endif |
#ifdef DO_TEX |
COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]); |
#endif |
#if defined(DO_MULTITEX) || defined(DO_TEX) |
array->lambda[0][j] = array->lambda[0][j + left]; |
#endif |
array->coverage[j] = array->coverage[j + left]; |
} |
} |
#ifdef DO_MULTITEX |
/* shift texcoords */ |
{ |
struct span_arrays *array = span.array; |
GLuint unit; |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
GLint j; |
for (j = 0; j < (GLint) n; j++) { |
array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0]; |
array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1]; |
array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2]; |
array->lambda[unit][j] = array->lambda[unit][j + left]; |
} |
} |
} |
} |
#endif |
span.x = left; |
span.y = iy; |
span.end = n; |
ASSERT(span.interpMask == 0); |
#if defined(DO_MULTITEX) || defined(DO_TEX) |
_mesa_write_texture_span(ctx, &span); |
#elif defined(DO_RGBA) |
_mesa_write_rgba_span(ctx, &span); |
#elif defined(DO_INDEX) |
_mesa_write_index_span(ctx, &span); |
#endif |
} |
} |
} |
#ifdef DO_Z |
#undef DO_Z |
#endif |
#ifdef DO_FOG |
#undef DO_FOG |
#endif |
#ifdef DO_RGBA |
#undef DO_RGBA |
#endif |
#ifdef DO_INDEX |
#undef DO_INDEX |
#endif |
#ifdef DO_SPEC |
#undef DO_SPEC |
#endif |
#ifdef DO_TEX |
#undef DO_TEX |
#endif |
#ifdef DO_MULTITEX |
#undef DO_MULTITEX |
#endif |
#ifdef DO_OCCLUSION_TEST |
#undef DO_OCCLUSION_TEST |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_buffers.c |
---|
0,0 → 1,305 |
/* $Id: s_buffers.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "macros.h" |
#include "imports.h" |
#include "s_accum.h" |
#include "s_alphabuf.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_masking.h" |
#include "s_stencil.h" |
/* |
* Clear the color buffer when glColorMask or glIndexMask is in effect. |
*/ |
static void |
clear_color_buffer_with_masking( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLint x = ctx->DrawBuffer->_Xmin; |
const GLint y = ctx->DrawBuffer->_Ymin; |
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
if (ctx->Visual.rgbMode) { |
/* RGBA mode */ |
GLchan clearColor[4]; |
GLint i; |
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); |
for (i = 0; i < height; i++) { |
GLchan rgba[MAX_WIDTH][4]; |
GLint j; |
for (j = 0; j < width; j++) { |
COPY_CHAN4(rgba[j], clearColor); |
} |
_mesa_mask_rgba_array( ctx, width, x, y + i, rgba ); |
(*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i, |
(CONST GLchan (*)[4]) rgba, NULL ); |
} |
} |
else { |
/* Color index mode */ |
GLuint span[MAX_WIDTH]; |
GLubyte mask[MAX_WIDTH]; |
GLint i, j; |
MEMSET( mask, 1, width ); |
for (i=0;i<height;i++) { |
for (j=0;j<width;j++) { |
span[j] = ctx->Color.ClearIndex; |
} |
_mesa_mask_index_array( ctx, width, x, y + i, span ); |
(*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask ); |
} |
} |
} |
/* |
* Clear a color buffer without index/channel masking. |
*/ |
static void |
clear_color_buffer(GLcontext *ctx) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLint x = ctx->DrawBuffer->_Xmin; |
const GLint y = ctx->DrawBuffer->_Ymin; |
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
if (ctx->Visual.rgbMode) { |
/* RGBA mode */ |
GLchan clearColor[4]; |
GLchan span[MAX_WIDTH][4]; |
GLint i; |
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); |
CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); |
ASSERT(*((GLuint *) &ctx->Color.ColorMask) == 0xffffffff); |
for (i = 0; i < width; i++) { |
COPY_CHAN4(span[i], clearColor); |
} |
for (i = 0; i < height; i++) { |
(*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i, |
(CONST GLchan (*)[4]) span, NULL ); |
} |
} |
else { |
/* Color index mode */ |
ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1)) |
== (GLuint) ((1 << ctx->Visual.indexBits) - 1)); |
if (ctx->Visual.indexBits == 8) { |
/* 8-bit clear */ |
GLubyte span[MAX_WIDTH]; |
GLint i; |
MEMSET(span, ctx->Color.ClearIndex, width); |
for (i = 0; i < height; i++) { |
(*swrast->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL ); |
} |
} |
else { |
/* non 8-bit clear */ |
GLuint span[MAX_WIDTH]; |
GLint i; |
for (i = 0; i < width; i++) { |
span[i] = ctx->Color.ClearIndex; |
} |
for (i = 0; i < height; i++) { |
(*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL ); |
} |
} |
} |
} |
/* |
* Clear the front/back/left/right color buffers. |
* This function is usually only called if we need to clear the |
* buffers with masking. |
*/ |
static void |
clear_color_buffers(GLcontext *ctx) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); |
GLuint bufferBit; |
/* loop over four possible dest color buffers */ |
for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { |
if (bufferBit & ctx->Color._DrawDestMask) { |
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); |
if (colorMask != 0xffffffff) { |
clear_color_buffer_with_masking(ctx); |
} |
else { |
clear_color_buffer(ctx); |
} |
} |
} |
/* restore default read/draw buffer */ |
_swrast_use_draw_buffer(ctx); |
} |
void |
_swrast_Clear( GLcontext *ctx, GLbitfield mask, |
GLboolean all, |
GLint x, GLint y, GLint width, GLint height ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
#ifdef DEBUG |
{ |
GLbitfield legalBits = DD_FRONT_LEFT_BIT | |
DD_FRONT_RIGHT_BIT | |
DD_BACK_LEFT_BIT | |
DD_BACK_RIGHT_BIT | |
DD_DEPTH_BIT | |
DD_STENCIL_BIT | |
DD_ACCUM_BIT; |
assert((mask & (~legalBits)) == 0); |
} |
#endif |
RENDER_START(swrast,ctx); |
/* do software clearing here */ |
if (mask) { |
if (mask & ctx->Color._DrawDestMask) clear_color_buffers(ctx); |
if (mask & GL_DEPTH_BUFFER_BIT) _mesa_clear_depth_buffer(ctx); |
if (mask & GL_ACCUM_BUFFER_BIT) _mesa_clear_accum_buffer(ctx); |
if (mask & GL_STENCIL_BUFFER_BIT) _mesa_clear_stencil_buffer(ctx); |
} |
/* clear software-based alpha buffer(s) */ |
if ( (mask & GL_COLOR_BUFFER_BIT) |
&& ctx->DrawBuffer->UseSoftwareAlphaBuffers |
&& ctx->Color.ColorMask[ACOMP]) { |
_mesa_clear_alpha_buffers( ctx ); |
} |
RENDER_FINISH(swrast,ctx); |
} |
void |
_swrast_alloc_buffers( GLframebuffer *buffer ) |
{ |
/* Reallocate other buffers if needed. */ |
if (buffer->UseSoftwareDepthBuffer) { |
_mesa_alloc_depth_buffer( buffer ); |
} |
if (buffer->UseSoftwareStencilBuffer) { |
_mesa_alloc_stencil_buffer( buffer ); |
} |
if (buffer->UseSoftwareAccumBuffer) { |
_mesa_alloc_accum_buffer( buffer ); |
} |
if (buffer->UseSoftwareAlphaBuffers) { |
_mesa_alloc_alpha_buffers( buffer ); |
} |
} |
/* |
* Fallback for ctx->Driver.DrawBuffer() |
*/ |
void |
_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ) |
{ |
_swrast_use_draw_buffer(ctx); |
} |
/* |
* Setup things so that we read/write spans from the user-designated |
* read buffer (set via glReadPixels). We usually just have to call |
* this for glReadPixels, glCopyPixels, etc. |
*/ |
void |
_swrast_use_read_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
/* Do this so the software-emulated alpha plane span functions work! */ |
swrast->CurrentBuffer = ctx->Pixel._ReadSrcMask; |
/* Tell the device driver where to read/write spans */ |
(*swrast->Driver.SetBuffer)( ctx, ctx->ReadBuffer, swrast->CurrentBuffer ); |
} |
/* |
* Setup things so that we read/write spans from the default draw buffer. |
* This is the usual mode that Mesa's software rasterizer operates in. |
*/ |
void |
_swrast_use_draw_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
/* The user can specify rendering to zero, one, two, or four color |
* buffers simultaneously with glDrawBuffer()! |
* We don't expect the span/point/line/triangle functions to deal with |
* that mess so we'll iterate over the multiple buffers as needed. |
* But usually we only render to one color buffer at a time. |
* We set ctx->Color._DriverDrawBuffer to that buffer and tell the |
* device driver to use that buffer. |
* Look in s_span.c's multi_write_rgba_span() function to see how |
* we loop over multiple color buffers when needed. |
*/ |
if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) |
swrast->CurrentBuffer = FRONT_LEFT_BIT; |
else if (ctx->Color._DrawDestMask & BACK_LEFT_BIT) |
swrast->CurrentBuffer = BACK_LEFT_BIT; |
else if (ctx->Color._DrawDestMask & FRONT_RIGHT_BIT) |
swrast->CurrentBuffer = FRONT_RIGHT_BIT; |
else if (ctx->Color._DrawDestMask & BACK_RIGHT_BIT) |
swrast->CurrentBuffer = BACK_RIGHT_BIT; |
else |
/* glDrawBuffer(GL_NONE) */ |
swrast->CurrentBuffer = FRONT_LEFT_BIT; /* we always have this buffer */ |
(*swrast->Driver.SetBuffer)( ctx, ctx->DrawBuffer, swrast->CurrentBuffer ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_logic.c |
---|
0,0 → 1,498 |
/* $Id: s_logic.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "imports.h" |
#include "macros.h" |
#include "s_alphabuf.h" |
#include "s_context.h" |
#include "s_logic.h" |
#include "s_span.h" |
/* |
* Apply logic op to array of CI pixels. |
*/ |
static void |
index_logicop( GLcontext *ctx, GLuint n, GLuint index[], const GLuint dest[], |
const GLubyte mask[] ) |
{ |
GLuint i; |
switch (ctx->Color.LogicOp) { |
case GL_CLEAR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = 0; |
} |
} |
break; |
case GL_SET: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~0; |
} |
} |
break; |
case GL_COPY: |
/* do nothing */ |
break; |
case GL_COPY_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~index[i]; |
} |
} |
break; |
case GL_NOOP: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = dest[i]; |
} |
} |
break; |
case GL_INVERT: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~dest[i]; |
} |
} |
break; |
case GL_AND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] &= dest[i]; |
} |
} |
break; |
case GL_NAND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~(index[i] & dest[i]); |
} |
} |
break; |
case GL_OR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] |= dest[i]; |
} |
} |
break; |
case GL_NOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~(index[i] | dest[i]); |
} |
} |
break; |
case GL_XOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] ^= dest[i]; |
} |
} |
break; |
case GL_EQUIV: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~(index[i] ^ dest[i]); |
} |
} |
break; |
case GL_AND_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = index[i] & ~dest[i]; |
} |
} |
break; |
case GL_AND_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~index[i] & dest[i]; |
} |
} |
break; |
case GL_OR_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = index[i] | ~dest[i]; |
} |
} |
break; |
case GL_OR_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
index[i] = ~index[i] | dest[i]; |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad mode in index_logic()"); |
} |
} |
/* |
* Apply the current logic operator to a span of CI pixels. This is only |
* used if the device driver can't do logic ops. |
*/ |
void |
_mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span, |
GLuint index[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint dest[MAX_WIDTH]; |
ASSERT(span->end < MAX_WIDTH); |
/* Read dest values from frame buffer */ |
if (span->arrayMask & SPAN_XY) { |
(*swrast->Driver.ReadCI32Pixels)( ctx, span->end, |
span->array->x, span->array->y, |
dest, span->array->mask ); |
} |
else { |
(*swrast->Driver.ReadCI32Span)( ctx, span->end, span->x, span->y, dest ); |
} |
index_logicop( ctx, span->end, index, dest, span->array->mask ); |
} |
/* |
* Apply logic operator to rgba pixels. |
* Input: ctx - the context |
* n - number of pixels |
* mask - pixel mask array |
* In/Out: src - incoming pixels which will be modified |
* Input: dest - frame buffer values |
* |
* Note: Since the R, G, B, and A channels are all treated the same we |
* process them as 4-byte GLuints instead of four GLubytes. |
*/ |
static void |
rgba_logicop_ui( const GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLuint src[], const GLuint dest[] ) |
{ |
GLuint i; |
switch (ctx->Color.LogicOp) { |
case GL_CLEAR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = 0; |
} |
} |
break; |
case GL_SET: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~0; |
} |
} |
break; |
case GL_COPY: |
/* do nothing */ |
break; |
case GL_COPY_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i]; |
} |
} |
break; |
case GL_NOOP: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = dest[i]; |
} |
} |
break; |
case GL_INVERT: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~dest[i]; |
} |
} |
break; |
case GL_AND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] &= dest[i]; |
} |
} |
break; |
case GL_NAND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] & dest[i]); |
} |
} |
break; |
case GL_OR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i]|= dest[i]; |
} |
} |
break; |
case GL_NOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] | dest[i]); |
} |
} |
break; |
case GL_XOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] ^= dest[i]; |
} |
} |
break; |
case GL_EQUIV: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] ^ dest[i]); |
} |
} |
break; |
case GL_AND_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = src[i] & ~dest[i]; |
} |
} |
break; |
case GL_AND_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i] & dest[i]; |
} |
} |
break; |
case GL_OR_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = src[i] | ~dest[i]; |
} |
} |
break; |
case GL_OR_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i] | dest[i]; |
} |
} |
break; |
default: |
/* should never happen */ |
_mesa_problem(ctx, "Bad function in rgba_logicop"); |
} |
} |
/* |
* As above, but operate on GLchan values |
* Note: need to pass n = numPixels * 4. |
*/ |
static void |
rgba_logicop_chan( const GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan srcPtr[], const GLchan destPtr[] ) |
{ |
#if CHAN_TYPE == GL_FLOAT |
GLuint *src = (GLuint *) srcPtr; |
const GLuint *dest = (const GLuint *) destPtr; |
GLuint i; |
ASSERT(sizeof(GLfloat) == sizeof(GLuint)); |
#else |
GLchan *src = srcPtr; |
const GLchan *dest = destPtr; |
GLuint i; |
#endif |
switch (ctx->Color.LogicOp) { |
case GL_CLEAR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = 0; |
} |
} |
break; |
case GL_SET: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~0; |
} |
} |
break; |
case GL_COPY: |
/* do nothing */ |
break; |
case GL_COPY_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i]; |
} |
} |
break; |
case GL_NOOP: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = dest[i]; |
} |
} |
break; |
case GL_INVERT: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~dest[i]; |
} |
} |
break; |
case GL_AND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] &= dest[i]; |
} |
} |
break; |
case GL_NAND: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] & dest[i]); |
} |
} |
break; |
case GL_OR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i]|= dest[i]; |
} |
} |
break; |
case GL_NOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] | dest[i]); |
} |
} |
break; |
case GL_XOR: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] ^= dest[i]; |
} |
} |
break; |
case GL_EQUIV: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~(src[i] ^ dest[i]); |
} |
} |
break; |
case GL_AND_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = src[i] & ~dest[i]; |
} |
} |
break; |
case GL_AND_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i] & dest[i]; |
} |
} |
break; |
case GL_OR_REVERSE: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = src[i] | ~dest[i]; |
} |
} |
break; |
case GL_OR_INVERTED: |
for (i=0;i<n;i++) { |
if (mask[i]) { |
src[i] = ~src[i] | dest[i]; |
} |
} |
break; |
default: |
/* should never happen */ |
_mesa_problem(ctx, "Bad function in rgba_logicop"); |
} |
} |
/* |
* Apply the current logic operator to a span of RGBA pixels. |
* We can handle horizontal runs of pixels (spans) or arrays of x/y |
* pixel coordinates. |
*/ |
void |
_mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan dest[MAX_WIDTH][4]; |
ASSERT(span->end < MAX_WIDTH); |
ASSERT(span->arrayMask & SPAN_RGBA); |
if (span->arrayMask & SPAN_XY) { |
(*swrast->Driver.ReadRGBAPixels)(ctx, span->end, |
span->array->x, span->array->y, |
dest, span->array->mask); |
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { |
_mesa_read_alpha_pixels(ctx, span->end, |
span->array->x, span->array->y, |
dest, span->array->mask); |
} |
} |
else { |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, span->end, |
span->x, span->y, dest); |
} |
if (sizeof(GLchan) * 4 == sizeof(GLuint)) { |
rgba_logicop_ui(ctx, span->end, span->array->mask, |
(GLuint *) rgba, (const GLuint *) dest); |
} |
else { |
rgba_logicop_chan(ctx, 4 * span->end, span->array->mask, |
(GLchan *) rgba, (const GLchan *) dest); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_accum.h |
---|
0,0 → 1,44 |
/* $Id: s_accum.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.2 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_ACCUM_H |
#define S_ACCUM_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_alloc_accum_buffer( GLframebuffer *buffer ); |
extern void |
_mesa_clear_accum_buffer( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aaline.h |
---|
0,0 → 1,40 |
/* $Id: s_aaline.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_AALINE_H |
#define S_AALINE_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_swrast_choose_aa_line_function(GLcontext *ctx); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_stencil.c |
---|
0,0 → 1,1327 |
/* $Id: s_stencil.c,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_stencil.h" |
/* Stencil Logic: |
IF stencil test fails THEN |
Apply fail-op to stencil value |
Don't write the pixel (RGBA,Z) |
ELSE |
IF doing depth test && depth test fails THEN |
Apply zfail-op to stencil value |
Write RGBA and Z to appropriate buffers |
ELSE |
Apply zpass-op to stencil value |
ENDIF |
*/ |
/* |
* Return the address of a stencil buffer value given the window coords: |
*/ |
#define STENCIL_ADDRESS(X,Y) \ |
(ctx->DrawBuffer->Stencil + ctx->DrawBuffer->Width * (Y) + (X)) |
/** |
* Apply the given stencil operator to the array of stencil values. |
* Don't touch stencil[i] if mask[i] is zero. |
* Input: n - size of stencil array |
* oper - the stencil buffer operator |
* face - 0 or 1 for front or back face operation |
* stencil - array of stencil values |
* mask - array [n] of flag: 1=apply operator, 0=don't apply operator |
* Output: stencil - modified values |
*/ |
static void |
apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, |
GLuint n, GLstencil stencil[], const GLubyte mask[] ) |
{ |
const GLstencil ref = ctx->Stencil.Ref[face]; |
const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; |
const GLstencil invmask = (GLstencil) (~wrtmask); |
GLuint i; |
switch (oper) { |
case GL_KEEP: |
/* do nothing */ |
break; |
case GL_ZERO: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
stencil[i] = 0; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
stencil[i] = (GLstencil) (stencil[i] & invmask); |
} |
} |
} |
break; |
case GL_REPLACE: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
stencil[i] = ref; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
stencil[i] = (GLstencil) ((invmask & s ) | (wrtmask & ref)); |
} |
} |
} |
break; |
case GL_INCR: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
if (s < STENCIL_MAX) { |
stencil[i] = (GLstencil) (s+1); |
} |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
/* VERIFY logic of adding 1 to a write-masked value */ |
GLstencil s = stencil[i]; |
if (s < STENCIL_MAX) { |
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1))); |
} |
} |
} |
} |
break; |
case GL_DECR: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
if (s>0) { |
stencil[i] = (GLstencil) (s-1); |
} |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
/* VERIFY logic of subtracting 1 to a write-masked value */ |
GLstencil s = stencil[i]; |
if (s>0) { |
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); |
} |
} |
} |
} |
break; |
case GL_INCR_WRAP_EXT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
stencil[i]++; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1))); |
} |
} |
} |
break; |
case GL_DECR_WRAP_EXT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
stencil[i]--; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); |
} |
} |
} |
break; |
case GL_INVERT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
stencil[i] = (GLstencil) ~s; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil s = stencil[i]; |
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & ~s)); |
} |
} |
} |
break; |
default: |
_mesa_problem(ctx, "Bad stencil op in apply_stencil_op"); |
} |
} |
/** |
* Apply stencil test to an array of stencil values (before depth buffering). |
* Input: face - 0 or 1 for front or back-face polygons |
* n - number of pixels in the array |
* stencil - array of [n] stencil values |
* mask - array [n] of flag: 0=skip the pixel, 1=stencil the pixel |
* Output: mask - pixels which fail the stencil test will have their |
* mask flag set to 0. |
* stencil - updated stencil values (where the test passed) |
* Return: GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. |
*/ |
static GLboolean |
do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[], |
GLubyte mask[] ) |
{ |
GLubyte fail[MAX_WIDTH]; |
GLboolean allfail = GL_FALSE; |
GLuint i; |
GLstencil r, s; |
const GLuint valueMask = ctx->Stencil.ValueMask[face]; |
ASSERT(n <= MAX_WIDTH); |
/* |
* Perform stencil test. The results of this operation are stored |
* in the fail[] array: |
* IF fail[i] is non-zero THEN |
* the stencil fail operator is to be applied |
* ELSE |
* the stencil fail operator is not to be applied |
* ENDIF |
*/ |
switch (ctx->Stencil.Function[face]) { |
case GL_NEVER: |
/* never pass; always fail */ |
for (i=0;i<n;i++) { |
if (mask[i]) { |
mask[i] = 0; |
fail[i] = 1; |
} |
else { |
fail[i] = 0; |
} |
} |
allfail = GL_TRUE; |
break; |
case GL_LESS: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r < s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_LEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r <= s) { |
/* pass */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_GREATER: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r > s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_GEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r >= s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_EQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r == s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_NOTEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
s = (GLstencil) (stencil[i] & valueMask); |
if (r != s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_ALWAYS: |
/* always pass */ |
for (i=0;i<n;i++) { |
fail[i] = 0; |
} |
break; |
default: |
_mesa_problem(ctx, "Bad stencil func in gl_stencil_span"); |
return 0; |
} |
if (ctx->Stencil.FailFunc[face] != GL_KEEP) { |
apply_stencil_op( ctx, ctx->Stencil.FailFunc[face], face, n, stencil, fail ); |
} |
return !allfail; |
} |
/** |
* Apply stencil and depth testing to the span of pixels. |
* Both software and hardware stencil buffers are acceptable. |
* Input: n - number of pixels in the span |
* x, y - location of leftmost pixel in span |
* z - array [n] of z values |
* mask - array [n] of flags (1=test this pixel, 0=skip the pixel) |
* Output: mask - array [n] of flags (1=stencil and depth test passed) |
* Return: GL_FALSE - all fragments failed the testing |
* GL_TRUE - one or more fragments passed the testing |
* |
*/ |
static GLboolean |
stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span, GLuint face) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLstencil stencilRow[MAX_WIDTH]; |
GLstencil *stencil; |
const GLuint n = span->end; |
const GLint x = span->x; |
const GLint y = span->y; |
GLubyte *mask = span->array->mask; |
ASSERT((span->arrayMask & SPAN_XY) == 0); |
ASSERT(ctx->Stencil.Enabled); |
ASSERT(n <= MAX_WIDTH); |
#ifdef DEBUG |
if (ctx->Depth.Test) { |
ASSERT(span->arrayMask & SPAN_Z); |
} |
#endif |
/* Get initial stencil values */ |
if (swrast->Driver.WriteStencilSpan) { |
/* Get stencil values from the hardware stencil buffer */ |
ASSERT(swrast->Driver.ReadStencilSpan); |
(*swrast->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow); |
stencil = stencilRow; |
} |
else { |
/* Get pointer into software stencil buffer */ |
stencil = STENCIL_ADDRESS(x, y); |
} |
/* |
* Apply the stencil test to the fragments. |
* failMask[i] is 1 if the stencil test failed. |
*/ |
if (do_stencil_test( ctx, face, n, stencil, mask ) == GL_FALSE) { |
/* all fragments failed the stencil test, we're done. */ |
span->writeAll = GL_FALSE; |
return GL_FALSE; |
} |
/* |
* Some fragments passed the stencil test, apply depth test to them |
* and apply Zpass and Zfail stencil ops. |
*/ |
if (ctx->Depth.Test == GL_FALSE) { |
/* |
* No depth buffer, just apply zpass stencil function to active pixels. |
*/ |
apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, mask ); |
} |
else { |
/* |
* Perform depth buffering, then apply zpass or zfail stencil function. |
*/ |
GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; |
GLuint i; |
/* save the current mask bits */ |
MEMCPY(oldmask, mask, n * sizeof(GLubyte)); |
/* apply the depth test */ |
_mesa_depth_test_span(ctx, span); |
/* Set the stencil pass/fail flags according to result of depth testing. |
* if oldmask[i] == 0 then |
* Don't touch the stencil value |
* else if oldmask[i] and newmask[i] then |
* Depth test passed |
* else |
* assert(oldmask[i] && !newmask[i]) |
* Depth test failed |
* endif |
*/ |
for (i=0;i<n;i++) { |
ASSERT(mask[i] == 0 || mask[i] == 1); |
passmask[i] = oldmask[i] & mask[i]; |
failmask[i] = oldmask[i] & (mask[i] ^ 1); |
} |
/* apply the pass and fail operations */ |
if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { |
apply_stencil_op( ctx, ctx->Stencil.ZFailFunc[face], face, |
n, stencil, failmask ); |
} |
if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { |
apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, |
n, stencil, passmask ); |
} |
} |
/* |
* Write updated stencil values back into hardware stencil buffer. |
*/ |
if (swrast->Driver.WriteStencilSpan) { |
ASSERT(stencil == stencilRow); |
(swrast->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask ); |
} |
span->writeAll = GL_FALSE; |
return GL_TRUE; /* one or more fragments passed both tests */ |
} |
/** |
* Apply the given stencil operator for each pixel in the array whose |
* mask flag is set. |
* \note This is for software stencil buffers only. |
* Input: n - number of pixels in the span |
* x, y - array of [n] pixels |
* operator - the stencil buffer operator |
* mask - array [n] of flag: 1=apply operator, 0=don't apply operator |
*/ |
static void |
apply_stencil_op_to_pixels( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLenum oper, GLuint face, const GLubyte mask[] ) |
{ |
const GLstencil ref = ctx->Stencil.Ref[face]; |
const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; |
const GLstencil invmask = (GLstencil) (~wrtmask); |
GLuint i; |
ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */ |
switch (oper) { |
case GL_KEEP: |
/* do nothing */ |
break; |
case GL_ZERO: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = 0; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) (invmask & *sptr); |
} |
} |
} |
break; |
case GL_REPLACE: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = ref; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) ((invmask & *sptr ) | (wrtmask & ref)); |
} |
} |
} |
break; |
case GL_INCR: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
if (*sptr < STENCIL_MAX) { |
*sptr = (GLstencil) (*sptr + 1); |
} |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
if (*sptr < STENCIL_MAX) { |
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1))); |
} |
} |
} |
} |
break; |
case GL_DECR: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
if (*sptr>0) { |
*sptr = (GLstencil) (*sptr - 1); |
} |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
if (*sptr>0) { |
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); |
} |
} |
} |
} |
break; |
case GL_INCR_WRAP_EXT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) (*sptr + 1); |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1))); |
} |
} |
} |
break; |
case GL_DECR_WRAP_EXT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) (*sptr - 1); |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); |
} |
} |
} |
break; |
case GL_INVERT: |
if (invmask==0) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) (~*sptr); |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); |
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & ~*sptr)); |
} |
} |
} |
break; |
default: |
_mesa_problem(ctx, "Bad stencilop in apply_stencil_op_to_pixels"); |
} |
} |
/** |
* Apply stencil test to an array of pixels before depth buffering. |
* |
* \note Used for software stencil buffer only. |
* Input: n - number of pixels in the span |
* x, y - array of [n] pixels to stencil |
* mask - array [n] of flag: 0=skip the pixel, 1=stencil the pixel |
* Output: mask - pixels which fail the stencil test will have their |
* mask flag set to 0. |
* \return GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. |
*/ |
static GLboolean |
stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n, |
const GLint x[], const GLint y[], GLubyte mask[] ) |
{ |
GLubyte fail[MAX_WIDTH]; |
GLstencil r, s; |
GLuint i; |
GLboolean allfail = GL_FALSE; |
const GLuint valueMask = ctx->Stencil.ValueMask[face]; |
/* software stencil buffer only! */ |
ASSERT(ctx->DrawBuffer->UseSoftwareStencilBuffer); |
ASSERT(!SWRAST_CONTEXT(ctx)->Driver.ReadStencilSpan); |
ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); |
/* |
* Perform stencil test. The results of this operation are stored |
* in the fail[] array: |
* IF fail[i] is non-zero THEN |
* the stencil fail operator is to be applied |
* ELSE |
* the stencil fail operator is not to be applied |
* ENDIF |
*/ |
switch (ctx->Stencil.Function[face]) { |
case GL_NEVER: |
/* always fail */ |
for (i=0;i<n;i++) { |
if (mask[i]) { |
mask[i] = 0; |
fail[i] = 1; |
} |
else { |
fail[i] = 0; |
} |
} |
allfail = GL_TRUE; |
break; |
case GL_LESS: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r < s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_LEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r <= s) { |
/* pass */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_GREATER: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r > s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_GEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r >= s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_EQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r == s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_NOTEQUAL: |
r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); |
s = (GLstencil) (*sptr & valueMask); |
if (r != s) { |
/* passed */ |
fail[i] = 0; |
} |
else { |
fail[i] = 1; |
mask[i] = 0; |
} |
} |
else { |
fail[i] = 0; |
} |
} |
break; |
case GL_ALWAYS: |
/* always pass */ |
for (i=0;i<n;i++) { |
fail[i] = 0; |
} |
break; |
default: |
_mesa_problem(ctx, "Bad stencil func in gl_stencil_pixels"); |
return 0; |
} |
if (ctx->Stencil.FailFunc[face] != GL_KEEP) { |
apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.FailFunc[face], |
face, fail ); |
} |
return !allfail; |
} |
/** |
* Apply stencil and depth testing to an array of pixels. |
* This is used both for software and hardware stencil buffers. |
* |
* The comments in this function are a bit sparse but the code is |
* almost identical to stencil_and_ztest_span(), which is well |
* commented. |
* |
* Input: n - number of pixels in the array |
* x, y - array of [n] pixel positions |
* z - array [n] of z values |
* mask - array [n] of flags (1=test this pixel, 0=skip the pixel) |
* Output: mask - array [n] of flags (1=stencil and depth test passed) |
* Return: GL_FALSE - all fragments failed the testing |
* GL_TRUE - one or more fragments passed the testing |
*/ |
static GLboolean |
stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span, GLuint face ) |
{ |
const GLuint n = span->end; |
const GLint *x = span->array->x; |
const GLint *y = span->array->y; |
GLubyte *mask = span->array->mask; |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
ASSERT(span->arrayMask & SPAN_XY); |
ASSERT(ctx->Stencil.Enabled); |
ASSERT(n <= MAX_WIDTH); |
if (swrast->Driver.WriteStencilPixels) { |
/*** Hardware stencil buffer ***/ |
GLstencil stencil[MAX_WIDTH]; |
GLubyte origMask[MAX_WIDTH]; |
ASSERT(!ctx->DrawBuffer->UseSoftwareStencilBuffer); |
ASSERT(swrast->Driver.ReadStencilPixels); |
(*swrast->Driver.ReadStencilPixels)(ctx, n, x, y, stencil); |
MEMCPY(origMask, mask, n * sizeof(GLubyte)); |
(void) do_stencil_test(ctx, face, n, stencil, mask); |
if (ctx->Depth.Test == GL_FALSE) { |
apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, |
n, stencil, mask); |
} |
else { |
_mesa_depth_test_span(ctx, span); |
if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { |
GLubyte failmask[MAX_WIDTH]; |
GLuint i; |
for (i = 0; i < n; i++) { |
ASSERT(mask[i] == 0 || mask[i] == 1); |
failmask[i] = origMask[i] & (mask[i] ^ 1); |
} |
apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face, |
n, stencil, failmask); |
} |
if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { |
GLubyte passmask[MAX_WIDTH]; |
GLuint i; |
for (i = 0; i < n; i++) { |
ASSERT(mask[i] == 0 || mask[i] == 1); |
passmask[i] = origMask[i] & mask[i]; |
} |
apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, |
n, stencil, passmask); |
} |
} |
/* Write updated stencil values into hardware stencil buffer */ |
(swrast->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask); |
return GL_TRUE; |
} |
else { |
/*** Software stencil buffer ***/ |
ASSERT(ctx->DrawBuffer->UseSoftwareStencilBuffer); |
if (stencil_test_pixels(ctx, face, n, x, y, mask) == GL_FALSE) { |
/* all fragments failed the stencil test, we're done. */ |
return GL_FALSE; |
} |
if (ctx->Depth.Test==GL_FALSE) { |
apply_stencil_op_to_pixels(ctx, n, x, y, |
ctx->Stencil.ZPassFunc[face], face, mask); |
} |
else { |
GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; |
GLuint i; |
MEMCPY(oldmask, mask, n * sizeof(GLubyte)); |
_mesa_depth_test_span(ctx, span); |
for (i=0;i<n;i++) { |
ASSERT(mask[i] == 0 || mask[i] == 1); |
passmask[i] = oldmask[i] & mask[i]; |
failmask[i] = oldmask[i] & (mask[i] ^ 1); |
} |
if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { |
apply_stencil_op_to_pixels(ctx, n, x, y, |
ctx->Stencil.ZFailFunc[face], |
face, failmask); |
} |
if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { |
apply_stencil_op_to_pixels(ctx, n, x, y, |
ctx->Stencil.ZPassFunc[face], |
face, passmask); |
} |
} |
return GL_TRUE; /* one or more fragments passed both tests */ |
} |
} |
/** |
* /return GL_TRUE = one or more fragments passed, |
* GL_FALSE = all fragments failed. |
*/ |
GLboolean |
_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span) |
{ |
/* span->facing can only be non-zero if using two-sided stencil */ |
ASSERT(ctx->Stencil.TestTwoSide || span->facing == 0); |
if (span->arrayMask & SPAN_XY) |
return stencil_and_ztest_pixels(ctx, span, span->facing); |
else |
return stencil_and_ztest_span(ctx, span, span->facing); |
} |
/** |
* Return a span of stencil values from the stencil buffer. |
* Used for glRead/CopyPixels |
* Input: n - how many pixels |
* x,y - location of first pixel |
* Output: stencil - the array of stencil values |
*/ |
void |
_mesa_read_stencil_span( GLcontext *ctx, |
GLint n, GLint x, GLint y, GLstencil stencil[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; |
const GLint bufHeight = (GLint) ctx->DrawBuffer->Height; |
if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { |
/* span is completely outside framebuffer */ |
return; /* undefined values OK */ |
} |
if (x < 0) { |
GLint dx = -x; |
x = 0; |
n -= dx; |
stencil += dx; |
} |
if (x + n > bufWidth) { |
GLint dx = x + n - bufWidth; |
n -= dx; |
} |
if (n <= 0) { |
return; |
} |
ASSERT(n >= 0); |
if (swrast->Driver.ReadStencilSpan) { |
(*swrast->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil ); |
} |
else if (ctx->DrawBuffer->Stencil) { |
const GLstencil *s = STENCIL_ADDRESS( x, y ); |
#if STENCIL_BITS == 8 |
MEMCPY( stencil, s, n * sizeof(GLstencil) ); |
#else |
GLuint i; |
for (i=0;i<n;i++) |
stencil[i] = s[i]; |
#endif |
} |
} |
/** |
* Write a span of stencil values to the stencil buffer. |
* Used for glDraw/CopyPixels |
* Input: n - how many pixels |
* x, y - location of first pixel |
* stencil - the array of stencil values |
*/ |
void |
_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, |
const GLstencil stencil[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLstencil *ssrc = stencil; |
const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; |
const GLint bufHeight = (GLint) ctx->DrawBuffer->Height; |
if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { |
/* span is completely outside framebuffer */ |
return; /* undefined values OK */ |
} |
if (x < 0) { |
GLint dx = -x; |
x = 0; |
n -= dx; |
ssrc += dx; |
} |
if (x + n > bufWidth) { |
GLint dx = x + n - bufWidth; |
n -= dx; |
} |
if (n <= 0) { |
return; |
} |
if (swrast->Driver.WriteStencilSpan) { |
(*swrast->Driver.WriteStencilSpan)( ctx, n, x, y, ssrc, NULL ); |
} |
else if (ctx->DrawBuffer->Stencil) { |
GLstencil *s = STENCIL_ADDRESS( x, y ); |
#if STENCIL_BITS == 8 |
MEMCPY( s, ssrc, n * sizeof(GLstencil) ); |
#else |
GLuint i; |
for (i=0;i<n;i++) |
s[i] = ssrc[i]; |
#endif |
} |
} |
/** |
* Allocate a new stencil buffer. If there's an old one it will be |
* deallocated first. The new stencil buffer will be uninitialized. |
*/ |
void |
_mesa_alloc_stencil_buffer( GLframebuffer *buffer ) |
{ |
/* deallocate current stencil buffer if present */ |
if (buffer->Stencil) { |
MESA_PBUFFER_FREE(buffer->Stencil); |
buffer->Stencil = NULL; |
} |
/* allocate new stencil buffer */ |
buffer->Stencil = (GLstencil *) |
MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height * sizeof(GLstencil)); |
if (!buffer->Stencil) { |
/* out of memory */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" ); |
} |
} |
/** |
* Clear the software (malloc'd) stencil buffer. |
*/ |
static void |
clear_software_stencil_buffer( GLcontext *ctx ) |
{ |
if (ctx->Visual.stencilBits==0 || !ctx->DrawBuffer->Stencil) { |
/* no stencil buffer */ |
return; |
} |
if (ctx->Scissor.Enabled) { |
/* clear scissor region only */ |
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { |
/* must apply mask to the clear */ |
GLint y; |
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { |
const GLstencil mask = ctx->Stencil.WriteMask[0]; |
const GLstencil invMask = ~mask; |
const GLstencil clearVal = (ctx->Stencil.Clear & mask); |
GLstencil *stencil = STENCIL_ADDRESS( ctx->DrawBuffer->_Xmin, y ); |
GLint i; |
for (i = 0; i < width; i++) { |
stencil[i] = (stencil[i] & invMask) | clearVal; |
} |
} |
} |
else { |
/* no masking */ |
GLint y; |
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { |
GLstencil *stencil = STENCIL_ADDRESS( ctx->DrawBuffer->_Xmin, y ); |
#if STENCIL_BITS==8 |
MEMSET( stencil, ctx->Stencil.Clear, width * sizeof(GLstencil) ); |
#else |
GLint i; |
for (i = 0; i < width; i++) |
stencil[x] = ctx->Stencil.Clear; |
#endif |
} |
} |
} |
else { |
/* clear whole stencil buffer */ |
if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { |
/* must apply mask to the clear */ |
const GLuint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
GLstencil *stencil = ctx->DrawBuffer->Stencil; |
const GLstencil mask = ctx->Stencil.WriteMask[0]; |
const GLstencil invMask = ~mask; |
const GLstencil clearVal = (ctx->Stencil.Clear & mask); |
GLuint i; |
for (i = 0; i < n; i++) { |
stencil[i] = (stencil[i] & invMask) | clearVal; |
} |
} |
else { |
/* clear whole buffer without masking */ |
const GLuint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
GLstencil *stencil = ctx->DrawBuffer->Stencil; |
#if STENCIL_BITS==8 |
MEMSET(stencil, ctx->Stencil.Clear, n * sizeof(GLstencil) ); |
#else |
GLuint i; |
for (i = 0; i < n; i++) { |
stencil[i] = ctx->Stencil.Clear; |
} |
#endif |
} |
} |
} |
/** |
* Clear the hardware (in graphics card) stencil buffer. |
* This is done with the Driver.WriteStencilSpan() and Driver.ReadStencilSpan() |
* functions. |
* Actually, if there is a hardware stencil buffer it really should have |
* been cleared in Driver.Clear()! However, if the hardware does not |
* support scissored clears or masked clears (i.e. glStencilMask) then |
* we have to use the span-based functions. |
*/ |
static void |
clear_hardware_stencil_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
ASSERT(swrast->Driver.WriteStencilSpan); |
ASSERT(swrast->Driver.ReadStencilSpan); |
if (ctx->Scissor.Enabled) { |
/* clear scissor region only */ |
const GLint x = ctx->DrawBuffer->_Xmin; |
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { |
/* must apply mask to the clear */ |
GLint y; |
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { |
const GLstencil mask = ctx->Stencil.WriteMask[0]; |
const GLstencil invMask = ~mask; |
const GLstencil clearVal = (ctx->Stencil.Clear & mask); |
GLstencil stencil[MAX_WIDTH]; |
GLint i; |
(*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil); |
for (i = 0; i < width; i++) { |
stencil[i] = (stencil[i] & invMask) | clearVal; |
} |
(*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); |
} |
} |
else { |
/* no masking */ |
GLstencil stencil[MAX_WIDTH]; |
GLint y, i; |
for (i = 0; i < width; i++) { |
stencil[i] = ctx->Stencil.Clear; |
} |
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { |
(*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); |
} |
} |
} |
else { |
/* clear whole stencil buffer */ |
if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { |
/* must apply mask to the clear */ |
const GLstencil mask = ctx->Stencil.WriteMask[0]; |
const GLstencil invMask = ~mask; |
const GLstencil clearVal = (ctx->Stencil.Clear & mask); |
const GLint width = ctx->DrawBuffer->Width; |
const GLint height = ctx->DrawBuffer->Height; |
const GLint x = ctx->DrawBuffer->_Xmin; |
GLint y; |
for (y = 0; y < height; y++) { |
GLstencil stencil[MAX_WIDTH]; |
GLint i; |
(*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil); |
for (i = 0; i < width; i++) { |
stencil[i] = (stencil[i] & invMask) | clearVal; |
} |
(*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); |
} |
} |
else { |
/* clear whole buffer without masking */ |
const GLint width = ctx->DrawBuffer->Width; |
const GLint height = ctx->DrawBuffer->Height; |
const GLint x = ctx->DrawBuffer->_Xmin; |
GLstencil stencil[MAX_WIDTH]; |
GLint y, i; |
for (i = 0; i < width; i++) { |
stencil[i] = ctx->Stencil.Clear; |
} |
for (y = 0; y < height; y++) { |
(*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL); |
} |
} |
} |
} |
/** |
* Clear the stencil buffer (hardware or software). |
*/ |
void |
_mesa_clear_stencil_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->Driver.WriteStencilSpan) { |
ASSERT(swrast->Driver.ReadStencilSpan); |
clear_hardware_stencil_buffer(ctx); |
} |
else { |
clear_software_stencil_buffer(ctx); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_pixeltex.c |
---|
0,0 → 1,118 |
/* $Id: s_pixeltex.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* This file implements both the GL_SGIX_pixel_texture and |
* GL_SIGS_pixel_texture extensions. Luckily, they pretty much |
* overlap in functionality so we use the same state variables |
* and execution code for both. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "imports.h" |
#include "s_context.h" |
#include "s_pixeltex.h" |
#include "s_texture.h" |
/* |
* Convert RGBA values into strq texture coordinates. |
*/ |
static void |
pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], |
GLfloat texcoord[][4]) |
{ |
if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) { |
GLuint i; |
for (i = 0; i < n; i++) { |
texcoord[i][0] = ctx->Current.RasterColor[RCOMP]; |
texcoord[i][1] = ctx->Current.RasterColor[GCOMP]; |
texcoord[i][2] = ctx->Current.RasterColor[BCOMP]; |
} |
} |
else { |
GLuint i; |
ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS); |
for (i = 0; i < n; i++) { |
texcoord[i][0] = CHAN_TO_FLOAT(rgba[i][RCOMP]); |
texcoord[i][1] = CHAN_TO_FLOAT(rgba[i][GCOMP]); |
texcoord[i][2] = CHAN_TO_FLOAT(rgba[i][BCOMP]); |
} |
} |
if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) { |
GLuint i; |
for (i = 0; i < n; i++) { |
texcoord[i][3] = ctx->Current.RasterColor[ACOMP]; |
} |
} |
else { |
GLuint i; |
ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS); |
for (i = 0; i < n; i++) { |
texcoord[i][3] = CHAN_TO_FLOAT(rgba[i][ACOMP]); |
} |
} |
} |
/* |
* Used by glDraw/CopyPixels: the incoming image colors are treated |
* as texture coordinates. Use those coords to texture the image. |
* This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture. |
*/ |
void |
_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) |
{ |
GLuint unit; |
ASSERT(!(span->arrayMask & SPAN_TEXTURE)); |
span->arrayMask |= SPAN_TEXTURE; |
/* convert colors into texture coordinates */ |
pixeltexgen( ctx, span->end, |
(const GLchan (*)[4]) span->array->rgba, |
span->array->texcoords[0] ); |
/* copy the new texture units for all enabled units */ |
for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
MEMCPY( span->array->texcoords[unit], span->array->texcoords[0], |
span->end * 4 * sizeof(GLfloat) ); |
} |
} |
/* apply texture mapping */ |
_swrast_texture_span( ctx, span ); |
/* this is a work-around to be fixed by initializing again span */ |
span->arrayMask &= ~SPAN_TEXTURE; |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_logic.h |
---|
0,0 → 1,46 |
/* $Id: s_logic.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_LOGIC_H |
#define S_LOGIC_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span, |
GLuint index[] ); |
extern void |
_mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_stencil.h |
---|
0,0 → 1,60 |
/* $Id: s_stencil.h,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_STENCIL_H |
#define S_STENCIL_H |
#include "mtypes.h" |
#include "swrast.h" |
extern GLboolean |
_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span); |
extern void |
_mesa_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, |
GLstencil stencil[] ); |
extern void |
_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, |
const GLstencil stencil[] ); |
extern void |
_mesa_alloc_stencil_buffer( GLframebuffer *buffer ); |
extern void |
_mesa_clear_stencil_buffer( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aatriangle.c |
---|
0,0 → 1,480 |
/* $Id: s_aatriangle.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Antialiased Triangle rasterizers |
*/ |
#include "glheader.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "s_aatriangle.h" |
#include "s_context.h" |
#include "s_span.h" |
/* |
* Compute coefficients of a plane using the X,Y coords of the v0, v1, v2 |
* vertices and the given Z values. |
* A point (x,y,z) lies on plane iff a*x+b*y+c*z+d = 0. |
*/ |
static INLINE void |
compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], |
GLfloat z0, GLfloat z1, GLfloat z2, GLfloat plane[4]) |
{ |
const GLfloat px = v1[0] - v0[0]; |
const GLfloat py = v1[1] - v0[1]; |
const GLfloat pz = z1 - z0; |
const GLfloat qx = v2[0] - v0[0]; |
const GLfloat qy = v2[1] - v0[1]; |
const GLfloat qz = z2 - z0; |
/* Crossproduct "(a,b,c):= dv1 x dv2" is orthogonal to plane. */ |
const GLfloat a = py * qz - pz * qy; |
const GLfloat b = pz * qx - px * qz; |
const GLfloat c = px * qy - py * qx; |
/* Point on the plane = "r*(a,b,c) + w", with fixed "r" depending |
on the distance of plane from origin and arbitrary "w" parallel |
to the plane. */ |
/* The scalar product "(r*(a,b,c)+w)*(a,b,c)" is "r*(a^2+b^2+c^2)", |
which is equal to "-d" below. */ |
const GLfloat d = -(a * v0[0] + b * v0[1] + c * z0); |
plane[0] = a; |
plane[1] = b; |
plane[2] = c; |
plane[3] = d; |
} |
/* |
* Compute coefficients of a plane with a constant Z value. |
*/ |
static INLINE void |
constant_plane(GLfloat value, GLfloat plane[4]) |
{ |
plane[0] = 0.0; |
plane[1] = 0.0; |
plane[2] = -1.0; |
plane[3] = value; |
} |
#define CONSTANT_PLANE(VALUE, PLANE) \ |
do { \ |
PLANE[0] = 0.0F; \ |
PLANE[1] = 0.0F; \ |
PLANE[2] = -1.0F; \ |
PLANE[3] = VALUE; \ |
} while (0) |
/* |
* Solve plane equation for Z at (X,Y). |
*/ |
static INLINE GLfloat |
solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
ASSERT(plane[2] != 0.0F); |
return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; |
} |
#define SOLVE_PLANE(X, Y, PLANE) \ |
((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) |
/* |
* Return 1 / solve_plane(). |
*/ |
static INLINE GLfloat |
solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; |
if (denom == 0.0F) |
return 0.0F; |
else |
return -plane[2] / denom; |
} |
/* |
* Solve plane and return clamped GLchan value. |
*/ |
static INLINE GLchan |
solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) |
{ |
GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F; |
if (z < 0.0F) |
return 0; |
else if (z > CHAN_MAXF) |
return (GLchan) CHAN_MAXF; |
return (GLchan) (GLint) z; |
} |
/* |
* Compute how much (area) of the given pixel is inside the triangle. |
* Vertices MUST be specified in counter-clockwise order. |
* Return: coverage in [0, 1]. |
*/ |
static GLfloat |
compute_coveragef(const GLfloat v0[3], const GLfloat v1[3], |
const GLfloat v2[3], GLint winx, GLint winy) |
{ |
/* Given a position [0,3]x[0,3] return the sub-pixel sample position. |
* Contributed by Ray Tice. |
* |
* Jitter sample positions - |
* - average should be .5 in x & y for each column |
* - each of the 16 rows and columns should be used once |
* - the rectangle formed by the first four points |
* should contain the other points |
* - the distrubition should be fairly even in any given direction |
* |
* The pattern drawn below isn't optimal, but it's better than a regular |
* grid. In the drawing, the center of each subpixel is surrounded by |
* four dots. The "x" marks the jittered position relative to the |
* subpixel center. |
*/ |
#define POS(a, b) (0.5+a*4+b)/16 |
static const GLfloat samples[16][2] = { |
/* start with the four corners */ |
{ POS(0, 2), POS(0, 0) }, |
{ POS(3, 3), POS(0, 2) }, |
{ POS(0, 0), POS(3, 1) }, |
{ POS(3, 1), POS(3, 3) }, |
/* continue with interior samples */ |
{ POS(1, 1), POS(0, 1) }, |
{ POS(2, 0), POS(0, 3) }, |
{ POS(0, 3), POS(1, 3) }, |
{ POS(1, 2), POS(1, 0) }, |
{ POS(2, 3), POS(1, 2) }, |
{ POS(3, 2), POS(1, 1) }, |
{ POS(0, 1), POS(2, 2) }, |
{ POS(1, 0), POS(2, 1) }, |
{ POS(2, 1), POS(2, 3) }, |
{ POS(3, 0), POS(2, 0) }, |
{ POS(1, 3), POS(3, 0) }, |
{ POS(2, 2), POS(3, 2) } |
}; |
const GLfloat x = (GLfloat) winx; |
const GLfloat y = (GLfloat) winy; |
const GLfloat dx0 = v1[0] - v0[0]; |
const GLfloat dy0 = v1[1] - v0[1]; |
const GLfloat dx1 = v2[0] - v1[0]; |
const GLfloat dy1 = v2[1] - v1[1]; |
const GLfloat dx2 = v0[0] - v2[0]; |
const GLfloat dy2 = v0[1] - v2[1]; |
GLint stop = 4, i; |
GLfloat insideCount = 16.0F; |
#ifdef DEBUG |
{ |
const GLfloat area = dx0 * dy1 - dx1 * dy0; |
ASSERT(area >= 0.0); |
} |
#endif |
for (i = 0; i < stop; i++) { |
const GLfloat sx = x + samples[i][0]; |
const GLfloat sy = y + samples[i][1]; |
const GLfloat fx0 = sx - v0[0]; |
const GLfloat fy0 = sy - v0[1]; |
const GLfloat fx1 = sx - v1[0]; |
const GLfloat fy1 = sy - v1[1]; |
const GLfloat fx2 = sx - v2[0]; |
const GLfloat fy2 = sy - v2[1]; |
/* cross product determines if sample is inside or outside each edge */ |
GLfloat cross0 = (dx0 * fy0 - dy0 * fx0); |
GLfloat cross1 = (dx1 * fy1 - dy1 * fx1); |
GLfloat cross2 = (dx2 * fy2 - dy2 * fx2); |
/* Check if the sample is exactly on an edge. If so, let cross be a |
* positive or negative value depending on the direction of the edge. |
*/ |
if (cross0 == 0.0F) |
cross0 = dx0 + dy0; |
if (cross1 == 0.0F) |
cross1 = dx1 + dy1; |
if (cross2 == 0.0F) |
cross2 = dx2 + dy2; |
if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F) { |
/* point is outside triangle */ |
insideCount -= 1.0F; |
stop = 16; |
} |
} |
if (stop == 4) |
return 1.0F; |
else |
return insideCount * (1.0F / 16.0F); |
} |
/* |
* Compute how much (area) of the given pixel is inside the triangle. |
* Vertices MUST be specified in counter-clockwise order. |
* Return: coverage in [0, 15]. |
*/ |
static GLint |
compute_coveragei(const GLfloat v0[3], const GLfloat v1[3], |
const GLfloat v2[3], GLint winx, GLint winy) |
{ |
/* NOTE: 15 samples instead of 16. */ |
static const GLfloat samples[15][2] = { |
/* start with the four corners */ |
{ POS(0, 2), POS(0, 0) }, |
{ POS(3, 3), POS(0, 2) }, |
{ POS(0, 0), POS(3, 1) }, |
{ POS(3, 1), POS(3, 3) }, |
/* continue with interior samples */ |
{ POS(1, 1), POS(0, 1) }, |
{ POS(2, 0), POS(0, 3) }, |
{ POS(0, 3), POS(1, 3) }, |
{ POS(1, 2), POS(1, 0) }, |
{ POS(2, 3), POS(1, 2) }, |
{ POS(3, 2), POS(1, 1) }, |
{ POS(0, 1), POS(2, 2) }, |
{ POS(1, 0), POS(2, 1) }, |
{ POS(2, 1), POS(2, 3) }, |
{ POS(3, 0), POS(2, 0) }, |
{ POS(1, 3), POS(3, 0) } |
}; |
const GLfloat x = (GLfloat) winx; |
const GLfloat y = (GLfloat) winy; |
const GLfloat dx0 = v1[0] - v0[0]; |
const GLfloat dy0 = v1[1] - v0[1]; |
const GLfloat dx1 = v2[0] - v1[0]; |
const GLfloat dy1 = v2[1] - v1[1]; |
const GLfloat dx2 = v0[0] - v2[0]; |
const GLfloat dy2 = v0[1] - v2[1]; |
GLint stop = 4, i; |
GLint insideCount = 15; |
#ifdef DEBUG |
{ |
const GLfloat area = dx0 * dy1 - dx1 * dy0; |
ASSERT(area >= 0.0); |
} |
#endif |
for (i = 0; i < stop; i++) { |
const GLfloat sx = x + samples[i][0]; |
const GLfloat sy = y + samples[i][1]; |
const GLfloat fx0 = sx - v0[0]; |
const GLfloat fy0 = sy - v0[1]; |
const GLfloat fx1 = sx - v1[0]; |
const GLfloat fy1 = sy - v1[1]; |
const GLfloat fx2 = sx - v2[0]; |
const GLfloat fy2 = sy - v2[1]; |
/* cross product determines if sample is inside or outside each edge */ |
GLfloat cross0 = (dx0 * fy0 - dy0 * fx0); |
GLfloat cross1 = (dx1 * fy1 - dy1 * fx1); |
GLfloat cross2 = (dx2 * fy2 - dy2 * fx2); |
/* Check if the sample is exactly on an edge. If so, let cross be a |
* positive or negative value depending on the direction of the edge. |
*/ |
if (cross0 == 0.0F) |
cross0 = dx0 + dy0; |
if (cross1 == 0.0F) |
cross1 = dx1 + dy1; |
if (cross2 == 0.0F) |
cross2 = dx2 + dy2; |
if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F) { |
/* point is outside triangle */ |
insideCount--; |
stop = 15; |
} |
} |
if (stop == 4) |
return 15; |
else |
return insideCount; |
} |
static void |
rgba_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#include "s_aatritemp.h" |
} |
static void |
index_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_INDEX |
#include "s_aatritemp.h" |
} |
/* |
* Compute mipmap level of detail. |
* XXX we should really include the R coordinate in this computation |
* in order to do 3-D texture mipmapping. |
*/ |
static INLINE GLfloat |
compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], |
const GLfloat qPlane[4], GLfloat cx, GLfloat cy, |
GLfloat invQ, GLfloat texWidth, GLfloat texHeight) |
{ |
const GLfloat s = solve_plane(cx, cy, sPlane); |
const GLfloat t = solve_plane(cx, cy, tPlane); |
const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane); |
const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane); |
const GLfloat s_x1 = s - sPlane[0] / sPlane[2]; |
const GLfloat s_y1 = s - sPlane[1] / sPlane[2]; |
const GLfloat t_x1 = t - tPlane[0] / tPlane[2]; |
const GLfloat t_y1 = t - tPlane[1] / tPlane[2]; |
GLfloat dsdx = s_x1 * invQ_x1 - s * invQ; |
GLfloat dsdy = s_y1 * invQ_y1 - s * invQ; |
GLfloat dtdx = t_x1 * invQ_x1 - t * invQ; |
GLfloat dtdy = t_y1 * invQ_y1 - t * invQ; |
GLfloat maxU, maxV, rho, lambda; |
dsdx = FABSF(dsdx); |
dsdy = FABSF(dsdy); |
dtdx = FABSF(dtdx); |
dtdy = FABSF(dtdy); |
maxU = MAX2(dsdx, dsdy) * texWidth; |
maxV = MAX2(dtdx, dtdy) * texHeight; |
rho = MAX2(maxU, maxV); |
lambda = LOG2(rho); |
return lambda; |
} |
static void |
tex_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_TEX |
#include "s_aatritemp.h" |
} |
static void |
spec_tex_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_TEX |
#define DO_SPEC |
#include "s_aatritemp.h" |
} |
static void |
multitex_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_MULTITEX |
#include "s_aatritemp.h" |
} |
static void |
spec_multitex_aa_tri(GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
#define DO_Z |
#define DO_FOG |
#define DO_RGBA |
#define DO_MULTITEX |
#define DO_SPEC |
#include "s_aatritemp.h" |
} |
/* |
* Examine GL state and set swrast->Triangle to an |
* appropriate antialiased triangle rasterizer function. |
*/ |
void |
_mesa_set_aa_triangle_function(GLcontext *ctx) |
{ |
ASSERT(ctx->Polygon.SmoothFlag); |
if (ctx->Texture._EnabledUnits != 0) { |
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { |
if (ctx->Texture._EnabledUnits > 1) { |
SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri; |
} |
else { |
SWRAST_CONTEXT(ctx)->Triangle = spec_tex_aa_tri; |
} |
} |
else { |
if (ctx->Texture._EnabledUnits > 1) { |
SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri; |
} |
else { |
SWRAST_CONTEXT(ctx)->Triangle = tex_aa_tri; |
} |
} |
} |
else if (ctx->Visual.rgbMode) { |
SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri; |
} |
else { |
SWRAST_CONTEXT(ctx)->Triangle = index_aa_tri; |
} |
ASSERT(SWRAST_CONTEXT(ctx)->Triangle); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_pixeltex.h |
---|
0,0 → 1,39 |
/* $Id: s_pixeltex.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_PIXELTEX_H |
#define S_PIXELTEX_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_lines.c |
---|
0,0 → 1,884 |
/* $Id: s_lines.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "macros.h" |
#include "mmath.h" |
#include "s_aaline.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_feedback.h" |
#include "s_lines.h" |
#include "s_span.h" |
/* |
* Init the mask[] array to implement a line stipple. |
*/ |
static void |
compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < len; i++) { |
GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; |
if ((1 << bit) & ctx->Line.StipplePattern) { |
mask[i] = GL_TRUE; |
} |
else { |
mask[i] = GL_FALSE; |
} |
swrast->StippleCounter++; |
} |
} |
/* |
* To draw a wide line we can simply redraw the span N times, side by side. |
*/ |
static void |
draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) |
{ |
GLint width, start; |
ASSERT(span->end < MAX_WIDTH); |
width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); |
if (width & 1) |
start = width / 2; |
else |
start = width / 2 - 1; |
if (xMajor) { |
GLint *y = span->array->y; |
GLuint i; |
GLint w; |
for (w = 0; w < width; w++) { |
if (w == 0) { |
for (i = 0; i < span->end; i++) |
y[i] -= start; |
} |
else { |
for (i = 0; i < span->end; i++) |
y[i]++; |
} |
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) |
_mesa_write_texture_span(ctx, span); |
else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) |
_mesa_write_rgba_span(ctx, span); |
else |
_mesa_write_index_span(ctx, span); |
} |
} |
else { |
GLint *x = span->array->x; |
GLuint i; |
GLint w; |
for (w = 0; w < width; w++) { |
if (w == 0) { |
for (i = 0; i < span->end; i++) |
x[i] -= start; |
} |
else { |
for (i = 0; i < span->end; i++) |
x[i]++; |
} |
if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) |
_mesa_write_texture_span(ctx, span); |
else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) |
_mesa_write_rgba_span(ctx, span); |
else |
_mesa_write_index_span(ctx, span); |
} |
} |
} |
/**********************************************************************/ |
/***** Rasterization *****/ |
/**********************************************************************/ |
/* Flat, color index line */ |
static void flat_ci_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLint *x, *y; |
struct sw_span span; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
ASSERT(!ctx->Line.StippleFlag); |
ASSERT(ctx->Line.Width == 1.0F); |
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, SPAN_XY); |
span.index = IntToFixed(vert1->index); |
span.indexStep = 0; |
x = span.array->x; |
y = span.array->y; |
#define INTERP_XY 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
_mesa_write_index_span(ctx, &span); |
} |
/* Flat-shaded, RGBA line */ |
static void flat_rgba_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
struct sw_span span; |
GLint *x, *y; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
ASSERT(!ctx->Line.StippleFlag); |
ASSERT(ctx->Line.Width == 1.0F); |
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, SPAN_XY); |
span.red = ChanToFixed(vert1->color[0]); |
span.green = ChanToFixed(vert1->color[1]); |
span.blue = ChanToFixed(vert1->color[2]); |
span.alpha = ChanToFixed(vert1->color[3]); |
span.redStep = 0; |
span.greenStep = 0; |
span.blueStep = 0; |
span.alphaStep = 0; |
x = span.array->x; |
y = span.array->y; |
#define INTERP_XY 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
_mesa_write_rgba_span(ctx, &span); |
} |
/* Smooth shaded, color index line */ |
static void smooth_ci_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
struct sw_span span; |
GLint *x, *y; |
GLuint *index; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
ASSERT(!ctx->Line.StippleFlag); |
ASSERT(ctx->Line.Width == 1.0F); |
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_INDEX); |
x = span.array->x; |
y = span.array->y; |
index = span.array->index; |
#define INTERP_XY 1 |
#define INTERP_INDEX 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
index[span.end] = I; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
_mesa_write_index_span(ctx, &span); |
} |
/* Smooth-shaded, RGBA line */ |
static void smooth_rgba_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
struct sw_span span; |
GLint *x, *y; |
GLchan (*rgba)[4]; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
ASSERT(!ctx->Line.StippleFlag); |
ASSERT(ctx->Line.Width == 1.0F); |
INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_RGBA); |
x = span.array->x; |
y = span.array->y; |
rgba = span.array->rgba; |
#define INTERP_XY 1 |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
rgba[span.end][RCOMP] = FixedToInt(r0); \ |
rgba[span.end][GCOMP] = FixedToInt(g0); \ |
rgba[span.end][BCOMP] = FixedToInt(b0); \ |
rgba[span.end][ACOMP] = FixedToInt(a0); \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
_mesa_write_rgba_span(ctx, &span); |
} |
/* Smooth shaded, color index, any width, maybe stippled */ |
static void general_smooth_ci_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLint *x, *y; |
GLdepth *z; |
GLfloat *fog; |
GLuint *index; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
INIT_SPAN(span, GL_LINE, 0, 0, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX); |
x = span.array->x; |
y = span.array->y; |
z = span.array->z; |
fog = span.array->fog; |
index = span.array->index; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_INDEX 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
z[span.end] = Z; \ |
fog[span.end] = fog0; \ |
index[span.end] = I; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_index_span(ctx, &span); |
} |
} |
/* Flat shaded, color index, any width, maybe stippled */ |
static void general_flat_ci_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLint *x, *y; |
GLdepth *z; |
GLfloat *fog; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, |
SPAN_XY | SPAN_Z | SPAN_FOG); |
span.index = IntToFixed(vert1->index); |
span.indexStep = 0; |
x = span.array->x; |
y = span.array->y; |
z = span.array->z; |
fog = span.array->fog; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
z[span.end] = Z; \ |
fog[span.end] = fog0; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_index_span(ctx, &span); |
} |
} |
static void general_smooth_rgba_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLint *x, *y; |
GLdepth *z; |
GLchan (*rgba)[4]; |
GLfloat *fog; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
INIT_SPAN(span, GL_LINE, 0, 0, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA); |
x = span.array->x; |
y = span.array->y; |
z = span.array->z; |
rgba = span.array->rgba; |
fog = span.array->fog; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
z[span.end] = Z; \ |
rgba[span.end][RCOMP] = FixedToInt(r0); \ |
rgba[span.end][GCOMP] = FixedToInt(g0); \ |
rgba[span.end][BCOMP] = FixedToInt(b0); \ |
rgba[span.end][ACOMP] = FixedToInt(a0); \ |
fog[span.end] = fog0; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
static void general_flat_rgba_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLint *x, *y; |
GLdepth *z; |
GLfloat *fog; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, |
SPAN_XY | SPAN_Z | SPAN_FOG); |
span.red = ChanToFixed(vert1->color[0]); |
span.green = ChanToFixed(vert1->color[1]); |
span.blue = ChanToFixed(vert1->color[2]); |
span.alpha = ChanToFixed(vert1->color[3]); |
span.redStep = 0; |
span.greenStep = 0; |
span.blueStep = 0; |
span.alphaStep = 0; |
x = span.array->x; |
y = span.array->y; |
z = span.array->z; |
fog = span.array->fog; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define PLOT(X,Y) \ |
{ \ |
x[span.end] = X; \ |
y[span.end] = Y; \ |
z[span.end] = Z; \ |
fog[span.end] = fog0; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
/* Flat-shaded, textured, any width, maybe stippled */ |
static void flat_textured_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); |
span.red = ChanToFixed(vert1->color[0]); |
span.green = ChanToFixed(vert1->color[1]); |
span.blue = ChanToFixed(vert1->color[2]); |
span.alpha = ChanToFixed(vert1->color[3]); |
span.redStep = 0; |
span.greenStep = 0; |
span.blueStep = 0; |
span.alphaStep = 0; |
span.specRed = ChanToFixed(vert1->specular[0]); |
span.specGreen = ChanToFixed(vert1->specular[1]); |
span.specBlue = ChanToFixed(vert1->specular[2]); |
span.specRedStep = 0; |
span.specGreenStep = 0; |
span.specBlueStep = 0; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_TEX 1 |
#define PLOT(X,Y) \ |
{ \ |
span.array->x[span.end] = X; \ |
span.array->y[span.end] = Y; \ |
span.array->z[span.end] = Z; \ |
span.array->fog[span.end] = fog0; \ |
span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \ |
span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \ |
span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \ |
span.array->lambda[0][span.end] = 0.0; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_texture_span(ctx, &span); |
} |
} |
/* Smooth-shaded, textured, any width, maybe stippled */ |
static void smooth_textured_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
INIT_SPAN(span, GL_LINE, 0, 0, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA); |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define INTERP_TEX 1 |
#define PLOT(X,Y) \ |
{ \ |
span.array->x[span.end] = X; \ |
span.array->y[span.end] = Y; \ |
span.array->z[span.end] = Z; \ |
span.array->fog[span.end] = fog0; \ |
span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \ |
span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \ |
span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \ |
span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \ |
span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \ |
span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \ |
span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \ |
span.array->lambda[0][span.end] = 0.0; \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_texture_span(ctx, &span); |
} |
} |
/* Smooth-shaded, multitextured, any width, maybe stippled, separate specular |
* color interpolation. |
*/ |
static void smooth_multitextured_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLuint u; |
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); |
INIT_SPAN(span, GL_LINE, 0, 0, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA); |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_RGB 1 |
#define INTERP_SPEC 1 |
#define INTERP_ALPHA 1 |
#define INTERP_MULTITEX 1 |
#define PLOT(X,Y) \ |
{ \ |
span.array->x[span.end] = X; \ |
span.array->y[span.end] = Y; \ |
span.array->z[span.end] = Z; \ |
span.array->fog[span.end] = fog0; \ |
span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \ |
span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \ |
span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \ |
span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \ |
span.array->spec[span.end][RCOMP] = FixedToInt(sr0); \ |
span.array->spec[span.end][GCOMP] = FixedToInt(sg0); \ |
span.array->spec[span.end][BCOMP] = FixedToInt(sb0); \ |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ |
if (ctx->Texture.Unit[u]._ReallyEnabled) { \ |
span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \ |
span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \ |
span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \ |
span.array->lambda[u][span.end] = 0.0; \ |
} \ |
} \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_texture_span(ctx, &span); |
} |
} |
/* Flat-shaded, multitextured, any width, maybe stippled, separate specular |
* color interpolation. |
*/ |
static void flat_multitextured_line( GLcontext *ctx, |
const SWvertex *vert0, |
const SWvertex *vert1 ) |
{ |
GLboolean xMajor = GL_FALSE; |
struct sw_span span; |
GLuint u; |
ASSERT(ctx->Light.ShadeModel == GL_FLAT); |
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, |
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); |
span.red = ChanToFixed(vert1->color[0]); |
span.green = ChanToFixed(vert1->color[1]); |
span.blue = ChanToFixed(vert1->color[2]); |
span.alpha = ChanToFixed(vert1->color[3]); |
span.redStep = 0; |
span.greenStep = 0; |
span.blueStep = 0; |
span.alphaStep = 0; |
span.specRed = ChanToFixed(vert1->specular[0]); |
span.specGreen = ChanToFixed(vert1->specular[1]); |
span.specBlue = ChanToFixed(vert1->specular[2]); |
span.specRedStep = 0; |
span.specGreenStep = 0; |
span.specBlueStep = 0; |
#define SET_XMAJOR 1 |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_MULTITEX 1 |
#define PLOT(X,Y) \ |
{ \ |
span.array->x[span.end] = X; \ |
span.array->y[span.end] = Y; \ |
span.array->z[span.end] = Z; \ |
span.array->fog[span.end] = fog0; \ |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ |
if (ctx->Texture.Unit[u]._ReallyEnabled) { \ |
span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \ |
span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \ |
span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \ |
span.array->lambda[u][span.end] = 0.0; \ |
} \ |
} \ |
span.end++; \ |
} |
#include "s_linetemp.h" |
if (ctx->Line.StippleFlag) { |
span.arrayMask |= SPAN_MASK; |
compute_stipple_mask(ctx, span.end, span.array->mask); |
} |
if (ctx->Line.Width > 1.0) { |
draw_wide_line(ctx, &span, xMajor); |
} |
else { |
_mesa_write_texture_span(ctx, &span); |
} |
} |
void _swrast_add_spec_terms_line( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1 ) |
{ |
SWvertex *ncv0 = (SWvertex *)v0; |
SWvertex *ncv1 = (SWvertex *)v1; |
GLchan c[2][4]; |
COPY_CHAN4( c[0], ncv0->color ); |
COPY_CHAN4( c[1], ncv1->color ); |
ACC_3V( ncv0->color, ncv0->specular ); |
ACC_3V( ncv1->color, ncv1->specular ); |
SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 ); |
COPY_CHAN4( ncv0->color, c[0] ); |
COPY_CHAN4( ncv1->color, c[1] ); |
} |
#ifdef DEBUG |
extern void |
_mesa_print_line_function(GLcontext *ctx); /* silence compiler warning */ |
void |
_mesa_print_line_function(GLcontext *ctx) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_mesa_printf("Line Func == "); |
if (swrast->Line == flat_ci_line) |
_mesa_printf("flat_ci_line\n"); |
else if (swrast->Line == flat_rgba_line) |
_mesa_printf("flat_rgba_line\n"); |
else if (swrast->Line == smooth_ci_line) |
_mesa_printf("smooth_ci_line\n"); |
else if (swrast->Line == smooth_rgba_line) |
_mesa_printf("smooth_rgba_line\n"); |
else if (swrast->Line == general_smooth_ci_line) |
_mesa_printf("general_smooth_ci_line\n"); |
else if (swrast->Line == general_flat_ci_line) |
_mesa_printf("general_flat_ci_line\n"); |
else if (swrast->Line == general_smooth_rgba_line) |
_mesa_printf("general_smooth_rgba_line\n"); |
else if (swrast->Line == general_flat_rgba_line) |
_mesa_printf("general_flat_rgba_line\n"); |
else if (swrast->Line == flat_textured_line) |
_mesa_printf("flat_textured_line\n"); |
else if (swrast->Line == smooth_textured_line) |
_mesa_printf("smooth_textured_line\n"); |
else if (swrast->Line == smooth_multitextured_line) |
_mesa_printf("smooth_multitextured_line\n"); |
else if (swrast->Line == flat_multitextured_line) |
_mesa_printf("flat_multitextured_line\n"); |
else |
_mesa_printf("Driver func %p\n", (void *) swrast->Line); |
} |
#endif |
#ifdef DEBUG |
/* record the current line function name */ |
static const char *lineFuncName = NULL; |
#define USE(lineFunc) \ |
do { \ |
lineFuncName = #lineFunc; \ |
/*_mesa_printf("%s\n", lineFuncName);*/ \ |
swrast->Line = lineFunc; \ |
} while (0) |
#else |
#define USE(lineFunc) swrast->Line = lineFunc |
#endif |
/* |
* Determine which line drawing function to use given the current |
* rendering context. |
* |
* Please update the summary flag _SWRAST_NEW_LINE if you add or remove |
* tests to this code. |
*/ |
void |
_swrast_choose_line( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLboolean rgbmode = ctx->Visual.rgbMode; |
if (ctx->RenderMode == GL_RENDER) { |
if (ctx->Line.SmoothFlag) { |
/* antialiased lines */ |
_swrast_choose_aa_line_function(ctx); |
ASSERT(swrast->Triangle); |
} |
else if (ctx->Texture._EnabledUnits) { |
if (ctx->Texture._EnabledUnits > 1 || |
(ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) { |
/* multi-texture and/or separate specular color */ |
if (ctx->Light.ShadeModel == GL_SMOOTH) |
USE(smooth_multitextured_line); |
else |
USE(flat_multitextured_line); |
} |
else { |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
USE(smooth_textured_line); |
} |
else { |
USE(flat_textured_line); |
} |
} |
} |
else { |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0 |
|| ctx->Line.StippleFlag) { |
if (rgbmode) |
USE(general_smooth_rgba_line); |
else |
USE(general_smooth_ci_line); |
} |
else { |
if (rgbmode) |
USE(smooth_rgba_line); |
else |
USE(smooth_ci_line); |
} |
} |
else { |
if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0 |
|| ctx->Line.StippleFlag) { |
if (rgbmode) |
USE(general_flat_rgba_line); |
else |
USE(general_flat_ci_line); |
} |
else { |
if (rgbmode) |
USE(flat_rgba_line); |
else |
USE(flat_ci_line); |
} |
} |
} |
} |
else if (ctx->RenderMode == GL_FEEDBACK) { |
USE(_mesa_feedback_line); |
} |
else { |
ASSERT(ctx->RenderMode == GL_SELECT); |
USE(_mesa_select_line); |
} |
/*_mesa_print_line_function(ctx);*/ |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_fog.c |
---|
0,0 → 1,315 |
/* $Id: s_fog.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "s_context.h" |
#include "s_fog.h" |
#include "s_span.h" |
/** |
* Used to convert current raster distance to a fog factor in [0,1]. |
*/ |
GLfloat |
_mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z) |
{ |
GLfloat d, f; |
switch (ctx->Fog.Mode) { |
case GL_LINEAR: |
if (ctx->Fog.Start == ctx->Fog.End) |
d = 1.0F; |
else |
d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); |
f = (ctx->Fog.End - z) * d; |
return CLAMP(f, 0.0F, 1.0F); |
case GL_EXP: |
d = ctx->Fog.Density; |
f = (GLfloat) exp(-d * z); |
return f; |
case GL_EXP2: |
d = ctx->Fog.Density; |
f = (GLfloat) exp(-(d * d * z * z)); |
return f; |
default: |
_mesa_problem(ctx, "Bad fog mode in _mesa_z_to_fogfactor"); |
return 0.0; |
} |
} |
/** |
* Calculate fog factors (in [0,1]) from window z values |
* Input: n - number of pixels |
* z - array of integer depth values |
* red, green, blue, alpha - pixel colors |
* Output: red, green, blue, alpha - fogged pixel colors |
* |
* Use lookup table & interpolation? |
*/ |
static void |
compute_fog_factors_from_z( const GLcontext *ctx, |
GLuint n, |
const GLdepth z[], |
GLfloat fogFact[] ) |
{ |
const GLfloat *proj = ctx->ProjectionMatrixStack.Top->m; |
const GLboolean ortho = (proj[15] != 0.0F); |
const GLfloat p10 = proj[10]; |
const GLfloat p14 = proj[14]; |
const GLfloat tz = ctx->Viewport._WindowMap.m[MAT_TZ]; |
GLfloat szInv; |
GLuint i; |
if (ctx->Viewport._WindowMap.m[MAT_SZ] == 0.0) |
szInv = 1.0F; |
else |
szInv = 1.0F / ctx->Viewport._WindowMap.m[MAT_SZ]; |
/* |
* Note: to compute eyeZ from the ndcZ we have to solve the following: |
* |
* p[10] * eyeZ + p[14] * eyeW |
* ndcZ = --------------------------- |
* p[11] * eyeZ + p[15] * eyeW |
* |
* Thus: |
* |
* p[14] * eyeW - p[15] * eyeW * ndcZ |
* eyeZ = ---------------------------------- |
* p[11] * ndcZ - p[10] |
* |
* If we note: |
* a) if using an orthographic projection, p[11] = 0 and p[15] = 1. |
* b) if using a perspective projection, p[11] = -1 and p[15] = 0. |
* c) we assume eyeW = 1 (not always true- glVertex4) |
* |
* Then we can simplify the calculation of eyeZ quite a bit. We do |
* separate calculations for the orthographic and perspective cases below. |
* Note that we drop a negative sign or two since they don't matter. |
*/ |
switch (ctx->Fog.Mode) { |
case GL_LINEAR: |
{ |
GLfloat fogEnd = ctx->Fog.End; |
GLfloat fogScale; |
if (ctx->Fog.Start == ctx->Fog.End) |
fogScale = 1.0; |
else |
fogScale = 1.0F / (ctx->Fog.End - ctx->Fog.Start); |
if (ortho) { |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = (ndcz - p14) / p10; |
GLfloat f; |
if (eyez < 0.0) |
eyez = -eyez; |
f = (fogEnd - eyez) * fogScale; |
fogFact[i] = CLAMP(f, 0.0F, 1.0F); |
} |
} |
else { |
/* perspective */ |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = p14 / (ndcz + p10); |
GLfloat f; |
if (eyez < 0.0) |
eyez = -eyez; |
f = (fogEnd - eyez) * fogScale; |
fogFact[i] = CLAMP(f, 0.0F, 1.0F); |
} |
} |
} |
break; |
case GL_EXP: |
if (ortho) { |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = (ndcz - p14) / p10; |
if (eyez < 0.0) |
eyez = -eyez; |
fogFact[i] = (GLfloat) exp( -ctx->Fog.Density * eyez ); |
} |
} |
else { |
/* perspective */ |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = p14 / (ndcz + p10); |
if (eyez < 0.0) |
eyez = -eyez; |
fogFact[i] = (GLfloat) exp( -ctx->Fog.Density * eyez ); |
} |
} |
break; |
case GL_EXP2: |
{ |
GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; |
if (ortho) { |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = (ndcz - p14) / p10; |
GLfloat tmp = negDensitySquared * eyez * eyez; |
#if defined(__alpha__) || defined(__alpha) |
/* XXX this underflow check may be needed for other systems*/ |
if (tmp < FLT_MIN_10_EXP) |
tmp = FLT_MIN_10_EXP; |
#endif |
fogFact[i] = (GLfloat) exp( tmp ); |
} |
} |
else { |
/* perspective */ |
for (i=0;i<n;i++) { |
GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv; |
GLfloat eyez = p14 / (ndcz + p10); |
GLfloat tmp = negDensitySquared * eyez * eyez; |
#if defined(__alpha__) || defined(__alpha) |
/* XXX this underflow check may be needed for other systems*/ |
if (tmp < FLT_MIN_10_EXP) |
tmp = FLT_MIN_10_EXP; |
#endif |
fogFact[i] = (GLfloat) exp( tmp ); |
} |
} |
} |
break; |
default: |
_mesa_problem(ctx, "Bad fog mode in compute_fog_factors_from_z"); |
return; |
} |
} |
/** |
* Apply fog to a span of RGBA pixels. |
* The fog factors are either in the span->array->fog or stored as base/step. |
* These are fog _factors_, not fog coords. Fog coords were converted to |
* fog factors per vertex. |
*/ |
void |
_mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ) |
{ |
const SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint n = span->end; |
GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba; |
GLchan rFog, gFog, bFog; |
ASSERT(ctx->Fog.Enabled); |
ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); |
ASSERT(span->arrayMask & SPAN_RGBA); |
UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); |
UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); |
UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); |
if (swrast->_PreferPixelFog) { |
/* compute fog factor from each fragment's Z value */ |
if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0) |
_mesa_span_interpolate_z(ctx, span); |
compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog); |
span->arrayMask |= SPAN_FOG; |
} |
if (span->arrayMask & SPAN_FOG) { |
/* use fog array in span */ |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLfloat fog = span->array->fog[i]; |
const GLfloat oneMinusFog = 1.0F - fog; |
rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog); |
rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog); |
rgba[i][BCOMP] = (GLchan) (fog * rgba[i][BCOMP] + oneMinusFog * bFog); |
} |
} |
else { |
/* interpolate fog factors */ |
GLfloat fog = span->fog, dFog = span->fogStep; |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLfloat oneMinusFog = 1.0F - fog; |
rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog); |
rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog); |
rgba[i][BCOMP] = (GLchan) (fog * rgba[i][BCOMP] + oneMinusFog * bFog); |
fog += dFog; |
} |
} |
} |
/** |
* As above, but color index mode. |
*/ |
void |
_mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span ) |
{ |
const SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint n = span->end; |
GLuint *index = span->array->index; |
ASSERT(ctx->Fog.Enabled); |
ASSERT(span->arrayMask & SPAN_INDEX); |
ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); |
if (swrast->_PreferPixelFog) { |
/* compute fog factor from each fragment's Z value */ |
if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0) |
_mesa_span_interpolate_z(ctx, span); |
compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog); |
span->arrayMask |= SPAN_FOG; |
} |
if (span->arrayMask & SPAN_FOG) { |
const GLuint idx = (GLuint) ctx->Fog.Index; |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLfloat f = CLAMP(span->array->fog[i], 0.0F, 1.0F); |
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); |
} |
} |
else { |
GLfloat fog = span->fog, dFog = span->fogStep; |
const GLuint idx = (GLuint) ctx->Fog.Index; |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLfloat f = CLAMP(fog, 0.0F, 1.0F); |
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); |
fog += dFog; |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_imaging.c |
---|
0,0 → 1,156 |
/* $Id: s_imaging.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* KW: Moved these here to remove knowledge of swrast from core mesa. |
* Should probably pull the entire software implementation of these |
* extensions into either swrast or a sister module. |
*/ |
#include "s_context.h" |
#include "s_span.h" |
void |
_swrast_CopyColorTable( GLcontext *ctx, |
GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width) |
{ |
GLchan data[MAX_WIDTH][4]; |
/* Select buffer to read from */ |
_swrast_use_read_buffer(ctx); |
if (width > MAX_WIDTH) |
width = MAX_WIDTH; |
/* read the data from framebuffer */ |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); |
/* Restore reading from draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
glColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); |
} |
void |
_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width) |
{ |
GLchan data[MAX_WIDTH][4]; |
/* Select buffer to read from */ |
_swrast_use_read_buffer(ctx); |
if (width > MAX_WIDTH) |
width = MAX_WIDTH; |
/* read the data from framebuffer */ |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); |
/* Restore reading from draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
glColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); |
} |
void |
_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; |
/* Select buffer to read from */ |
_swrast_use_read_buffer(ctx); |
RENDER_START( swrast, ctx ); |
/* read the data from framebuffer */ |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, |
(GLchan (*)[4]) rgba ); |
RENDER_FINISH( swrast, ctx ); |
/* Restore reading from draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
/* store as convolution filter */ |
glConvolutionFilter1D(target, internalFormat, width, |
GL_RGBA, CHAN_TYPE, rgba); |
} |
void |
_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
struct gl_pixelstore_attrib packSave; |
GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; |
GLint i; |
/* Select buffer to read from */ |
_swrast_use_read_buffer(ctx); |
RENDER_START(swrast,ctx); |
/* read pixels from framebuffer */ |
for (i = 0; i < height; i++) { |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y + i, |
(GLchan (*)[4]) rgba[i] ); |
} |
RENDER_FINISH(swrast,ctx); |
/* Restore reading from draw buffer (the default) */ |
_swrast_use_draw_buffer(ctx); |
/* |
* HACK: save & restore context state so we can store this as a |
* convolution filter via the GL api. Doesn't call any callbacks |
* hanging off ctx->Unpack statechanges. |
*/ |
packSave = ctx->Unpack; /* save pixel packing params */ |
ctx->Unpack.Alignment = 1; |
ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; |
ctx->Unpack.SkipPixels = 0; |
ctx->Unpack.SkipRows = 0; |
ctx->Unpack.ImageHeight = 0; |
ctx->Unpack.SkipImages = 0; |
ctx->Unpack.SwapBytes = GL_FALSE; |
ctx->Unpack.LsbFirst = GL_FALSE; |
ctx->NewState |= _NEW_PACKUNPACK; |
glConvolutionFilter2D(target, internalFormat, width, height, |
GL_RGBA, CHAN_TYPE, rgba); |
ctx->Unpack = packSave; /* restore pixel packing params */ |
ctx->NewState |= _NEW_PACKUNPACK; |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_bitmap.c |
---|
0,0 → 1,255 |
/* $Id: s_bitmap.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file swrast/s_bitmap.c |
* \brief glBitmap rendering. |
* \author Brian Paul |
*/ |
#include "glheader.h" |
#include "image.h" |
#include "macros.h" |
#include "mmath.h" |
#include "pixel.h" |
#include "s_context.h" |
#include "s_span.h" |
/* |
* Render a bitmap. |
*/ |
void |
_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, |
GLsizei width, GLsizei height, |
const struct gl_pixelstore_attrib *unpack, |
const GLubyte *bitmap ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLint row, col; |
GLuint count = 0; |
struct sw_span span; |
ASSERT(ctx->RenderMode == GL_RENDER); |
ASSERT(bitmap); |
RENDER_START(swrast,ctx); |
if (SWRAST_CONTEXT(ctx)->NewState) |
_swrast_validate_derived( ctx ); |
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY); |
if (ctx->Visual.rgbMode) { |
span.interpMask |= SPAN_RGBA; |
span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); |
span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); |
span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); |
span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); |
span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; |
} |
else { |
span.interpMask |= SPAN_INDEX; |
span.index = ChanToFixed(ctx->Current.RasterIndex); |
span.indexStep = 0; |
} |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
for (row = 0; row < height; row++, span.y++) { |
const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, |
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); |
if (unpack->LsbFirst) { |
/* Lsb first */ |
GLubyte mask = 1U << (unpack->SkipPixels & 0x7); |
for (col = 0; col < width; col++) { |
if (*src & mask) { |
span.array->x[count] = px + col; |
span.array->y[count] = py + row; |
count++; |
} |
if (mask == 128U) { |
src++; |
mask = 1U; |
} |
else { |
mask = mask << 1; |
} |
} |
/* get ready for next row */ |
if (mask != 1) |
src++; |
} |
else { |
/* Msb first */ |
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); |
for (col = 0; col < width; col++) { |
if (*src & mask) { |
span.array->x[count] = px + col; |
span.array->y[count] = py + row; |
count++; |
} |
if (mask == 1U) { |
src++; |
mask = 128U; |
} |
else { |
mask = mask >> 1; |
} |
} |
/* get ready for next row */ |
if (mask != 128) |
src++; |
} |
if (count + width >= MAX_WIDTH || row + 1 == height) { |
/* flush the span */ |
span.end = count; |
if (ctx->Visual.rgbMode) |
_mesa_write_rgba_span(ctx, &span); |
else |
_mesa_write_index_span(ctx, &span); |
span.end = 0; |
count = 0; |
} |
} |
RENDER_FINISH(swrast,ctx); |
} |
#if 0 |
/* |
* XXX this is another way to implement Bitmap. Use horizontal runs of |
* fragments, initializing the mask array to indicate which fragmens to |
* draw or skip. |
*/ |
void |
_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, |
GLsizei width, GLsizei height, |
const struct gl_pixelstore_attrib *unpack, |
const GLubyte *bitmap ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLint row, col; |
struct sw_span span; |
ASSERT(ctx->RenderMode == GL_RENDER); |
ASSERT(bitmap); |
RENDER_START(swrast,ctx); |
if (SWRAST_CONTEXT(ctx)->NewState) |
_swrast_validate_derived( ctx ); |
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK); |
/*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */ |
span.x = px; |
span.y = py; |
/*span.end = width;*/ |
if (ctx->Visual.rgbMode) { |
span.interpMask |= SPAN_RGBA; |
span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); |
span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); |
span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); |
span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); |
span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; |
} |
else { |
span.interpMask |= SPAN_INDEX; |
span.index = ChanToFixed(ctx->Current.RasterIndex); |
span.indexStep = 0; |
} |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
for (row=0; row<height; row++, span.y++) { |
const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, |
bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); |
if (unpack->LsbFirst) { |
/* Lsb first */ |
GLubyte mask = 1U << (unpack->SkipPixels & 0x7); |
for (col=0; col<width; col++) { |
span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; |
if (mask == 128U) { |
src++; |
mask = 1U; |
} |
else { |
mask = mask << 1; |
} |
} |
if (ctx->Visual.rgbMode) |
_mesa_write_rgba_span(ctx, &span); |
else |
_mesa_write_index_span(ctx, &span); |
/* get ready for next row */ |
if (mask != 1) |
src++; |
} |
else { |
/* Msb first */ |
GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); |
for (col=0; col<width; col++) { |
span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; |
if (mask == 1U) { |
src++; |
mask = 128U; |
} |
else { |
mask = mask >> 1; |
} |
} |
if (ctx->Visual.rgbMode) |
_mesa_write_rgba_span(ctx, &span); |
else |
_mesa_write_index_span(ctx, &span); |
/* get ready for next row */ |
if (mask != 128) |
src++; |
} |
} |
RENDER_FINISH(swrast,ctx); |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aatriangle.h |
---|
0,0 → 1,40 |
/* $Id: s_aatriangle.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_AATRIANGLE_H |
#define S_AATRIANGLE_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_set_aa_triangle_function(GLcontext *ctx); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_lines.h |
---|
0,0 → 1,42 |
/* $Id: s_lines.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_LINES_H |
#define S_LINES_H |
#include "mtypes.h" |
void |
_swrast_choose_line( GLcontext *ctx ); |
void |
_swrast_add_spec_terms_line( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1 ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_fog.h |
---|
0,0 → 1,46 |
/* $Id: s_fog.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_FOG_H |
#define S_FOG_H |
#include "mtypes.h" |
#include "swrast.h" |
extern GLfloat |
_mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z); |
extern void |
_mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_alphabuf.c |
---|
0,0 → 1,335 |
/* $Id: s_alphabuf.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Software alpha planes. Many frame buffers don't have alpha bits so |
* we simulate them in software. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "imports.h" |
#include "s_context.h" |
#include "s_alphabuf.h" |
/* |
* Allocate a new front and back alpha buffer. |
*/ |
void |
_mesa_alloc_alpha_buffers( GLframebuffer *buffer ) |
{ |
const GLint bytes = buffer->Width * buffer->Height * sizeof(GLchan); |
ASSERT(buffer->UseSoftwareAlphaBuffers); |
if (buffer->FrontLeftAlpha) { |
MESA_PBUFFER_FREE( buffer->FrontLeftAlpha ); |
} |
buffer->FrontLeftAlpha = MESA_PBUFFER_ALLOC( bytes ); |
if (!buffer->FrontLeftAlpha) { |
/* out of memory */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, |
"Couldn't allocate front-left alpha buffer" ); |
} |
if (buffer->Visual.doubleBufferMode) { |
if (buffer->BackLeftAlpha) { |
MESA_PBUFFER_FREE( buffer->BackLeftAlpha ); |
} |
buffer->BackLeftAlpha = MESA_PBUFFER_ALLOC( bytes ); |
if (!buffer->BackLeftAlpha) { |
/* out of memory */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, |
"Couldn't allocate back-left alpha buffer" ); |
} |
} |
if (buffer->Visual.stereoMode) { |
if (buffer->FrontRightAlpha) { |
MESA_PBUFFER_FREE( buffer->FrontRightAlpha ); |
} |
buffer->FrontRightAlpha = MESA_PBUFFER_ALLOC( bytes ); |
if (!buffer->FrontRightAlpha) { |
/* out of memory */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, |
"Couldn't allocate front-right alpha buffer" ); |
} |
if (buffer->Visual.doubleBufferMode) { |
if (buffer->BackRightAlpha) { |
MESA_PBUFFER_FREE( buffer->BackRightAlpha ); |
} |
buffer->BackRightAlpha = MESA_PBUFFER_ALLOC( bytes ); |
if (!buffer->BackRightAlpha) { |
/* out of memory */ |
_mesa_error( NULL, GL_OUT_OF_MEMORY, |
"Couldn't allocate back-right alpha buffer" ); |
} |
} |
} |
} |
/* |
* Clear all the alpha buffers |
*/ |
void |
_mesa_clear_alpha_buffers( GLcontext *ctx ) |
{ |
const GLchan aclear = (GLchan) ctx->Color.ClearColor[3]; |
GLuint bufferBit; |
ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); |
ASSERT(ctx->Color.ColorMask[ACOMP]); |
/* loop over four possible alpha buffers */ |
for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { |
if (bufferBit & ctx->Color._DrawDestMask) { |
GLchan *buffer; |
if (bufferBit == FRONT_LEFT_BIT) { |
buffer = (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; |
} |
else if (bufferBit == FRONT_RIGHT_BIT) { |
buffer = (GLchan *) ctx->DrawBuffer->FrontRightAlpha; |
} |
else if (bufferBit == BACK_LEFT_BIT) { |
buffer = (GLchan *) ctx->DrawBuffer->BackLeftAlpha; |
} |
else { |
buffer = (GLchan *) ctx->DrawBuffer->BackRightAlpha; |
} |
if (ctx->Scissor.Enabled) { |
/* clear scissor region */ |
GLint j; |
GLint rowLen = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
GLint width = ctx->DrawBuffer->Width; |
GLchan *aptr = buffer |
+ ctx->DrawBuffer->_Ymin * ctx->DrawBuffer->Width |
+ ctx->DrawBuffer->_Xmin; |
for (j = 0; j < rows; j++) { |
#if CHAN_BITS == 8 |
MEMSET( aptr, aclear, rowLen ); |
#elif CHAN_BITS == 16 |
MEMSET16( aptr, aclear, rowLen ); |
#else |
GLint i; |
for (i = 0; i < rowLen; i++) { |
aptr[i] = aclear; |
} |
#endif |
aptr += width; |
} |
} |
else { |
/* clear whole buffer */ |
GLuint pixels = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
#if CHAN_BITS == 8 |
MEMSET(buffer, aclear, pixels); |
#elif CHAN_BITS == 16 |
MEMSET16(buffer, aclear, pixels); |
#else |
GLuint i; |
for (i = 0; i < pixels; i++) { |
buffer[i] = aclear; |
} |
#endif |
} |
} |
} |
} |
static INLINE |
GLchan *get_alpha_buffer( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
switch (swrast->CurrentBuffer) { |
case FRONT_LEFT_BIT: |
return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; |
break; |
case BACK_LEFT_BIT: |
return (GLchan *) ctx->DrawBuffer->BackLeftAlpha; |
break; |
case FRONT_RIGHT_BIT: |
return (GLchan *) ctx->DrawBuffer->FrontRightAlpha; |
break; |
case BACK_RIGHT_BIT: |
return (GLchan *) ctx->DrawBuffer->BackRightAlpha; |
break; |
default: |
_mesa_problem(ctx, "Bad CurrentBuffer in get_alpha_buffer()"); |
return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; |
} |
} |
void |
_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
GLchan *buffer, *aptr; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
aptr = buffer + y * ctx->DrawBuffer->Width + x; |
if (mask) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
*aptr = rgba[i][ACOMP]; |
} |
aptr++; |
} |
} |
else { |
for (i=0;i<n;i++) { |
*aptr++ = rgba[i][ACOMP]; |
} |
} |
} |
void |
_mesa_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan alpha, const GLubyte mask[] ) |
{ |
GLchan *buffer, *aptr; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
aptr = buffer + y * ctx->DrawBuffer->Width + x; |
if (mask) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
*aptr = alpha; |
} |
aptr++; |
} |
} |
else { |
for (i=0;i<n;i++) { |
*aptr++ = alpha; |
} |
} |
} |
void |
_mesa_write_alpha_pixels( GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
GLchan *buffer; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
if (mask) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; |
*aptr = rgba[i][ACOMP]; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; |
*aptr = rgba[i][ACOMP]; |
} |
} |
} |
void |
_mesa_write_mono_alpha_pixels( GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan alpha, const GLubyte mask[] ) |
{ |
GLchan *buffer; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
if (mask) { |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; |
*aptr = alpha; |
} |
} |
} |
else { |
for (i=0;i<n;i++) { |
GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; |
*aptr = alpha; |
} |
} |
} |
void |
_mesa_read_alpha_span( GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLchan rgba[][4] ) |
{ |
const GLchan *buffer, *aptr; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
aptr = buffer + y * ctx->DrawBuffer->Width + x; |
for (i = 0; i < n; i++) |
rgba[i][ACOMP] = *aptr++; |
} |
void |
_mesa_read_alpha_pixels( GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const GLchan *buffer; |
GLuint i; |
buffer = get_alpha_buffer(ctx); |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
const GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; |
rgba[i][ACOMP] = *aptr; |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_zoom.c |
---|
0,0 → 1,346 |
/* $Id: s_zoom.c,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "macros.h" |
#include "imports.h" |
#include "colormac.h" |
#include "s_context.h" |
#include "s_span.h" |
#include "s_stencil.h" |
#include "s_zoom.h" |
/* |
* Helper function called from _mesa_write_zoomed_rgba/rgb/index_span(). |
*/ |
static void |
zoom_span( GLcontext *ctx, const struct sw_span *span, |
const GLvoid *src, GLint y0, GLenum format ) |
{ |
GLint r0, r1, row; |
GLint c0, c1, skipCol; |
GLint i, j; |
const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); |
GLchan rgbaSave[MAX_WIDTH][4]; |
GLuint indexSave[MAX_WIDTH]; |
const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; |
const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; |
const GLuint *indexes = (const GLuint *) src; |
struct sw_span zoomed; |
struct span_arrays zoomed_arrays; /* this is big! */ |
/* no pixel arrays! */ |
ASSERT((span->arrayMask & SPAN_XY) == 0); |
ASSERT(span->primitive == GL_BITMAP); |
INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); |
zoomed.array = &zoomed_arrays; |
if (format == GL_RGBA || format == GL_RGB) { |
zoomed.z = span->z; |
zoomed.zStep = span->z; |
zoomed.fog = span->fog; |
zoomed.fogStep = span->fogStep; |
zoomed.interpMask = span->interpMask & ~SPAN_RGBA; |
zoomed.arrayMask |= SPAN_RGBA; |
} |
else if (format == GL_COLOR_INDEX) { |
zoomed.z = span->z; |
zoomed.zStep = span->z; |
zoomed.fog = span->fog; |
zoomed.fogStep = span->fogStep; |
zoomed.interpMask = span->interpMask & ~SPAN_INDEX; |
zoomed.arrayMask |= SPAN_INDEX; |
} |
/* |
* Compute which columns to draw: [c0, c1) |
*/ |
c0 = (GLint) span->x; |
c1 = (GLint) (span->x + span->end * ctx->Pixel.ZoomX); |
if (c0 == c1) { |
return; |
} |
else if (c1 < c0) { |
/* swap */ |
GLint ctmp = c1; |
c1 = c0; |
c0 = ctmp; |
} |
if (c0 < 0) { |
zoomed.x = 0; |
zoomed.start = 0; |
zoomed.end = c1; |
skipCol = -c0; |
} |
else { |
zoomed.x = c0; |
zoomed.start = 0; |
zoomed.end = c1 - c0; |
skipCol = 0; |
} |
if (zoomed.end > maxWidth) |
zoomed.end = maxWidth; |
/* |
* Compute which rows to draw: [r0, r1) |
*/ |
row = span->y - y0; |
r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); |
r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); |
if (r0 == r1) { |
return; |
} |
else if (r1 < r0) { |
/* swap */ |
GLint rtmp = r1; |
r1 = r0; |
r0 = rtmp; |
} |
ASSERT(r0 < r1); |
ASSERT(c0 < c1); |
/* |
* Trivial clip rejection testing. |
*/ |
if (r1 < 0) /* below window */ |
return; |
if (r0 >= (GLint) ctx->DrawBuffer->Height) /* above window */ |
return; |
if (c1 < 0) /* left of window */ |
return; |
if (c0 >= (GLint) ctx->DrawBuffer->Width) /* right of window */ |
return; |
/* zoom the span horizontally */ |
if (format == GL_RGBA) { |
if (ctx->Pixel.ZoomX == -1.0F) { |
/* common case */ |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = span->end - (j + skipCol) - 1; |
COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); |
} |
} |
else { |
/* general solution */ |
const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = (GLint) ((j + skipCol) * xscale); |
if (i < 0) |
i = span->end + i - 1; |
COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); |
} |
} |
} |
else if (format == GL_RGB) { |
if (ctx->Pixel.ZoomX == -1.0F) { |
/* common case */ |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = span->end - (j + skipCol) - 1; |
zoomed.array->rgba[j][0] = rgb[i][0]; |
zoomed.array->rgba[j][1] = rgb[i][1]; |
zoomed.array->rgba[j][2] = rgb[i][2]; |
zoomed.array->rgba[j][3] = CHAN_MAX; |
} |
} |
else { |
/* general solution */ |
const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = (GLint) ((j + skipCol) * xscale); |
if (i < 0) |
i = span->end + i - 1; |
zoomed.array->rgba[j][0] = rgb[i][0]; |
zoomed.array->rgba[j][1] = rgb[i][1]; |
zoomed.array->rgba[j][2] = rgb[i][2]; |
zoomed.array->rgba[j][3] = CHAN_MAX; |
} |
} |
} |
else if (format == GL_COLOR_INDEX) { |
if (ctx->Pixel.ZoomX == -1.0F) { |
/* common case */ |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = span->end - (j + skipCol) - 1; |
zoomed.array->index[j] = indexes[i]; |
} |
} |
else { |
/* general solution */ |
const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; |
for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { |
i = (GLint) ((j + skipCol) * xscale); |
if (i < 0) |
i = span->end + i - 1; |
zoomed.array->index[j] = indexes[i]; |
} |
} |
} |
/* write the span in rows [r0, r1) */ |
if (format == GL_RGBA || format == GL_RGB) { |
/* Writing the span may modify the colors, so make a backup now if we're |
* going to call _mesa_write_zoomed_span() more than once. |
*/ |
if (r1 - r0 > 1) { |
MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); |
} |
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { |
_mesa_write_rgba_span(ctx, &zoomed); |
if (r1 - r0 > 1) { |
/* restore the colors */ |
MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); |
} |
} |
} |
else if (format == GL_COLOR_INDEX) { |
if (r1 - r0 > 1) { |
MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); |
} |
for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { |
_mesa_write_index_span(ctx, &zoomed); |
if (r1 - r0 > 1) { |
/* restore the colors */ |
MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); |
} |
} |
} |
} |
void |
_mesa_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, |
CONST GLchan rgba[][4], GLint y0 ) |
{ |
zoom_span(ctx, span, (const GLvoid *) rgba, y0, GL_RGBA); |
} |
void |
_mesa_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, |
CONST GLchan rgb[][3], GLint y0 ) |
{ |
zoom_span(ctx, span, (const GLvoid *) rgb, y0, GL_RGB); |
} |
void |
_mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, |
GLint y0 ) |
{ |
zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, GL_COLOR_INDEX); |
} |
/* |
* As above, but write stencil values. |
*/ |
void |
_mesa_write_zoomed_stencil_span( GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
const GLstencil stencil[], GLint y0 ) |
{ |
GLint m; |
GLint r0, r1, row, r; |
GLint i, j, skipcol; |
GLstencil zstencil[MAX_WIDTH]; /* zoomed stencil values */ |
GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); |
/* compute width of output row */ |
m = (GLint) ABSF( n * ctx->Pixel.ZoomX ); |
if (m==0) { |
return; |
} |
if (ctx->Pixel.ZoomX<0.0) { |
/* adjust x coordinate for left/right mirroring */ |
x = x - m; |
} |
/* compute which rows to draw */ |
row = y-y0; |
r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); |
r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); |
if (r0==r1) { |
return; |
} |
else if (r1<r0) { |
GLint rtmp = r1; |
r1 = r0; |
r0 = rtmp; |
} |
/* return early if r0...r1 is above or below window */ |
if (r0<0 && r1<0) { |
/* below window */ |
return; |
} |
if (r0 >= (GLint) ctx->DrawBuffer->Height && |
r1 >= (GLint) ctx->DrawBuffer->Height) { |
/* above window */ |
return; |
} |
/* check if left edge is outside window */ |
skipcol = 0; |
if (x<0) { |
skipcol = -x; |
m += x; |
} |
/* make sure span isn't too long or short */ |
if (m>maxwidth) { |
m = maxwidth; |
} |
else if (m<=0) { |
return; |
} |
ASSERT( m <= MAX_WIDTH ); |
/* zoom the span horizontally */ |
if (ctx->Pixel.ZoomX==-1.0F) { |
/* n==m */ |
for (j=0;j<m;j++) { |
i = n - (j+skipcol) - 1; |
zstencil[j] = stencil[i]; |
} |
} |
else { |
GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; |
for (j=0;j<m;j++) { |
i = (GLint) ((j+skipcol) * xscale); |
if (i<0) i = n + i - 1; |
zstencil[j] = stencil[i]; |
} |
} |
/* write the span */ |
for (r=r0; r<r1; r++) { |
_mesa_write_stencil_span( ctx, m, x+skipcol, r, zstencil ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_aalinetemp.h |
---|
0,0 → 1,315 |
/* $Id: s_aalinetemp.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Antialiased line template. |
*/ |
/* |
* Function to render each fragment in the AA line. |
*/ |
static void |
NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) |
{ |
const GLfloat fx = (GLfloat) ix; |
const GLfloat fy = (GLfloat) iy; |
const GLfloat coverage = compute_coveragef(line, ix, iy); |
const GLuint i = line->span.end; |
if (coverage == 0.0) |
return; |
line->span.end++; |
line->span.array->coverage[i] = coverage; |
line->span.array->x[i] = ix; |
line->span.array->y[i] = iy; |
/* |
* Compute Z, color, texture coords, fog for the fragment by |
* solving the plane equations at (ix,iy). |
*/ |
#ifdef DO_Z |
line->span.array->z[i] = (GLdepth) solve_plane(fx, fy, line->zPlane); |
#endif |
#ifdef DO_FOG |
line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane); |
#endif |
#ifdef DO_RGBA |
line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); |
line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane); |
line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane); |
line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane); |
#endif |
#ifdef DO_INDEX |
line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane); |
#endif |
#ifdef DO_SPEC |
line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane); |
line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane); |
line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane); |
#endif |
#ifdef DO_TEX |
{ |
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]); |
line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; |
line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; |
line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; |
line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ, |
line->texWidth[0], line->texHeight[0]); |
} |
#elif defined(DO_MULTITEX) |
{ |
GLuint unit; |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); |
line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; |
line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; |
line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; |
line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit], |
line->tPlane[unit], invQ, |
line->texWidth[unit], line->texHeight[unit]); |
} |
} |
} |
#endif |
if (line->span.end == MAX_WIDTH) { |
#if defined(DO_TEX) || defined(DO_MULTITEX) |
_mesa_write_texture_span(ctx, &(line->span)); |
#elif defined(DO_RGBA) |
_mesa_write_rgba_span(ctx, &(line->span)); |
#else |
_mesa_write_index_span(ctx, &(line->span)); |
#endif |
line->span.end = 0; /* reset counter */ |
} |
} |
/* |
* Line setup |
*/ |
static void |
NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLfloat tStart, tEnd; /* segment start, end along line length */ |
GLboolean inSegment; |
GLint iLen, i; |
/* Init the LineInfo struct */ |
struct LineInfo line; |
line.x0 = v0->win[0]; |
line.y0 = v0->win[1]; |
line.x1 = v1->win[0]; |
line.y1 = v1->win[1]; |
line.dx = line.x1 - line.x0; |
line.dy = line.y1 - line.y0; |
line.len = (GLfloat) sqrt(line.dx * line.dx + line.dy * line.dy); |
line.halfWidth = 0.5F * ctx->Line.Width; |
if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) |
return; |
INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); |
line.xAdj = line.dx / line.len * line.halfWidth; |
line.yAdj = line.dy / line.len * line.halfWidth; |
#ifdef DO_Z |
line.span.arrayMask |= SPAN_Z; |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->win[2], v1->win[2], line.zPlane); |
#endif |
#ifdef DO_FOG |
line.span.arrayMask |= SPAN_FOG; |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->fog, v1->fog, line.fPlane); |
#endif |
#ifdef DO_RGBA |
line.span.arrayMask |= SPAN_RGBA; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->color[RCOMP], v1->color[RCOMP], line.rPlane); |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->color[GCOMP], v1->color[GCOMP], line.gPlane); |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->color[BCOMP], v1->color[BCOMP], line.bPlane); |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->color[ACOMP], v1->color[ACOMP], line.aPlane); |
} |
else { |
constant_plane(v1->color[RCOMP], line.rPlane); |
constant_plane(v1->color[GCOMP], line.gPlane); |
constant_plane(v1->color[BCOMP], line.bPlane); |
constant_plane(v1->color[ACOMP], line.aPlane); |
} |
#endif |
#ifdef DO_SPEC |
line.span.arrayMask |= SPAN_SPEC; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane); |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->specular[GCOMP], v1->specular[GCOMP], line.sgPlane); |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
v0->specular[BCOMP], v1->specular[BCOMP], line.sbPlane); |
} |
else { |
constant_plane(v1->specular[RCOMP], line.srPlane); |
constant_plane(v1->specular[GCOMP], line.sgPlane); |
constant_plane(v1->specular[BCOMP], line.sbPlane); |
} |
#endif |
#ifdef DO_INDEX |
line.span.arrayMask |= SPAN_INDEX; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
compute_plane(line.x0, line.y0, line.x1, line.y1, |
(GLfloat) v0->index, (GLfloat) v1->index, line.iPlane); |
} |
else { |
constant_plane((GLfloat) v1->index, line.iPlane); |
} |
#endif |
#ifdef DO_TEX |
{ |
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; |
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; |
const GLfloat invW0 = v0->win[3]; |
const GLfloat invW1 = v1->win[3]; |
const GLfloat s0 = v0->texcoord[0][0] * invW0; |
const GLfloat s1 = v1->texcoord[0][0] * invW1; |
const GLfloat t0 = v0->texcoord[0][1] * invW0; |
const GLfloat t1 = v1->texcoord[0][1] * invW0; |
const GLfloat r0 = v0->texcoord[0][2] * invW0; |
const GLfloat r1 = v1->texcoord[0][2] * invW0; |
const GLfloat q0 = v0->texcoord[0][3] * invW0; |
const GLfloat q1 = v1->texcoord[0][3] * invW0; |
line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); |
compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[0]); |
line.texWidth[0] = (GLfloat) texImage->Width; |
line.texHeight[0] = (GLfloat) texImage->Height; |
} |
#elif defined(DO_MULTITEX) |
{ |
GLuint u; |
line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; |
const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; |
const GLfloat invW0 = v0->win[3]; |
const GLfloat invW1 = v1->win[3]; |
const GLfloat s0 = v0->texcoord[u][0] * invW0; |
const GLfloat s1 = v1->texcoord[u][0] * invW1; |
const GLfloat t0 = v0->texcoord[u][1] * invW0; |
const GLfloat t1 = v1->texcoord[u][1] * invW0; |
const GLfloat r0 = v0->texcoord[u][2] * invW0; |
const GLfloat r1 = v1->texcoord[u][2] * invW0; |
const GLfloat q0 = v0->texcoord[u][3] * invW0; |
const GLfloat q1 = v1->texcoord[u][3] * invW0; |
compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[u]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[u]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[u]); |
compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[u]); |
line.texWidth[u] = (GLfloat) texImage->Width; |
line.texHeight[u] = (GLfloat) texImage->Height; |
} |
} |
} |
#endif |
tStart = tEnd = 0.0; |
inSegment = GL_FALSE; |
iLen = (GLint) line.len; |
if (ctx->Line.StippleFlag) { |
for (i = 0; i < iLen; i++) { |
const GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; |
if ((1 << bit) & ctx->Line.StipplePattern) { |
/* stipple bit is on */ |
const GLfloat t = (GLfloat) i / (GLfloat) line.len; |
if (!inSegment) { |
/* start new segment */ |
inSegment = GL_TRUE; |
tStart = t; |
} |
else { |
/* still in the segment, extend it */ |
tEnd = t; |
} |
} |
else { |
/* stipple bit is off */ |
if (inSegment && (tEnd > tStart)) { |
/* draw the segment */ |
segment(ctx, &line, NAME(plot), tStart, tEnd); |
inSegment = GL_FALSE; |
} |
else { |
/* still between segments, do nothing */ |
} |
} |
swrast->StippleCounter++; |
} |
if (inSegment) { |
/* draw the final segment of the line */ |
segment(ctx, &line, NAME(plot), tStart, 1.0F); |
} |
} |
else { |
/* non-stippled */ |
segment(ctx, &line, NAME(plot), 0.0, 1.0); |
} |
#if defined(DO_TEX) || defined(DO_MULTITEX) |
_mesa_write_texture_span(ctx, &(line.span)); |
#elif defined(DO_RGBA) |
_mesa_write_rgba_span(ctx, &(line.span)); |
#else |
_mesa_write_index_span(ctx, &(line.span)); |
#endif |
} |
#undef DO_Z |
#undef DO_FOG |
#undef DO_RGBA |
#undef DO_INDEX |
#undef DO_SPEC |
#undef DO_TEX |
#undef DO_MULTITEX |
#undef NAME |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_context.c |
---|
0,0 → 1,660 |
/* $Id: s_context.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "mtypes.h" |
#include "imports.h" |
#include "swrast.h" |
#include "s_blend.h" |
#include "s_context.h" |
#include "s_lines.h" |
#include "s_points.h" |
#include "s_span.h" |
#include "s_triangle.h" |
#include "s_texture.h" |
/* |
* Recompute the value of swrast->_RasterMask, etc. according to |
* the current context. |
*/ |
static void |
_swrast_update_rasterflags( GLcontext *ctx ) |
{ |
GLuint RasterMask = 0; |
if (ctx->Color.AlphaEnabled) RasterMask |= ALPHATEST_BIT; |
if (ctx->Color.BlendEnabled) RasterMask |= BLEND_BIT; |
if (ctx->Depth.Test) RasterMask |= DEPTH_BIT; |
if (ctx->Fog.Enabled) RasterMask |= FOG_BIT; |
if (ctx->Scissor.Enabled) RasterMask |= CLIP_BIT; |
if (ctx->Stencil.Enabled) RasterMask |= STENCIL_BIT; |
if (ctx->Visual.rgbMode) { |
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); |
if (colorMask != 0xffffffff) RasterMask |= MASKING_BIT; |
if (ctx->Color.ColorLogicOpEnabled) RasterMask |= LOGIC_OP_BIT; |
if (ctx->Texture._EnabledUnits) RasterMask |= TEXTURE_BIT; |
} |
else { |
if (ctx->Color.IndexMask != 0xffffffff) RasterMask |= MASKING_BIT; |
if (ctx->Color.IndexLogicOpEnabled) RasterMask |= LOGIC_OP_BIT; |
} |
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers |
&& ctx->Color.ColorMask[ACOMP] |
&& ctx->Color.DrawBuffer != GL_NONE) |
RasterMask |= ALPHABUF_BIT; |
if ( ctx->Viewport.X < 0 |
|| ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width |
|| ctx->Viewport.Y < 0 |
|| ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { |
RasterMask |= CLIP_BIT; |
} |
if (ctx->Depth.OcclusionTest) |
RasterMask |= OCCLUSION_BIT; |
/* If we're not drawing to exactly one color buffer set the |
* MULTI_DRAW_BIT flag. Also set it if we're drawing to no |
* buffers or the RGBA or CI mask disables all writes. |
*/ |
if (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && |
ctx->Color._DrawDestMask != BACK_LEFT_BIT && |
ctx->Color._DrawDestMask != FRONT_RIGHT_BIT && |
ctx->Color._DrawDestMask != BACK_RIGHT_BIT) { |
/* more than one color buffer designated for writing (or zero buffers) */ |
RasterMask |= MULTI_DRAW_BIT; |
} |
else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) { |
RasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */ |
} |
else if (!ctx->Visual.rgbMode && ctx->Color.IndexMask==0) { |
RasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ |
} |
SWRAST_CONTEXT(ctx)->_RasterMask = RasterMask; |
} |
static void |
_swrast_update_polygon( GLcontext *ctx ) |
{ |
GLfloat backface_sign = 1; |
if (ctx->Polygon.CullFlag) { |
backface_sign = 1; |
switch(ctx->Polygon.CullFaceMode) { |
case GL_BACK: |
if(ctx->Polygon.FrontFace==GL_CCW) |
backface_sign = -1; |
break; |
case GL_FRONT: |
if(ctx->Polygon.FrontFace!=GL_CCW) |
backface_sign = -1; |
break; |
default: |
case GL_FRONT_AND_BACK: |
backface_sign = 0; |
break; |
} |
} |
else { |
backface_sign = 0; |
} |
SWRAST_CONTEXT(ctx)->_backface_sign = backface_sign; |
} |
static void |
_swrast_update_hint( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
swrast->_PreferPixelFog = (!swrast->AllowVertexFog || |
(ctx->Hint.Fog == GL_NICEST && |
swrast->AllowPixelFog)); |
} |
/* |
* Update the swrast->_AnyTextureCombine flag. |
*/ |
static void |
_swrast_update_texture_env( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint i; |
swrast->_AnyTextureCombine = GL_FALSE; |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { |
if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT || |
ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) { |
swrast->_AnyTextureCombine = GL_TRUE; |
return; |
} |
} |
} |
#define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ |
_NEW_TEXTURE | \ |
_NEW_HINT | \ |
_NEW_POLYGON ) |
/* State referenced by _swrast_choose_triangle, _swrast_choose_line. |
*/ |
#define _SWRAST_NEW_TRIANGLE (_SWRAST_NEW_DERIVED | \ |
_NEW_RENDERMODE| \ |
_NEW_POLYGON| \ |
_NEW_DEPTH| \ |
_NEW_STENCIL| \ |
_NEW_COLOR| \ |
_NEW_TEXTURE| \ |
_SWRAST_NEW_RASTERMASK| \ |
_NEW_LIGHT| \ |
_NEW_FOG | \ |
_DD_NEW_SEPARATE_SPECULAR) |
#define _SWRAST_NEW_LINE (_SWRAST_NEW_DERIVED | \ |
_NEW_RENDERMODE| \ |
_NEW_LINE| \ |
_NEW_TEXTURE| \ |
_NEW_LIGHT| \ |
_NEW_FOG| \ |
_NEW_DEPTH | \ |
_DD_NEW_SEPARATE_SPECULAR) |
#define _SWRAST_NEW_POINT (_SWRAST_NEW_DERIVED | \ |
_NEW_RENDERMODE | \ |
_NEW_POINT | \ |
_NEW_TEXTURE | \ |
_NEW_LIGHT | \ |
_NEW_FOG | \ |
_DD_NEW_SEPARATE_SPECULAR) |
#define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE |
#define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE |
#define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR |
/* Stub for swrast->Triangle to select a true triangle function |
* after a state change. |
*/ |
static void |
_swrast_validate_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_swrast_validate_derived( ctx ); |
swrast->choose_triangle( ctx ); |
if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && |
ctx->Texture._EnabledUnits == 0) { |
swrast->SpecTriangle = swrast->Triangle; |
swrast->Triangle = _swrast_add_spec_terms_triangle; |
} |
swrast->Triangle( ctx, v0, v1, v2 ); |
} |
static void |
_swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_swrast_validate_derived( ctx ); |
swrast->choose_line( ctx ); |
if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && |
ctx->Texture._EnabledUnits == 0) { |
swrast->SpecLine = swrast->Line; |
swrast->Line = _swrast_add_spec_terms_line; |
} |
swrast->Line( ctx, v0, v1 ); |
} |
static void |
_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_swrast_validate_derived( ctx ); |
swrast->choose_point( ctx ); |
if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && |
ctx->Texture._EnabledUnits == 0) { |
swrast->SpecPoint = swrast->Point; |
swrast->Point = _swrast_add_spec_terms_point; |
} |
swrast->Point( ctx, v0 ); |
} |
static void |
_swrast_validate_blend_func( GLcontext *ctx, GLuint n, |
const GLubyte mask[], |
GLchan src[][4], |
CONST GLchan dst[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_swrast_validate_derived( ctx ); |
_swrast_choose_blend_func( ctx ); |
swrast->BlendFunc( ctx, n, mask, src, dst ); |
} |
static void |
_swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
_swrast_validate_derived( ctx ); |
_swrast_choose_texture_sample_func( ctx, texUnit, tObj ); |
swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, |
lambda, rgba ); |
} |
static void |
_swrast_sleep( GLcontext *ctx, GLuint new_state ) |
{ |
} |
static void |
_swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint i; |
swrast->NewState |= new_state; |
/* After 10 statechanges without any swrast functions being called, |
* put the module to sleep. |
*/ |
if (++swrast->StateChanges > 10) { |
swrast->InvalidateState = _swrast_sleep; |
swrast->NewState = ~0; |
new_state = ~0; |
} |
if (new_state & swrast->invalidate_triangle) |
swrast->Triangle = _swrast_validate_triangle; |
if (new_state & swrast->invalidate_line) |
swrast->Line = _swrast_validate_line; |
if (new_state & swrast->invalidate_point) |
swrast->Point = _swrast_validate_point; |
if (new_state & _SWRAST_NEW_BLEND_FUNC) |
swrast->BlendFunc = _swrast_validate_blend_func; |
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
swrast->TextureSample[i] = _swrast_validate_texture_sample; |
if (ctx->Visual.rgbMode) { |
ASSERT(swrast->Driver.WriteRGBASpan); |
ASSERT(swrast->Driver.WriteRGBSpan); |
ASSERT(swrast->Driver.WriteMonoRGBASpan); |
ASSERT(swrast->Driver.WriteRGBAPixels); |
ASSERT(swrast->Driver.WriteMonoRGBAPixels); |
ASSERT(swrast->Driver.ReadRGBASpan); |
ASSERT(swrast->Driver.ReadRGBAPixels); |
} |
else { |
ASSERT(swrast->Driver.WriteCI32Span); |
ASSERT(swrast->Driver.WriteCI8Span); |
ASSERT(swrast->Driver.WriteMonoCISpan); |
ASSERT(swrast->Driver.WriteCI32Pixels); |
ASSERT(swrast->Driver.WriteMonoCIPixels); |
ASSERT(swrast->Driver.ReadCI32Span); |
ASSERT(swrast->Driver.ReadCI32Pixels); |
} |
} |
void |
_swrast_validate_derived( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->NewState) { |
if (swrast->NewState & _SWRAST_NEW_RASTERMASK) |
_swrast_update_rasterflags( ctx ); |
if (swrast->NewState & _NEW_POLYGON) |
_swrast_update_polygon( ctx ); |
if (swrast->NewState & _NEW_HINT) |
_swrast_update_hint( ctx ); |
if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE) |
_swrast_update_texture_env( ctx ); |
swrast->NewState = 0; |
swrast->StateChanges = 0; |
swrast->InvalidateState = _swrast_invalidate_state; |
} |
} |
#define SWRAST_DEBUG 0 |
/* Public entrypoints: See also s_accum.c, s_bitmap.c, etc. |
*/ |
void |
_swrast_Quad( GLcontext *ctx, |
const SWvertex *v0, const SWvertex *v1, |
const SWvertex *v2, const SWvertex *v3 ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_Quad\n"); |
_swrast_print_vertex( ctx, v0 ); |
_swrast_print_vertex( ctx, v1 ); |
_swrast_print_vertex( ctx, v2 ); |
_swrast_print_vertex( ctx, v3 ); |
} |
SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 ); |
SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 ); |
} |
void |
_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, |
const SWvertex *v1, const SWvertex *v2 ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_Triangle\n"); |
_swrast_print_vertex( ctx, v0 ); |
_swrast_print_vertex( ctx, v1 ); |
_swrast_print_vertex( ctx, v2 ); |
} |
SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); |
} |
void |
_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_Line\n"); |
_swrast_print_vertex( ctx, v0 ); |
_swrast_print_vertex( ctx, v1 ); |
} |
SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 ); |
} |
void |
_swrast_Point( GLcontext *ctx, const SWvertex *v0 ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_Point\n"); |
_swrast_print_vertex( ctx, v0 ); |
} |
SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); |
} |
void |
_swrast_InvalidateState( GLcontext *ctx, GLuint new_state ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_InvalidateState\n"); |
} |
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state ); |
} |
void |
_swrast_ResetLineStipple( GLcontext *ctx ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_ResetLineStipple\n"); |
} |
SWRAST_CONTEXT(ctx)->StippleCounter = 0; |
} |
void |
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value); |
} |
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); |
SWRAST_CONTEXT(ctx)->AllowVertexFog = value; |
} |
void |
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) |
{ |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value); |
} |
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); |
SWRAST_CONTEXT(ctx)->AllowPixelFog = value; |
} |
GLboolean |
_swrast_CreateContext( GLcontext *ctx ) |
{ |
GLuint i; |
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_CreateContext\n"); |
} |
if (!swrast) |
return GL_FALSE; |
swrast->NewState = ~0; |
swrast->choose_point = _swrast_choose_point; |
swrast->choose_line = _swrast_choose_line; |
swrast->choose_triangle = _swrast_choose_triangle; |
swrast->invalidate_point = _SWRAST_NEW_POINT; |
swrast->invalidate_line = _SWRAST_NEW_LINE; |
swrast->invalidate_triangle = _SWRAST_NEW_TRIANGLE; |
swrast->Point = _swrast_validate_point; |
swrast->Line = _swrast_validate_line; |
swrast->Triangle = _swrast_validate_triangle; |
swrast->InvalidateState = _swrast_sleep; |
swrast->BlendFunc = _swrast_validate_blend_func; |
swrast->AllowVertexFog = GL_TRUE; |
swrast->AllowPixelFog = GL_TRUE; |
if (ctx->Visual.doubleBufferMode) |
swrast->CurrentBuffer = BACK_LEFT_BIT; |
else |
swrast->CurrentBuffer = FRONT_LEFT_BIT; |
/* Optimized Accum buffer */ |
swrast->_IntegerAccumMode = GL_TRUE; |
swrast->_IntegerAccumScaler = 0.0; |
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) |
swrast->TextureSample[i] = _swrast_validate_texture_sample; |
swrast->SpanArrays = MALLOC_STRUCT(span_arrays); |
if (!swrast->SpanArrays) { |
FREE(swrast); |
return GL_FALSE; |
} |
/* init point span buffer */ |
swrast->PointSpan.primitive = GL_POINT; |
swrast->PointSpan.start = 0; |
swrast->PointSpan.end = 0; |
swrast->PointSpan.facing = 0; |
swrast->PointSpan.array = swrast->SpanArrays; |
assert(ctx->Const.MaxTextureUnits > 0); |
assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_UNITS); |
swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits * |
MAX_WIDTH * 4 * sizeof(GLchan)); |
if (!swrast->TexelBuffer) { |
FREE(swrast->SpanArrays); |
FREE(swrast); |
return GL_FALSE; |
} |
ctx->swrast_context = swrast; |
return GL_TRUE; |
} |
void |
_swrast_DestroyContext( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (SWRAST_DEBUG) { |
_mesa_debug(ctx, "_swrast_DestroyContext\n"); |
} |
FREE( swrast->SpanArrays ); |
FREE( swrast->TexelBuffer ); |
FREE( swrast ); |
ctx->swrast_context = 0; |
} |
struct swrast_device_driver * |
_swrast_GetDeviceDriverReference( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
return &swrast->Driver; |
} |
void |
_swrast_flush( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
/* flush any pending fragments from rendering points */ |
if (swrast->PointSpan.end > 0) { |
if (ctx->Visual.rgbMode) { |
if (ctx->Texture._EnabledUnits) |
_mesa_write_texture_span(ctx, &(swrast->PointSpan)); |
else |
_mesa_write_rgba_span(ctx, &(swrast->PointSpan)); |
} |
else { |
_mesa_write_index_span(ctx, &(swrast->PointSpan)); |
} |
swrast->PointSpan.end = 0; |
} |
} |
void |
_swrast_render_primitive( GLcontext *ctx, GLenum prim ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) { |
_swrast_flush(ctx); |
} |
swrast->Primitive = prim; |
} |
void |
_swrast_render_start( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->Driver.SpanRenderStart) |
swrast->Driver.SpanRenderStart( ctx ); |
swrast->PointSpan.end = 0; |
} |
void |
_swrast_render_finish( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->Driver.SpanRenderFinish) |
swrast->Driver.SpanRenderFinish( ctx ); |
_swrast_flush(ctx); |
} |
#define SWRAST_DEBUG_VERTICES 0 |
void |
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) |
{ |
GLuint i; |
if (SWRAST_DEBUG_VERTICES) { |
_mesa_debug(ctx, "win %f %f %f %f\n", |
v->win[0], v->win[1], v->win[2], v->win[3]); |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Texture.Unit[i]._ReallyEnabled) |
_mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, |
v->texcoord[i][0], v->texcoord[i][1], |
v->texcoord[i][2], v->texcoord[i][3]); |
#if CHAN_TYPE == GL_FLOAT |
_mesa_debug(ctx, "color %f %f %f %f\n", |
v->color[0], v->color[1], v->color[2], v->color[3]); |
_mesa_debug(ctx, "spec %f %f %f %f\n", |
v->specular[0], v->specular[1], |
v->specular[2], v->specular[3]); |
#else |
_mesa_debug(ctx, "color %d %d %d %d\n", |
v->color[0], v->color[1], v->color[2], v->color[3]); |
_mesa_debug(ctx, "spec %d %d %d %d\n", |
v->specular[0], v->specular[1], |
v->specular[2], v->specular[3]); |
#endif |
_mesa_debug(ctx, "fog %f\n", v->fog); |
_mesa_debug(ctx, "index %d\n", v->index); |
_mesa_debug(ctx, "pointsize %f\n", v->pointSize); |
_mesa_debug(ctx, "\n"); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_pointtemp.h |
---|
0,0 → 1,373 |
/* $Id: s_pointtemp.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Point rendering template code. |
* |
* Set FLAGS = bitwise-OR of the following tokens: |
* |
* RGBA = do rgba instead of color index |
* SMOOTH = do antialiasing |
* TEXTURE = do texture coords |
* SPECULAR = do separate specular color |
* LARGE = do points with diameter > 1 pixel |
* ATTENUATE = compute point size attenuation |
* SPRITE = GL_NV_point_sprite |
* |
* Notes: LARGE and ATTENUATE are exclusive of each other. |
* TEXTURE requires RGBA |
* SPECULAR requires TEXTURE |
*/ |
/* |
* NOTES on antialiased point rasterization: |
* |
* Let d = distance of fragment center from vertex. |
* if d < rmin2 then |
* fragment has 100% coverage |
* else if d > rmax2 then |
* fragment has 0% coverage |
* else |
* fragment has % coverage = (d - rmin2) / (rmax2 - rmin2) |
*/ |
static void |
NAME ( GLcontext *ctx, const SWvertex *vert ) |
{ |
#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) |
GLfloat size; |
#endif |
#if FLAGS & ATTENUATE |
GLfloat alphaAtten; |
#endif |
#if FLAGS & RGBA |
const GLchan red = vert->color[0]; |
const GLchan green = vert->color[1]; |
const GLchan blue = vert->color[2]; |
const GLchan alpha = vert->color[3]; |
#endif |
#if FLAGS & SPECULAR |
const GLchan specRed = vert->specular[0]; |
const GLchan specGreen = vert->specular[1]; |
const GLchan specBlue = vert->specular[2]; |
#endif |
#if FLAGS & INDEX |
const GLuint colorIndex = vert->index; |
#endif |
#if FLAGS & TEXTURE |
GLfloat texcoord[MAX_TEXTURE_UNITS][4]; |
GLuint u; |
#endif |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
struct sw_span *span = &(swrast->PointSpan); |
/* Cull primitives with malformed coordinates. |
*/ |
{ |
float tmp = vert->win[0] + vert->win[1]; |
if (IS_INF_OR_NAN(tmp)) |
return; |
} |
/* |
* Span init |
*/ |
span->interpMask = SPAN_FOG; |
span->arrayMask = SPAN_XY | SPAN_Z; |
span->fog = vert->fog; |
span->fogStep = 0.0; |
#if FLAGS & RGBA |
span->arrayMask |= SPAN_RGBA; |
#endif |
#if FLAGS & SPECULAR |
span->arrayMask |= SPAN_SPEC; |
#endif |
#if FLAGS & INDEX |
span->arrayMask |= SPAN_INDEX; |
#endif |
#if FLAGS & TEXTURE |
span->arrayMask |= SPAN_TEXTURE; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const GLfloat q = vert->texcoord[u][3]; |
const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q); |
texcoord[u][0] = vert->texcoord[u][0] * invQ; |
texcoord[u][1] = vert->texcoord[u][1] * invQ; |
texcoord[u][2] = vert->texcoord[u][2] * invQ; |
texcoord[u][3] = q; |
} |
} |
#endif |
#if FLAGS & SMOOTH |
span->arrayMask |= SPAN_COVERAGE; |
#endif |
#if FLAGS & SPRITE |
span->arrayMask |= SPAN_TEXTURE; |
#endif |
#if FLAGS & ATTENUATE |
if (vert->pointSize >= ctx->Point.Threshold) { |
size = MIN2(vert->pointSize, ctx->Point.MaxSize); |
alphaAtten = 1.0F; |
} |
else { |
GLfloat dsize = vert->pointSize / ctx->Point.Threshold; |
size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize); |
alphaAtten = dsize * dsize; |
} |
#elif FLAGS & (LARGE | SMOOTH | SPRITE) |
size = ctx->Point._Size; |
#endif |
#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) |
/* |
* Multi-pixel points |
*/ |
{{ |
GLint x, y; |
const GLfloat radius = 0.5F * size; |
const GLint z = (GLint) (vert->win[2] + 0.5F); |
GLuint count; |
#if FLAGS & SMOOTH |
const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ |
const GLfloat rmax = radius + 0.7071F; |
const GLfloat rmin2 = MAX2(0.0F, rmin * rmin); |
const GLfloat rmax2 = rmax * rmax; |
const GLfloat cscale = 1.0F / (rmax2 - rmin2); |
const GLint xmin = (GLint) (vert->win[0] - radius); |
const GLint xmax = (GLint) (vert->win[0] + radius); |
const GLint ymin = (GLint) (vert->win[1] - radius); |
const GLint ymax = (GLint) (vert->win[1] + radius); |
#else |
/* non-smooth */ |
GLint xmin, xmax, ymin, ymax; |
GLint iSize = (GLint) (size + 0.5F); |
GLint iRadius; |
iSize = MAX2(1, iSize); |
iRadius = iSize / 2; |
if (iSize & 1) { |
/* odd size */ |
xmin = (GLint) (vert->win[0] - iRadius); |
xmax = (GLint) (vert->win[0] + iRadius); |
ymin = (GLint) (vert->win[1] - iRadius); |
ymax = (GLint) (vert->win[1] + iRadius); |
} |
else { |
/* even size */ |
xmin = (GLint) vert->win[0] - iRadius + 1; |
xmax = xmin + iSize - 1; |
ymin = (GLint) vert->win[1] - iRadius + 1; |
ymax = ymin + iSize - 1; |
} |
#endif /*SMOOTH*/ |
/* check if we need to flush */ |
if (span->end + (xmax-xmin+1) * (ymax-ymin+1) >= MAX_WIDTH || |
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { |
#if FLAGS & (TEXTURE | SPRITE) |
if (ctx->Texture._EnabledUnits) |
_mesa_write_texture_span(ctx, span); |
else |
_mesa_write_rgba_span(ctx, span); |
#elif FLAGS & RGBA |
_mesa_write_rgba_span(ctx, span); |
#else |
_mesa_write_index_span(ctx, span); |
#endif |
span->end = 0; |
} |
/* |
* OK, generate fragments |
*/ |
count = span->end; |
(void) radius; |
for (y = ymin; y <= ymax; y++) { |
for (x = xmin; x <= xmax; x++) { |
#if FLAGS & (SPRITE | TEXTURE) |
GLuint u; |
#endif |
#if FLAGS & RGBA |
span->array->rgba[count][RCOMP] = red; |
span->array->rgba[count][GCOMP] = green; |
span->array->rgba[count][BCOMP] = blue; |
span->array->rgba[count][ACOMP] = alpha; |
#endif |
#if FLAGS & SPECULAR |
span->array->spec[count][RCOMP] = specRed; |
span->array->spec[count][GCOMP] = specGreen; |
span->array->spec[count][BCOMP] = specBlue; |
#endif |
#if FLAGS & INDEX |
span->array->index[count] = colorIndex; |
#endif |
#if FLAGS & TEXTURE |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
COPY_4V(span->array->texcoords[u][count], texcoord[u]); |
} |
} |
#endif |
#if FLAGS & SMOOTH |
/* compute coverage */ |
{ |
const GLfloat dx = x - vert->win[0] + 0.5F; |
const GLfloat dy = y - vert->win[1] + 0.5F; |
const GLfloat dist2 = dx * dx + dy * dy; |
if (dist2 < rmax2) { |
if (dist2 >= rmin2) { |
/* compute partial coverage */ |
span->array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale; |
#if FLAGS & INDEX |
/* coverage in [0,15] */ |
span->array->coverage[count] *= 15.0; |
#endif |
} |
else { |
/* full coverage */ |
span->array->coverage[count] = 1.0F; |
} |
span->array->x[count] = x; |
span->array->y[count] = y; |
span->array->z[count] = z; |
#if (FLAGS & ATTENUATE) && (FLAGS & RGBA) |
span->array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten); |
#elif FLAGS & RGBA |
span->array->rgba[count][ACOMP] = alpha; |
#endif /*ATTENUATE*/ |
count++; |
} /*if*/ |
} |
#else /*SMOOTH*/ |
/* not smooth (square points) */ |
span->array->x[count] = x; |
span->array->y[count] = y; |
span->array->z[count] = z; |
#if FLAGS & SPRITE |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
if (ctx->Point.CoordReplace[u]) { |
GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size; |
GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size; |
span->array->texcoords[u][count][0] = s; |
span->array->texcoords[u][count][1] = t; |
span->array->texcoords[u][count][3] = 1.0F; |
if (ctx->Point.SpriteRMode == GL_ZERO) |
span->array->texcoords[u][count][2] = 0.0F; |
else if (ctx->Point.SpriteRMode == GL_S) |
span->array->texcoords[u][count][2] = vert->texcoord[u][0]; |
else /* GL_R */ |
span->array->texcoords[u][count][2] = vert->texcoord[u][2]; |
} |
else { |
COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]); |
} |
} |
} |
#endif /*SPRITE*/ |
count++; /* square point */ |
#endif /*SMOOTH*/ |
} /*for x*/ |
} /*for y*/ |
span->end = count; |
}} |
#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */ |
/* |
* Single-pixel points |
*/ |
{{ |
GLuint count; |
/* check if we need to flush */ |
if (span->end >= MAX_WIDTH || |
(swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { |
#if FLAGS & (TEXTURE | SPRITE) |
if (ctx->Texture._EnabledUnits) |
_mesa_write_texture_span(ctx, span); |
else |
_mesa_write_rgba_span(ctx, span); |
#elif FLAGS & RGBA |
_mesa_write_rgba_span(ctx, span); |
#else |
_mesa_write_index_span(ctx, span); |
#endif |
span->end = 0; |
} |
count = span->end; |
#if FLAGS & RGBA |
span->array->rgba[count][RCOMP] = red; |
span->array->rgba[count][GCOMP] = green; |
span->array->rgba[count][BCOMP] = blue; |
span->array->rgba[count][ACOMP] = alpha; |
#endif |
#if FLAGS & SPECULAR |
span->array->spec[count][RCOMP] = specRed; |
span->array->spec[count][GCOMP] = specGreen; |
span->array->spec[count][BCOMP] = specBlue; |
#endif |
#if FLAGS & INDEX |
span->array->index[count] = colorIndex; |
#endif |
#if FLAGS & TEXTURE |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
COPY_4V(span->array->texcoords[u][count], texcoord[u]); |
} |
} |
#endif |
span->array->x[count] = (GLint) vert->win[0]; |
span->array->y[count] = (GLint) vert->win[1]; |
span->array->z[count] = (GLint) (vert->win[2] + 0.5F); |
span->end = count + 1; |
}} |
#endif /* LARGE || ATTENUATE || SMOOTH */ |
ASSERT(span->end <= MAX_WIDTH); |
} |
#undef FLAGS |
#undef NAME |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_feedback.c |
---|
0,0 → 1,167 |
/* $Id: s_feedback.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "feedback.h" |
#include "macros.h" |
#include "mmath.h" |
#include "s_context.h" |
#include "s_feedback.h" |
#include "s_triangle.h" |
#define FB_3D 0x01 |
#define FB_4D 0x02 |
#define FB_INDEX 0x04 |
#define FB_COLOR 0x08 |
#define FB_TEXTURE 0X10 |
static void feedback_vertex( GLcontext *ctx, |
const SWvertex *v, const SWvertex *pv ) |
{ |
const GLuint texUnit = 0; /* See section 5.3 of 1.2.1 spec */ |
GLfloat win[4]; |
GLfloat color[4]; |
GLfloat tc[4]; |
GLuint index; |
win[0] = v->win[0]; |
win[1] = v->win[1]; |
win[2] = v->win[2] / ctx->DepthMaxF; |
win[3] = 1.0F / v->win[3]; |
color[0] = CHAN_TO_FLOAT(pv->color[0]); |
color[1] = CHAN_TO_FLOAT(pv->color[1]); |
color[2] = CHAN_TO_FLOAT(pv->color[2]); |
color[3] = CHAN_TO_FLOAT(pv->color[3]); |
if (v->texcoord[texUnit][3] != 1.0 && |
v->texcoord[texUnit][3] != 0.0) { |
GLfloat invq = 1.0F / v->texcoord[texUnit][3]; |
tc[0] = v->texcoord[texUnit][0] * invq; |
tc[1] = v->texcoord[texUnit][1] * invq; |
tc[2] = v->texcoord[texUnit][2] * invq; |
tc[3] = v->texcoord[texUnit][3]; |
} |
else { |
COPY_4V(tc, v->texcoord[texUnit]); |
} |
index = v->index; |
_mesa_feedback_vertex( ctx, win, color, index, tc ); |
} |
/* |
* Put triangle in feedback buffer. |
*/ |
void _mesa_feedback_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
if (_mesa_cull_triangle( ctx, v0, v1, v2 )) { |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN ); |
FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */ |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
feedback_vertex( ctx, v0, v0 ); |
feedback_vertex( ctx, v1, v1 ); |
feedback_vertex( ctx, v2, v2 ); |
} else { |
feedback_vertex( ctx, v0, v2 ); |
feedback_vertex( ctx, v1, v2 ); |
feedback_vertex( ctx, v2, v2 ); |
} |
} |
} |
void _mesa_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) |
{ |
GLenum token = GL_LINE_TOKEN; |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (swrast->StippleCounter==0) |
token = GL_LINE_RESET_TOKEN; |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
feedback_vertex( ctx, v0, v0 ); |
feedback_vertex( ctx, v1, v1 ); |
} else { |
feedback_vertex( ctx, v0, v1 ); |
feedback_vertex( ctx, v1, v1 ); |
} |
swrast->StippleCounter++; |
} |
void _mesa_feedback_point( GLcontext *ctx, const SWvertex *v ) |
{ |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN ); |
feedback_vertex( ctx, v, v ); |
} |
void _mesa_select_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2) |
{ |
if (_mesa_cull_triangle( ctx, v0, v1, v2 )) { |
const GLfloat zs = 1.0F / ctx->DepthMaxF; |
_mesa_update_hitflag( ctx, v0->win[2] * zs ); |
_mesa_update_hitflag( ctx, v1->win[2] * zs ); |
_mesa_update_hitflag( ctx, v2->win[2] * zs ); |
} |
} |
void _mesa_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) |
{ |
const GLfloat zs = 1.0F / ctx->DepthMaxF; |
_mesa_update_hitflag( ctx, v0->win[2] * zs ); |
_mesa_update_hitflag( ctx, v1->win[2] * zs ); |
} |
void _mesa_select_point( GLcontext *ctx, const SWvertex *v ) |
{ |
const GLfloat zs = 1.0F / ctx->DepthMaxF; |
_mesa_update_hitflag( ctx, v->win[2] * zs ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_alphabuf.h |
---|
0,0 → 1,81 |
/* $Id: s_alphabuf.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.2 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_ALPHABUF_H |
#define S_ALPHABUF_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_alloc_alpha_buffers( GLframebuffer *buffer ); |
extern void |
_mesa_clear_alpha_buffers( GLcontext *ctx ); |
extern void |
_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ); |
extern void |
_mesa_write_mono_alpha_span( GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
GLchan alpha, const GLubyte mask[] ); |
extern void |
_mesa_write_alpha_pixels( GLcontext* ctx, |
GLuint n, const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], |
const GLubyte mask[] ); |
extern void |
_mesa_write_mono_alpha_pixels( GLcontext* ctx, |
GLuint n, const GLint x[], |
const GLint y[], GLchan alpha, |
const GLubyte mask[] ); |
extern void |
_mesa_read_alpha_span( GLcontext* ctx, |
GLuint n, GLint x, GLint y, GLchan rgba[][4] ); |
extern void |
_mesa_read_alpha_pixels( GLcontext* ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_zoom.h |
---|
0,0 → 1,49 |
/* $Id: s_zoom.h,v 1.1 2003-02-28 11:49:44 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_ZOOM_H |
#define S_ZOOM_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, |
CONST GLchan rgb[][4], GLint y0 ); |
extern void |
_mesa_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, |
CONST GLchan rgb[][3], GLint y0 ); |
extern void |
_mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, |
GLint y0 ); |
extern void |
_mesa_write_zoomed_stencil_span( GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLstencil stencil[], GLint y0 ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_tritemp.h |
---|
0,0 → 1,1406 |
/* $Id: s_tritemp.h,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* $XFree86: xc/extras/Mesa/src/swrast/s_tritemp.h,v 1.2 2002/02/27 21:07:54 tsi Exp $ */ |
/* |
* Triangle Rasterizer Template |
* |
* This file is #include'd to generate custom triangle rasterizers. |
* |
* The following macros may be defined to indicate what auxillary information |
* must be interplated across the triangle: |
* INTERP_Z - if defined, interpolate Z values |
* INTERP_FOG - if defined, interpolate fog values |
* INTERP_RGB - if defined, interpolate RGB values |
* INTERP_ALPHA - if defined, interpolate Alpha values (req's INTERP_RGB) |
* INTERP_SPEC - if defined, interpolate specular RGB values |
* INTERP_INDEX - if defined, interpolate color index values |
* INTERP_INT_TEX - if defined, interpolate integer ST texcoords |
* (fast, simple 2-D texture mapping) |
* INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords |
* NOTE: OpenGL STRQ = Mesa STUV (R was taken for red) |
* INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords |
* INTERP_FLOAT_RGBA - if defined, interpolate RGBA with floating point |
* INTERP_FLOAT_SPEC - if defined, interpolate specular with floating point |
* |
* When one can directly address pixels in the color buffer the following |
* macros can be defined and used to compute pixel addresses during |
* rasterization (see pRow): |
* PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) |
* BYTES_PER_ROW - number of bytes per row in the color buffer |
* PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where |
* Y==0 at bottom of screen and increases upward. |
* |
* Similarly, for direct depth buffer access, this type is used for depth |
* buffer addressing: |
* DEPTH_TYPE - either GLushort or GLuint |
* |
* Optionally, one may provide one-time setup code per triangle: |
* SETUP_CODE - code which is to be executed once per triangle |
* CLEANUP_CODE - code to execute at end of triangle |
* |
* The following macro MUST be defined: |
* RENDER_SPAN(span) - code to write a span of pixels. |
* |
* This code was designed for the origin to be in the lower-left corner. |
* |
* Inspired by triangle rasterizer code written by Allen Akin. Thanks Allen! |
*/ |
/* |
* This is a bit of a hack, but it's a centralized place to enable floating- |
* point color interpolation when GLchan is actually floating point. |
*/ |
#if CHAN_TYPE == GL_FLOAT |
#if defined(INTERP_RGB) |
#undef INTERP_RGB |
#undef INTERP_ALPHA |
#define INTERP_FLOAT_RGBA |
#endif |
#if defined(INTERP_SPEC) |
#undef INTERP_SPEC |
#define INTERP_FLOAT_SPEC |
#endif |
#endif |
/*void triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 )*/ |
{ |
typedef struct { |
const SWvertex *v0, *v1; /* Y(v0) < Y(v1) */ |
GLfloat dx; /* X(v1) - X(v0) */ |
GLfloat dy; /* Y(v1) - Y(v0) */ |
GLfixed fdxdy; /* dx/dy in fixed-point */ |
GLfixed fsx; /* first sample point x coord */ |
GLfixed fsy; |
GLfloat adjy; /* adjust from v[0]->fy to fsy, scaled */ |
GLint lines; /* number of lines to be sampled on this edge */ |
GLfixed fx0; /* fixed pt X of lower endpoint */ |
} EdgeT; |
#ifdef INTERP_Z |
const GLint depthBits = ctx->Visual.depthBits; |
const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; |
const GLfloat maxDepth = ctx->DepthMaxF; |
#define FixedToDepth(F) ((F) >> fixedToDepthShift) |
#endif |
EdgeT eMaj, eTop, eBot; |
GLfloat oneOverArea; |
const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */ |
float bf = SWRAST_CONTEXT(ctx)->_backface_sign; |
const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */ |
GLfixed vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; |
struct sw_span span; |
INIT_SPAN(span, GL_POLYGON, 0, 0, 0); |
#ifdef INTERP_Z |
(void) fixedToDepthShift; |
#endif |
/* |
printf("%s()\n", __FUNCTION__); |
printf(" %g, %g, %g\n", v0->win[0], v0->win[1], v0->win[2]); |
printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]); |
printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]); |
*/ |
/* Compute fixed point x,y coords w/ half-pixel offsets and snapping. |
* And find the order of the 3 vertices along the Y axis. |
*/ |
{ |
const GLfixed fy0 = FloatToFixed(v0->win[1] - 0.5F) & snapMask; |
const GLfixed fy1 = FloatToFixed(v1->win[1] - 0.5F) & snapMask; |
const GLfixed fy2 = FloatToFixed(v2->win[1] - 0.5F) & snapMask; |
if (fy0 <= fy1) { |
if (fy1 <= fy2) { |
/* y0 <= y1 <= y2 */ |
vMin = v0; vMid = v1; vMax = v2; |
vMin_fy = fy0; vMid_fy = fy1; vMax_fy = fy2; |
} |
else if (fy2 <= fy0) { |
/* y2 <= y0 <= y1 */ |
vMin = v2; vMid = v0; vMax = v1; |
vMin_fy = fy2; vMid_fy = fy0; vMax_fy = fy1; |
} |
else { |
/* y0 <= y2 <= y1 */ |
vMin = v0; vMid = v2; vMax = v1; |
vMin_fy = fy0; vMid_fy = fy2; vMax_fy = fy1; |
bf = -bf; |
} |
} |
else { |
if (fy0 <= fy2) { |
/* y1 <= y0 <= y2 */ |
vMin = v1; vMid = v0; vMax = v2; |
vMin_fy = fy1; vMid_fy = fy0; vMax_fy = fy2; |
bf = -bf; |
} |
else if (fy2 <= fy1) { |
/* y2 <= y1 <= y0 */ |
vMin = v2; vMid = v1; vMax = v0; |
vMin_fy = fy2; vMid_fy = fy1; vMax_fy = fy0; |
bf = -bf; |
} |
else { |
/* y1 <= y2 <= y0 */ |
vMin = v1; vMid = v2; vMax = v0; |
vMin_fy = fy1; vMid_fy = fy2; vMax_fy = fy0; |
} |
} |
/* fixed point X coords */ |
vMin_fx = FloatToFixed(vMin->win[0] + 0.5F) & snapMask; |
vMid_fx = FloatToFixed(vMid->win[0] + 0.5F) & snapMask; |
vMax_fx = FloatToFixed(vMax->win[0] + 0.5F) & snapMask; |
} |
/* vertex/edge relationship */ |
eMaj.v0 = vMin; eMaj.v1 = vMax; /*TODO: .v1's not needed */ |
eTop.v0 = vMid; eTop.v1 = vMax; |
eBot.v0 = vMin; eBot.v1 = vMid; |
/* compute deltas for each edge: vertex[upper] - vertex[lower] */ |
eMaj.dx = FixedToFloat(vMax_fx - vMin_fx); |
eMaj.dy = FixedToFloat(vMax_fy - vMin_fy); |
eTop.dx = FixedToFloat(vMax_fx - vMid_fx); |
eTop.dy = FixedToFloat(vMax_fy - vMid_fy); |
eBot.dx = FixedToFloat(vMid_fx - vMin_fx); |
eBot.dy = FixedToFloat(vMid_fy - vMin_fy); |
/* compute area, oneOverArea and perform backface culling */ |
{ |
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; |
/* Do backface culling */ |
if (area * bf < 0.0) |
return; |
if (IS_INF_OR_NAN(area) || area == 0.0F) |
return; |
oneOverArea = 1.0F / area; |
} |
#ifndef DO_OCCLUSION_TEST |
ctx->OcclusionResult = GL_TRUE; |
#endif |
span.facing = ctx->_Facing; /* for 2-sided stencil test */ |
/* Edge setup. For a triangle strip these could be reused... */ |
{ |
eMaj.fsy = FixedCeil(vMin_fy); |
eMaj.lines = FixedToInt(FixedCeil(vMax_fy - eMaj.fsy)); |
if (eMaj.lines > 0) { |
GLfloat dxdy = eMaj.dx / eMaj.dy; |
eMaj.fdxdy = SignedFloatToFixed(dxdy); |
eMaj.adjy = (GLfloat) (eMaj.fsy - vMin_fy); /* SCALED! */ |
eMaj.fx0 = vMin_fx; |
eMaj.fsx = eMaj.fx0 + (GLfixed) (eMaj.adjy * dxdy); |
} |
else { |
return; /*CULLED*/ |
} |
eTop.fsy = FixedCeil(vMid_fy); |
eTop.lines = FixedToInt(FixedCeil(vMax_fy - eTop.fsy)); |
if (eTop.lines > 0) { |
GLfloat dxdy = eTop.dx / eTop.dy; |
eTop.fdxdy = SignedFloatToFixed(dxdy); |
eTop.adjy = (GLfloat) (eTop.fsy - vMid_fy); /* SCALED! */ |
eTop.fx0 = vMid_fx; |
eTop.fsx = eTop.fx0 + (GLfixed) (eTop.adjy * dxdy); |
} |
eBot.fsy = FixedCeil(vMin_fy); |
eBot.lines = FixedToInt(FixedCeil(vMid_fy - eBot.fsy)); |
if (eBot.lines > 0) { |
GLfloat dxdy = eBot.dx / eBot.dy; |
eBot.fdxdy = SignedFloatToFixed(dxdy); |
eBot.adjy = (GLfloat) (eBot.fsy - vMin_fy); /* SCALED! */ |
eBot.fx0 = vMin_fx; |
eBot.fsx = eBot.fx0 + (GLfixed) (eBot.adjy * dxdy); |
} |
} |
/* |
* Conceptually, we view a triangle as two subtriangles |
* separated by a perfectly horizontal line. The edge that is |
* intersected by this line is one with maximal absolute dy; we |
* call it a ``major'' edge. The other two edges are the |
* ``top'' edge (for the upper subtriangle) and the ``bottom'' |
* edge (for the lower subtriangle). If either of these two |
* edges is horizontal or very close to horizontal, the |
* corresponding subtriangle might cover zero sample points; |
* we take care to handle such cases, for performance as well |
* as correctness. |
* |
* By stepping rasterization parameters along the major edge, |
* we can avoid recomputing them at the discontinuity where |
* the top and bottom edges meet. However, this forces us to |
* be able to scan both left-to-right and right-to-left. |
* Also, we must determine whether the major edge is at the |
* left or right side of the triangle. We do this by |
* computing the magnitude of the cross-product of the major |
* and top edges. Since this magnitude depends on the sine of |
* the angle between the two edges, its sign tells us whether |
* we turn to the left or to the right when travelling along |
* the major edge to the top edge, and from this we infer |
* whether the major edge is on the left or the right. |
* |
* Serendipitously, this cross-product magnitude is also a |
* value we need to compute the iteration parameter |
* derivatives for the triangle, and it can be used to perform |
* backface culling because its sign tells us whether the |
* triangle is clockwise or counterclockwise. In this code we |
* refer to it as ``area'' because it's also proportional to |
* the pixel area of the triangle. |
*/ |
{ |
GLint scan_from_left_to_right; /* true if scanning left-to-right */ |
#ifdef INTERP_Z |
GLfloat dzdx, dzdy; |
#endif |
#ifdef INTERP_FOG |
GLfloat dfogdy; |
#endif |
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA) |
GLfloat drdx, drdy; |
GLfloat dgdx, dgdy; |
GLfloat dbdx, dbdy; |
#endif |
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA) |
GLfloat dadx, dady; |
#endif |
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC) |
GLfloat dsrdx, dsrdy; |
GLfloat dsgdx, dsgdy; |
GLfloat dsbdx, dsbdy; |
#endif |
#ifdef INTERP_INDEX |
GLfloat didx, didy; |
#endif |
#ifdef INTERP_INT_TEX |
GLfloat dsdx, dsdy; |
GLfloat dtdx, dtdy; |
#endif |
#ifdef INTERP_TEX |
GLfloat dsdx, dsdy; |
GLfloat dtdx, dtdy; |
GLfloat dudx, dudy; |
GLfloat dvdx, dvdy; |
#endif |
#ifdef INTERP_MULTITEX |
GLfloat dsdx[MAX_TEXTURE_UNITS], dsdy[MAX_TEXTURE_UNITS]; |
GLfloat dtdx[MAX_TEXTURE_UNITS], dtdy[MAX_TEXTURE_UNITS]; |
GLfloat dudx[MAX_TEXTURE_UNITS], dudy[MAX_TEXTURE_UNITS]; |
GLfloat dvdx[MAX_TEXTURE_UNITS], dvdy[MAX_TEXTURE_UNITS]; |
#endif |
/* |
* Execute user-supplied setup code |
*/ |
#ifdef SETUP_CODE |
SETUP_CODE |
#endif |
scan_from_left_to_right = (oneOverArea < 0.0F); |
/* compute d?/dx and d?/dy derivatives */ |
#ifdef INTERP_Z |
span.interpMask |= SPAN_Z; |
{ |
GLfloat eMaj_dz, eBot_dz; |
eMaj_dz = vMax->win[2] - vMin->win[2]; |
eBot_dz = vMid->win[2] - vMin->win[2]; |
dzdx = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); |
if (dzdx > maxDepth || dzdx < -maxDepth) { |
/* probably a sliver triangle */ |
dzdx = 0.0; |
dzdy = 0.0; |
} |
else { |
dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); |
} |
if (depthBits <= 16) |
span.zStep = SignedFloatToFixed(dzdx); |
else |
span.zStep = (GLint) dzdx; |
} |
#endif |
#ifdef INTERP_FOG |
span.interpMask |= SPAN_FOG; |
{ |
const GLfloat eMaj_dfog = vMax->fog - vMin->fog; |
const GLfloat eBot_dfog = vMid->fog - vMin->fog; |
span.fogStep = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog); |
dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx); |
} |
#endif |
#ifdef INTERP_RGB |
span.interpMask |= SPAN_RGBA; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
GLfloat eMaj_dr, eBot_dr; |
GLfloat eMaj_dg, eBot_dg; |
GLfloat eMaj_db, eBot_db; |
# ifdef INTERP_ALPHA |
GLfloat eMaj_da, eBot_da; |
# endif |
eMaj_dr = (GLfloat) ((GLint) vMax->color[RCOMP] - |
(GLint) vMin->color[RCOMP]); |
eBot_dr = (GLfloat) ((GLint) vMid->color[RCOMP] - |
(GLint) vMin->color[RCOMP]); |
drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); |
span.redStep = SignedFloatToFixed(drdx); |
drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); |
eMaj_dg = (GLfloat) ((GLint) vMax->color[GCOMP] - |
(GLint) vMin->color[GCOMP]); |
eBot_dg = (GLfloat) ((GLint) vMid->color[GCOMP] - |
(GLint) vMin->color[GCOMP]); |
dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); |
span.greenStep = SignedFloatToFixed(dgdx); |
dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); |
eMaj_db = (GLfloat) ((GLint) vMax->color[BCOMP] - |
(GLint) vMin->color[BCOMP]); |
eBot_db = (GLfloat) ((GLint) vMid->color[BCOMP] - |
(GLint) vMin->color[BCOMP]); |
dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); |
span.blueStep = SignedFloatToFixed(dbdx); |
dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); |
# ifdef INTERP_ALPHA |
eMaj_da = (GLfloat) ((GLint) vMax->color[ACOMP] - |
(GLint) vMin->color[ACOMP]); |
eBot_da = (GLfloat) ((GLint) vMid->color[ACOMP] - |
(GLint) vMin->color[ACOMP]); |
dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); |
span.alphaStep = SignedFloatToFixed(dadx); |
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); |
# endif |
} |
else { |
ASSERT (ctx->Light.ShadeModel == GL_FLAT); |
span.interpMask |= SPAN_FLAT; |
drdx = drdy = 0.0F; |
dgdx = dgdy = 0.0F; |
dbdx = dbdy = 0.0F; |
span.redStep = 0; |
span.greenStep = 0; |
span.blueStep = 0; |
# ifdef INTERP_ALPHA |
dadx = dady = 0.0F; |
span.alphaStep = 0; |
# endif |
} |
#endif |
#ifdef INTERP_FLOAT_RGBA |
span.interpMask |= SPAN_RGBA; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
GLfloat eMaj_dr, eBot_dr; |
GLfloat eMaj_dg, eBot_dg; |
GLfloat eMaj_db, eBot_db; |
GLfloat eMaj_da, eBot_da; |
eMaj_dr = vMax->color[RCOMP] - vMin->color[RCOMP]; |
eBot_dr = vMid->color[RCOMP] - vMin->color[RCOMP]; |
drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); |
span.redStep = drdx; |
drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); |
eMaj_dg = vMax->color[GCOMP] - vMin->color[GCOMP]; |
eBot_dg = vMid->color[GCOMP] - vMin->color[GCOMP]; |
dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); |
span.greenStep = dgdx; |
dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); |
eMaj_db = vMax->color[BCOMP] - vMin->color[BCOMP]; |
eBot_db = vMid->color[BCOMP] - vMin->color[BCOMP]; |
dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); |
span.blueStep = dbdx; |
dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); |
eMaj_da = vMax->color[ACOMP] - vMin->color[ACOMP]; |
eBot_da = vMid->color[ACOMP] - vMin->color[ACOMP]; |
dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); |
span.alphaStep = dadx; |
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); |
} |
else { |
drdx = drdy = span.redStep = 0.0F; |
dgdx = dgdy = span.greenStep = 0.0F; |
dbdx = dbdy = span.blueStep = 0.0F; |
dadx = dady = span.alphaStep = 0.0F; |
} |
#endif |
#ifdef INTERP_SPEC |
span.interpMask |= SPAN_SPEC; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
GLfloat eMaj_dsr, eBot_dsr; |
GLfloat eMaj_dsg, eBot_dsg; |
GLfloat eMaj_dsb, eBot_dsb; |
eMaj_dsr = (GLfloat) ((GLint) vMax->specular[RCOMP] - |
(GLint) vMin->specular[RCOMP]); |
eBot_dsr = (GLfloat) ((GLint) vMid->specular[RCOMP] - |
(GLint) vMin->specular[RCOMP]); |
dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); |
span.specRedStep = SignedFloatToFixed(dsrdx); |
dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); |
eMaj_dsg = (GLfloat) ((GLint) vMax->specular[GCOMP] - |
(GLint) vMin->specular[GCOMP]); |
eBot_dsg = (GLfloat) ((GLint) vMid->specular[GCOMP] - |
(GLint) vMin->specular[GCOMP]); |
dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); |
span.specGreenStep = SignedFloatToFixed(dsgdx); |
dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); |
eMaj_dsb = (GLfloat) ((GLint) vMax->specular[BCOMP] - |
(GLint) vMin->specular[BCOMP]); |
eBot_dsb = (GLfloat) ((GLint) vMid->specular[BCOMP] - |
(GLint) vMin->specular[BCOMP]); |
dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); |
span.specBlueStep = SignedFloatToFixed(dsbdx); |
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); |
} |
else { |
dsrdx = dsrdy = 0.0F; |
dsgdx = dsgdy = 0.0F; |
dsbdx = dsbdy = 0.0F; |
span.specRedStep = 0; |
span.specGreenStep = 0; |
span.specBlueStep = 0; |
} |
#endif |
#ifdef INTERP_FLOAT_SPEC |
span.interpMask |= SPAN_SPEC; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
GLfloat eMaj_dsr, eBot_dsr; |
GLfloat eMaj_dsg, eBot_dsg; |
GLfloat eMaj_dsb, eBot_dsb; |
eMaj_dsr = vMax->specular[RCOMP] - vMin->specular[RCOMP]; |
eBot_dsr = vMid->specular[RCOMP] - vMin->specular[RCOMP]; |
dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); |
span.specRedStep = dsrdx; |
dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); |
eMaj_dsg = vMax->specular[GCOMP] - vMin->specular[GCOMP]; |
eBot_dsg = vMid->specular[GCOMP] - vMin->specular[GCOMP]; |
dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); |
span.specGreenStep = dsgdx; |
dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); |
eMaj_dsb = vMax->specular[BCOMP] - vMin->specular[BCOMP]; |
eBot_dsb = vMid->specular[BCOMP] - vMin->specular[BCOMP]; |
dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); |
span.specBlueStep = dsbdx; |
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); |
} |
else { |
dsrdx = dsrdy = span.specRedStep = 0; |
dsgdx = dsgdy = span.specGreenStep = 0; |
dsbdx = dsbdy = span.specBlueStep = 0; |
} |
#endif |
#ifdef INTERP_INDEX |
span.interpMask |= SPAN_INDEX; |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
GLfloat eMaj_di, eBot_di; |
eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index); |
eBot_di = (GLfloat) ((GLint) vMid->index - (GLint) vMin->index); |
didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di); |
span.indexStep = SignedFloatToFixed(didx); |
didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx); |
} |
else { |
span.interpMask |= SPAN_FLAT; |
didx = didy = 0.0F; |
span.indexStep = 0; |
} |
#endif |
#ifdef INTERP_INT_TEX |
span.interpMask |= SPAN_INT_TEXTURE; |
{ |
GLfloat eMaj_ds, eBot_ds; |
eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; |
eBot_ds = (vMid->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; |
dsdx = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); |
span.intTexStep[0] = SignedFloatToFixed(dsdx); |
dsdy = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); |
} |
{ |
GLfloat eMaj_dt, eBot_dt; |
eMaj_dt = (vMax->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; |
eBot_dt = (vMid->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; |
dtdx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); |
span.intTexStep[1] = SignedFloatToFixed(dtdx); |
dtdy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); |
} |
#endif |
#ifdef INTERP_TEX |
span.interpMask |= SPAN_TEXTURE; |
{ |
GLfloat wMax = vMax->win[3]; |
GLfloat wMin = vMin->win[3]; |
GLfloat wMid = vMid->win[3]; |
GLfloat eMaj_ds, eBot_ds; |
GLfloat eMaj_dt, eBot_dt; |
GLfloat eMaj_du, eBot_du; |
GLfloat eMaj_dv, eBot_dv; |
eMaj_ds = vMax->texcoord[0][0] * wMax - vMin->texcoord[0][0] * wMin; |
eBot_ds = vMid->texcoord[0][0] * wMid - vMin->texcoord[0][0] * wMin; |
dsdx = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); |
dsdy = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); |
span.texStepX[0][0] = dsdx; |
span.texStepY[0][0] = dsdy; |
eMaj_dt = vMax->texcoord[0][1] * wMax - vMin->texcoord[0][1] * wMin; |
eBot_dt = vMid->texcoord[0][1] * wMid - vMin->texcoord[0][1] * wMin; |
dtdx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); |
dtdy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); |
span.texStepX[0][1] = dtdx; |
span.texStepY[0][1] = dtdy; |
eMaj_du = vMax->texcoord[0][2] * wMax - vMin->texcoord[0][2] * wMin; |
eBot_du = vMid->texcoord[0][2] * wMid - vMin->texcoord[0][2] * wMin; |
dudx = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); |
dudy = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); |
span.texStepX[0][2] = dudx; |
span.texStepY[0][2] = dudy; |
eMaj_dv = vMax->texcoord[0][3] * wMax - vMin->texcoord[0][3] * wMin; |
eBot_dv = vMid->texcoord[0][3] * wMid - vMin->texcoord[0][3] * wMin; |
dvdx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); |
dvdy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); |
span.texStepX[0][3] = dvdx; |
span.texStepY[0][3] = dvdy; |
} |
#endif |
#ifdef INTERP_MULTITEX |
span.interpMask |= SPAN_TEXTURE; |
{ |
GLfloat wMax = vMax->win[3]; |
GLfloat wMin = vMin->win[3]; |
GLfloat wMid = vMid->win[3]; |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
GLfloat eMaj_ds, eBot_ds; |
GLfloat eMaj_dt, eBot_dt; |
GLfloat eMaj_du, eBot_du; |
GLfloat eMaj_dv, eBot_dv; |
eMaj_ds = vMax->texcoord[u][0] * wMax |
- vMin->texcoord[u][0] * wMin; |
eBot_ds = vMid->texcoord[u][0] * wMid |
- vMin->texcoord[u][0] * wMin; |
dsdx[u] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); |
dsdy[u] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); |
span.texStepX[u][0] = dsdx[u]; |
span.texStepY[u][0] = dsdy[u]; |
eMaj_dt = vMax->texcoord[u][1] * wMax |
- vMin->texcoord[u][1] * wMin; |
eBot_dt = vMid->texcoord[u][1] * wMid |
- vMin->texcoord[u][1] * wMin; |
dtdx[u] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); |
dtdy[u] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); |
span.texStepX[u][1] = dtdx[u]; |
span.texStepY[u][1] = dtdy[u]; |
eMaj_du = vMax->texcoord[u][2] * wMax |
- vMin->texcoord[u][2] * wMin; |
eBot_du = vMid->texcoord[u][2] * wMid |
- vMin->texcoord[u][2] * wMin; |
dudx[u] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); |
dudy[u] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); |
span.texStepX[u][2] = dudx[u]; |
span.texStepY[u][2] = dudy[u]; |
eMaj_dv = vMax->texcoord[u][3] * wMax |
- vMin->texcoord[u][3] * wMin; |
eBot_dv = vMid->texcoord[u][3] * wMid |
- vMin->texcoord[u][3] * wMin; |
dvdx[u] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); |
dvdy[u] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); |
span.texStepX[u][3] = dvdx[u]; |
span.texStepY[u][3] = dvdy[u]; |
} |
} |
} |
#endif |
/* |
* We always sample at pixel centers. However, we avoid |
* explicit half-pixel offsets in this code by incorporating |
* the proper offset in each of x and y during the |
* transformation to window coordinates. |
* |
* We also apply the usual rasterization rules to prevent |
* cracks and overlaps. A pixel is considered inside a |
* subtriangle if it meets all of four conditions: it is on or |
* to the right of the left edge, strictly to the left of the |
* right edge, on or below the top edge, and strictly above |
* the bottom edge. (Some edges may be degenerate.) |
* |
* The following discussion assumes left-to-right scanning |
* (that is, the major edge is on the left); the right-to-left |
* case is a straightforward variation. |
* |
* We start by finding the half-integral y coordinate that is |
* at or below the top of the triangle. This gives us the |
* first scan line that could possibly contain pixels that are |
* inside the triangle. |
* |
* Next we creep down the major edge until we reach that y, |
* and compute the corresponding x coordinate on the edge. |
* Then we find the half-integral x that lies on or just |
* inside the edge. This is the first pixel that might lie in |
* the interior of the triangle. (We won't know for sure |
* until we check the other edges.) |
* |
* As we rasterize the triangle, we'll step down the major |
* edge. For each step in y, we'll move an integer number |
* of steps in x. There are two possible x step sizes, which |
* we'll call the ``inner'' step (guaranteed to land on the |
* edge or inside it) and the ``outer'' step (guaranteed to |
* land on the edge or outside it). The inner and outer steps |
* differ by one. During rasterization we maintain an error |
* term that indicates our distance from the true edge, and |
* select either the inner step or the outer step, whichever |
* gets us to the first pixel that falls inside the triangle. |
* |
* All parameters (z, red, etc.) as well as the buffer |
* addresses for color and z have inner and outer step values, |
* so that we can increment them appropriately. This method |
* eliminates the need to adjust parameters by creeping a |
* sub-pixel amount into the triangle at each scanline. |
*/ |
{ |
int subTriangle; |
GLfixed fx; |
GLfixed fxLeftEdge = 0, fxRightEdge = 0; |
GLfixed fdxLeftEdge = 0, fdxRightEdge = 0; |
GLfixed fdxOuter; |
int idxOuter; |
float dxOuter; |
GLfixed fError = 0, fdError = 0; |
float adjx, adjy; |
GLfixed fy; |
#ifdef PIXEL_ADDRESS |
PIXEL_TYPE *pRow = NULL; |
int dPRowOuter = 0, dPRowInner; /* offset in bytes */ |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
DEPTH_TYPE *zRow = NULL; |
int dZRowOuter = 0, dZRowInner; /* offset in bytes */ |
# endif |
GLfixed fz = 0, fdzOuter = 0, fdzInner; |
#endif |
#ifdef INTERP_FOG |
GLfloat fogLeft = 0, dfogOuter = 0, dfogInner; |
#endif |
#ifdef INTERP_RGB |
GLfixed fr = 0, fdrOuter = 0, fdrInner; |
GLfixed fg = 0, fdgOuter = 0, fdgInner; |
GLfixed fb = 0, fdbOuter = 0, fdbInner; |
#endif |
#ifdef INTERP_ALPHA |
GLfixed fa = 0, fdaOuter = 0, fdaInner; |
#endif |
#ifdef INTERP_FLOAT_RGBA |
GLfloat fr, fdrOuter, fdrInner; |
GLfloat fg, fdgOuter, fdgInner; |
GLfloat fb, fdbOuter, fdbInner; |
GLfloat fa, fdaOuter, fdaInner; |
#endif |
#ifdef INTERP_SPEC |
GLfixed fsr=0, fdsrOuter=0, fdsrInner; |
GLfixed fsg=0, fdsgOuter=0, fdsgInner; |
GLfixed fsb=0, fdsbOuter=0, fdsbInner; |
#endif |
#ifdef INTERP_FLOAT_SPEC |
GLfloat fsr=0, fdsrOuter=0, fdsrInner; |
GLfloat fsg=0, fdsgOuter=0, fdsgInner; |
GLfloat fsb=0, fdsbOuter=0, fdsbInner; |
#endif |
#ifdef INTERP_INDEX |
GLfixed fi=0, fdiOuter=0, fdiInner; |
#endif |
#ifdef INTERP_INT_TEX |
GLfixed fs=0, fdsOuter=0, fdsInner; |
GLfixed ft=0, fdtOuter=0, fdtInner; |
#endif |
#ifdef INTERP_TEX |
GLfloat sLeft=0, dsOuter=0, dsInner; |
GLfloat tLeft=0, dtOuter=0, dtInner; |
GLfloat uLeft=0, duOuter=0, duInner; |
GLfloat vLeft=0, dvOuter=0, dvInner; |
#endif |
#ifdef INTERP_MULTITEX |
GLfloat sLeft[MAX_TEXTURE_UNITS]; |
GLfloat tLeft[MAX_TEXTURE_UNITS]; |
GLfloat uLeft[MAX_TEXTURE_UNITS]; |
GLfloat vLeft[MAX_TEXTURE_UNITS]; |
GLfloat dsOuter[MAX_TEXTURE_UNITS], dsInner[MAX_TEXTURE_UNITS]; |
GLfloat dtOuter[MAX_TEXTURE_UNITS], dtInner[MAX_TEXTURE_UNITS]; |
GLfloat duOuter[MAX_TEXTURE_UNITS], duInner[MAX_TEXTURE_UNITS]; |
GLfloat dvOuter[MAX_TEXTURE_UNITS], dvInner[MAX_TEXTURE_UNITS]; |
#endif |
for (subTriangle=0; subTriangle<=1; subTriangle++) { |
EdgeT *eLeft, *eRight; |
int setupLeft, setupRight; |
int lines; |
if (subTriangle==0) { |
/* bottom half */ |
if (scan_from_left_to_right) { |
eLeft = &eMaj; |
eRight = &eBot; |
lines = eRight->lines; |
setupLeft = 1; |
setupRight = 1; |
} |
else { |
eLeft = &eBot; |
eRight = &eMaj; |
lines = eLeft->lines; |
setupLeft = 1; |
setupRight = 1; |
} |
} |
else { |
/* top half */ |
if (scan_from_left_to_right) { |
eLeft = &eMaj; |
eRight = &eTop; |
lines = eRight->lines; |
setupLeft = 0; |
setupRight = 1; |
} |
else { |
eLeft = &eTop; |
eRight = &eMaj; |
lines = eLeft->lines; |
setupLeft = 1; |
setupRight = 0; |
} |
if (lines == 0) |
return; |
} |
if (setupLeft && eLeft->lines > 0) { |
const SWvertex *vLower; |
GLfixed fsx = eLeft->fsx; |
fx = FixedCeil(fsx); |
fError = fx - fsx - FIXED_ONE; |
fxLeftEdge = fsx - FIXED_EPSILON; |
fdxLeftEdge = eLeft->fdxdy; |
fdxOuter = FixedFloor(fdxLeftEdge - FIXED_EPSILON); |
fdError = fdxOuter - fdxLeftEdge + FIXED_ONE; |
idxOuter = FixedToInt(fdxOuter); |
dxOuter = (float) idxOuter; |
(void) dxOuter; |
fy = eLeft->fsy; |
span.y = FixedToInt(fy); |
adjx = (float)(fx - eLeft->fx0); /* SCALED! */ |
adjy = eLeft->adjy; /* SCALED! */ |
(void) adjx; /* silence compiler warnings */ |
(void) adjy; /* silence compiler warnings */ |
vLower = eLeft->v0; |
(void) vLower; /* silence compiler warnings */ |
#ifdef PIXEL_ADDRESS |
{ |
pRow = (PIXEL_TYPE *) PIXEL_ADDRESS(FixedToInt(fxLeftEdge), span.y); |
dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE); |
/* negative because Y=0 at bottom and increases upward */ |
} |
#endif |
/* |
* Now we need the set of parameter (z, color, etc.) values at |
* the point (fx, fy). This gives us properly-sampled parameter |
* values that we can step from pixel to pixel. Furthermore, |
* although we might have intermediate results that overflow |
* the normal parameter range when we step temporarily outside |
* the triangle, we shouldn't overflow or underflow for any |
* pixel that's actually inside the triangle. |
*/ |
#ifdef INTERP_Z |
{ |
GLfloat z0 = vLower->win[2]; |
if (depthBits <= 16) { |
/* interpolate fixed-pt values */ |
GLfloat tmp = (z0 * FIXED_SCALE + |
dzdx * adjx + dzdy * adjy) + FIXED_HALF; |
if (tmp < MAX_GLUINT / 2) |
fz = (GLfixed) tmp; |
else |
fz = MAX_GLUINT / 2; |
fdzOuter = SignedFloatToFixed(dzdy + dxOuter * dzdx); |
} |
else { |
/* interpolate depth values exactly */ |
fz = (GLint) (z0 + dzdx * FixedToFloat(adjx) |
+ dzdy * FixedToFloat(adjy)); |
fdzOuter = (GLint) (dzdy + dxOuter * dzdx); |
} |
# ifdef DEPTH_TYPE |
zRow = (DEPTH_TYPE *) |
_mesa_zbuffer_address(ctx, FixedToInt(fxLeftEdge), span.y); |
dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE); |
# endif |
} |
#endif |
#ifdef INTERP_FOG |
fogLeft = vLower->fog + (span.fogStep * adjx + dfogdy * adjy) |
* (1.0F/FIXED_SCALE); |
dfogOuter = dfogdy + dxOuter * span.fogStep; |
#endif |
#ifdef INTERP_RGB |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
fr = (GLfixed) (ChanToFixed(vLower->color[RCOMP]) |
+ drdx * adjx + drdy * adjy) + FIXED_HALF; |
fdrOuter = SignedFloatToFixed(drdy + dxOuter * drdx); |
fg = (GLfixed) (ChanToFixed(vLower->color[GCOMP]) |
+ dgdx * adjx + dgdy * adjy) + FIXED_HALF; |
fdgOuter = SignedFloatToFixed(dgdy + dxOuter * dgdx); |
fb = (GLfixed) (ChanToFixed(vLower->color[BCOMP]) |
+ dbdx * adjx + dbdy * adjy) + FIXED_HALF; |
fdbOuter = SignedFloatToFixed(dbdy + dxOuter * dbdx); |
# ifdef INTERP_ALPHA |
fa = (GLfixed) (ChanToFixed(vLower->color[ACOMP]) |
+ dadx * adjx + dady * adjy) + FIXED_HALF; |
fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx); |
# endif |
} |
else { |
ASSERT (ctx->Light.ShadeModel == GL_FLAT); |
fr = ChanToFixed(v2->color[RCOMP]); |
fg = ChanToFixed(v2->color[GCOMP]); |
fb = ChanToFixed(v2->color[BCOMP]); |
fdrOuter = fdgOuter = fdbOuter = 0; |
# ifdef INTERP_ALPHA |
fa = ChanToFixed(v2->color[ACOMP]); |
fdaOuter = 0; |
# endif |
} |
#endif |
#ifdef INTERP_FLOAT_RGBA |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
fr = vLower->color[RCOMP] |
+ (drdx * adjx + drdy * adjy) * (1.0F / FIXED_SCALE); |
fdrOuter = drdy + dxOuter * drdx; |
fg = vLower->color[GCOMP] |
+ (dgdx * adjx + dgdy * adjy) * (1.0F / FIXED_SCALE); |
fdgOuter = dgdy + dxOuter * dgdx; |
fb = vLower->color[BCOMP] |
+ (dbdx * adjx + dbdy * adjy) * (1.0F / FIXED_SCALE); |
fdbOuter = dbdy + dxOuter * dbdx; |
fa = vLower->color[ACOMP] |
+ (dadx * adjx + dady * adjy) * (1.0F / FIXED_SCALE); |
fdaOuter = dady + dxOuter * dadx; |
} |
else { |
fr = v2->color[RCOMP]; |
fg = v2->color[GCOMP]; |
fb = v2->color[BCOMP]; |
fa = v2->color[ACOMP]; |
fdrOuter = fdgOuter = fdbOuter = fdaOuter = 0.0F; |
} |
#endif |
#ifdef INTERP_SPEC |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
fsr = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) |
+ dsrdx * adjx + dsrdy * adjy) + FIXED_HALF; |
fdsrOuter = SignedFloatToFixed(dsrdy + dxOuter * dsrdx); |
fsg = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) |
+ dsgdx * adjx + dsgdy * adjy) + FIXED_HALF; |
fdsgOuter = SignedFloatToFixed(dsgdy + dxOuter * dsgdx); |
fsb = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) |
+ dsbdx * adjx + dsbdy * adjy) + FIXED_HALF; |
fdsbOuter = SignedFloatToFixed(dsbdy + dxOuter * dsbdx); |
} |
else { |
fsr = ChanToFixed(v2->specular[RCOMP]); |
fsg = ChanToFixed(v2->specular[GCOMP]); |
fsb = ChanToFixed(v2->specular[BCOMP]); |
fdsrOuter = fdsgOuter = fdsbOuter = 0; |
} |
#endif |
#ifdef INTERP_FLOAT_SPEC |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
fsr = vLower->specular[RCOMP] |
+ (dsrdx * adjx + dsrdy * adjy) * (1.0F / FIXED_SCALE); |
fdsrOuter = dsrdy + dxOuter * dsrdx; |
fsg = vLower->specular[GCOMP] |
+ (dsgdx * adjx + dsgdy * adjy) * (1.0F / FIXED_SCALE); |
fdsgOuter = dsgdy + dxOuter * dsgdx; |
fsb = vLower->specular[BCOMP] |
+ (dsbdx * adjx + dsbdy * adjy) * (1.0F / FIXED_SCALE); |
fdsbOuter = dsbdy + dxOuter * dsbdx; |
} |
else { |
fsr = v2->specular[RCOMP]; |
fsg = v2->specular[GCOMP]; |
fsb = v2->specular[BCOMP]; |
fdsrOuter = fdsgOuter = fdsbOuter = 0.0F; |
} |
#endif |
#ifdef INTERP_INDEX |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
fi = (GLfixed)(vLower->index * FIXED_SCALE |
+ didx * adjx + didy * adjy) + FIXED_HALF; |
fdiOuter = SignedFloatToFixed(didy + dxOuter * didx); |
} |
else { |
fi = (GLfixed) (v2->index * FIXED_SCALE); |
fdiOuter = 0; |
} |
#endif |
#ifdef INTERP_INT_TEX |
{ |
GLfloat s0, t0; |
s0 = vLower->texcoord[0][0] * S_SCALE; |
fs = (GLfixed)(s0 * FIXED_SCALE + dsdx * adjx |
+ dsdy * adjy) + FIXED_HALF; |
fdsOuter = SignedFloatToFixed(dsdy + dxOuter * dsdx); |
t0 = vLower->texcoord[0][1] * T_SCALE; |
ft = (GLfixed)(t0 * FIXED_SCALE + dtdx * adjx |
+ dtdy * adjy) + FIXED_HALF; |
fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx); |
} |
#endif |
#ifdef INTERP_TEX |
{ |
GLfloat invW = vLower->win[3]; |
GLfloat s0, t0, u0, v0; |
s0 = vLower->texcoord[0][0] * invW; |
sLeft = s0 + (span.texStepX[0][0] * adjx + dsdy * adjy) |
* (1.0F/FIXED_SCALE); |
dsOuter = dsdy + dxOuter * span.texStepX[0][0]; |
t0 = vLower->texcoord[0][1] * invW; |
tLeft = t0 + (span.texStepX[0][1] * adjx + dtdy * adjy) |
* (1.0F/FIXED_SCALE); |
dtOuter = dtdy + dxOuter * span.texStepX[0][1]; |
u0 = vLower->texcoord[0][2] * invW; |
uLeft = u0 + (span.texStepX[0][2] * adjx + dudy * adjy) |
* (1.0F/FIXED_SCALE); |
duOuter = dudy + dxOuter * span.texStepX[0][2]; |
v0 = vLower->texcoord[0][3] * invW; |
vLeft = v0 + (span.texStepX[0][3] * adjx + dvdy * adjy) |
* (1.0F/FIXED_SCALE); |
dvOuter = dvdy + dxOuter * span.texStepX[0][3]; |
} |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
GLfloat invW = vLower->win[3]; |
GLfloat s0, t0, u0, v0; |
s0 = vLower->texcoord[u][0] * invW; |
sLeft[u] = s0 + (span.texStepX[u][0] * adjx + dsdy[u] |
* adjy) * (1.0F/FIXED_SCALE); |
dsOuter[u] = dsdy[u] + dxOuter * span.texStepX[u][0]; |
t0 = vLower->texcoord[u][1] * invW; |
tLeft[u] = t0 + (span.texStepX[u][1] * adjx + dtdy[u] |
* adjy) * (1.0F/FIXED_SCALE); |
dtOuter[u] = dtdy[u] + dxOuter * span.texStepX[u][1]; |
u0 = vLower->texcoord[u][2] * invW; |
uLeft[u] = u0 + (span.texStepX[u][2] * adjx + dudy[u] |
* adjy) * (1.0F/FIXED_SCALE); |
duOuter[u] = dudy[u] + dxOuter * span.texStepX[u][2]; |
v0 = vLower->texcoord[u][3] * invW; |
vLeft[u] = v0 + (span.texStepX[u][3] * adjx + dvdy[u] |
* adjy) * (1.0F/FIXED_SCALE); |
dvOuter[u] = dvdy[u] + dxOuter * span.texStepX[u][3]; |
} |
} |
} |
#endif |
} /*if setupLeft*/ |
if (setupRight && eRight->lines>0) { |
fxRightEdge = eRight->fsx - FIXED_EPSILON; |
fdxRightEdge = eRight->fdxdy; |
} |
if (lines==0) { |
continue; |
} |
/* Rasterize setup */ |
#ifdef PIXEL_ADDRESS |
dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE); |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE); |
# endif |
fdzInner = fdzOuter + span.zStep; |
#endif |
#ifdef INTERP_FOG |
dfogInner = dfogOuter + span.fogStep; |
#endif |
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA) |
fdrInner = fdrOuter + span.redStep; |
fdgInner = fdgOuter + span.greenStep; |
fdbInner = fdbOuter + span.blueStep; |
#endif |
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA) |
fdaInner = fdaOuter + span.alphaStep; |
#endif |
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC) |
fdsrInner = fdsrOuter + span.specRedStep; |
fdsgInner = fdsgOuter + span.specGreenStep; |
fdsbInner = fdsbOuter + span.specBlueStep; |
#endif |
#ifdef INTERP_INDEX |
fdiInner = fdiOuter + span.indexStep; |
#endif |
#ifdef INTERP_INT_TEX |
fdsInner = fdsOuter + span.intTexStep[0]; |
fdtInner = fdtOuter + span.intTexStep[1]; |
#endif |
#ifdef INTERP_TEX |
dsInner = dsOuter + span.texStepX[0][0]; |
dtInner = dtOuter + span.texStepX[0][1]; |
duInner = duOuter + span.texStepX[0][2]; |
dvInner = dvOuter + span.texStepX[0][3]; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
dsInner[u] = dsOuter[u] + span.texStepX[u][0]; |
dtInner[u] = dtOuter[u] + span.texStepX[u][1]; |
duInner[u] = duOuter[u] + span.texStepX[u][2]; |
dvInner[u] = dvOuter[u] + span.texStepX[u][3]; |
} |
} |
} |
#endif |
while (lines > 0) { |
/* initialize the span interpolants to the leftmost value */ |
/* ff = fixed-pt fragment */ |
const GLint right = FixedToInt(fxRightEdge); |
span.x = FixedToInt(fxLeftEdge); |
if (right <= span.x) |
span.end = 0; |
else |
span.end = right - span.x; |
#ifdef INTERP_Z |
span.z = fz; |
#endif |
#ifdef INTERP_FOG |
span.fog = fogLeft; |
#endif |
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA) |
span.red = fr; |
span.green = fg; |
span.blue = fb; |
#endif |
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA) |
span.alpha = fa; |
#endif |
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC) |
span.specRed = fsr; |
span.specGreen = fsg; |
span.specBlue = fsb; |
#endif |
#ifdef INTERP_INDEX |
span.index = fi; |
#endif |
#ifdef INTERP_INT_TEX |
span.intTex[0] = fs; |
span.intTex[1] = ft; |
#endif |
#ifdef INTERP_TEX |
span.tex[0][0] = sLeft; |
span.tex[0][1] = tLeft; |
span.tex[0][2] = uLeft; |
span.tex[0][3] = vLeft; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
span.tex[u][0] = sLeft[u]; |
span.tex[u][1] = tLeft[u]; |
span.tex[u][2] = uLeft[u]; |
span.tex[u][3] = vLeft[u]; |
} |
} |
} |
#endif |
#ifdef INTERP_RGB |
{ |
/* need this to accomodate round-off errors */ |
const GLint len = right - span.x - 1; |
GLfixed ffrend = span.red + len * span.redStep; |
GLfixed ffgend = span.green + len * span.greenStep; |
GLfixed ffbend = span.blue + len * span.blueStep; |
if (ffrend < 0) { |
span.red -= ffrend; |
if (span.red < 0) |
span.red = 0; |
} |
if (ffgend < 0) { |
span.green -= ffgend; |
if (span.green < 0) |
span.green = 0; |
} |
if (ffbend < 0) { |
span.blue -= ffbend; |
if (span.blue < 0) |
span.blue = 0; |
} |
} |
#endif |
#ifdef INTERP_ALPHA |
{ |
const GLint len = right - span.x - 1; |
GLfixed ffaend = span.alpha + len * span.alphaStep; |
if (ffaend < 0) { |
span.alpha -= ffaend; |
if (span.alpha < 0) |
span.alpha = 0; |
} |
} |
#endif |
#ifdef INTERP_SPEC |
{ |
/* need this to accomodate round-off errors */ |
const GLint len = right - span.x - 1; |
GLfixed ffsrend = span.specRed + len * span.specRedStep; |
GLfixed ffsgend = span.specGreen + len * span.specGreenStep; |
GLfixed ffsbend = span.specBlue + len * span.specBlueStep; |
if (ffsrend < 0) { |
span.specRed -= ffsrend; |
if (span.specRed < 0) |
span.specRed = 0; |
} |
if (ffsgend < 0) { |
span.specGreen -= ffsgend; |
if (span.specGreen < 0) |
span.specGreen = 0; |
} |
if (ffsbend < 0) { |
span.specBlue -= ffsbend; |
if (span.specBlue < 0) |
span.specBlue = 0; |
} |
} |
#endif |
#ifdef INTERP_INDEX |
if (span.index < 0) span.index = 0; |
#endif |
/* This is where we actually generate fragments */ |
if (span.end > 0) { |
RENDER_SPAN( span ); |
} |
/* |
* Advance to the next scan line. Compute the |
* new edge coordinates, and adjust the |
* pixel-center x coordinate so that it stays |
* on or inside the major edge. |
*/ |
(span.y)++; |
lines--; |
fxLeftEdge += fdxLeftEdge; |
fxRightEdge += fdxRightEdge; |
fError += fdError; |
if (fError >= 0) { |
fError -= FIXED_ONE; |
#ifdef PIXEL_ADDRESS |
pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowOuter); |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowOuter); |
# endif |
fz += fdzOuter; |
#endif |
#ifdef INTERP_FOG |
fogLeft += dfogOuter; |
#endif |
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA) |
fr += fdrOuter; |
fg += fdgOuter; |
fb += fdbOuter; |
#endif |
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA) |
fa += fdaOuter; |
#endif |
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC) |
fsr += fdsrOuter; |
fsg += fdsgOuter; |
fsb += fdsbOuter; |
#endif |
#ifdef INTERP_INDEX |
fi += fdiOuter; |
#endif |
#ifdef INTERP_INT_TEX |
fs += fdsOuter; |
ft += fdtOuter; |
#endif |
#ifdef INTERP_TEX |
sLeft += dsOuter; |
tLeft += dtOuter; |
uLeft += duOuter; |
vLeft += dvOuter; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
sLeft[u] += dsOuter[u]; |
tLeft[u] += dtOuter[u]; |
uLeft[u] += duOuter[u]; |
vLeft[u] += dvOuter[u]; |
} |
} |
} |
#endif |
} |
else { |
#ifdef PIXEL_ADDRESS |
pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowInner); |
#endif |
#ifdef INTERP_Z |
# ifdef DEPTH_TYPE |
zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowInner); |
# endif |
fz += fdzInner; |
#endif |
#ifdef INTERP_FOG |
fogLeft += dfogInner; |
#endif |
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA) |
fr += fdrInner; |
fg += fdgInner; |
fb += fdbInner; |
#endif |
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA) |
fa += fdaInner; |
#endif |
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC) |
fsr += fdsrInner; |
fsg += fdsgInner; |
fsb += fdsbInner; |
#endif |
#ifdef INTERP_INDEX |
fi += fdiInner; |
#endif |
#ifdef INTERP_INT_TEX |
fs += fdsInner; |
ft += fdtInner; |
#endif |
#ifdef INTERP_TEX |
sLeft += dsInner; |
tLeft += dtInner; |
uLeft += duInner; |
vLeft += dvInner; |
#endif |
#ifdef INTERP_MULTITEX |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
sLeft[u] += dsInner[u]; |
tLeft[u] += dtInner[u]; |
uLeft[u] += duInner[u]; |
vLeft[u] += dvInner[u]; |
} |
} |
} |
#endif |
} |
} /*while lines>0*/ |
} /* for subTriangle */ |
} |
#ifdef CLEANUP_CODE |
CLEANUP_CODE |
#endif |
} |
} |
#undef SETUP_CODE |
#undef CLEANUP_CODE |
#undef RENDER_SPAN |
#undef PIXEL_TYPE |
#undef BYTES_PER_ROW |
#undef PIXEL_ADDRESS |
#undef INTERP_Z |
#undef INTERP_FOG |
#undef INTERP_RGB |
#undef INTERP_ALPHA |
#undef INTERP_SPEC |
#undef INTERP_INDEX |
#undef INTERP_INT_TEX |
#undef INTERP_TEX |
#undef INTERP_MULTITEX |
#undef INTERP_FLOAT_RGBA |
#undef INTERP_FLOAT_SPEC |
#undef S_SCALE |
#undef T_SCALE |
#undef FixedToDepth |
#undef DO_OCCLUSION_TEST |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_context.h |
---|
0,0 → 1,236 |
/* $Id: s_context.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
/** |
* \file swrast/s_context.h |
* \brief fill in description |
* \author Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef S_CONTEXT_H |
#define S_CONTEXT_H |
#include "mtypes.h" |
#include "swrast.h" |
/* |
* For texture sampling: |
*/ |
typedef void (*TextureSampleFunc)( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ); |
/* |
* Blending function |
*/ |
#ifdef USE_MMX_ASM |
typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, |
const GLubyte mask[], |
GLchan src[][4], CONST GLchan dst[][4] ); |
#else |
typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLchan src[][4], CONST GLchan dst[][4] ); |
#endif |
typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); |
typedef void (*swrast_line_func)( GLcontext *ctx, |
const SWvertex *, const SWvertex *); |
typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, |
const SWvertex *, const SWvertex *); |
/** \defgroup Bitmasks |
* Bitmasks to indicate which rasterization options are enabled |
* (RasterMask) |
*/ |
/*@{*/ |
#define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */ |
#define BLEND_BIT 0x002 /**< Blend pixels */ |
#define DEPTH_BIT 0x004 /**< Depth-test pixels */ |
#define FOG_BIT 0x008 /**< Fog pixels */ |
#define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */ |
#define CLIP_BIT 0x020 /**< Scissor or window clip pixels */ |
#define STENCIL_BIT 0x040 /**< Stencil pixels */ |
#define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */ |
#define ALPHABUF_BIT 0x100 /**< Using software alpha buffer */ |
#define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */ |
/**< buffer or no buffers. */ |
#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */ |
#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */ |
/*@}*/ |
#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \ |
_NEW_SCISSOR| \ |
_NEW_COLOR| \ |
_NEW_DEPTH| \ |
_NEW_FOG| \ |
_NEW_STENCIL| \ |
_NEW_TEXTURE| \ |
_NEW_VIEWPORT| \ |
_NEW_DEPTH) |
/** |
* \struct SWcontext |
* \brief SWContext? |
*/ |
typedef struct |
{ |
/** Driver interface: |
*/ |
struct swrast_device_driver Driver; |
/** Configuration mechanisms to make software rasterizer match |
* characteristics of the hardware rasterizer (if present): |
*/ |
GLboolean AllowVertexFog; |
GLboolean AllowPixelFog; |
/** Derived values, invalidated on statechanges, updated from |
* _swrast_validate_derived(): |
*/ |
GLuint _RasterMask; |
GLfloat _MinMagThresh[MAX_TEXTURE_UNITS]; |
GLfloat _backface_sign; |
GLboolean _PreferPixelFog; |
GLboolean _AnyTextureCombine; |
/* Accum buffer temporaries. |
*/ |
GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ |
GLfloat _IntegerAccumScaler; /**< Implicit scale factor */ |
/* Working values: |
*/ |
GLuint StippleCounter; /**< Line stipple counter */ |
GLuint NewState; |
GLuint StateChanges; |
GLenum Primitive; /* current primitive being drawn (ala glBegin) */ |
GLuint CurrentBuffer; /* exactly one of FRONT_LEFT_BIT, BACK_LEFT_BIT, etc*/ |
/** Mechanism to allow driver (like X11) to register further |
* software rasterization routines. |
*/ |
/*@{*/ |
void (*choose_point)( GLcontext * ); |
void (*choose_line)( GLcontext * ); |
void (*choose_triangle)( GLcontext * ); |
GLuint invalidate_point; |
GLuint invalidate_line; |
GLuint invalidate_triangle; |
/*@}*/ |
/** Function pointers for dispatch behind public entrypoints. */ |
/*@{*/ |
void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); |
swrast_point_func Point; |
swrast_line_func Line; |
swrast_tri_func Triangle; |
/*@}*/ |
/** |
* Placeholders for when separate specular (or secondary color) is |
* enabled but texturing is not. |
*/ |
/*@{*/ |
swrast_point_func SpecPoint; |
swrast_line_func SpecLine; |
swrast_tri_func SpecTriangle; |
/*@}*/ |
/** |
* Typically, we'll allocate a sw_span structure as a local variable |
* and set its 'array' pointer to point to this object. The reason is |
* this object is big and causes problems when allocated on the stack |
* on some systems. |
*/ |
struct span_arrays *SpanArrays; |
/** |
* Used to buffer N GL_POINTS, instead of rendering one by one. |
*/ |
struct sw_span PointSpan; |
/** Internal hooks, kept uptodate by the same mechanism as above. |
*/ |
blend_func BlendFunc; |
TextureSampleFunc TextureSample[MAX_TEXTURE_UNITS]; |
/** Buffer for saving the sampled texture colors. |
* Needed for GL_ARB_texture_env_crossbar implementation. |
*/ |
GLchan *TexelBuffer; |
} SWcontext; |
extern void |
_swrast_validate_derived( GLcontext *ctx ); |
#define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context) |
#define RENDER_START(SWctx, GLctx) \ |
do { \ |
if ((SWctx)->Driver.SpanRenderStart) { \ |
(*(SWctx)->Driver.SpanRenderStart)(GLctx); \ |
} \ |
} while (0) |
#define RENDER_FINISH(SWctx, GLctx) \ |
do { \ |
if ((SWctx)->Driver.SpanRenderFinish) { \ |
(*(SWctx)->Driver.SpanRenderFinish)(GLctx); \ |
} \ |
} while (0) |
/* |
* XXX these macros are just bandages for now in order to make |
* CHAN_BITS==32 compile cleanly. |
* These should probably go elsewhere at some point. |
*/ |
#if CHAN_TYPE == GL_FLOAT |
#define ChanToFixed(X) (X) |
#define FixedToChan(X) (X) |
#else |
#define ChanToFixed(X) IntToFixed(X) |
#define FixedToChan(X) FixedToInt(X) |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_masking.c |
---|
0,0 → 1,192 |
/* $Id: s_masking.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Implement the effect of glColorMask and glIndexMask in software. |
*/ |
#include "glheader.h" |
#include "enums.h" |
#include "macros.h" |
#include "s_alphabuf.h" |
#include "s_context.h" |
#include "s_masking.h" |
#include "s_span.h" |
void |
_mesa_mask_rgba_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan dest[MAX_WIDTH][4]; |
#if CHAN_BITS == 8 |
GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); |
GLuint dstMask = ~srcMask; |
GLuint *rgba32 = (GLuint *) rgba; |
GLuint *dest32 = (GLuint *) dest; |
#else |
const GLboolean rMask = ctx->Color.ColorMask[RCOMP]; |
const GLboolean gMask = ctx->Color.ColorMask[GCOMP]; |
const GLboolean bMask = ctx->Color.ColorMask[BCOMP]; |
const GLboolean aMask = ctx->Color.ColorMask[ACOMP]; |
#endif |
const GLuint n = span->end; |
GLuint i; |
ASSERT(n < MAX_WIDTH); |
ASSERT(span->arrayMask & SPAN_RGBA); |
if (span->arrayMask & SPAN_XY) { |
(*swrast->Driver.ReadRGBAPixels)(ctx, n, span->array->x, span->array->y, |
dest, span->array->mask); |
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { |
_mesa_read_alpha_pixels(ctx, n, span->array->x, span->array->y, |
dest, span->array->mask); |
} |
} |
else { |
_mesa_read_rgba_span(ctx, ctx->DrawBuffer, n, span->x, span->y, dest); |
} |
#if CHAN_BITS == 8 |
for (i = 0; i < n; i++) { |
rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); |
} |
#else |
for (i = 0; i < n; i++) { |
if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; |
if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; |
if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; |
if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; |
} |
#endif |
} |
/* |
* Apply glColorMask to a span of RGBA pixels. |
*/ |
void |
_mesa_mask_rgba_array( GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLchan rgba[][4] ) |
{ |
GLchan dest[MAX_WIDTH][4]; |
GLuint i; |
#if CHAN_BITS == 8 |
GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); |
GLuint dstMask = ~srcMask; |
GLuint *rgba32 = (GLuint *) rgba; |
GLuint *dest32 = (GLuint *) dest; |
_mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); |
for (i = 0; i < n; i++) { |
rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); |
} |
#else |
const GLint rMask = ctx->Color.ColorMask[RCOMP]; |
const GLint gMask = ctx->Color.ColorMask[GCOMP]; |
const GLint bMask = ctx->Color.ColorMask[BCOMP]; |
const GLint aMask = ctx->Color.ColorMask[ACOMP]; |
_mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); |
for (i = 0; i < n; i++) { |
if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; |
if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; |
if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; |
if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; |
} |
#endif |
} |
void |
_mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span, |
GLuint index[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint msrc = ctx->Color.IndexMask; |
const GLuint mdest = ~msrc; |
GLuint fbindexes[MAX_WIDTH]; |
GLuint i; |
ASSERT(span->arrayMask & SPAN_INDEX); |
ASSERT(span->end < MAX_WIDTH); |
if (span->arrayMask & SPAN_XY) { |
(*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->array->x, |
span->array->y, fbindexes, |
span->array->mask); |
for (i = 0; i < span->end; i++) { |
index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); |
} |
} |
else { |
_mesa_read_index_span(ctx, ctx->DrawBuffer, span->end, span->x, span->y, |
fbindexes ); |
for (i = 0; i < span->end; i++) { |
index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); |
} |
} |
} |
/* |
* Apply glIndexMask to a span of CI pixels. |
*/ |
void |
_mesa_mask_index_array( GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLuint index[] ) |
{ |
GLuint i; |
GLuint fbindexes[MAX_WIDTH]; |
GLuint msrc, mdest; |
_mesa_read_index_span( ctx, ctx->DrawBuffer, n, x, y, fbindexes ); |
msrc = ctx->Color.IndexMask; |
mdest = ~msrc; |
for (i=0;i<n;i++) { |
index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_feedback.h |
---|
0,0 → 1,52 |
/* $Id: s_feedback.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_FEEDBACK_H |
#define S_FEEDBACK_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void _mesa_feedback_point( GLcontext *ctx, const SWvertex *v ); |
extern void _mesa_feedback_line( GLcontext *ctx, |
const SWvertex *v1, const SWvertex *v2 ); |
extern void _mesa_feedback_triangle( GLcontext *ctx, const SWvertex *v0, |
const SWvertex *v1, const SWvertex *v2 ); |
extern void _mesa_select_point( GLcontext *ctx, const SWvertex *v ); |
extern void _mesa_select_line( GLcontext *ctx, |
const SWvertex *v1, const SWvertex *v2 ); |
extern void _mesa_select_triangle( GLcontext *ctx, const SWvertex *v0, |
const SWvertex *v1, const SWvertex *v2 ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_copypix.c |
---|
0,0 → 1,816 |
/* $Id: s_copypix.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "convolve.h" |
#include "feedback.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "pixel.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_histogram.h" |
#include "s_pixeltex.h" |
#include "s_span.h" |
#include "s_stencil.h" |
#include "s_texture.h" |
#include "s_zoom.h" |
/* |
* Determine if there's overlap in an image copy. |
* This test also compensates for the fact that copies are done from |
* bottom to top and overlaps can sometimes be handled correctly |
* without making a temporary image copy. |
*/ |
static GLboolean |
regions_overlap(GLint srcx, GLint srcy, |
GLint dstx, GLint dsty, |
GLint width, GLint height, |
GLfloat zoomX, GLfloat zoomY) |
{ |
if (zoomX == 1.0 && zoomY == 1.0) { |
/* no zoom */ |
if (srcx >= dstx + width || (srcx + width <= dstx)) { |
return GL_FALSE; |
} |
else if (srcy < dsty) { /* this is OK */ |
return GL_FALSE; |
} |
else if (srcy > dsty + height) { |
return GL_FALSE; |
} |
else { |
return GL_TRUE; |
} |
} |
else { |
/* add one pixel of slop when zooming, just to be safe */ |
if ((srcx > dstx + (width * zoomX) + 1) || (srcx + width + 1 < dstx)) { |
return GL_FALSE; |
} |
else if ((srcy < dsty) && (srcy + height < dsty + (height * zoomY))) { |
return GL_FALSE; |
} |
else if ((srcy > dsty) && (srcy + height > dsty + (height * zoomY))) { |
return GL_FALSE; |
} |
else { |
return GL_TRUE; |
} |
} |
} |
/* |
* RGBA copypixels with convolution. |
*/ |
static void |
copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, |
GLint width, GLint height, GLint destx, GLint desty) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLboolean quick_draw; |
GLint row; |
GLboolean changeBuffer; |
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; |
const GLuint transferOps = ctx->_ImageTransferState; |
GLfloat *dest, *tmpImage, *convImage; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 |
&& !zoom |
&& destx >= 0 |
&& destx + width <= (GLint) ctx->DrawBuffer->Width) { |
quick_draw = GL_TRUE; |
} |
else { |
quick_draw = GL_FALSE; |
} |
/* If read and draw buffer are different we must do buffer switching */ |
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer |
|| ctx->DrawBuffer != ctx->ReadBuffer; |
/* allocate space for GLfloat image */ |
tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!tmpImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); |
return; |
} |
convImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!convImage) { |
FREE(tmpImage); |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); |
return; |
} |
dest = tmpImage; |
if (changeBuffer) { |
/* choose the read buffer */ |
_swrast_use_read_buffer(ctx); |
} |
/* read source image */ |
dest = tmpImage; |
for (row = 0; row < height; row++) { |
GLchan rgba[MAX_WIDTH][4]; |
GLint i; |
_mesa_read_rgba_span(ctx, ctx->ReadBuffer, width, srcx, srcy + row, rgba); |
/* convert GLchan to GLfloat */ |
for (i = 0; i < width; i++) { |
*dest++ = (GLfloat) rgba[i][RCOMP] * (1.0F / CHAN_MAXF); |
*dest++ = (GLfloat) rgba[i][GCOMP] * (1.0F / CHAN_MAXF); |
*dest++ = (GLfloat) rgba[i][BCOMP] * (1.0F / CHAN_MAXF); |
*dest++ = (GLfloat) rgba[i][ACOMP] * (1.0F / CHAN_MAXF); |
} |
} |
if (changeBuffer) { |
/* restore default src/dst buffer */ |
_swrast_use_draw_buffer(ctx); |
} |
/* do image transfer ops up until convolution */ |
for (row = 0; row < height; row++) { |
GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4); |
/* scale & bias */ |
if (transferOps & IMAGE_SCALE_BIAS_BIT) { |
_mesa_scale_and_bias_rgba(ctx, width, rgba, |
ctx->Pixel.RedScale, ctx->Pixel.GreenScale, |
ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, |
ctx->Pixel.RedBias, ctx->Pixel.GreenBias, |
ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); |
} |
/* color map lookup */ |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_rgba(ctx, width, rgba); |
} |
/* GL_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->ColorTable, width, rgba); |
} |
} |
/* do convolution */ |
if (ctx->Pixel.Convolution2DEnabled) { |
_mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); |
} |
else { |
ASSERT(ctx->Pixel.Separable2DEnabled); |
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); |
} |
FREE(tmpImage); |
/* do remaining image transfer ops */ |
for (row = 0; row < height; row++) { |
GLfloat (*rgba)[4] = (GLfloat (*)[4]) (convImage + row * width * 4); |
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, width, rgba); |
} |
/* color matrix */ |
if (transferOps & IMAGE_COLOR_MATRIX_BIT) { |
_mesa_transform_rgba(ctx, width, rgba); |
} |
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, width, rgba); |
} |
/* update histogram count */ |
if (transferOps & IMAGE_HISTOGRAM_BIT) { |
_mesa_update_histogram(ctx, width, (CONST GLfloat (*)[4]) rgba); |
} |
/* update min/max */ |
if (transferOps & IMAGE_MIN_MAX_BIT) { |
_mesa_update_minmax(ctx, width, (CONST GLfloat (*)[4]) rgba); |
} |
} |
for (row = 0; row < height; row++) { |
const GLfloat *src = convImage + row * width * 4; |
GLint i, dy; |
/* clamp to [0,1] and convert float back to chan */ |
for (i = 0; i < width; i++) { |
GLint r = (GLint) (src[i * 4 + RCOMP] * CHAN_MAXF); |
GLint g = (GLint) (src[i * 4 + GCOMP] * CHAN_MAXF); |
GLint b = (GLint) (src[i * 4 + BCOMP] * CHAN_MAXF); |
GLint a = (GLint) (src[i * 4 + ACOMP] * CHAN_MAXF); |
span.array->rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); |
span.array->rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); |
span.array->rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); |
span.array->rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); |
} |
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { |
span.end = width; |
_swrast_pixel_texture(ctx, &span); |
} |
/* write row to framebuffer */ |
dy = desty + row; |
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { |
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, |
(const GLchan (*)[4])span.array->rgba, NULL ); |
} |
else if (zoom) { |
span.x = destx; |
span.y = dy; |
span.end = width; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4])span.array->rgba, |
desty); |
} |
else { |
span.x = destx; |
span.y = dy; |
span.end = width; |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
FREE(convImage); |
} |
/* |
* RGBA copypixels |
*/ |
static void |
copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, |
GLint width, GLint height, GLint destx, GLint desty) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan *tmpImage,*p; |
GLboolean quick_draw; |
GLint sy, dy, stepy, j; |
GLboolean changeBuffer; |
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; |
GLint overlapping; |
const GLuint transferOps = ctx->_ImageTransferState; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); |
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { |
copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); |
return; |
} |
/* Determine if copy should be done bottom-to-top or top-to-bottom */ |
if (srcy < desty) { |
/* top-down max-to-min */ |
sy = srcy + height - 1; |
dy = desty + height - 1; |
stepy = -1; |
} |
else { |
/* bottom-up min-to-max */ |
sy = srcy; |
dy = desty; |
stepy = 1; |
} |
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, |
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 |
&& !zoom |
&& destx >= 0 |
&& destx + width <= (GLint) ctx->DrawBuffer->Width) { |
quick_draw = GL_TRUE; |
} |
else { |
quick_draw = GL_FALSE; |
} |
/* If read and draw buffer are different we must do buffer switching */ |
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer |
|| ctx->DrawBuffer != ctx->ReadBuffer; |
if (overlapping) { |
GLint ssy = sy; |
tmpImage = (GLchan *) MALLOC(width * height * sizeof(GLchan) * 4); |
if (!tmpImage) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); |
return; |
} |
/* setup source */ |
if (changeBuffer) |
_swrast_use_read_buffer(ctx); |
/* read the source image */ |
p = tmpImage; |
for (j = 0; j < height; j++, ssy += stepy) { |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, ssy, |
(GLchan (*)[4]) p ); |
p += width * 4; |
} |
p = tmpImage; |
/* restore dest */ |
if (changeBuffer) { |
_swrast_use_draw_buffer(ctx); |
changeBuffer = GL_FALSE; |
} |
} |
else { |
tmpImage = NULL; /* silence compiler warnings */ |
p = NULL; |
} |
for (j = 0; j < height; j++, sy += stepy, dy += stepy) { |
/* Get source pixels */ |
if (overlapping) { |
/* get from buffered image */ |
MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4); |
p += width * 4; |
} |
else { |
/* get from framebuffer */ |
if (changeBuffer) |
_swrast_use_read_buffer(ctx); |
_mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, |
span.array->rgba ); |
if (changeBuffer) |
_swrast_use_draw_buffer(ctx); |
} |
if (transferOps) { |
const GLfloat scale = (1.0F / CHAN_MAXF); |
GLint k; |
DEFMARRAY(GLfloat, rgbaFloat, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgbaFloat, return); |
/* convert chan to float */ |
for (k = 0; k < width; k++) { |
rgbaFloat[k][RCOMP] = (GLfloat) span.array->rgba[k][RCOMP] * scale; |
rgbaFloat[k][GCOMP] = (GLfloat) span.array->rgba[k][GCOMP] * scale; |
rgbaFloat[k][BCOMP] = (GLfloat) span.array->rgba[k][BCOMP] * scale; |
rgbaFloat[k][ACOMP] = (GLfloat) span.array->rgba[k][ACOMP] * scale; |
} |
/* scale & bias */ |
if (transferOps & IMAGE_SCALE_BIAS_BIT) { |
_mesa_scale_and_bias_rgba(ctx, width, rgbaFloat, |
ctx->Pixel.RedScale, ctx->Pixel.GreenScale, |
ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, |
ctx->Pixel.RedBias, ctx->Pixel.GreenBias, |
ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); |
} |
/* color map lookup */ |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_rgba(ctx, width, rgbaFloat); |
} |
/* GL_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->ColorTable, width, rgbaFloat); |
} |
/* convolution */ |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
_mesa_problem(ctx, "Convolution should not be enabled in copy_rgba_pixels()"); |
return; |
} |
/* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ |
if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { |
_mesa_scale_and_bias_rgba(ctx, width, rgbaFloat, |
ctx->Pixel.PostConvolutionScale[RCOMP], |
ctx->Pixel.PostConvolutionScale[GCOMP], |
ctx->Pixel.PostConvolutionScale[BCOMP], |
ctx->Pixel.PostConvolutionScale[ACOMP], |
ctx->Pixel.PostConvolutionBias[RCOMP], |
ctx->Pixel.PostConvolutionBias[GCOMP], |
ctx->Pixel.PostConvolutionBias[BCOMP], |
ctx->Pixel.PostConvolutionBias[ACOMP]); |
} |
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, width, rgbaFloat); |
} |
/* color matrix */ |
if (transferOps & IMAGE_COLOR_MATRIX_BIT) { |
_mesa_transform_rgba(ctx, width, rgbaFloat); |
} |
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, width, rgbaFloat); |
} |
/* update histogram count */ |
if (transferOps & IMAGE_HISTOGRAM_BIT) { |
_mesa_update_histogram(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); |
} |
/* update min/max */ |
if (transferOps & IMAGE_MIN_MAX_BIT) { |
_mesa_update_minmax(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); |
} |
/* clamp to [0,1] and convert float back to chan */ |
for (k = 0; k < width; k++) { |
GLint r = (GLint) (rgbaFloat[k][RCOMP] * CHAN_MAXF); |
GLint g = (GLint) (rgbaFloat[k][GCOMP] * CHAN_MAXF); |
GLint b = (GLint) (rgbaFloat[k][BCOMP] * CHAN_MAXF); |
GLint a = (GLint) (rgbaFloat[k][ACOMP] * CHAN_MAXF); |
span.array->rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); |
span.array->rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); |
span.array->rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); |
span.array->rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); |
} |
UNDEFARRAY(rgbaFloat); /* mac 32k limitation */ |
} |
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { |
span.end = width; |
_swrast_pixel_texture(ctx, &span); |
} |
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { |
(*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, |
(const GLchan (*)[4])span.array->rgba, NULL ); |
} |
else if (zoom) { |
span.x = destx; |
span.y = dy; |
span.end = width; |
_mesa_write_zoomed_rgba_span(ctx, &span, |
(CONST GLchan (*)[4]) span.array->rgba, |
desty); |
} |
else { |
span.x = destx; |
span.y = dy; |
span.end = width; |
_mesa_write_rgba_span(ctx, &span); |
} |
} |
if (overlapping) |
FREE(tmpImage); |
} |
static void copy_ci_pixels( GLcontext *ctx, |
GLint srcx, GLint srcy, GLint width, GLint height, |
GLint destx, GLint desty ) |
{ |
GLuint *tmpImage,*p; |
GLint sy, dy, stepy; |
GLint j; |
GLboolean changeBuffer; |
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; |
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; |
GLint overlapping; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); |
/* Determine if copy should be bottom-to-top or top-to-bottom */ |
if (srcy<desty) { |
/* top-down max-to-min */ |
sy = srcy + height - 1; |
dy = desty + height - 1; |
stepy = -1; |
} |
else { |
/* bottom-up min-to-max */ |
sy = srcy; |
dy = desty; |
stepy = 1; |
} |
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, |
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); |
if (ctx->Depth.Test) |
_mesa_span_default_z(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
/* If read and draw buffer are different we must do buffer switching */ |
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer |
|| ctx->DrawBuffer != ctx->ReadBuffer; |
if (overlapping) { |
GLint ssy = sy; |
tmpImage = (GLuint *) MALLOC(width * height * sizeof(GLuint)); |
if (!tmpImage) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); |
return; |
} |
/* setup source */ |
if (changeBuffer) |
_swrast_use_read_buffer(ctx); |
/* read the image */ |
p = tmpImage; |
for (j = 0; j < height; j++, ssy += stepy) { |
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, ssy, p ); |
p += width; |
} |
p = tmpImage; |
/* restore to draw buffer */ |
if (changeBuffer) { |
_swrast_use_draw_buffer(ctx); |
changeBuffer = GL_FALSE; |
} |
} |
else { |
tmpImage = NULL; /* silence compiler warning */ |
p = NULL; |
} |
for (j = 0; j < height; j++, sy += stepy, dy += stepy) { |
if (overlapping) { |
MEMCPY(span.array->index, p, width * sizeof(GLuint)); |
p += width; |
} |
else { |
if (changeBuffer) |
_swrast_use_read_buffer(ctx); |
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, |
span.array->index ); |
if (changeBuffer) |
_swrast_use_draw_buffer(ctx); |
} |
if (shift_or_offset) { |
_mesa_shift_and_offset_ci( ctx, width, span.array->index ); |
} |
if (ctx->Pixel.MapColorFlag) { |
_mesa_map_ci( ctx, width, span.array->index ); |
} |
span.x = destx; |
span.y = dy; |
span.end = width; |
if (zoom) |
_mesa_write_zoomed_index_span(ctx, &span, desty); |
else |
_mesa_write_index_span(ctx, &span); |
} |
if (overlapping) |
FREE(tmpImage); |
} |
/* |
* TODO: Optimize!!!! |
*/ |
static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, |
GLint width, GLint height, |
GLint destx, GLint desty ) |
{ |
GLfloat depth[MAX_WIDTH]; |
GLfloat *p, *tmpImage; |
GLint sy, dy, stepy; |
GLint i, j; |
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; |
GLint overlapping; |
struct sw_span span; |
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); |
if (!ctx->Visual.depthBits) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); |
return; |
} |
/* Determine if copy should be bottom-to-top or top-to-bottom */ |
if (srcy<desty) { |
/* top-down max-to-min */ |
sy = srcy + height - 1; |
dy = desty + height - 1; |
stepy = -1; |
} |
else { |
/* bottom-up min-to-max */ |
sy = srcy; |
dy = desty; |
stepy = 1; |
} |
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, |
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); |
_mesa_span_default_color(ctx, &span); |
if (ctx->Fog.Enabled) |
_mesa_span_default_fog(ctx, &span); |
if (overlapping) { |
GLint ssy = sy; |
tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); |
if (!tmpImage) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); |
return; |
} |
p = tmpImage; |
for (j = 0; j < height; j++, ssy += stepy) { |
_mesa_read_depth_span_float(ctx, width, srcx, ssy, p); |
p += width; |
} |
p = tmpImage; |
} |
else { |
tmpImage = NULL; /* silence compiler warning */ |
p = NULL; |
} |
for (j = 0; j < height; j++, sy += stepy, dy += stepy) { |
if (overlapping) { |
MEMCPY(depth, p, width * sizeof(GLfloat)); |
p += width; |
} |
else { |
_mesa_read_depth_span_float(ctx, width, srcx, sy, depth); |
} |
for (i = 0; i < width; i++) { |
GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; |
span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax); |
} |
span.x = destx; |
span.y = dy; |
span.end = width; |
if (ctx->Visual.rgbMode) { |
if (zoom) |
_mesa_write_zoomed_rgba_span( ctx, &span, |
(const GLchan (*)[4])span.array->rgba, |
desty ); |
else |
_mesa_write_rgba_span(ctx, &span); |
} |
else { |
if (zoom) |
_mesa_write_zoomed_index_span( ctx, &span, desty ); |
else |
_mesa_write_index_span(ctx, &span); |
} |
} |
if (overlapping) |
FREE(tmpImage); |
} |
static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, |
GLint width, GLint height, |
GLint destx, GLint desty ) |
{ |
GLint sy, dy, stepy; |
GLint j; |
GLstencil *p, *tmpImage; |
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; |
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; |
GLint overlapping; |
if (!ctx->Visual.stencilBits) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); |
return; |
} |
/* Determine if copy should be bottom-to-top or top-to-bottom */ |
if (srcy < desty) { |
/* top-down max-to-min */ |
sy = srcy + height - 1; |
dy = desty + height - 1; |
stepy = -1; |
} |
else { |
/* bottom-up min-to-max */ |
sy = srcy; |
dy = desty; |
stepy = 1; |
} |
overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, |
ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); |
if (overlapping) { |
GLint ssy = sy; |
tmpImage = (GLstencil *) MALLOC(width * height * sizeof(GLstencil)); |
if (!tmpImage) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); |
return; |
} |
p = tmpImage; |
for (j = 0; j < height; j++, ssy += stepy) { |
_mesa_read_stencil_span( ctx, width, srcx, ssy, p ); |
p += width; |
} |
p = tmpImage; |
} |
else { |
tmpImage = NULL; /* silence compiler warning */ |
p = NULL; |
} |
for (j = 0; j < height; j++, sy += stepy, dy += stepy) { |
GLstencil stencil[MAX_WIDTH]; |
if (overlapping) { |
MEMCPY(stencil, p, width * sizeof(GLstencil)); |
p += width; |
} |
else { |
_mesa_read_stencil_span( ctx, width, srcx, sy, stencil ); |
} |
if (shift_or_offset) { |
_mesa_shift_and_offset_stencil( ctx, width, stencil ); |
} |
if (ctx->Pixel.MapStencilFlag) { |
_mesa_map_stencil( ctx, width, stencil ); |
} |
if (zoom) { |
_mesa_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty ); |
} |
else { |
_mesa_write_stencil_span( ctx, width, destx, dy, stencil ); |
} |
} |
if (overlapping) |
FREE(tmpImage); |
} |
void |
_swrast_CopyPixels( GLcontext *ctx, |
GLint srcx, GLint srcy, GLsizei width, GLsizei height, |
GLint destx, GLint desty, |
GLenum type ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
RENDER_START(swrast,ctx); |
if (swrast->NewState) |
_swrast_validate_derived( ctx ); |
if (type == GL_COLOR && ctx->Visual.rgbMode) { |
copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); |
} |
else if (type == GL_COLOR && !ctx->Visual.rgbMode) { |
copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty ); |
} |
else if (type == GL_DEPTH) { |
copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty ); |
} |
else if (type == GL_STENCIL) { |
copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" ); |
} |
RENDER_FINISH(swrast,ctx); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_readpix.c |
---|
0,0 → 1,526 |
/* $Id: s_readpix.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "convolve.h" |
#include "context.h" |
#include "feedback.h" |
#include "image.h" |
#include "macros.h" |
#include "imports.h" |
#include "pixel.h" |
#include "s_alphabuf.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_span.h" |
#include "s_stencil.h" |
/* |
* Read a block of color index pixels. |
*/ |
static void |
read_index_pixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLint i, readWidth; |
/* error checking */ |
if (ctx->Visual.rgbMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); |
return; |
} |
_swrast_use_read_buffer(ctx); |
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
/* process image row by row */ |
for (i = 0; i < height; i++) { |
GLuint index[MAX_WIDTH]; |
GLvoid *dest; |
(*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index); |
dest = _mesa_image_address(packing, pixels, width, height, |
GL_COLOR_INDEX, type, 0, i, 0); |
_mesa_pack_index_span(ctx, readWidth, type, dest, index, |
&ctx->Pack, ctx->_ImageTransferState); |
} |
_swrast_use_draw_buffer(ctx); |
} |
static void |
read_depth_pixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
GLint readWidth; |
GLboolean bias_or_scale; |
/* Error checking */ |
if (ctx->Visual.depthBits <= 0) { |
/* No depth buffer */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); |
return; |
} |
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
if (type != GL_BYTE && |
type != GL_UNSIGNED_BYTE && |
type != GL_SHORT && |
type != GL_UNSIGNED_SHORT && |
type != GL_INT && |
type != GL_UNSIGNED_INT && |
type != GL_FLOAT) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(depth type)"); |
return; |
} |
bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; |
if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16 |
&& !bias_or_scale && !packing->SwapBytes) { |
/* Special case: directly read 16-bit unsigned depth values. */ |
GLint j; |
for (j=0;j<height;j++,y++) { |
GLdepth depth[MAX_WIDTH]; |
GLushort *dst = (GLushort*) _mesa_image_address( packing, pixels, |
width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); |
GLint i; |
_mesa_read_depth_span(ctx, width, x, y, depth); |
for (i = 0; i < width; i++) |
dst[i] = depth[i]; |
} |
} |
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32 |
&& !bias_or_scale && !packing->SwapBytes) { |
/* Special case: directly read 32-bit unsigned depth values. */ |
GLint j; |
for (j=0;j<height;j++,y++) { |
GLdepth *dst = (GLdepth *) _mesa_image_address( packing, pixels, |
width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); |
_mesa_read_depth_span(ctx, width, x, y, dst); |
} |
} |
else { |
/* General case (slower) */ |
GLint j; |
for (j=0;j<height;j++,y++) { |
GLfloat depth[MAX_WIDTH]; |
GLvoid *dest; |
_mesa_read_depth_span_float(ctx, readWidth, x, y, depth); |
dest = _mesa_image_address(packing, pixels, width, height, |
GL_DEPTH_COMPONENT, type, 0, j, 0); |
_mesa_pack_depth_span(ctx, readWidth, (GLdepth *) dest, type, |
depth, &ctx->Pack); |
} |
} |
} |
static void |
read_stencil_pixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type, GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
GLint j, readWidth; |
if (type != GL_BYTE && |
type != GL_UNSIGNED_BYTE && |
type != GL_SHORT && |
type != GL_UNSIGNED_SHORT && |
type != GL_INT && |
type != GL_UNSIGNED_INT && |
type != GL_FLOAT && |
type != GL_BITMAP) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(stencil type)"); |
return; |
} |
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
if (ctx->Visual.stencilBits <= 0) { |
/* No stencil buffer */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); |
return; |
} |
/* process image row by row */ |
for (j=0;j<height;j++,y++) { |
GLvoid *dest; |
GLstencil stencil[MAX_WIDTH]; |
_mesa_read_stencil_span(ctx, readWidth, x, y, stencil); |
dest = _mesa_image_address(packing, pixels, width, height, |
GL_STENCIL_INDEX, type, 0, j, 0); |
_mesa_pack_stencil_span(ctx, readWidth, type, dest, stencil, &ctx->Pack); |
} |
} |
/* |
* Optimized glReadPixels for particular pixel formats: |
* GL_UNSIGNED_BYTE, GL_RGBA |
* when pixel scaling, biasing and mapping are disabled. |
*/ |
static GLboolean |
read_fast_rgba_pixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
/* can't do scale, bias, mapping, etc */ |
if (ctx->_ImageTransferState) |
return GL_FALSE; |
/* can't do fancy pixel packing */ |
if (packing->Alignment != 1 || packing->SwapBytes || packing->LsbFirst) |
return GL_FALSE; |
{ |
GLint srcX = x; |
GLint srcY = y; |
GLint readWidth = width; /* actual width read */ |
GLint readHeight = height; /* actual height read */ |
GLint skipPixels = packing->SkipPixels; |
GLint skipRows = packing->SkipRows; |
GLint rowLength; |
if (packing->RowLength > 0) |
rowLength = packing->RowLength; |
else |
rowLength = width; |
/* horizontal clipping */ |
if (srcX < 0) { |
skipPixels -= srcX; |
readWidth += srcX; |
srcX = 0; |
} |
if (srcX + readWidth > (GLint) ctx->ReadBuffer->Width) |
readWidth -= (srcX + readWidth - (GLint) ctx->ReadBuffer->Width); |
if (readWidth <= 0) |
return GL_TRUE; |
/* vertical clipping */ |
if (srcY < 0) { |
skipRows -= srcY; |
readHeight += srcY; |
srcY = 0; |
} |
if (srcY + readHeight > (GLint) ctx->ReadBuffer->Height) |
readHeight -= (srcY + readHeight - (GLint) ctx->ReadBuffer->Height); |
if (readHeight <= 0) |
return GL_TRUE; |
/* |
* Ready to read! |
* The window region at (destX, destY) of size (readWidth, readHeight) |
* will be read back. |
* We'll write pixel data to buffer pointed to by "pixels" but we'll |
* skip "skipRows" rows and skip "skipPixels" pixels/row. |
*/ |
#if CHAN_BITS == 8 |
if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { |
#elif CHAN_BITS == 16 |
if (format == GL_RGBA && type == GL_UNSIGNED_SHORT) { |
#else |
if (0) { |
#endif |
GLchan *dest = (GLchan *) pixels |
+ (skipRows * rowLength + skipPixels) * 4; |
GLint row; |
if (packing->Invert) { |
/* start at top and go down */ |
dest += (readHeight - 1) * rowLength * 4; |
rowLength = -rowLength; |
} |
for (row=0; row<readHeight; row++) { |
(*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, |
(GLchan (*)[4]) dest); |
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) { |
_mesa_read_alpha_span(ctx, readWidth, srcX, srcY, |
(GLchan (*)[4]) dest); |
} |
dest += rowLength * 4; |
srcY++; |
} |
return GL_TRUE; |
} |
else { |
/* can't do this format/type combination */ |
return GL_FALSE; |
} |
} |
} |
/* |
* Read R, G, B, A, RGB, L, or LA pixels. |
*/ |
static void |
read_rgba_pixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLint readWidth; |
_swrast_use_read_buffer(ctx); |
/* Try optimized path first */ |
if (read_fast_rgba_pixels( ctx, x, y, width, height, |
format, type, pixels, packing )) { |
_swrast_use_draw_buffer(ctx); |
return; /* done! */ |
} |
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; |
/* do error checking on pixel type, format was already checked by caller */ |
switch (type) { |
case GL_UNSIGNED_BYTE: |
case GL_BYTE: |
case GL_UNSIGNED_SHORT: |
case GL_SHORT: |
case GL_UNSIGNED_INT: |
case GL_INT: |
case GL_FLOAT: |
case GL_UNSIGNED_BYTE_3_3_2: |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
case GL_UNSIGNED_SHORT_5_6_5: |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
case GL_UNSIGNED_SHORT_4_4_4_4: |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
case GL_UNSIGNED_SHORT_5_5_5_1: |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
case GL_UNSIGNED_INT_8_8_8_8: |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
case GL_UNSIGNED_INT_10_10_10_2: |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
/* valid pixel type */ |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" ); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type) || |
format == GL_INTENSITY) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)"); |
return; |
} |
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { |
const GLuint transferOps = ctx->_ImageTransferState; |
GLfloat *dest, *src, *tmpImage, *convImage; |
GLint row; |
tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!tmpImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); |
return; |
} |
convImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); |
if (!convImage) { |
FREE(tmpImage); |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); |
return; |
} |
/* read full RGBA, FLOAT image */ |
dest = tmpImage; |
for (row = 0; row < height; row++, y++) { |
GLchan rgba[MAX_WIDTH][4]; |
if (ctx->Visual.rgbMode) { |
_mesa_read_rgba_span(ctx, ctx->ReadBuffer, readWidth, x, y, rgba); |
} |
else { |
GLuint index[MAX_WIDTH]; |
(*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index); |
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) { |
_mesa_map_ci(ctx, readWidth, index); |
} |
_mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); |
} |
_mesa_pack_rgba_span(ctx, readWidth, (const GLchan (*)[4]) rgba, |
GL_RGBA, GL_FLOAT, dest, &_mesa_native_packing, |
transferOps & IMAGE_PRE_CONVOLUTION_BITS); |
dest += width * 4; |
} |
/* do convolution */ |
if (ctx->Pixel.Convolution2DEnabled) { |
_mesa_convolve_2d_image(ctx, &readWidth, &height, tmpImage, convImage); |
} |
else { |
ASSERT(ctx->Pixel.Separable2DEnabled); |
_mesa_convolve_sep_image(ctx, &readWidth, &height, tmpImage, convImage); |
} |
FREE(tmpImage); |
/* finish transfer ops and pack the resulting image */ |
src = convImage; |
for (row = 0; row < height; row++) { |
GLvoid *dest; |
dest = _mesa_image_address(packing, pixels, readWidth, height, |
format, type, 0, row, 0); |
_mesa_pack_float_rgba_span(ctx, readWidth, |
(const GLfloat (*)[4]) src, |
format, type, dest, packing, |
transferOps & IMAGE_POST_CONVOLUTION_BITS); |
src += readWidth * 4; |
} |
} |
else { |
/* no convolution */ |
GLint row; |
for (row = 0; row < height; row++, y++) { |
GLchan rgba[MAX_WIDTH][4]; |
GLvoid *dst; |
if (ctx->Visual.rgbMode) { |
_mesa_read_rgba_span(ctx, ctx->ReadBuffer, readWidth, x, y, rgba); |
} |
else { |
GLuint index[MAX_WIDTH]; |
(*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index); |
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { |
_mesa_map_ci(ctx, readWidth, index); |
} |
_mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); |
} |
dst = _mesa_image_address(packing, pixels, width, height, |
format, type, 0, row, 0); |
if (ctx->Visual.redBits < CHAN_BITS || |
ctx->Visual.greenBits < CHAN_BITS || |
ctx->Visual.blueBits < CHAN_BITS) { |
/* Requantize the color values into floating point and go from |
* there. This fixes conformance failures with 16-bit color |
* buffers, for example. |
*/ |
DEFMARRAY(GLfloat, rgbaf, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgbaf, return); /* mac 32k limitation */ |
_mesa_chan_to_float_span(ctx, readWidth, |
(CONST GLchan (*)[4]) rgba, rgbaf); |
_mesa_pack_float_rgba_span(ctx, readWidth, |
(CONST GLfloat (*)[4]) rgbaf, |
format, type, dst, packing, |
ctx->_ImageTransferState); |
UNDEFARRAY(rgbaf); /* mac 32k limitation */ |
} |
else { |
/* GLubytes are fine */ |
_mesa_pack_rgba_span(ctx, readWidth, (CONST GLchan (*)[4]) rgba, |
format, type, dst, packing, |
ctx->_ImageTransferState); |
} |
} |
} |
_swrast_use_draw_buffer(ctx); |
} |
void |
_swrast_ReadPixels( GLcontext *ctx, |
GLint x, GLint y, GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *pack, |
GLvoid *pixels ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
(void) pack; |
if (swrast->NewState) |
_swrast_validate_derived( ctx ); |
RENDER_START(swrast,ctx); |
switch (format) { |
case GL_COLOR_INDEX: |
read_index_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack); |
break; |
case GL_STENCIL_INDEX: |
read_stencil_pixels(ctx, x,y, width,height, type, pixels, &ctx->Pack); |
break; |
case GL_DEPTH_COMPONENT: |
read_depth_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack); |
break; |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_RGB: |
case GL_LUMINANCE: |
case GL_LUMINANCE_ALPHA: |
case GL_RGBA: |
case GL_BGR: |
case GL_BGRA: |
case GL_ABGR_EXT: |
read_rgba_pixels(ctx, x, y, width, height, |
format, type, pixels, &ctx->Pack); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" ); |
} |
RENDER_FINISH(swrast,ctx); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_histogram.c |
---|
0,0 → 1,97 |
/* $Id: s_histogram.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "image.h" |
#include "mmath.h" |
#include "s_context.h" |
#include "s_histogram.h" |
#include "s_span.h" |
/* |
* Update the min/max values from an array of fragment colors. |
*/ |
void |
_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
/* update mins */ |
if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) |
ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; |
if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) |
ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; |
if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) |
ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; |
if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) |
ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; |
/* update maxs */ |
if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) |
ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; |
if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) |
ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; |
if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) |
ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; |
if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) |
ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; |
} |
} |
/* |
* Update the histogram values from an array of fragment colors. |
*/ |
void |
_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) |
{ |
const GLint max = ctx->Histogram.Width - 1; |
GLfloat w = (GLfloat) max; |
GLuint i; |
if (ctx->Histogram.Width == 0) |
return; |
for (i = 0; i < n; i++) { |
GLint ri = IROUND(rgba[i][RCOMP] * w); |
GLint gi = IROUND(rgba[i][GCOMP] * w); |
GLint bi = IROUND(rgba[i][BCOMP] * w); |
GLint ai = IROUND(rgba[i][ACOMP] * w); |
ri = CLAMP(ri, 0, max); |
gi = CLAMP(gi, 0, max); |
bi = CLAMP(bi, 0, max); |
ai = CLAMP(ai, 0, max); |
ctx->Histogram.Count[ri][RCOMP]++; |
ctx->Histogram.Count[gi][GCOMP]++; |
ctx->Histogram.Count[bi][BCOMP]++; |
ctx->Histogram.Count[ai][ACOMP]++; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_masking.h |
---|
0,0 → 1,62 |
/* $Id: s_masking.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_MASKING_H |
#define S_MASKING_H |
#include "mtypes.h" |
#include "swrast.h" |
/* |
* Implement glColorMask for a span of RGBA pixels. |
*/ |
extern void |
_mesa_mask_rgba_span( GLcontext *ctx, const struct sw_span *span, |
GLchan rgba[][4] ); |
extern void |
_mesa_mask_rgba_array( GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ); |
/* |
* Implement glIndexMask for a span of CI pixels. |
*/ |
extern void |
_mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span, |
GLuint index[] ); |
extern void |
_mesa_mask_index_array( GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLuint index[] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_texture.c |
---|
0,0 → 1,3743 |
/* $Id: s_texture.c,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "colormac.h" |
#include "macros.h" |
#include "mmath.h" |
#include "imports.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "s_context.h" |
#include "s_texture.h" |
/* |
* These values are used in the fixed-point arithmetic used |
* for linear filtering. |
*/ |
#define WEIGHT_SCALE 65536.0F |
#define WEIGHT_SHIFT 16 |
/* |
* Used to compute texel locations for linear sampling. |
* Input: |
* wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER_ARB |
* S = texcoord in [0,1] |
* SIZE = width (or height or depth) of texture |
* Output: |
* U = texcoord in [0, width] |
* I0, I1 = two nearest texel indexes |
*/ |
#define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \ |
{ \ |
if (wrapMode == GL_REPEAT) { \ |
U = S * SIZE - 0.5F; \ |
I0 = IFLOOR(U) & (SIZE - 1); \ |
I1 = (I0 + 1) & (SIZE - 1); \ |
} \ |
else if (wrapMode == GL_CLAMP_TO_EDGE) { \ |
if (S <= 0.0F) \ |
U = 0.0F; \ |
else if (S >= 1.0F) \ |
U = (GLfloat) SIZE; \ |
else \ |
U = S * SIZE; \ |
U -= 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
if (I0 < 0) \ |
I0 = 0; \ |
if (I1 >= (GLint) SIZE) \ |
I1 = SIZE - 1; \ |
} \ |
else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \ |
const GLfloat min = -1.0F / (2.0F * SIZE); \ |
const GLfloat max = 1.0F - min; \ |
if (S <= min) \ |
U = min * SIZE; \ |
else if (S >= max) \ |
U = max * SIZE; \ |
else \ |
U = S * SIZE; \ |
U -= 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
} \ |
else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \ |
const GLint flr = IFLOOR(S); \ |
if (flr & 1) \ |
U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ |
else \ |
U = S - (GLfloat) flr; /* flr is even */ \ |
U = (U * SIZE) - 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
if (I0 < 0) \ |
I0 = 0; \ |
if (I1 >= (GLint) SIZE) \ |
I1 = SIZE - 1; \ |
} \ |
else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \ |
U = (GLfloat) fabs(S); \ |
if (U >= 1.0F) \ |
U = (GLfloat) SIZE; \ |
else \ |
U *= SIZE; \ |
U -= 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
} \ |
else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \ |
U = (GLfloat) fabs(S); \ |
if (U >= 1.0F) \ |
U = (GLfloat) SIZE; \ |
else \ |
U *= SIZE; \ |
U -= 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
if (I0 < 0) \ |
I0 = 0; \ |
if (I1 >= (GLint) SIZE) \ |
I1 = SIZE - 1; \ |
} \ |
else { \ |
ASSERT(wrapMode == GL_CLAMP); \ |
if (S <= 0.0F) \ |
U = 0.0F; \ |
else if (S >= 1.0F) \ |
U = (GLfloat) SIZE; \ |
else \ |
U = S * SIZE; \ |
U -= 0.5F; \ |
I0 = IFLOOR(U); \ |
I1 = I0 + 1; \ |
} \ |
} |
/* |
* Used to compute texel location for nearest sampling. |
*/ |
#define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \ |
{ \ |
if (wrapMode == GL_REPEAT) { \ |
/* s limited to [0,1) */ \ |
/* i limited to [0,size-1] */ \ |
I = IFLOOR(S * SIZE); \ |
I &= (SIZE - 1); \ |
} \ |
else if (wrapMode == GL_CLAMP_TO_EDGE) { \ |
/* s limited to [min,max] */ \ |
/* i limited to [0, size-1] */ \ |
const GLfloat min = 1.0F / (2.0F * SIZE); \ |
const GLfloat max = 1.0F - min; \ |
if (S < min) \ |
I = 0; \ |
else if (S > max) \ |
I = SIZE - 1; \ |
else \ |
I = IFLOOR(S * SIZE); \ |
} \ |
else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \ |
/* s limited to [min,max] */ \ |
/* i limited to [-1, size] */ \ |
const GLfloat min = -1.0F / (2.0F * SIZE); \ |
const GLfloat max = 1.0F - min; \ |
if (S <= min) \ |
I = -1; \ |
else if (S >= max) \ |
I = SIZE; \ |
else \ |
I = IFLOOR(S * SIZE); \ |
} \ |
else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \ |
const GLfloat min = 1.0F / (2.0F * SIZE); \ |
const GLfloat max = 1.0F - min; \ |
const GLint flr = IFLOOR(S); \ |
GLfloat u; \ |
if (flr & 1) \ |
u = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ |
else \ |
u = S - (GLfloat) flr; /* flr is even */ \ |
if (u < min) \ |
I = 0; \ |
else if (u > max) \ |
I = SIZE - 1; \ |
else \ |
I = IFLOOR(u * SIZE); \ |
} \ |
else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \ |
/* s limited to [0,1] */ \ |
/* i limited to [0,size-1] */ \ |
const GLfloat u = (GLfloat) fabs(S); \ |
if (u <= 0.0F) \ |
I = 0; \ |
else if (u >= 1.0F) \ |
I = SIZE - 1; \ |
else \ |
I = IFLOOR(u * SIZE); \ |
} \ |
else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \ |
/* s limited to [min,max] */ \ |
/* i limited to [0, size-1] */ \ |
const GLfloat min = 1.0F / (2.0F * SIZE); \ |
const GLfloat max = 1.0F - min; \ |
const GLfloat u = (GLfloat) fabs(S); \ |
if (u < min) \ |
I = 0; \ |
else if (u > max) \ |
I = SIZE - 1; \ |
else \ |
I = IFLOOR(u * SIZE); \ |
} \ |
else { \ |
ASSERT(wrapMode == GL_CLAMP); \ |
/* s limited to [0,1] */ \ |
/* i limited to [0,size-1] */ \ |
if (S <= 0.0F) \ |
I = 0; \ |
else if (S >= 1.0F) \ |
I = SIZE - 1; \ |
else \ |
I = IFLOOR(S * SIZE); \ |
} \ |
} |
#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \ |
{ \ |
U = S * SIZE - 0.5F; \ |
I0 = IFLOOR(U) & (SIZE - 1); \ |
I1 = (I0 + 1) & (SIZE - 1); \ |
} |
/* |
* Compute linear mipmap levels for given lambda. |
*/ |
#define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \ |
{ \ |
if (lambda < 0.0F) \ |
level = tObj->BaseLevel; \ |
else if (lambda > tObj->_MaxLambda) \ |
level = (GLint) (tObj->BaseLevel + tObj->_MaxLambda); \ |
else \ |
level = (GLint) (tObj->BaseLevel + lambda); \ |
} |
/* |
* Compute nearest mipmap level for given lambda. |
*/ |
#define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \ |
{ \ |
GLfloat l; \ |
if (lambda <= 0.5F) \ |
l = 0.0F; \ |
else if (lambda > tObj->_MaxLambda + 0.4999F) \ |
l = tObj->_MaxLambda + 0.4999F; \ |
else \ |
l = lambda; \ |
level = (GLint) (tObj->BaseLevel + l + 0.5F); \ |
if (level > tObj->_MaxLevel) \ |
level = tObj->_MaxLevel; \ |
} |
/* |
* Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes |
* see 1-pixel bands of improperly weighted linear-sampled texels. The |
* tests/texwrap.c demo is a good test. |
* Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0. |
* Instead, if x < 0 then FRAC(x) = 1 - true_frac(x). |
*/ |
#define FRAC(f) ((f) - IFLOOR(f)) |
/* |
* Bitflags for texture border color sampling. |
*/ |
#define I0BIT 1 |
#define I1BIT 2 |
#define J0BIT 4 |
#define J1BIT 8 |
#define K0BIT 16 |
#define K1BIT 32 |
/* |
* Get texture palette entry. |
*/ |
static void |
palette_sample(const GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLint index, GLchan rgba[4] ) |
{ |
const GLchan *palette; |
GLenum format; |
if (ctx->Texture.SharedPalette) { |
ASSERT(!ctx->Texture.Palette.FloatTable); |
palette = (const GLchan *) ctx->Texture.Palette.Table; |
format = ctx->Texture.Palette.Format; |
} |
else { |
ASSERT(!tObj->Palette.FloatTable); |
palette = (const GLchan *) tObj->Palette.Table; |
format = tObj->Palette.Format; |
} |
switch (format) { |
case GL_ALPHA: |
rgba[ACOMP] = palette[index]; |
return; |
case GL_LUMINANCE: |
case GL_INTENSITY: |
rgba[RCOMP] = palette[index]; |
return; |
case GL_LUMINANCE_ALPHA: |
rgba[RCOMP] = palette[(index << 1) + 0]; |
rgba[ACOMP] = palette[(index << 1) + 1]; |
return; |
case GL_RGB: |
rgba[RCOMP] = palette[index * 3 + 0]; |
rgba[GCOMP] = palette[index * 3 + 1]; |
rgba[BCOMP] = palette[index * 3 + 2]; |
return; |
case GL_RGBA: |
rgba[RCOMP] = palette[(index << 2) + 0]; |
rgba[GCOMP] = palette[(index << 2) + 1]; |
rgba[BCOMP] = palette[(index << 2) + 2]; |
rgba[ACOMP] = palette[(index << 2) + 3]; |
return; |
default: |
_mesa_problem(ctx, "Bad palette format in palette_sample"); |
} |
} |
/* |
* The lambda[] array values are always monotonic. Either the whole span |
* will be minified, magnified, or split between the two. This function |
* determines the subranges in [0, n-1] that are to be minified or magnified. |
*/ |
static INLINE void |
compute_min_mag_ranges( GLfloat minMagThresh, GLuint n, const GLfloat lambda[], |
GLuint *minStart, GLuint *minEnd, |
GLuint *magStart, GLuint *magEnd ) |
{ |
ASSERT(lambda != NULL); |
#if 0 |
/* Verify that lambda[] is monotonous. |
* We can't really use this because the inaccuracy in the LOG2 function |
* causes this test to fail, yet the resulting texturing is correct. |
*/ |
if (n > 1) { |
GLuint i; |
printf("lambda delta = %g\n", lambda[0] - lambda[n-1]); |
if (lambda[0] >= lambda[n-1]) { /* decreasing */ |
for (i = 0; i < n - 1; i++) { |
ASSERT((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10)); |
} |
} |
else { /* increasing */ |
for (i = 0; i < n - 1; i++) { |
ASSERT((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10)); |
} |
} |
} |
#endif /* DEBUG */ |
/* since lambda is monotonous-array use this check first */ |
if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { |
/* magnification for whole span */ |
*magStart = 0; |
*magEnd = n; |
*minStart = *minEnd = 0; |
} |
else if (lambda[0] > minMagThresh && lambda[n-1] > minMagThresh) { |
/* minification for whole span */ |
*minStart = 0; |
*minEnd = n; |
*magStart = *magEnd = 0; |
} |
else { |
/* a mix of minification and magnification */ |
GLuint i; |
if (lambda[0] > minMagThresh) { |
/* start with minification */ |
for (i = 1; i < n; i++) { |
if (lambda[i] <= minMagThresh) |
break; |
} |
*minStart = 0; |
*minEnd = i; |
*magStart = i; |
*magEnd = n; |
} |
else { |
/* start with magnification */ |
for (i = 1; i < n; i++) { |
if (lambda[i] > minMagThresh) |
break; |
} |
*magStart = 0; |
*magEnd = i; |
*minStart = i; |
*minEnd = n; |
} |
} |
#if 0 |
/* Verify the min/mag Start/End values |
* We don't use this either (see above) |
*/ |
{ |
GLint i; |
for (i = 0; i < n; i++) { |
if (lambda[i] > minMagThresh) { |
/* minification */ |
ASSERT(i >= *minStart); |
ASSERT(i < *minEnd); |
} |
else { |
/* magnification */ |
ASSERT(i >= *magStart); |
ASSERT(i < *magEnd); |
} |
} |
} |
#endif |
} |
/**********************************************************************/ |
/* 1-D Texture Sampling Functions */ |
/**********************************************************************/ |
/* |
* Return the texture sample for coordinate (s) using GL_NEAREST filter. |
*/ |
static void |
sample_1d_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], GLchan rgba[4]) |
{ |
const GLint width = img->Width2; /* without border, power of two */ |
GLint i; |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); |
/* skip over the border, if any */ |
i += img->Border; |
if (i < 0 || i >= (GLint) img->Width) { |
/* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ |
COPY_CHAN4(rgba, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i, 0, 0, (GLvoid *) rgba); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, rgba[0], rgba); |
} |
} |
} |
/* |
* Return the texture sample for coordinate (s) using GL_LINEAR filter. |
*/ |
static void |
sample_1d_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], GLchan rgba[4]) |
{ |
const GLint width = img->Width2; |
GLint i0, i1; |
GLfloat u; |
GLuint useBorderColor; |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); |
useBorderColor = 0; |
if (img->Border) { |
i0 += img->Border; |
i1 += img->Border; |
} |
else { |
if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; |
if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; |
} |
{ |
const GLfloat a = FRAC(u); |
#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT |
const GLfloat w0 = (1.0F-a); |
const GLfloat w1 = a ; |
#else /* CHAN_BITS == 8 */ |
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ |
const GLint w0 = IROUND_POS((1.0F - a) * WEIGHT_SCALE); |
const GLint w1 = IROUND_POS( a * WEIGHT_SCALE); |
#endif |
GLchan t0[4], t1[4]; /* texels */ |
if (useBorderColor & I0BIT) { |
COPY_CHAN4(t0, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, 0, 0, (GLvoid *) t0); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t0[0], t0); |
} |
} |
if (useBorderColor & I1BIT) { |
COPY_CHAN4(t1, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, 0, 0, (GLvoid *) t1); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t1[0], t1); |
} |
} |
#if CHAN_TYPE == GL_FLOAT |
rgba[0] = w0 * t0[0] + w1 * t1[0]; |
rgba[1] = w0 * t0[1] + w1 * t1[1]; |
rgba[2] = w0 * t0[2] + w1 * t1[2]; |
rgba[3] = w0 * t0[3] + w1 * t1[3]; |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
rgba[0] = (GLchan) (w0 * t0[0] + w1 * t1[0] + 0.5); |
rgba[1] = (GLchan) (w0 * t0[1] + w1 * t1[1] + 0.5); |
rgba[2] = (GLchan) (w0 * t0[2] + w1 * t1[2] + 0.5); |
rgba[3] = (GLchan) (w0 * t0[3] + w1 * t1[3] + 0.5); |
#else /* CHAN_BITS == 8 */ |
rgba[0] = (GLchan) ((w0 * t0[0] + w1 * t1[0]) >> WEIGHT_SHIFT); |
rgba[1] = (GLchan) ((w0 * t0[1] + w1 * t1[1]) >> WEIGHT_SHIFT); |
rgba[2] = (GLchan) ((w0 * t0[2] + w1 * t1[2]) >> WEIGHT_SHIFT); |
rgba[3] = (GLchan) ((w0 * t0[3] + w1 * t1[3]) >> WEIGHT_SHIFT); |
#endif |
} |
} |
static void |
sample_1d_nearest_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_1d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
static void |
sample_1d_linear_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_1d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
/* |
* This is really just needed in order to prevent warnings with some compilers. |
*/ |
#if CHAN_TYPE == GL_FLOAT |
#define CHAN_CAST |
#else |
#define CHAN_CAST (GLchan) (GLint) |
#endif |
static void |
sample_1d_nearest_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; |
const GLfloat f = FRAC(lambda[i]); |
sample_1d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_1d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_1d_linear_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; |
const GLfloat f = FRAC(lambda[i]); |
sample_1d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_1d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_nearest_1d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4] ) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
static void |
sample_linear_1d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4] ) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
/* |
* Given an (s) texture coordinate and lambda (level of detail) value, |
* return a texture sample. |
* |
*/ |
static void |
sample_lambda_1d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint minStart, minEnd; /* texels with minification */ |
GLuint magStart, magEnd; /* texels with magnification */ |
GLuint i; |
ASSERT(lambda != NULL); |
compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], |
n, lambda, &minStart, &minEnd, &magStart, &magEnd); |
if (minStart < minEnd) { |
/* do the minified texels */ |
const GLuint m = minEnd - minStart; |
switch (tObj->MinFilter) { |
case GL_NEAREST: |
for (i = minStart; i < minEnd; i++) |
sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_LINEAR: |
for (i = minStart; i < minEnd; i++) |
sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_NEAREST_MIPMAP_NEAREST: |
sample_1d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_NEAREST: |
sample_1d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_LINEAR: |
sample_1d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_LINEAR: |
sample_1d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
default: |
_mesa_problem(ctx, "Bad min filter in sample_1d_texture"); |
return; |
} |
} |
if (magStart < magEnd) { |
/* do the magnified texels */ |
switch (tObj->MagFilter) { |
case GL_NEAREST: |
for (i = magStart; i < magEnd; i++) |
sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_LINEAR: |
for (i = magStart; i < magEnd; i++) |
sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
default: |
_mesa_problem(ctx, "Bad mag filter in sample_1d_texture"); |
return; |
} |
} |
} |
/**********************************************************************/ |
/* 2-D Texture Sampling Functions */ |
/**********************************************************************/ |
/* |
* Return the texture sample for coordinate (s,t) using GL_NEAREST filter. |
*/ |
static INLINE void |
sample_2d_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], |
GLchan rgba[]) |
{ |
const GLint width = img->Width2; /* without border, power of two */ |
const GLint height = img->Height2; /* without border, power of two */ |
GLint i, j; |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); |
/* skip over the border, if any */ |
i += img->Border; |
j += img->Border; |
if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { |
/* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ |
COPY_CHAN4(rgba, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i, j, 0, (GLvoid *) rgba); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, rgba[0], rgba); |
} |
} |
} |
/* |
* Return the texture sample for coordinate (s,t) using GL_LINEAR filter. |
* New sampling code contributed by Lynn Quam <quam@ai.sri.com>. |
*/ |
static INLINE void |
sample_2d_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], |
GLchan rgba[]) |
{ |
const GLint width = img->Width2; |
const GLint height = img->Height2; |
GLint i0, j0, i1, j1; |
GLuint useBorderColor; |
GLfloat u, v; |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); |
useBorderColor = 0; |
if (img->Border) { |
i0 += img->Border; |
i1 += img->Border; |
j0 += img->Border; |
j1 += img->Border; |
} |
else { |
if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; |
if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; |
if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; |
if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; |
} |
{ |
const GLfloat a = FRAC(u); |
const GLfloat b = FRAC(v); |
#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT |
const GLfloat w00 = (1.0F-a) * (1.0F-b); |
const GLfloat w10 = a * (1.0F-b); |
const GLfloat w01 = (1.0F-a) * b ; |
const GLfloat w11 = a * b ; |
#else /* CHAN_BITS == 8 */ |
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ |
const GLint w00 = IROUND_POS((1.0F-a) * (1.0F-b) * WEIGHT_SCALE); |
const GLint w10 = IROUND_POS( a * (1.0F-b) * WEIGHT_SCALE); |
const GLint w01 = IROUND_POS((1.0F-a) * b * WEIGHT_SCALE); |
const GLint w11 = IROUND_POS( a * b * WEIGHT_SCALE); |
#endif |
GLchan t00[4]; |
GLchan t10[4]; |
GLchan t01[4]; |
GLchan t11[4]; |
if (useBorderColor & (I0BIT | J0BIT)) { |
COPY_CHAN4(t00, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t00[0], t00); |
} |
} |
if (useBorderColor & (I1BIT | J0BIT)) { |
COPY_CHAN4(t10, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t10[0], t10); |
} |
} |
if (useBorderColor & (I0BIT | J1BIT)) { |
COPY_CHAN4(t01, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t01[0], t01); |
} |
} |
if (useBorderColor & (I1BIT | J1BIT)) { |
COPY_CHAN4(t11, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t11[0], t11); |
} |
} |
#if CHAN_TYPE == GL_FLOAT |
rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]; |
rgba[1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]; |
rgba[2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]; |
rgba[3] = w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]; |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
rgba[0] = (GLchan) (w00 * t00[0] + w10 * t10[0] + |
w01 * t01[0] + w11 * t11[0] + 0.5); |
rgba[1] = (GLchan) (w00 * t00[1] + w10 * t10[1] + |
w01 * t01[1] + w11 * t11[1] + 0.5); |
rgba[2] = (GLchan) (w00 * t00[2] + w10 * t10[2] + |
w01 * t01[2] + w11 * t11[2] + 0.5); |
rgba[3] = (GLchan) (w00 * t00[3] + w10 * t10[3] + |
w01 * t01[3] + w11 * t11[3] + 0.5); |
#else /* CHAN_BITS == 8 */ |
rgba[0] = (GLchan) ((w00 * t00[0] + w10 * t10[0] + |
w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT); |
rgba[1] = (GLchan) ((w00 * t00[1] + w10 * t10[1] + |
w01 * t01[1] + w11 * t11[1]) >> WEIGHT_SHIFT); |
rgba[2] = (GLchan) ((w00 * t00[2] + w10 * t10[2] + |
w01 * t01[2] + w11 * t11[2]) >> WEIGHT_SHIFT); |
rgba[3] = (GLchan) ((w00 * t00[3] + w10 * t10[3] + |
w01 * t01[3] + w11 * t11[3]) >> WEIGHT_SHIFT); |
#endif |
} |
} |
/* |
* As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT |
* and we're not using a paletted texture. |
*/ |
static INLINE void |
sample_2d_linear_repeat(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], |
GLchan rgba[]) |
{ |
const GLint width = img->Width2; |
const GLint height = img->Height2; |
GLint i0, j0, i1, j1; |
GLfloat u, v; |
ASSERT(tObj->WrapS == GL_REPEAT); |
ASSERT(tObj->WrapT == GL_REPEAT); |
ASSERT(img->Border == 0); |
ASSERT(img->Format != GL_COLOR_INDEX); |
COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); |
COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1); |
{ |
const GLfloat a = FRAC(u); |
const GLfloat b = FRAC(v); |
#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT |
const GLfloat w00 = (1.0F-a) * (1.0F-b); |
const GLfloat w10 = a * (1.0F-b); |
const GLfloat w01 = (1.0F-a) * b ; |
const GLfloat w11 = a * b ; |
#else /* CHAN_BITS == 8 */ |
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ |
const GLint w00 = IROUND_POS((1.0F-a) * (1.0F-b) * WEIGHT_SCALE); |
const GLint w10 = IROUND_POS( a * (1.0F-b) * WEIGHT_SCALE); |
const GLint w01 = IROUND_POS((1.0F-a) * b * WEIGHT_SCALE); |
const GLint w11 = IROUND_POS( a * b * WEIGHT_SCALE); |
#endif |
GLchan t00[4]; |
GLchan t10[4]; |
GLchan t01[4]; |
GLchan t11[4]; |
(*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00); |
(*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10); |
(*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01); |
(*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11); |
#if CHAN_TYPE == GL_FLOAT |
rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]; |
rgba[1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]; |
rgba[2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]; |
rgba[3] = w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]; |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
rgba[0] = (GLchan) (w00 * t00[0] + w10 * t10[0] + |
w01 * t01[0] + w11 * t11[0] + 0.5); |
rgba[1] = (GLchan) (w00 * t00[1] + w10 * t10[1] + |
w01 * t01[1] + w11 * t11[1] + 0.5); |
rgba[2] = (GLchan) (w00 * t00[2] + w10 * t10[2] + |
w01 * t01[2] + w11 * t11[2] + 0.5); |
rgba[3] = (GLchan) (w00 * t00[3] + w10 * t10[3] + |
w01 * t01[3] + w11 * t11[3] + 0.5); |
#else /* CHAN_BITS == 8 */ |
rgba[0] = (GLchan) ((w00 * t00[0] + w10 * t10[0] + |
w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT); |
rgba[1] = (GLchan) ((w00 * t00[1] + w10 * t10[1] + |
w01 * t01[1] + w11 * t11[1]) >> WEIGHT_SHIFT); |
rgba[2] = (GLchan) ((w00 * t00[2] + w10 * t10[2] + |
w01 * t01[2] + w11 * t11[2]) >> WEIGHT_SHIFT); |
rgba[3] = (GLchan) ((w00 * t00[3] + w10 * t10[3] + |
w01 * t01[3] + w11 * t11[3]) >> WEIGHT_SHIFT); |
#endif |
} |
} |
static void |
sample_2d_nearest_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_2d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
static void |
sample_2d_linear_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_2d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
static void |
sample_2d_nearest_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_2d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_2d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
/* Trilinear filtering */ |
static void |
sample_2d_linear_mipmap_linear( GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_2d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_2d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
ASSERT(tObj->WrapS == GL_REPEAT); |
ASSERT(tObj->WrapT == GL_REPEAT); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_2d_linear_repeat(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_2d_linear_repeat(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_2d_linear_repeat(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_nearest_2d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
static void |
sample_linear_2d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
/* |
* Optimized 2-D texture sampling: |
* S and T wrap mode == GL_REPEAT |
* GL_NEAREST min/mag filter |
* No border, |
* RowStride == Width, |
* Format = GL_RGB |
*/ |
static void |
opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; |
const GLfloat width = (GLfloat) img->Width; |
const GLfloat height = (GLfloat) img->Height; |
const GLint colMask = img->Width - 1; |
const GLint rowMask = img->Height - 1; |
const GLint shift = img->WidthLog2; |
GLuint k; |
(void) lambda; |
ASSERT(tObj->WrapS==GL_REPEAT); |
ASSERT(tObj->WrapT==GL_REPEAT); |
ASSERT(img->Border==0); |
ASSERT(img->Format==GL_RGB); |
for (k=0; k<n; k++) { |
GLint i = IFLOOR(texcoords[k][0] * width) & colMask; |
GLint j = IFLOOR(texcoords[k][1] * height) & rowMask; |
GLint pos = (j << shift) | i; |
GLchan *texel = ((GLchan *) img->Data) + 3*pos; |
rgba[k][RCOMP] = texel[0]; |
rgba[k][GCOMP] = texel[1]; |
rgba[k][BCOMP] = texel[2]; |
} |
} |
/* |
* Optimized 2-D texture sampling: |
* S and T wrap mode == GL_REPEAT |
* GL_NEAREST min/mag filter |
* No border |
* RowStride == Width, |
* Format = GL_RGBA |
*/ |
static void |
opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; |
const GLfloat width = (GLfloat) img->Width; |
const GLfloat height = (GLfloat) img->Height; |
const GLint colMask = img->Width - 1; |
const GLint rowMask = img->Height - 1; |
const GLint shift = img->WidthLog2; |
GLuint i; |
(void) lambda; |
ASSERT(tObj->WrapS==GL_REPEAT); |
ASSERT(tObj->WrapT==GL_REPEAT); |
ASSERT(img->Border==0); |
ASSERT(img->Format==GL_RGBA); |
for (i = 0; i < n; i++) { |
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; |
const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; |
const GLint pos = (row << shift) | col; |
const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ |
COPY_CHAN4(rgba[i], texel); |
} |
} |
/* |
* Given an array of texture coordinate and lambda (level of detail) |
* values, return an array of texture sample. |
*/ |
static void |
sample_lambda_2d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
const struct gl_texture_image *tImg = tObj->Image[tObj->BaseLevel]; |
GLuint minStart, minEnd; /* texels with minification */ |
GLuint magStart, magEnd; /* texels with magnification */ |
const GLboolean repeatNoBorder = (tObj->WrapS == GL_REPEAT) |
&& (tObj->WrapT == GL_REPEAT) |
&& (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) |
&& (tImg->Format != GL_COLOR_INDEX); |
ASSERT(lambda != NULL); |
compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], |
n, lambda, &minStart, &minEnd, &magStart, &magEnd); |
if (minStart < minEnd) { |
/* do the minified texels */ |
const GLuint m = minEnd - minStart; |
switch (tObj->MinFilter) { |
case GL_NEAREST: |
if (repeatNoBorder) { |
switch (tImg->Format) { |
case GL_RGB: |
opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart, |
NULL, rgba + minStart); |
break; |
case GL_RGBA: |
opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart, |
NULL, rgba + minStart); |
break; |
default: |
sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, |
NULL, rgba + minStart ); |
} |
} |
else { |
sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, |
NULL, rgba + minStart); |
} |
break; |
case GL_LINEAR: |
sample_linear_2d(ctx, texUnit, tObj, m, texcoords + minStart, |
NULL, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_NEAREST: |
sample_2d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_NEAREST: |
sample_2d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_LINEAR: |
sample_2d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_LINEAR: |
if (repeatNoBorder) |
sample_2d_linear_mipmap_linear_repeat(ctx, tObj, m, |
texcoords + minStart, lambda + minStart, rgba + minStart); |
else |
sample_2d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
default: |
_mesa_problem(ctx, "Bad min filter in sample_2d_texture"); |
return; |
} |
} |
if (magStart < magEnd) { |
/* do the magnified texels */ |
const GLuint m = magEnd - magStart; |
switch (tObj->MagFilter) { |
case GL_NEAREST: |
if (repeatNoBorder) { |
switch (tImg->Format) { |
case GL_RGB: |
opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart, |
NULL, rgba + magStart); |
break; |
case GL_RGBA: |
opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart, |
NULL, rgba + magStart); |
break; |
default: |
sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, |
NULL, rgba + magStart ); |
} |
} |
else { |
sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, |
NULL, rgba + magStart); |
} |
break; |
case GL_LINEAR: |
sample_linear_2d(ctx, texUnit, tObj, m, texcoords + magStart, |
NULL, rgba + magStart); |
break; |
default: |
_mesa_problem(ctx, "Bad mag filter in sample_lambda_2d"); |
} |
} |
} |
/**********************************************************************/ |
/* 3-D Texture Sampling Functions */ |
/**********************************************************************/ |
/* |
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. |
*/ |
static void |
sample_3d_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], |
GLchan rgba[4]) |
{ |
const GLint width = img->Width2; /* without border, power of two */ |
const GLint height = img->Height2; /* without border, power of two */ |
const GLint depth = img->Depth2; /* without border, power of two */ |
GLint i, j, k; |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k); |
if (i < 0 || i >= (GLint) img->Width || |
j < 0 || j >= (GLint) img->Height || |
k < 0 || k >= (GLint) img->Depth) { |
/* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ |
COPY_CHAN4(rgba, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i, j, k, (GLvoid *) rgba); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, rgba[0], rgba); |
} |
} |
} |
/* |
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. |
*/ |
static void |
sample_3d_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
const struct gl_texture_image *img, |
const GLfloat texcoord[4], |
GLchan rgba[4]) |
{ |
const GLint width = img->Width2; |
const GLint height = img->Height2; |
const GLint depth = img->Depth2; |
GLint i0, j0, k0, i1, j1, k1; |
GLuint useBorderColor; |
GLfloat u, v, w; |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1); |
useBorderColor = 0; |
if (img->Border) { |
i0 += img->Border; |
i1 += img->Border; |
j0 += img->Border; |
j1 += img->Border; |
k0 += img->Border; |
k1 += img->Border; |
} |
else { |
/* check if sampling texture border color */ |
if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; |
if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; |
if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; |
if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; |
if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT; |
if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT; |
} |
{ |
const GLfloat a = FRAC(u); |
const GLfloat b = FRAC(v); |
const GLfloat c = FRAC(w); |
#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT |
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ |
GLfloat w000 = (1.0F-a) * (1.0F-b) * (1.0F-c); |
GLfloat w100 = a * (1.0F-b) * (1.0F-c); |
GLfloat w010 = (1.0F-a) * b * (1.0F-c); |
GLfloat w110 = a * b * (1.0F-c); |
GLfloat w001 = (1.0F-a) * (1.0F-b) * c ; |
GLfloat w101 = a * (1.0F-b) * c ; |
GLfloat w011 = (1.0F-a) * b * c ; |
GLfloat w111 = a * b * c ; |
#else /* CHAN_BITS == 8 */ |
/* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ |
GLint w000 = IROUND_POS((1.0F-a) * (1.0F-b) * (1.0F-c) * WEIGHT_SCALE); |
GLint w100 = IROUND_POS( a * (1.0F-b) * (1.0F-c) * WEIGHT_SCALE); |
GLint w010 = IROUND_POS((1.0F-a) * b * (1.0F-c) * WEIGHT_SCALE); |
GLint w110 = IROUND_POS( a * b * (1.0F-c) * WEIGHT_SCALE); |
GLint w001 = IROUND_POS((1.0F-a) * (1.0F-b) * c * WEIGHT_SCALE); |
GLint w101 = IROUND_POS( a * (1.0F-b) * c * WEIGHT_SCALE); |
GLint w011 = IROUND_POS((1.0F-a) * b * c * WEIGHT_SCALE); |
GLint w111 = IROUND_POS( a * b * c * WEIGHT_SCALE); |
#endif |
GLchan t000[4], t010[4], t001[4], t011[4]; |
GLchan t100[4], t110[4], t101[4], t111[4]; |
if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { |
COPY_CHAN4(t000, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j0, k0, (GLvoid *) t000); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t000[0], t000); |
} |
} |
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { |
COPY_CHAN4(t100, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j0, k0, (GLvoid *) t100); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t100[0], t100); |
} |
} |
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { |
COPY_CHAN4(t010, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j1, k0, (GLvoid *) t010); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t010[0], t010); |
} |
} |
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { |
COPY_CHAN4(t110, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j1, k0, (GLvoid *) t110); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t110[0], t110); |
} |
} |
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { |
COPY_CHAN4(t001, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j0, k1, (GLvoid *) t001); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t001[0], t001); |
} |
} |
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { |
COPY_CHAN4(t101, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j0, k1, (GLvoid *) t101); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t101[0], t101); |
} |
} |
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { |
COPY_CHAN4(t011, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i0, j1, k1, (GLvoid *) t011); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t011[0], t011); |
} |
} |
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { |
COPY_CHAN4(t111, tObj->_BorderChan); |
} |
else { |
(*img->FetchTexel)(img, i1, j1, k1, (GLvoid *) t111); |
if (img->Format == GL_COLOR_INDEX) { |
palette_sample(ctx, tObj, t111[0], t111); |
} |
} |
#if CHAN_TYPE == GL_FLOAT |
rgba[0] = w000*t000[0] + w010*t010[0] + w001*t001[0] + w011*t011[0] + |
w100*t100[0] + w110*t110[0] + w101*t101[0] + w111*t111[0]; |
rgba[1] = w000*t000[1] + w010*t010[1] + w001*t001[1] + w011*t011[1] + |
w100*t100[1] + w110*t110[1] + w101*t101[1] + w111*t111[1]; |
rgba[2] = w000*t000[2] + w010*t010[2] + w001*t001[2] + w011*t011[2] + |
w100*t100[2] + w110*t110[2] + w101*t101[2] + w111*t111[2]; |
rgba[3] = w000*t000[3] + w010*t010[3] + w001*t001[3] + w011*t011[3] + |
w100*t100[3] + w110*t110[3] + w101*t101[3] + w111*t111[3]; |
#elif CHAN_TYPE == GL_UNSIGNED_SHORT |
rgba[0] = (GLchan) (w000*t000[0] + w010*t010[0] + |
w001*t001[0] + w011*t011[0] + |
w100*t100[0] + w110*t110[0] + |
w101*t101[0] + w111*t111[0] + 0.5); |
rgba[1] = (GLchan) (w000*t000[1] + w010*t010[1] + |
w001*t001[1] + w011*t011[1] + |
w100*t100[1] + w110*t110[1] + |
w101*t101[1] + w111*t111[1] + 0.5); |
rgba[2] = (GLchan) (w000*t000[2] + w010*t010[2] + |
w001*t001[2] + w011*t011[2] + |
w100*t100[2] + w110*t110[2] + |
w101*t101[2] + w111*t111[2] + 0.5); |
rgba[3] = (GLchan) (w000*t000[3] + w010*t010[3] + |
w001*t001[3] + w011*t011[3] + |
w100*t100[3] + w110*t110[3] + |
w101*t101[3] + w111*t111[3] + 0.5); |
#else /* CHAN_BITS == 8 */ |
rgba[0] = (GLchan) ( |
(w000*t000[0] + w010*t010[0] + w001*t001[0] + w011*t011[0] + |
w100*t100[0] + w110*t110[0] + w101*t101[0] + w111*t111[0] ) |
>> WEIGHT_SHIFT); |
rgba[1] = (GLchan) ( |
(w000*t000[1] + w010*t010[1] + w001*t001[1] + w011*t011[1] + |
w100*t100[1] + w110*t110[1] + w101*t101[1] + w111*t111[1] ) |
>> WEIGHT_SHIFT); |
rgba[2] = (GLchan) ( |
(w000*t000[2] + w010*t010[2] + w001*t001[2] + w011*t011[2] + |
w100*t100[2] + w110*t110[2] + w101*t101[2] + w111*t111[2] ) |
>> WEIGHT_SHIFT); |
rgba[3] = (GLchan) ( |
(w000*t000[3] + w010*t010[3] + w001*t001[3] + w011*t011[3] + |
w100*t100[3] + w110*t110[3] + w101*t101[3] + w111*t111[3] ) |
>> WEIGHT_SHIFT); |
#endif |
} |
} |
static void |
sample_3d_nearest_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_3d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
static void |
sample_3d_linear_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
sample_3d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); |
} |
} |
static void |
sample_3d_nearest_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_3d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_3d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_3d_linear_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
if (level >= tObj->_MaxLevel) { |
sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], |
texcoord[i], rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_3d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); |
sample_3d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_nearest_3d(GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
static void |
sample_linear_3d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4] ) |
{ |
GLuint i; |
struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; |
(void) lambda; |
for (i=0;i<n;i++) { |
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]); |
} |
} |
/* |
* Given an (s,t,r) texture coordinate and lambda (level of detail) value, |
* return a texture sample. |
*/ |
static void |
sample_lambda_3d( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4] ) |
{ |
GLuint minStart, minEnd; /* texels with minification */ |
GLuint magStart, magEnd; /* texels with magnification */ |
GLuint i; |
ASSERT(lambda != NULL); |
compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], |
n, lambda, &minStart, &minEnd, &magStart, &magEnd); |
if (minStart < minEnd) { |
/* do the minified texels */ |
GLuint m = minEnd - minStart; |
switch (tObj->MinFilter) { |
case GL_NEAREST: |
for (i = minStart; i < minEnd; i++) |
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_LINEAR: |
for (i = minStart; i < minEnd; i++) |
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_NEAREST_MIPMAP_NEAREST: |
sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_NEAREST: |
sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_LINEAR: |
sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_LINEAR: |
sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
default: |
_mesa_problem(ctx, "Bad min filter in sample_3d_texture"); |
return; |
} |
} |
if (magStart < magEnd) { |
/* do the magnified texels */ |
switch (tObj->MagFilter) { |
case GL_NEAREST: |
for (i = magStart; i < magEnd; i++) |
sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
case GL_LINEAR: |
for (i = magStart; i < magEnd; i++) |
sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], |
texcoords[i], rgba[i]); |
break; |
default: |
_mesa_problem(ctx, "Bad mag filter in sample_3d_texture"); |
return; |
} |
} |
} |
/**********************************************************************/ |
/* Texture Cube Map Sampling Functions */ |
/**********************************************************************/ |
/* |
* Choose one of six sides of a texture cube map given the texture |
* coord (rx,ry,rz). Return pointer to corresponding array of texture |
* images. |
*/ |
static const struct gl_texture_image ** |
choose_cube_face(const struct gl_texture_object *texObj, |
const GLfloat texcoord[4], GLfloat newCoord[4]) |
{ |
/* |
major axis |
direction target sc tc ma |
---------- ------------------------------- --- --- --- |
+rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx |
-rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx |
+ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry |
-ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry |
+rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz |
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz |
*/ |
const GLfloat rx = texcoord[0]; |
const GLfloat ry = texcoord[1]; |
const GLfloat rz = texcoord[2]; |
const struct gl_texture_image **imgArray; |
const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz); |
GLfloat sc, tc, ma; |
if (arx > ary && arx > arz) { |
if (rx >= 0.0F) { |
imgArray = (const struct gl_texture_image **) texObj->Image; |
sc = -rz; |
tc = -ry; |
ma = arx; |
} |
else { |
imgArray = (const struct gl_texture_image **) texObj->NegX; |
sc = rz; |
tc = -ry; |
ma = arx; |
} |
} |
else if (ary > arx && ary > arz) { |
if (ry >= 0.0F) { |
imgArray = (const struct gl_texture_image **) texObj->PosY; |
sc = rx; |
tc = rz; |
ma = ary; |
} |
else { |
imgArray = (const struct gl_texture_image **) texObj->NegY; |
sc = rx; |
tc = -rz; |
ma = ary; |
} |
} |
else { |
if (rz > 0.0F) { |
imgArray = (const struct gl_texture_image **) texObj->PosZ; |
sc = rx; |
tc = -ry; |
ma = arz; |
} |
else { |
imgArray = (const struct gl_texture_image **) texObj->NegZ; |
sc = -rx; |
tc = -ry; |
ma = arz; |
} |
} |
newCoord[0] = ( sc / ma + 1.0F ) * 0.5F; |
newCoord[1] = ( tc / ma + 1.0F ) * 0.5F; |
return imgArray; |
} |
static void |
sample_nearest_cube(GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
GLuint i; |
(void) lambda; |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
images = choose_cube_face(tObj, texcoords[i], newCoord); |
sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], |
newCoord, rgba[i]); |
} |
} |
static void |
sample_linear_cube(GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
(void) lambda; |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
images = choose_cube_face(tObj, texcoords[i], newCoord); |
sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], |
newCoord, rgba[i]); |
} |
} |
static void |
sample_cube_nearest_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
images = choose_cube_face(tObj, texcoord[i], newCoord); |
sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]); |
} |
} |
static void |
sample_cube_linear_mipmap_nearest(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
GLint level; |
COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); |
images = choose_cube_face(tObj, texcoord[i], newCoord); |
sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]); |
} |
} |
static void |
sample_cube_nearest_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
images = choose_cube_face(tObj, texcoord[i], newCoord); |
if (level >= tObj->_MaxLevel) { |
sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], |
newCoord, rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; /* texels */ |
const GLfloat f = FRAC(lambda[i]); |
sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0); |
sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_cube_linear_mipmap_linear(GLcontext *ctx, |
const struct gl_texture_object *tObj, |
GLuint n, GLfloat texcoord[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
GLuint i; |
ASSERT(lambda != NULL); |
for (i = 0; i < n; i++) { |
const struct gl_texture_image **images; |
GLfloat newCoord[4]; |
GLint level; |
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); |
images = choose_cube_face(tObj, texcoord[i], newCoord); |
if (level >= tObj->_MaxLevel) { |
sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], |
newCoord, rgba[i]); |
} |
else { |
GLchan t0[4], t1[4]; |
const GLfloat f = FRAC(lambda[i]); |
sample_2d_linear(ctx, tObj, images[level ], newCoord, t0); |
sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1); |
rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); |
rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); |
rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); |
rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); |
} |
} |
} |
static void |
sample_lambda_cube( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
GLuint minStart, minEnd; /* texels with minification */ |
GLuint magStart, magEnd; /* texels with magnification */ |
ASSERT(lambda != NULL); |
compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], |
n, lambda, &minStart, &minEnd, &magStart, &magEnd); |
if (minStart < minEnd) { |
/* do the minified texels */ |
const GLuint m = minEnd - minStart; |
switch (tObj->MinFilter) { |
case GL_NEAREST: |
sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR: |
sample_linear_cube(ctx, texUnit, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_NEAREST: |
sample_cube_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_NEAREST: |
sample_cube_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_NEAREST_MIPMAP_LINEAR: |
sample_cube_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
case GL_LINEAR_MIPMAP_LINEAR: |
sample_cube_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, |
lambda + minStart, rgba + minStart); |
break; |
default: |
_mesa_problem(ctx, "Bad min filter in sample_lambda_cube"); |
} |
} |
if (magStart < magEnd) { |
/* do the magnified texels */ |
const GLuint m = magEnd - magStart; |
switch (tObj->MagFilter) { |
case GL_NEAREST: |
sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + magStart, |
lambda + magStart, rgba + magStart); |
break; |
case GL_LINEAR: |
sample_linear_cube(ctx, texUnit, tObj, m, texcoords + magStart, |
lambda + magStart, rgba + magStart); |
break; |
default: |
_mesa_problem(ctx, "Bad mag filter in sample_lambda_cube"); |
} |
} |
} |
/**********************************************************************/ |
/* Texture Rectangle Sampling Functions */ |
/**********************************************************************/ |
static void |
sample_nearest_rect(GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
const struct gl_texture_image *img = tObj->Image[0]; |
const GLfloat width = (GLfloat) img->Width; |
const GLfloat height = (GLfloat) img->Height; |
const GLint width_minus_1 = img->Width - 1; |
const GLint height_minus_1 = img->Height - 1; |
GLuint i; |
(void) texUnit; |
(void) lambda; |
ASSERT(tObj->WrapS == GL_CLAMP || |
tObj->WrapS == GL_CLAMP_TO_EDGE || |
tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); |
ASSERT(tObj->WrapT == GL_CLAMP || |
tObj->WrapT == GL_CLAMP_TO_EDGE || |
tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); |
ASSERT(img->Format != GL_COLOR_INDEX); |
/* XXX move Wrap mode tests outside of loops for common cases */ |
for (i = 0; i < n; i++) { |
GLint row, col; |
/* NOTE: we DO NOT use [0, 1] texture coordinates! */ |
if (tObj->WrapS == GL_CLAMP) { |
col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width) ); |
} |
else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { |
col = IFLOOR( CLAMP(texcoords[i][0], 0.5F, width - 0.5F) ); |
} |
else { |
col = IFLOOR( CLAMP(texcoords[i][0], -0.5F, width + 0.5F) ); |
} |
if (tObj->WrapT == GL_CLAMP) { |
row = IFLOOR( CLAMP(texcoords[i][1], 0.0F, height) ); |
} |
else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { |
row = IFLOOR( CLAMP(texcoords[i][1], 0.5F, height - 0.5F) ); |
} |
else { |
row = IFLOOR( CLAMP(texcoords[i][1], -0.5F, height + 0.5F) ); |
} |
col = CLAMP(col, 0, width_minus_1); |
row = CLAMP(row, 0, height_minus_1); |
(*img->FetchTexel)(img, col, row, 0, (GLvoid *) rgba[i]); |
} |
} |
static void |
sample_linear_rect(GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], |
const GLfloat lambda[], GLchan rgba[][4]) |
{ |
const struct gl_texture_image *img = tObj->Image[0]; |
const GLfloat width = (GLfloat) img->Width; |
const GLfloat height = (GLfloat) img->Height; |
const GLint width_minus_1 = img->Width - 1; |
const GLint height_minus_1 = img->Height - 1; |
GLuint i; |
(void) texUnit; |
(void) lambda; |
ASSERT(tObj->WrapS == GL_CLAMP || |
tObj->WrapS == GL_CLAMP_TO_EDGE || |
tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); |
ASSERT(tObj->WrapT == GL_CLAMP || |
tObj->WrapT == GL_CLAMP_TO_EDGE || |
tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); |
ASSERT(img->Format != GL_COLOR_INDEX); |
/* XXX lots of opportunity for optimization in this loop */ |
for (i = 0; i < n; i++) { |
GLfloat frow, fcol; |
GLint row0, col0, row1, col1; |
GLchan t00[4], t01[4], t10[4], t11[4]; |
GLfloat a, b, w00, w01, w10, w11; |
/* NOTE: we DO NOT use [0, 1] texture coordinates! */ |
if (tObj->WrapS == GL_CLAMP) { |
fcol = CLAMP(texcoords[i][0], 0.0F, width); |
} |
else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { |
fcol = CLAMP(texcoords[i][0], 0.5F, width - 0.5F); |
} |
else { |
fcol = CLAMP(texcoords[i][0], -0.5F, width + 0.5F); |
} |
if (tObj->WrapT == GL_CLAMP) { |
frow = CLAMP(texcoords[i][1], 0.0F, height); |
} |
else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { |
frow = CLAMP(texcoords[i][1], 0.5F, height - 0.5F); |
} |
else { |
frow = CLAMP(texcoords[i][1], -0.5F, height + 0.5F); |
} |
/* compute integer rows/columns */ |
col0 = IFLOOR(fcol); |
col1 = col0 + 1; |
col0 = CLAMP(col0, 0, width_minus_1); |
col1 = CLAMP(col1, 0, width_minus_1); |
row0 = IFLOOR(frow); |
row1 = row0 + 1; |
row0 = CLAMP(row0, 0, height_minus_1); |
row1 = CLAMP(row1, 0, height_minus_1); |
/* get four texel samples */ |
(*img->FetchTexel)(img, col0, row0, 0, (GLvoid *) t00); |
(*img->FetchTexel)(img, col1, row0, 0, (GLvoid *) t10); |
(*img->FetchTexel)(img, col0, row1, 0, (GLvoid *) t01); |
(*img->FetchTexel)(img, col1, row1, 0, (GLvoid *) t11); |
/* compute sample weights */ |
a = FRAC(fcol); |
b = FRAC(frow); |
w00 = (1.0F-a) * (1.0F-b); |
w10 = a * (1.0F-b); |
w01 = (1.0F-a) * b ; |
w11 = a * b ; |
/* compute weighted average of samples */ |
rgba[i][0] = |
(GLchan) (w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]); |
rgba[i][1] = |
(GLchan) (w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]); |
rgba[i][2] = |
(GLchan) (w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]); |
rgba[i][3] = |
(GLchan) (w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]); |
} |
} |
static void |
sample_lambda_rect( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
GLuint minStart, minEnd, magStart, magEnd; |
/* We only need lambda to decide between minification and magnification. |
* There is no mipmapping with rectangular textures. |
*/ |
compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], |
n, lambda, &minStart, &minEnd, &magStart, &magEnd); |
if (minStart < minEnd) { |
if (tObj->MinFilter == GL_NEAREST) { |
sample_nearest_rect( ctx, texUnit, tObj, minEnd - minStart, |
texcoords + minStart, NULL, rgba + minStart); |
} |
else { |
sample_linear_rect( ctx, texUnit, tObj, minEnd - minStart, |
texcoords + minStart, NULL, rgba + minStart); |
} |
} |
if (magStart < magEnd) { |
if (tObj->MagFilter == GL_NEAREST) { |
sample_nearest_rect( ctx, texUnit, tObj, magEnd - magStart, |
texcoords + magStart, NULL, rgba + magStart); |
} |
else { |
sample_linear_rect( ctx, texUnit, tObj, magEnd - magStart, |
texcoords + magStart, NULL, rgba + magStart); |
} |
} |
} |
/* |
* Sample a shadow/depth texture. |
*/ |
static void |
sample_depth_texture( GLcontext *ctx, GLuint unit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan texel[][4] ) |
{ |
const GLint baseLevel = tObj->BaseLevel; |
const struct gl_texture_image *texImage = tObj->Image[baseLevel]; |
const GLuint width = texImage->Width; |
const GLuint height = texImage->Height; |
GLchan ambient; |
GLenum function; |
GLchan result; |
(void) unit; |
ASSERT(tObj->Image[tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); |
ASSERT(tObj->Target == GL_TEXTURE_1D || |
tObj->Target == GL_TEXTURE_2D || |
tObj->Target == GL_TEXTURE_RECTANGLE_NV); |
UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); |
/* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ |
/* XXX this could be precomputed and saved in the texture object */ |
if (tObj->CompareFlag) { |
/* GL_SGIX_shadow */ |
if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { |
function = GL_LEQUAL; |
} |
else { |
ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); |
function = GL_GEQUAL; |
} |
} |
else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { |
/* GL_ARB_shadow */ |
function = tObj->CompareFunc; |
} |
else { |
function = GL_NONE; /* pass depth through as grayscale */ |
} |
if (tObj->MagFilter == GL_NEAREST) { |
GLuint i; |
for (i = 0; i < n; i++) { |
GLfloat depthSample; |
GLint col, row; |
/* XXX fix for texture rectangle! */ |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col); |
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row); |
depthSample = *((const GLfloat *) texImage->Data + row * width + col); |
switch (function) { |
case GL_LEQUAL: |
result = (texcoords[i][2] <= depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_GEQUAL: |
result = (texcoords[i][2] >= depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_LESS: |
result = (texcoords[i][2] < depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_GREATER: |
result = (texcoords[i][2] > depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_EQUAL: |
result = (texcoords[i][2] == depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_NOTEQUAL: |
result = (texcoords[i][2] != depthSample) ? CHAN_MAX : ambient; |
break; |
case GL_ALWAYS: |
result = CHAN_MAX; |
break; |
case GL_NEVER: |
result = ambient; |
break; |
case GL_NONE: |
CLAMPED_FLOAT_TO_CHAN(result, depthSample); |
break; |
default: |
_mesa_problem(ctx, "Bad compare func in sample_depth_texture"); |
return; |
} |
switch (tObj->DepthMode) { |
case GL_LUMINANCE: |
texel[i][RCOMP] = result; |
texel[i][GCOMP] = result; |
texel[i][BCOMP] = result; |
texel[i][ACOMP] = CHAN_MAX; |
break; |
case GL_INTENSITY: |
texel[i][RCOMP] = result; |
texel[i][GCOMP] = result; |
texel[i][BCOMP] = result; |
texel[i][ACOMP] = result; |
break; |
case GL_ALPHA: |
texel[i][RCOMP] = 0; |
texel[i][GCOMP] = 0; |
texel[i][BCOMP] = 0; |
texel[i][ACOMP] = result; |
break; |
default: |
_mesa_problem(ctx, "Bad depth texture mode"); |
} |
} |
} |
else { |
GLuint i; |
ASSERT(tObj->MagFilter == GL_LINEAR); |
for (i = 0; i < n; i++) { |
GLfloat depth00, depth01, depth10, depth11; |
GLint i0, i1, j0, j1; |
GLfloat u, v; |
GLuint useBorderTexel; |
/* XXX fix for texture rectangle! */ |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], u, width, i0, i1); |
COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1); |
useBorderTexel = 0; |
if (texImage->Border) { |
i0 += texImage->Border; |
i1 += texImage->Border; |
j0 += texImage->Border; |
j1 += texImage->Border; |
} |
else { |
if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; |
if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; |
if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; |
if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; |
} |
/* get four depth samples from the texture */ |
if (useBorderTexel & (I0BIT | J0BIT)) { |
depth00 = 1.0; |
} |
else { |
depth00 = *((const GLfloat *) texImage->Data + j0 * width + i0); |
} |
if (useBorderTexel & (I1BIT | J0BIT)) { |
depth10 = 1.0; |
} |
else { |
depth10 = *((const GLfloat *) texImage->Data + j0 * width + i1); |
} |
if (useBorderTexel & (I0BIT | J1BIT)) { |
depth01 = 1.0; |
} |
else { |
depth01 = *((const GLfloat *) texImage->Data + j1 * width + i0); |
} |
if (useBorderTexel & (I1BIT | J1BIT)) { |
depth11 = 1.0; |
} |
else { |
depth11 = *((const GLfloat *) texImage->Data + j1 * width + i1); |
} |
if (0) { |
/* compute a single weighted depth sample and do one comparison */ |
const GLfloat a = FRAC(u + 1.0F); |
const GLfloat b = FRAC(v + 1.0F); |
const GLfloat w00 = (1.0F - a) * (1.0F - b); |
const GLfloat w10 = ( a) * (1.0F - b); |
const GLfloat w01 = (1.0F - a) * ( b); |
const GLfloat w11 = ( a) * ( b); |
const GLfloat depthSample = w00 * depth00 + w10 * depth10 |
+ w01 * depth01 + w11 * depth11; |
if ((depthSample <= texcoords[i][2] && function == GL_LEQUAL) || |
(depthSample >= texcoords[i][2] && function == GL_GEQUAL)) { |
result = ambient; |
} |
else { |
result = CHAN_MAX; |
} |
} |
else { |
/* Do four depth/R comparisons and compute a weighted result. |
* If this touches on somebody's I.P., I'll remove this code |
* upon request. |
*/ |
const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; |
GLfloat luminance = CHAN_MAXF; |
switch (function) { |
case GL_LEQUAL: |
if (depth00 <= texcoords[i][2]) luminance -= d; |
if (depth01 <= texcoords[i][2]) luminance -= d; |
if (depth10 <= texcoords[i][2]) luminance -= d; |
if (depth11 <= texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_GEQUAL: |
if (depth00 >= texcoords[i][2]) luminance -= d; |
if (depth01 >= texcoords[i][2]) luminance -= d; |
if (depth10 >= texcoords[i][2]) luminance -= d; |
if (depth11 >= texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_LESS: |
if (depth00 < texcoords[i][2]) luminance -= d; |
if (depth01 < texcoords[i][2]) luminance -= d; |
if (depth10 < texcoords[i][2]) luminance -= d; |
if (depth11 < texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_GREATER: |
if (depth00 > texcoords[i][2]) luminance -= d; |
if (depth01 > texcoords[i][2]) luminance -= d; |
if (depth10 > texcoords[i][2]) luminance -= d; |
if (depth11 > texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_EQUAL: |
if (depth00 == texcoords[i][2]) luminance -= d; |
if (depth01 == texcoords[i][2]) luminance -= d; |
if (depth10 == texcoords[i][2]) luminance -= d; |
if (depth11 == texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_NOTEQUAL: |
if (depth00 != texcoords[i][2]) luminance -= d; |
if (depth01 != texcoords[i][2]) luminance -= d; |
if (depth10 != texcoords[i][2]) luminance -= d; |
if (depth11 != texcoords[i][2]) luminance -= d; |
result = (GLchan) luminance; |
break; |
case GL_ALWAYS: |
result = 0; |
break; |
case GL_NEVER: |
result = CHAN_MAX; |
break; |
case GL_NONE: |
/* ordinary bilinear filtering */ |
{ |
const GLfloat a = FRAC(u + 1.0F); |
const GLfloat b = FRAC(v + 1.0F); |
const GLfloat w00 = (1.0F - a) * (1.0F - b); |
const GLfloat w10 = ( a) * (1.0F - b); |
const GLfloat w01 = (1.0F - a) * ( b); |
const GLfloat w11 = ( a) * ( b); |
const GLfloat depthSample = w00 * depth00 + w10 * depth10 |
+ w01 * depth01 + w11 * depth11; |
CLAMPED_FLOAT_TO_CHAN(result, depthSample); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad compare func in sample_depth_texture"); |
return; |
} |
} |
switch (tObj->DepthMode) { |
case GL_LUMINANCE: |
texel[i][RCOMP] = result; |
texel[i][GCOMP] = result; |
texel[i][BCOMP] = result; |
texel[i][ACOMP] = CHAN_MAX; |
break; |
case GL_INTENSITY: |
texel[i][RCOMP] = result; |
texel[i][GCOMP] = result; |
texel[i][BCOMP] = result; |
texel[i][ACOMP] = result; |
break; |
case GL_ALPHA: |
texel[i][RCOMP] = 0; |
texel[i][GCOMP] = 0; |
texel[i][BCOMP] = 0; |
texel[i][ACOMP] = result; |
break; |
default: |
_mesa_problem(ctx, "Bad depth texture mode"); |
} |
} /* for */ |
} /* if filter */ |
} |
#if 0 |
/* |
* Experimental depth texture sampling function. |
*/ |
static void |
sample_depth_texture2(const GLcontext *ctx, |
const struct gl_texture_unit *texUnit, |
GLuint n, GLfloat texcoords[][4], |
GLchan texel[][4]) |
{ |
const struct gl_texture_object *texObj = texUnit->_Current; |
const GLint baseLevel = texObj->BaseLevel; |
const struct gl_texture_image *texImage = texObj->Image[baseLevel]; |
const GLuint width = texImage->Width; |
const GLuint height = texImage->Height; |
GLchan ambient; |
GLboolean lequal, gequal; |
if (texObj->Target != GL_TEXTURE_2D) { |
_mesa_problem(ctx, "only 2-D depth textures supported at this time"); |
return; |
} |
if (texObj->MinFilter != texObj->MagFilter) { |
_mesa_problem(ctx, "mipmapped depth textures not supported at this time"); |
return; |
} |
/* XXX the GL_SGIX_shadow extension spec doesn't say what to do if |
* GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object |
* isn't a depth texture. |
*/ |
if (texImage->Format != GL_DEPTH_COMPONENT) { |
_mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); |
return; |
} |
UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); |
if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { |
lequal = GL_TRUE; |
gequal = GL_FALSE; |
} |
else { |
lequal = GL_FALSE; |
gequal = GL_TRUE; |
} |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLint K = 3; |
GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; |
GLfloat w; |
GLchan lum; |
COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, texcoords[i][0], |
width, col); |
COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, texcoords[i][1], |
height, row); |
imin = col - K; |
imax = col + K; |
jmin = row - K; |
jmax = row + K; |
if (imin < 0) imin = 0; |
if (imax >= width) imax = width - 1; |
if (jmin < 0) jmin = 0; |
if (jmax >= height) jmax = height - 1; |
samples = (imax - imin + 1) * (jmax - jmin + 1); |
count = 0; |
for (jj = jmin; jj <= jmax; jj++) { |
for (ii = imin; ii <= imax; ii++) { |
GLfloat depthSample = *((const GLfloat *) texImage->Data |
+ jj * width + ii); |
if ((depthSample <= r[i] && lequal) || |
(depthSample >= r[i] && gequal)) { |
count++; |
} |
} |
} |
w = (GLfloat) count / (GLfloat) samples; |
w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); |
lum = (GLint) w; |
texel[i][RCOMP] = lum; |
texel[i][GCOMP] = lum; |
texel[i][BCOMP] = lum; |
texel[i][ACOMP] = CHAN_MAX; |
} |
} |
} |
#endif |
/** |
* We use this function when a texture object is in an "incomplete" state. |
*/ |
static void |
null_sample_func( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *tObj, GLuint n, |
GLfloat texcoords[][4], const GLfloat lambda[], |
GLchan rgba[][4]) |
{ |
} |
/** |
* Setup the texture sampling function for this texture object. |
*/ |
void |
_swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, |
const struct gl_texture_object *t ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (!t->Complete) { |
swrast->TextureSample[texUnit] = null_sample_func; |
} |
else { |
const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); |
const GLenum format = t->Image[t->BaseLevel]->Format; |
if (needLambda) { |
/* Compute min/mag filter threshold */ |
if (t->MagFilter == GL_LINEAR |
&& (t->MinFilter == GL_NEAREST_MIPMAP_NEAREST || |
t->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { |
swrast->_MinMagThresh[texUnit] = 0.5F; |
} |
else { |
swrast->_MinMagThresh[texUnit] = 0.0F; |
} |
} |
switch (t->Target) { |
case GL_TEXTURE_1D: |
if (format == GL_DEPTH_COMPONENT) { |
swrast->TextureSample[texUnit] = sample_depth_texture; |
} |
else if (needLambda) { |
swrast->TextureSample[texUnit] = sample_lambda_1d; |
} |
else if (t->MinFilter == GL_LINEAR) { |
swrast->TextureSample[texUnit] = sample_linear_1d; |
} |
else { |
ASSERT(t->MinFilter == GL_NEAREST); |
swrast->TextureSample[texUnit] = sample_nearest_1d; |
} |
break; |
case GL_TEXTURE_2D: |
if (format == GL_DEPTH_COMPONENT) { |
swrast->TextureSample[texUnit] = sample_depth_texture; |
} |
else if (needLambda) { |
swrast->TextureSample[texUnit] = sample_lambda_2d; |
} |
else if (t->MinFilter == GL_LINEAR) { |
swrast->TextureSample[texUnit] = sample_linear_2d; |
} |
else { |
GLint baseLevel = t->BaseLevel; |
ASSERT(t->MinFilter == GL_NEAREST); |
if (t->WrapS == GL_REPEAT && |
t->WrapT == GL_REPEAT && |
t->Image[baseLevel]->Border == 0 && |
t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { |
swrast->TextureSample[texUnit] = opt_sample_rgb_2d; |
} |
else if (t->WrapS == GL_REPEAT && |
t->WrapT == GL_REPEAT && |
t->Image[baseLevel]->Border == 0 && |
t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { |
swrast->TextureSample[texUnit] = opt_sample_rgba_2d; |
} |
else |
swrast->TextureSample[texUnit] = sample_nearest_2d; |
} |
break; |
case GL_TEXTURE_3D: |
if (needLambda) { |
swrast->TextureSample[texUnit] = sample_lambda_3d; |
} |
else if (t->MinFilter == GL_LINEAR) { |
swrast->TextureSample[texUnit] = sample_linear_3d; |
} |
else { |
ASSERT(t->MinFilter == GL_NEAREST); |
swrast->TextureSample[texUnit] = sample_nearest_3d; |
} |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (needLambda) { |
swrast->TextureSample[texUnit] = sample_lambda_cube; |
} |
else if (t->MinFilter == GL_LINEAR) { |
swrast->TextureSample[texUnit] = sample_linear_cube; |
} |
else { |
ASSERT(t->MinFilter == GL_NEAREST); |
swrast->TextureSample[texUnit] = sample_nearest_cube; |
} |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
if (needLambda) { |
swrast->TextureSample[texUnit] = sample_lambda_rect; |
} |
else if (t->MinFilter == GL_LINEAR) { |
swrast->TextureSample[texUnit] = sample_linear_rect; |
} |
else { |
ASSERT(t->MinFilter == GL_NEAREST); |
swrast->TextureSample[texUnit] = sample_nearest_rect; |
} |
break; |
default: |
_mesa_problem(ctx, "invalid target in _swrast_choose_texture_sample_func"); |
} |
} |
} |
#define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) |
#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) |
/** |
* Do texture application for GL_ARB/EXT_texture_env_combine. |
* Input: |
* ctx - rendering context |
* textureUnit - the texture unit to apply |
* n - number of fragments to process (span width) |
* primary_rgba - incoming fragment color array |
* texelBuffer - pointer to texel colors for all texture units |
* Input/Output: |
* rgba - incoming colors, which get modified here |
*/ |
static INLINE void |
texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, |
CONST GLchan (*primary_rgba)[4], |
CONST GLchan *texelBuffer, |
GLchan (*rgba)[4] ) |
{ |
const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); |
const GLchan (*argRGB [3])[4]; |
const GLchan (*argA [3])[4]; |
const GLuint RGBshift = textureUnit->CombineScaleShiftRGB; |
const GLuint Ashift = textureUnit->CombineScaleShiftA; |
#if CHAN_TYPE == GL_FLOAT |
const GLchan RGBmult = (GLfloat) (1 << RGBshift); |
const GLchan Amult = (GLfloat) (1 << Ashift); |
#else |
const GLint half = (CHAN_MAX + 1) / 2; |
#endif |
GLuint i, j; |
/* GLchan ccolor[3][4]; */ |
DEFMNARRAY(GLchan, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(ccolor, return); /* mac 32k limitation */ |
ASSERT(ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine); |
ASSERT(SWRAST_CONTEXT(ctx)->_AnyTextureCombine); |
/* |
printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", |
textureUnit->CombineModeRGB, |
textureUnit->CombineModeA, |
textureUnit->CombineSourceRGB[0], |
textureUnit->CombineSourceA[0], |
textureUnit->CombineSourceRGB[1], |
textureUnit->CombineSourceA[1]); |
*/ |
/* |
* Do operand setup for up to 3 operands. Loop over the terms. |
*/ |
for (j = 0; j < 3; j++) { |
const GLenum srcA = textureUnit->CombineSourceA[j]; |
const GLenum srcRGB = textureUnit->CombineSourceRGB[j]; |
switch (srcA) { |
case GL_TEXTURE: |
argA[j] = (const GLchan (*)[4]) |
(texelBuffer + unit * (n * 4 * sizeof(GLchan))); |
break; |
case GL_PRIMARY_COLOR_EXT: |
argA[j] = primary_rgba; |
break; |
case GL_PREVIOUS_EXT: |
argA[j] = (const GLchan (*)[4]) rgba; |
break; |
case GL_CONSTANT_EXT: |
{ |
GLchan alpha, (*c)[4] = ccolor[j]; |
UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); |
for (i = 0; i < n; i++) |
c[i][ACOMP] = alpha; |
argA[j] = (const GLchan (*)[4]) ccolor[j]; |
} |
break; |
default: |
/* ARB_texture_env_crossbar source */ |
{ |
const GLuint srcUnit = srcA - GL_TEXTURE0_ARB; |
ASSERT(srcUnit < ctx->Const.MaxTextureUnits); |
if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) |
return; |
argA[j] = (const GLchan (*)[4]) |
(texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); |
} |
} |
switch (srcRGB) { |
case GL_TEXTURE: |
argRGB[j] = (const GLchan (*)[4]) |
(texelBuffer + unit * (n * 4 * sizeof(GLchan))); |
break; |
case GL_PRIMARY_COLOR_EXT: |
argRGB[j] = primary_rgba; |
break; |
case GL_PREVIOUS_EXT: |
argRGB[j] = (const GLchan (*)[4]) rgba; |
break; |
case GL_CONSTANT_EXT: |
{ |
GLchan (*c)[4] = ccolor[j]; |
GLchan red, green, blue, alpha; |
UNCLAMPED_FLOAT_TO_CHAN(red, textureUnit->EnvColor[0]); |
UNCLAMPED_FLOAT_TO_CHAN(green, textureUnit->EnvColor[1]); |
UNCLAMPED_FLOAT_TO_CHAN(blue, textureUnit->EnvColor[2]); |
UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); |
for (i = 0; i < n; i++) { |
c[i][RCOMP] = red; |
c[i][GCOMP] = green; |
c[i][BCOMP] = blue; |
c[i][ACOMP] = alpha; |
} |
argRGB[j] = (const GLchan (*)[4]) ccolor[j]; |
} |
break; |
default: |
/* ARB_texture_env_crossbar source */ |
{ |
const GLuint srcUnit = srcRGB - GL_TEXTURE0_ARB; |
ASSERT(srcUnit < ctx->Const.MaxTextureUnits); |
if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) |
return; |
argRGB[j] = (const GLchan (*)[4]) |
(texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); |
} |
} |
if (textureUnit->CombineOperandRGB[j] != GL_SRC_COLOR) { |
const GLchan (*src)[4] = argRGB[j]; |
GLchan (*dst)[4] = ccolor[j]; |
/* point to new arg[j] storage */ |
argRGB[j] = (const GLchan (*)[4]) ccolor[j]; |
if (textureUnit->CombineOperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) { |
for (i = 0; i < n; i++) { |
dst[i][RCOMP] = CHAN_MAX - src[i][RCOMP]; |
dst[i][GCOMP] = CHAN_MAX - src[i][GCOMP]; |
dst[i][BCOMP] = CHAN_MAX - src[i][BCOMP]; |
} |
} |
else if (textureUnit->CombineOperandRGB[j] == GL_SRC_ALPHA) { |
for (i = 0; i < n; i++) { |
dst[i][RCOMP] = src[i][ACOMP]; |
dst[i][GCOMP] = src[i][ACOMP]; |
dst[i][BCOMP] = src[i][ACOMP]; |
} |
} |
else { |
ASSERT(textureUnit->CombineOperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); |
for (i = 0; i < n; i++) { |
dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP]; |
dst[i][GCOMP] = CHAN_MAX - src[i][ACOMP]; |
dst[i][BCOMP] = CHAN_MAX - src[i][ACOMP]; |
} |
} |
} |
if (textureUnit->CombineOperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { |
const GLchan (*src)[4] = argA[j]; |
GLchan (*dst)[4] = ccolor[j]; |
argA[j] = (const GLchan (*)[4]) ccolor[j]; |
for (i = 0; i < n; i++) { |
dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP]; |
} |
} |
if (textureUnit->CombineModeRGB == GL_REPLACE && |
textureUnit->CombineModeA == GL_REPLACE) { |
break; /* done, we need only arg0 */ |
} |
if (j == 1 && |
textureUnit->CombineModeRGB != GL_INTERPOLATE_EXT && |
textureUnit->CombineModeA != GL_INTERPOLATE_EXT) { |
break; /* arg0 and arg1 are done. we don't need arg2. */ |
} |
} |
/* |
* Do the texture combine. |
*/ |
switch (textureUnit->CombineModeRGB) { |
case GL_REPLACE: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
if (RGBshift) { |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; |
rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; |
rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; |
#else |
GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift; |
GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift; |
GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
#endif |
} |
} |
else { |
for (i = 0; i < n; i++) { |
rgba[i][RCOMP] = arg0[i][RCOMP]; |
rgba[i][GCOMP] = arg0[i][GCOMP]; |
rgba[i][BCOMP] = arg0[i][BCOMP]; |
} |
} |
} |
break; |
case GL_MODULATE: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
#if CHAN_TYPE != GL_FLOAT |
const GLint shift = CHAN_BITS - RGBshift; |
#endif |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; |
rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; |
rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; |
#else |
GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift; |
GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift; |
GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift; |
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_ADD: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; |
rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; |
rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; |
#else |
GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift; |
GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift; |
GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift; |
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_ADD_SIGNED_EXT: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; |
rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; |
rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; |
#else |
GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] -half; |
GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] -half; |
GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] -half; |
r = (r < 0) ? 0 : r << RGBshift; |
g = (g < 0) ? 0 : g << RGBshift; |
b = (b < 0) ? 0 : b << RGBshift; |
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_INTERPOLATE_EXT: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; |
#if CHAN_TYPE != GL_FLOAT |
const GLint shift = CHAN_BITS - RGBshift; |
#endif |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + |
arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult; |
rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + |
arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult; |
rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + |
arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult; |
#else |
GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) |
+ PROD(arg1[i][RCOMP], CHAN_MAX - arg2[i][RCOMP])) |
>> shift; |
GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) |
+ PROD(arg1[i][GCOMP], CHAN_MAX - arg2[i][GCOMP])) |
>> shift; |
GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) |
+ PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP])) |
>> shift; |
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_SUBTRACT_ARB: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; |
rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; |
rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; |
#else |
GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift; |
GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift; |
GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift; |
rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_DOT3_RGB_EXT: |
case GL_DOT3_RGBA_EXT: |
{ |
/* Do not scale the result by 1 2 or 4 */ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + |
(arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + |
(arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) |
* 4.0F; |
dot = CLAMP(dot, 0.0F, CHAN_MAXF); |
#else |
GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, |
(GLint)arg1[i][RCOMP] - half) + |
S_PROD((GLint)arg0[i][GCOMP] - half, |
(GLint)arg1[i][GCOMP] - half) + |
S_PROD((GLint)arg0[i][BCOMP] - half, |
(GLint)arg1[i][BCOMP] - half)) >> 6; |
dot = CLAMP(dot, 0, CHAN_MAX); |
#endif |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; |
} |
} |
break; |
case GL_DOT3_RGB_ARB: |
case GL_DOT3_RGBA_ARB: |
{ |
/* DO scale the result by 1 2 or 4 */ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + |
(arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + |
(arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) |
* 4.0F * RGBmult; |
dot = CLAMP(dot, 0.0, CHAN_MAXF); |
#else |
GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, |
(GLint)arg1[i][RCOMP] - half) + |
S_PROD((GLint)arg0[i][GCOMP] - half, |
(GLint)arg1[i][GCOMP] - half) + |
S_PROD((GLint)arg0[i][BCOMP] - half, |
(GLint)arg1[i][BCOMP] - half)) >> 6; |
dot <<= RGBshift; |
dot = CLAMP(dot, 0, CHAN_MAX); |
#endif |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; |
} |
} |
break; |
default: |
_mesa_problem(ctx, "invalid combine mode"); |
} |
switch (textureUnit->CombineModeA) { |
case GL_REPLACE: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
if (Ashift) { |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
GLchan a = arg0[i][ACOMP] * Amult; |
#else |
GLuint a = (GLuint) arg0[i][ACOMP] << Ashift; |
#endif |
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); |
} |
} |
else { |
for (i = 0; i < n; i++) { |
rgba[i][ACOMP] = arg0[i][ACOMP]; |
} |
} |
} |
break; |
case GL_MODULATE: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; |
#if CHAN_TYPE != GL_FLOAT |
const GLint shift = CHAN_BITS - Ashift; |
#endif |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; |
#else |
GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift); |
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_ADD: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; |
#else |
GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift; |
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_ADD_SIGNED_EXT: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; |
#else |
GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half; |
a = (a < 0) ? 0 : a << Ashift; |
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_INTERPOLATE_EXT: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; |
const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; |
#if CHAN_TYPE != GL_FLOAT |
const GLint shift = CHAN_BITS - Ashift; |
#endif |
for (i=0; i<n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (arg0[i][ACOMP] * arg2[i][ACOMP] + |
arg1[i][ACOMP] * (CHAN_MAXF - arg2[i][ACOMP])) |
* Amult; |
#else |
GLuint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP]) |
+ PROD(arg1[i][ACOMP], CHAN_MAX - arg2[i][ACOMP])) |
>> shift; |
rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); |
#endif |
} |
} |
break; |
case GL_SUBTRACT_ARB: |
{ |
const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; |
const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult; |
#else |
GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift; |
rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); |
#endif |
} |
} |
break; |
default: |
_mesa_problem(ctx, "invalid combine mode"); |
} |
/* Fix the alpha component for GL_DOT3_RGBA_EXT/ARB combining. |
* This is kind of a kludge. It would have been better if the spec |
* were written such that the GL_COMBINE_ALPHA value could be set to |
* GL_DOT3. |
*/ |
if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT || |
textureUnit->CombineModeRGB == GL_DOT3_RGBA_ARB) { |
for (i = 0; i < n; i++) { |
rgba[i][ACOMP] = rgba[i][RCOMP]; |
} |
} |
UNDEFARRAY(ccolor); /* mac 32k limitation */ |
} |
#undef PROD |
/** |
* Implement NVIDIA's GL_NV_texture_env_combine4 extension when |
* texUnit->EnvMode == GL_COMBINE4_NV. |
*/ |
static INLINE void |
texture_combine4( const GLcontext *ctx, GLuint unit, GLuint n, |
CONST GLchan (*primary_rgba)[4], |
CONST GLchan *texelBuffer, |
GLchan (*rgba)[4] ) |
{ |
} |
/** |
* Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND, |
* MODULATE, or DECAL) to an array of fragments. |
* Input: textureUnit - pointer to texture unit to apply |
* format - base internal texture format |
* n - number of fragments |
* primary_rgba - primary colors (may alias rgba for single texture) |
* texels - array of texel colors |
* InOut: rgba - incoming fragment colors modified by texel colors |
* according to the texture environment mode. |
*/ |
static void |
texture_apply( const GLcontext *ctx, |
const struct gl_texture_unit *texUnit, |
GLuint n, |
CONST GLchan primary_rgba[][4], CONST GLchan texel[][4], |
GLchan rgba[][4] ) |
{ |
GLint baseLevel; |
GLuint i; |
GLint Rc, Gc, Bc, Ac; |
GLenum format; |
ASSERT(texUnit); |
ASSERT(texUnit->_Current); |
baseLevel = texUnit->_Current->BaseLevel; |
ASSERT(texUnit->_Current->Image[baseLevel]); |
format = texUnit->_Current->Image[baseLevel]->Format; |
if (format == GL_COLOR_INDEX || format == GL_DEPTH_COMPONENT |
|| format == GL_YCBCR_MESA) { |
format = GL_RGBA; /* a bit of a hack */ |
} |
switch (texUnit->EnvMode) { |
case GL_REPLACE: |
switch (format) { |
case GL_ALPHA: |
for (i=0;i<n;i++) { |
/* Cv = Cf */ |
/* Av = At */ |
rgba[i][ACOMP] = texel[i][ACOMP]; |
} |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) { |
/* Cv = Lt */ |
GLchan Lt = texel[i][RCOMP]; |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = Lt; |
/* Av = Af */ |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
GLchan Lt = texel[i][RCOMP]; |
/* Cv = Lt */ |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = Lt; |
/* Av = At */ |
rgba[i][ACOMP] = texel[i][ACOMP]; |
} |
break; |
case GL_INTENSITY: |
for (i=0;i<n;i++) { |
/* Cv = It */ |
GLchan It = texel[i][RCOMP]; |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = It; |
/* Av = It */ |
rgba[i][ACOMP] = It; |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
/* Cv = Ct */ |
rgba[i][RCOMP] = texel[i][RCOMP]; |
rgba[i][GCOMP] = texel[i][GCOMP]; |
rgba[i][BCOMP] = texel[i][BCOMP]; |
/* Av = Af */ |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
/* Cv = Ct */ |
rgba[i][RCOMP] = texel[i][RCOMP]; |
rgba[i][GCOMP] = texel[i][GCOMP]; |
rgba[i][BCOMP] = texel[i][BCOMP]; |
/* Av = At */ |
rgba[i][ACOMP] = texel[i][ACOMP]; |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format (GL_REPLACE) in texture_apply"); |
return; |
} |
break; |
case GL_MODULATE: |
switch (format) { |
case GL_ALPHA: |
for (i=0;i<n;i++) { |
/* Cv = Cf */ |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] ); |
} |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) { |
/* Cv = LtCf */ |
GLchan Lt = texel[i][RCOMP]; |
rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], Lt ); |
rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], Lt ); |
rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], Lt ); |
/* Av = Af */ |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
/* Cv = CfLt */ |
GLchan Lt = texel[i][RCOMP]; |
rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], Lt ); |
rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], Lt ); |
rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], Lt ); |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] ); |
} |
break; |
case GL_INTENSITY: |
for (i=0;i<n;i++) { |
/* Cv = CfIt */ |
GLchan It = texel[i][RCOMP]; |
rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], It ); |
rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], It ); |
rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], It ); |
/* Av = AfIt */ |
rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], It ); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
/* Cv = CfCt */ |
rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], texel[i][RCOMP] ); |
rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], texel[i][GCOMP] ); |
rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], texel[i][BCOMP] ); |
/* Av = Af */ |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
/* Cv = CfCt */ |
rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], texel[i][RCOMP] ); |
rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], texel[i][GCOMP] ); |
rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], texel[i][BCOMP] ); |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] ); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format (GL_MODULATE) in texture_apply"); |
return; |
} |
break; |
case GL_DECAL: |
switch (format) { |
case GL_ALPHA: |
case GL_LUMINANCE: |
case GL_LUMINANCE_ALPHA: |
case GL_INTENSITY: |
/* undefined */ |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
/* Cv = Ct */ |
rgba[i][RCOMP] = texel[i][RCOMP]; |
rgba[i][GCOMP] = texel[i][GCOMP]; |
rgba[i][BCOMP] = texel[i][BCOMP]; |
/* Av = Af */ |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-At) + CtAt */ |
GLint t = texel[i][ACOMP], s = CHAN_MAX - t; |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(texel[i][RCOMP],t); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(texel[i][GCOMP],t); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(texel[i][BCOMP],t); |
/* Av = Af */ |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format (GL_DECAL) in texture_apply"); |
return; |
} |
break; |
case GL_BLEND: |
Rc = (GLint) (texUnit->EnvColor[0] * CHAN_MAXF); |
Gc = (GLint) (texUnit->EnvColor[1] * CHAN_MAXF); |
Bc = (GLint) (texUnit->EnvColor[2] * CHAN_MAXF); |
Ac = (GLint) (texUnit->EnvColor[3] * CHAN_MAXF); |
switch (format) { |
case GL_ALPHA: |
for (i=0;i<n;i++) { |
/* Cv = Cf */ |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]); |
} |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-Lt) + CcLt */ |
GLchan Lt = texel[i][RCOMP], s = CHAN_MAX - Lt; |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, Lt); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, Lt); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, Lt); |
/* Av = Af */ |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-Lt) + CcLt */ |
GLchan Lt = texel[i][RCOMP], s = CHAN_MAX - Lt; |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, Lt); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, Lt); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, Lt); |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP],texel[i][ACOMP]); |
} |
break; |
case GL_INTENSITY: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-It) + CcLt */ |
GLchan It = texel[i][RCOMP], s = CHAN_MAX - It; |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, It); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, It); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, It); |
/* Av = Af(1-It) + Ac*It */ |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], s) + CHAN_PRODUCT(Ac, It); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-Ct) + CcCt */ |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], (CHAN_MAX-texel[i][RCOMP])) + CHAN_PRODUCT(Rc,texel[i][RCOMP]); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], (CHAN_MAX-texel[i][GCOMP])) + CHAN_PRODUCT(Gc,texel[i][GCOMP]); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], (CHAN_MAX-texel[i][BCOMP])) + CHAN_PRODUCT(Bc,texel[i][BCOMP]); |
/* Av = Af */ |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
/* Cv = Cf(1-Ct) + CcCt */ |
rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], (CHAN_MAX-texel[i][RCOMP])) + CHAN_PRODUCT(Rc,texel[i][RCOMP]); |
rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], (CHAN_MAX-texel[i][GCOMP])) + CHAN_PRODUCT(Gc,texel[i][GCOMP]); |
rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], (CHAN_MAX-texel[i][BCOMP])) + CHAN_PRODUCT(Bc,texel[i][BCOMP]); |
/* Av = AfAt */ |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP],texel[i][ACOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format (GL_BLEND) in texture_apply"); |
return; |
} |
break; |
/* XXX don't clamp results if GLchan is float??? */ |
case GL_ADD: /* GL_EXT_texture_add_env */ |
switch (format) { |
case GL_ALPHA: |
for (i=0;i<n;i++) { |
/* Rv = Rf */ |
/* Gv = Gf */ |
/* Bv = Bf */ |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]); |
} |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) { |
GLuint Lt = texel[i][RCOMP]; |
GLuint r = rgba[i][RCOMP] + Lt; |
GLuint g = rgba[i][GCOMP] + Lt; |
GLuint b = rgba[i][BCOMP] + Lt; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
/* Av = Af */ |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
GLuint Lt = texel[i][RCOMP]; |
GLuint r = rgba[i][RCOMP] + Lt; |
GLuint g = rgba[i][GCOMP] + Lt; |
GLuint b = rgba[i][BCOMP] + Lt; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]); |
} |
break; |
case GL_INTENSITY: |
for (i=0;i<n;i++) { |
GLchan It = texel[i][RCOMP]; |
GLuint r = rgba[i][RCOMP] + It; |
GLuint g = rgba[i][GCOMP] + It; |
GLuint b = rgba[i][BCOMP] + It; |
GLuint a = rgba[i][ACOMP] + It; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
rgba[i][ACOMP] = MIN2(a, CHAN_MAX); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
GLuint r = rgba[i][RCOMP] + texel[i][RCOMP]; |
GLuint g = rgba[i][GCOMP] + texel[i][GCOMP]; |
GLuint b = rgba[i][BCOMP] + texel[i][BCOMP]; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
/* Av = Af */ |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
GLuint r = rgba[i][RCOMP] + texel[i][RCOMP]; |
GLuint g = rgba[i][GCOMP] + texel[i][GCOMP]; |
GLuint b = rgba[i][BCOMP] + texel[i][BCOMP]; |
rgba[i][RCOMP] = MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = MIN2(b, CHAN_MAX); |
rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format (GL_ADD) in texture_apply"); |
return; |
} |
break; |
default: |
_mesa_problem(ctx, "Bad env mode in texture_apply"); |
return; |
} |
} |
/** |
* Apply texture mapping to a span of fragments. |
*/ |
void |
_swrast_texture_span( GLcontext *ctx, struct sw_span *span ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLchan primary_rgba[MAX_WIDTH][4]; |
GLuint unit; |
ASSERT(span->end < MAX_WIDTH); |
ASSERT(span->arrayMask & SPAN_TEXTURE); |
/* |
* Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) |
*/ |
if (swrast->_AnyTextureCombine) |
MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); |
/* |
* Must do all texture sampling before combining in order to |
* accomodate GL_ARB_texture_env_crossbar. |
*/ |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
const struct gl_texture_object *curObj = texUnit->_Current; |
GLfloat *lambda = span->array->lambda[unit]; |
GLchan (*texels)[4] = (GLchan (*)[4]) |
(swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); |
/* adjust texture lod (lambda) */ |
if (span->arrayMask | SPAN_LAMBDA) { |
if (texUnit->LodBias != 0.0F) { |
/* apply LOD bias, but don't clamp yet */ |
GLuint i; |
for (i = 0; i < span->end; i++) { |
lambda[i] += texUnit->LodBias; |
} |
} |
if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { |
/* apply LOD clamping to lambda */ |
const GLfloat min = curObj->MinLod; |
const GLfloat max = curObj->MaxLod; |
GLuint i; |
for (i = 0; i < span->end; i++) { |
GLfloat l = lambda[i]; |
lambda[i] = CLAMP(l, min, max); |
} |
} |
} |
/* Sample the texture (span->end fragments) */ |
swrast->TextureSample[unit]( ctx, unit, texUnit->_Current, |
span->end, span->array->texcoords[unit], |
lambda, texels ); |
} |
} |
/* |
* OK, now apply the texture (aka texture combine/blend). |
* We modify the span->color.rgba values. |
*/ |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
if (ctx->Texture.Unit[unit]._ReallyEnabled) { |
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
if (texUnit->EnvMode == GL_COMBINE_EXT) { |
/* GL_ARB/EXT_texture_env_combine */ |
texture_combine( ctx, unit, span->end, |
(CONST GLchan (*)[4]) primary_rgba, |
swrast->TexelBuffer, |
span->array->rgba ); |
} |
else if (texUnit->EnvMode == GL_COMBINE4_NV) { |
/* GL_NV_texture_env_combine4 */ |
texture_combine4( ctx, unit, span->end, |
(CONST GLchan (*)[4]) primary_rgba, |
swrast->TexelBuffer, |
span->array->rgba ); |
} |
else { |
/* conventional texture blend */ |
const GLchan (*texels)[4] = (const GLchan (*)[4]) |
(swrast->TexelBuffer + unit * |
(span->end * 4 * sizeof(GLchan))); |
texture_apply( ctx, texUnit, span->end, |
(CONST GLchan (*)[4]) primary_rgba, texels, |
span->array->rgba ); |
} |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_span.c |
---|
0,0 → 1,1409 |
/* $Id: s_span.c,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file swrast/s_span.c |
* \brief Span processing functions used by all rasterization functions. |
* This is where all the per-fragment tests are performed |
* \author Brian Paul |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "imports.h" |
#include "s_alpha.h" |
#include "s_alphabuf.h" |
#include "s_blend.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_fog.h" |
#include "s_logic.h" |
#include "s_masking.h" |
#include "s_span.h" |
#include "s_stencil.h" |
#include "s_texture.h" |
/** |
* Init span's Z interpolation values to the RasterPos Z. |
* Used during setup for glDraw/CopyPixels. |
*/ |
void |
_mesa_span_default_z( GLcontext *ctx, struct sw_span *span ) |
{ |
if (ctx->Visual.depthBits <= 16) |
span->z = FloatToFixed(ctx->Current.RasterPos[2] * ctx->DepthMax + 0.5F); |
else |
span->z = (GLint) (ctx->Current.RasterPos[2] * ctx->DepthMax + 0.5F); |
span->zStep = 0; |
span->interpMask |= SPAN_Z; |
} |
/** |
* Init span's fog interpolation values to the RasterPos fog. |
* Used during setup for glDraw/CopyPixels. |
*/ |
void |
_mesa_span_default_fog( GLcontext *ctx, struct sw_span *span ) |
{ |
span->fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); |
span->fogStep = 0; |
span->interpMask |= SPAN_FOG; |
} |
/** |
* Init span's color or index interpolation values to the RasterPos color. |
* Used during setup for glDraw/CopyPixels. |
*/ |
void |
_mesa_span_default_color( GLcontext *ctx, struct sw_span *span ) |
{ |
if (ctx->Visual.rgbMode) { |
GLchan r, g, b, a; |
UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); |
UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]); |
UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]); |
UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]); |
#if CHAN_TYPE == GL_FLOAT |
span->red = r; |
span->green = g; |
span->blue = b; |
span->alpha = a; |
#else |
span->red = IntToFixed(r); |
span->green = IntToFixed(g); |
span->blue = IntToFixed(b); |
span->alpha = IntToFixed(a); |
#endif |
span->redStep = 0; |
span->greenStep = 0; |
span->blueStep = 0; |
span->alphaStep = 0; |
span->interpMask |= SPAN_RGBA; |
} |
else { |
span->index = IntToFixed(ctx->Current.RasterIndex); |
span->indexStep = 0; |
span->interpMask |= SPAN_INDEX; |
} |
} |
/** |
* Init span's texcoord interpolation values to the RasterPos texcoords. |
* Used during setup for glDraw/CopyPixels. |
*/ |
void |
_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span ) |
{ |
GLuint i; |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { |
COPY_4V(span->tex[i], ctx->Current.RasterTexCoords[i]); |
ASSIGN_4V(span->texStepX[i], 0.0F, 0.0F, 0.0F, 0.0F); |
ASSIGN_4V(span->texStepY[i], 0.0F, 0.0F, 0.0F, 0.0F); |
} |
span->interpMask |= SPAN_TEXTURE; |
} |
/* Fill in the span.color.rgba array from the interpolation values */ |
static void |
interpolate_colors(GLcontext *ctx, struct sw_span *span) |
{ |
GLfixed r = span->red; |
GLfixed g = span->green; |
GLfixed b = span->blue; |
GLfixed a = span->alpha; |
const GLint dr = span->redStep; |
const GLint dg = span->greenStep; |
const GLint db = span->blueStep; |
const GLint da = span->alphaStep; |
const GLuint n = span->end; |
GLchan (*rgba)[4] = span->array->rgba; |
GLuint i; |
ASSERT((span->interpMask & SPAN_RGBA) && |
!(span->arrayMask & SPAN_RGBA)); |
if (span->interpMask & SPAN_FLAT) { |
/* constant color */ |
GLchan color[4]; |
color[RCOMP] = FixedToChan(r); |
color[GCOMP] = FixedToChan(g); |
color[BCOMP] = FixedToChan(b); |
color[ACOMP] = FixedToChan(a); |
for (i = 0; i < n; i++) { |
COPY_CHAN4(span->array->rgba[i], color); |
} |
} |
else { |
/* interpolate */ |
for (i = 0; i < n; i++) { |
rgba[i][RCOMP] = FixedToChan(r); |
rgba[i][GCOMP] = FixedToChan(g); |
rgba[i][BCOMP] = FixedToChan(b); |
rgba[i][ACOMP] = FixedToChan(a); |
r += dr; |
g += dg; |
b += db; |
a += da; |
} |
} |
span->arrayMask |= SPAN_RGBA; |
} |
/* Fill in the span.color.index array from the interpolation values */ |
static void |
interpolate_indexes(GLcontext *ctx, struct sw_span *span) |
{ |
GLfixed index = span->index; |
const GLint indexStep = span->indexStep; |
const GLuint n = span->end; |
GLuint *indexes = span->array->index; |
GLuint i; |
ASSERT((span->interpMask & SPAN_INDEX) && |
!(span->arrayMask & SPAN_INDEX)); |
if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) { |
/* constant color */ |
index = FixedToInt(index); |
for (i = 0; i < n; i++) { |
indexes[i] = index; |
} |
} |
else { |
/* interpolate */ |
for (i = 0; i < n; i++) { |
indexes[i] = FixedToInt(index); |
index += indexStep; |
} |
} |
span->arrayMask |= SPAN_INDEX; |
} |
/* Fill in the span.->array->spec array from the interpolation values */ |
static void |
interpolate_specular(GLcontext *ctx, struct sw_span *span) |
{ |
if (span->interpMask & SPAN_FLAT) { |
/* constant color */ |
const GLchan r = FixedToChan(span->specRed); |
const GLchan g = FixedToChan(span->specGreen); |
const GLchan b = FixedToChan(span->specBlue); |
GLuint i; |
for (i = 0; i < span->end; i++) { |
span->array->spec[i][RCOMP] = r; |
span->array->spec[i][GCOMP] = g; |
span->array->spec[i][BCOMP] = b; |
} |
} |
else { |
/* interpolate */ |
#if CHAN_TYPE == GL_FLOAT |
GLfloat r = span->specRed; |
GLfloat g = span->specGreen; |
GLfloat b = span->specBlue; |
#else |
GLfixed r = span->specRed; |
GLfixed g = span->specGreen; |
GLfixed b = span->specBlue; |
#endif |
GLuint i; |
for (i = 0; i < span->end; i++) { |
span->array->spec[i][RCOMP] = FixedToChan(r); |
span->array->spec[i][GCOMP] = FixedToChan(g); |
span->array->spec[i][BCOMP] = FixedToChan(b); |
r += span->specRedStep; |
g += span->specGreenStep; |
b += span->specBlueStep; |
} |
} |
span->arrayMask |= SPAN_SPEC; |
} |
/* Fill in the span.zArray array from the interpolation values */ |
void |
_mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ) |
{ |
const GLuint n = span->end; |
GLuint i; |
ASSERT((span->interpMask & SPAN_Z) && |
!(span->arrayMask & SPAN_Z)); |
if (ctx->Visual.depthBits <= 16) { |
GLfixed zval = span->z; |
GLdepth *z = span->array->z; |
for (i = 0; i < n; i++) { |
z[i] = FixedToInt(zval); |
zval += span->zStep; |
} |
} |
else { |
/* Deep Z buffer, no fixed->int shift */ |
GLfixed zval = span->z; |
GLdepth *z = span->array->z; |
for (i = 0; i < n; i++) { |
z[i] = zval; |
zval += span->zStep; |
} |
} |
span->arrayMask |= SPAN_Z; |
} |
/* |
* This the ideal solution, as given in the OpenGL spec. |
*/ |
#if 0 |
static GLfloat |
compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, |
GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, |
GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) |
{ |
GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ); |
GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); |
GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); |
GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); |
GLfloat x = sqrt(dudx * dudx + dvdx * dvdx); |
GLfloat y = sqrt(dudy * dudy + dvdy * dvdy); |
GLfloat rho = MAX2(x, y); |
GLfloat lambda = LOG2(rho); |
return lambda; |
} |
#endif |
/* |
* This is a faster approximation |
*/ |
static GLfloat |
compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, |
GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, |
GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) |
{ |
GLfloat dsdx2 = (s + dsdx) / (q + dqdx) - s * invQ; |
GLfloat dtdx2 = (t + dtdx) / (q + dqdx) - t * invQ; |
GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ; |
GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ; |
GLfloat maxU, maxV, rho, lambda; |
dsdx2 = FABSF(dsdx2); |
dsdy2 = FABSF(dsdy2); |
dtdx2 = FABSF(dtdx2); |
dtdy2 = FABSF(dtdy2); |
maxU = MAX2(dsdx2, dsdy2) * texW; |
maxV = MAX2(dtdx2, dtdy2) * texH; |
rho = MAX2(maxU, maxV); |
lambda = LOG2(rho); |
return lambda; |
} |
/* |
* Fill in the span.texcoords array from the interpolation values. |
* XXX We could optimize here for the case when dq = 0. That would |
* usually be the case when using an orthographic projection. |
*/ |
static void |
interpolate_texcoords(GLcontext *ctx, struct sw_span *span) |
{ |
ASSERT(span->interpMask & SPAN_TEXTURE); |
ASSERT(!(span->arrayMask & SPAN_TEXTURE)); |
if (ctx->Texture._EnabledUnits > 1) { |
/* multitexture */ |
GLuint u; |
span->arrayMask |= SPAN_TEXTURE; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
if (ctx->Texture.Unit[u]._ReallyEnabled) { |
const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current; |
const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; |
GLboolean needLambda = (obj->MinFilter != obj->MagFilter); |
if (needLambda) { |
GLfloat (*texcoord)[4] = span->array->texcoords[u]; |
GLfloat *lambda = span->array->lambda[u]; |
const GLfloat texW = (GLfloat) img->WidthScale; |
const GLfloat texH = (GLfloat) img->HeightScale; |
const GLfloat dsdx = span->texStepX[u][0]; |
const GLfloat dsdy = span->texStepY[u][0]; |
const GLfloat dtdx = span->texStepX[u][1]; |
const GLfloat dtdy = span->texStepY[u][1]; |
const GLfloat drdx = span->texStepX[u][2]; |
const GLfloat dqdx = span->texStepX[u][3]; |
const GLfloat dqdy = span->texStepY[u][3]; |
GLfloat s = span->tex[u][0]; |
GLfloat t = span->tex[u][1]; |
GLfloat r = span->tex[u][2]; |
GLfloat q = span->tex[u][3]; |
GLuint i; |
for (i = 0; i < span->end; i++) { |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy, |
dqdx, dqdy, texW, texH, |
s, t, q, invQ); |
s += dsdx; |
t += dtdx; |
r += drdx; |
q += dqdx; |
} |
span->arrayMask |= SPAN_LAMBDA; |
} |
else { |
GLfloat (*texcoord)[4] = span->array->texcoords[u]; |
GLfloat *lambda = span->array->lambda[u]; |
const GLfloat dsdx = span->texStepX[u][0]; |
const GLfloat dtdx = span->texStepX[u][1]; |
const GLfloat drdx = span->texStepX[u][2]; |
const GLfloat dqdx = span->texStepX[u][3]; |
GLfloat s = span->tex[u][0]; |
GLfloat t = span->tex[u][1]; |
GLfloat r = span->tex[u][2]; |
GLfloat q = span->tex[u][3]; |
GLuint i; |
if (dqdx == 0.0) { |
/* Ortho projection or polygon's parallel to window X axis */ |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
for (i = 0; i < span->end; i++) { |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
lambda[i] = 0.0; |
s += dsdx; |
t += dtdx; |
r += drdx; |
} |
} |
else { |
for (i = 0; i < span->end; i++) { |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
lambda[i] = 0.0; |
s += dsdx; |
t += dtdx; |
r += drdx; |
q += dqdx; |
} |
} |
} /* lambda */ |
} /* if */ |
} /* for */ |
} |
else { |
/* single texture */ |
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; |
const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; |
GLboolean needLambda = (obj->MinFilter != obj->MagFilter); |
span->arrayMask |= SPAN_TEXTURE; |
if (needLambda) { |
/* just texture unit 0, with lambda */ |
GLfloat (*texcoord)[4] = span->array->texcoords[0]; |
GLfloat *lambda = span->array->lambda[0]; |
const GLfloat texW = (GLfloat) img->WidthScale; |
const GLfloat texH = (GLfloat) img->HeightScale; |
const GLfloat dsdx = span->texStepX[0][0]; |
const GLfloat dsdy = span->texStepY[0][0]; |
const GLfloat dtdx = span->texStepX[0][1]; |
const GLfloat dtdy = span->texStepY[0][1]; |
const GLfloat drdx = span->texStepX[0][2]; |
const GLfloat dqdx = span->texStepX[0][3]; |
const GLfloat dqdy = span->texStepY[0][3]; |
GLfloat s = span->tex[0][0]; |
GLfloat t = span->tex[0][1]; |
GLfloat r = span->tex[0][2]; |
GLfloat q = span->tex[0][3]; |
GLuint i; |
for (i = 0; i < span->end; i++) { |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy, |
dqdx, dqdy, texW, texH, |
s, t, q, invQ); |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
s += dsdx; |
t += dtdx; |
r += drdx; |
q += dqdx; |
} |
span->arrayMask |= SPAN_LAMBDA; |
} |
else { |
/* just texture 0, without lambda */ |
GLfloat (*texcoord)[4] = span->array->texcoords[0]; |
const GLfloat dsdx = span->texStepX[0][0]; |
const GLfloat dtdx = span->texStepX[0][1]; |
const GLfloat drdx = span->texStepX[0][2]; |
const GLfloat dqdx = span->texStepX[0][3]; |
GLfloat s = span->tex[0][0]; |
GLfloat t = span->tex[0][1]; |
GLfloat r = span->tex[0][2]; |
GLfloat q = span->tex[0][3]; |
GLuint i; |
if (dqdx == 0.0) { |
/* Ortho projection or polygon's parallel to window X axis */ |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
for (i = 0; i < span->end; i++) { |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
s += dsdx; |
t += dtdx; |
r += drdx; |
} |
} |
else { |
for (i = 0; i < span->end; i++) { |
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); |
texcoord[i][0] = s * invQ; |
texcoord[i][1] = t * invQ; |
texcoord[i][2] = r * invQ; |
s += dsdx; |
t += dtdx; |
r += drdx; |
q += dqdx; |
} |
} |
} |
} |
} |
/** |
* Apply the current polygon stipple pattern to a span of pixels. |
*/ |
static void |
stipple_polygon_span( GLcontext *ctx, struct sw_span *span ) |
{ |
const GLuint highbit = 0x80000000; |
const GLuint stipple = ctx->PolygonStipple[span->y % 32]; |
GLubyte *mask = span->array->mask; |
GLuint i, m; |
ASSERT(ctx->Polygon.StippleFlag); |
ASSERT((span->arrayMask & SPAN_XY) == 0); |
m = highbit >> (GLuint) (span->x % 32); |
for (i = 0; i < span->end; i++) { |
if ((m & stipple) == 0) { |
mask[i] = 0; |
} |
m = m >> 1; |
if (m == 0) { |
m = highbit; |
} |
} |
span->writeAll = GL_FALSE; |
} |
/** |
* Clip a pixel span to the current buffer/window boundaries: |
* DrawBuffer->_Xmin, _Xmax, _Ymin, _Ymax. This will accomplish |
* window clipping and scissoring. |
* Return: GL_TRUE some pixels still visible |
* GL_FALSE nothing visible |
*/ |
static GLuint |
clip_span( GLcontext *ctx, struct sw_span *span ) |
{ |
const GLint xmin = ctx->DrawBuffer->_Xmin; |
const GLint xmax = ctx->DrawBuffer->_Xmax; |
const GLint ymin = ctx->DrawBuffer->_Ymin; |
const GLint ymax = ctx->DrawBuffer->_Ymax; |
if (span->arrayMask & SPAN_XY) { |
/* arrays of x/y pixel coords */ |
const GLint *x = span->array->x; |
const GLint *y = span->array->y; |
const GLint n = span->end; |
GLubyte *mask = span->array->mask; |
GLint i; |
if (span->arrayMask & SPAN_MASK) { |
/* note: using & intead of && to reduce branches */ |
for (i = 0; i < n; i++) { |
mask[i] &= (x[i] >= xmin) & (x[i] < xmax) |
& (y[i] >= ymin) & (y[i] < ymax); |
} |
} |
else { |
/* note: using & intead of && to reduce branches */ |
for (i = 0; i < n; i++) { |
mask[i] = (x[i] >= xmin) & (x[i] < xmax) |
& (y[i] >= ymin) & (y[i] < ymax); |
} |
} |
return GL_TRUE; /* some pixels visible */ |
} |
else { |
/* horizontal span of pixels */ |
const GLint x = span->x; |
const GLint y = span->y; |
const GLint n = span->end; |
/* Trivial rejection tests */ |
if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) { |
span->end = 0; |
return GL_FALSE; /* all pixels clipped */ |
} |
/* Clip to the left */ |
if (x < xmin) { |
ASSERT(x + n > xmin); |
span->writeAll = GL_FALSE; |
_mesa_bzero(span->array->mask, (xmin - x) * sizeof(GLubyte)); |
} |
/* Clip to right */ |
if (x + n > xmax) { |
ASSERT(x < xmax); |
span->end = xmax - x; |
} |
return GL_TRUE; /* some pixels visible */ |
} |
} |
/** |
* Draw to more than one color buffer (or none). |
*/ |
static void |
multi_write_index_span( GLcontext *ctx, struct sw_span *span ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
GLuint bufferBit; |
/* loop over four possible dest color buffers */ |
for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { |
if (bufferBit & ctx->Color._DrawDestMask) { |
GLuint indexTmp[MAX_WIDTH]; |
ASSERT(span->end < MAX_WIDTH); |
/* Set the current read/draw buffer */ |
swrast->CurrentBuffer = bufferBit; |
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); |
/* make copy of incoming indexes */ |
MEMCPY( indexTmp, span->array->index, span->end * sizeof(GLuint) ); |
if (ctx->Color.IndexLogicOpEnabled) { |
_mesa_logicop_ci_span(ctx, span, indexTmp); |
} |
if (ctx->Color.IndexMask != 0xffffffff) { |
_mesa_mask_index_span(ctx, span, indexTmp); |
} |
if (span->arrayMask & SPAN_XY) { |
/* array of pixel coords */ |
(*swrast->Driver.WriteCI32Pixels)(ctx, span->end, |
span->array->x, span->array->y, |
indexTmp, span->array->mask); |
} |
else { |
/* horizontal run of pixels */ |
(*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y, |
indexTmp, span->array->mask); |
} |
} |
} |
/* restore default dest buffer */ |
_swrast_use_draw_buffer(ctx); |
} |
/** |
* Draw to more than one RGBA color buffer (or none). |
* All fragment operations, up to (but not) blending/logicop should |
* have been done first. |
*/ |
static void |
multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) |
{ |
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); |
GLuint bufferBit; |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
ASSERT(colorMask != 0x0); |
if (ctx->Color.DrawBuffer == GL_NONE) |
return; |
/* loop over four possible dest color buffers */ |
for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { |
if (bufferBit & ctx->Color._DrawDestMask) { |
GLchan rgbaTmp[MAX_WIDTH][4]; |
ASSERT(span->end < MAX_WIDTH); |
/* Set the current read/draw buffer */ |
swrast->CurrentBuffer = bufferBit; |
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); |
/* make copy of incoming colors */ |
MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); |
if (ctx->Color.ColorLogicOpEnabled) { |
_mesa_logicop_rgba_span(ctx, span, rgbaTmp); |
} |
else if (ctx->Color.BlendEnabled) { |
_mesa_blend_span(ctx, span, rgbaTmp); |
} |
if (colorMask != 0xffffffff) { |
_mesa_mask_rgba_span(ctx, span, rgbaTmp); |
} |
if (span->arrayMask & SPAN_XY) { |
/* array of pixel coords */ |
(*swrast->Driver.WriteRGBAPixels)(ctx, span->end, |
span->array->x, span->array->y, |
(const GLchan (*)[4]) rgbaTmp, |
span->array->mask); |
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_pixels(ctx, span->end, |
span->array->x, span->array->y, |
(const GLchan (*)[4]) rgbaTmp, |
span->array->mask); |
} |
} |
else { |
/* horizontal run of pixels */ |
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) rgbaTmp, |
span->array->mask); |
if (swrast->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_span(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) rgbaTmp, |
span->array->mask); |
} |
} |
} |
} |
/* restore default dest buffer */ |
_swrast_use_draw_buffer(ctx); |
} |
/** |
* This function may modify any of the array values in the span. |
* span->interpMask and span->arrayMask may be changed but will be restored |
* to their original values before returning. |
*/ |
void |
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint origInterpMask = span->interpMask; |
const GLuint origArrayMask = span->arrayMask; |
ASSERT(span->end <= MAX_WIDTH); |
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || |
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); |
ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX); |
ASSERT((span->interpMask & span->arrayMask) == 0); |
if (span->arrayMask & SPAN_MASK) { |
/* mask was initialized by caller, probably glBitmap */ |
span->writeAll = GL_FALSE; |
} |
else { |
MEMSET(span->array->mask, 1, span->end); |
span->writeAll = GL_TRUE; |
} |
/* Clipping */ |
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { |
if (!clip_span(ctx, span)) { |
return; |
} |
} |
#ifdef DEBUG |
if (span->arrayMask & SPAN_XY) { |
GLuint i; |
for (i = 0; i < span->end; i++) { |
if (span->array->mask[i]) { |
assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); |
assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); |
assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); |
assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); |
} |
} |
} |
#endif |
/* Polygon Stippling */ |
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { |
stipple_polygon_span(ctx, span); |
} |
/* Depth test and stencil */ |
if (ctx->Depth.Test || ctx->Stencil.Enabled) { |
if (span->interpMask & SPAN_Z) |
_mesa_span_interpolate_z(ctx, span); |
if (ctx->Stencil.Enabled) { |
if (!_mesa_stencil_and_ztest_span(ctx, span)) { |
span->arrayMask = origArrayMask; |
return; |
} |
} |
else { |
ASSERT(ctx->Depth.Test); |
if (!_mesa_depth_test_span(ctx, span)) { |
span->arrayMask = origArrayMask; |
return; |
} |
} |
} |
/* if we get here, something passed the depth test */ |
ctx->OcclusionResult = GL_TRUE; |
/* we have to wait until after occlusion to do this test */ |
if (ctx->Color.DrawBuffer == GL_NONE || ctx->Color.IndexMask == 0) { |
/* write no pixels */ |
span->arrayMask = origArrayMask; |
return; |
} |
/* Interpolate the color indexes if needed */ |
if (span->interpMask & SPAN_INDEX) { |
interpolate_indexes(ctx, span); |
/* clear the bit - this allows the WriteMonoCISpan optimization below */ |
span->interpMask &= ~SPAN_INDEX; |
} |
/* Fog */ |
if (ctx->Fog.Enabled) { |
_mesa_fog_ci_span(ctx, span); |
} |
/* Antialias coverage application */ |
if (span->arrayMask & SPAN_COVERAGE) { |
GLuint i; |
GLuint *index = span->array->index; |
GLfloat *coverage = span->array->coverage; |
for (i = 0; i < span->end; i++) { |
ASSERT(coverage[i] < 16); |
index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]); |
} |
} |
if (swrast->_RasterMask & MULTI_DRAW_BIT) { |
/* draw to zero or two or more buffers */ |
multi_write_index_span(ctx, span); |
} |
else { |
/* normal situation: draw to exactly one buffer */ |
if (ctx->Color.IndexLogicOpEnabled) { |
_mesa_logicop_ci_span(ctx, span, span->array->index); |
} |
if (ctx->Color.IndexMask != 0xffffffff) { |
_mesa_mask_index_span(ctx, span, span->array->index); |
} |
/* write pixels */ |
if (span->arrayMask & SPAN_XY) { |
/* array of pixel coords */ |
if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { |
/* all pixels have same color index */ |
(*swrast->Driver.WriteMonoCIPixels)(ctx, span->end, |
span->array->x, span->array->y, |
FixedToInt(span->index), |
span->array->mask); |
} |
else { |
(*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->array->x, |
span->array->y, span->array->index, |
span->array->mask ); |
} |
} |
else { |
/* horizontal run of pixels */ |
if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { |
/* all pixels have same color index */ |
(*swrast->Driver.WriteMonoCISpan)(ctx, span->end, span->x, span->y, |
FixedToInt(span->index), |
span->array->mask); |
} |
else { |
(*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y, |
span->array->index, |
span->array->mask); |
} |
} |
} |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
} |
/** |
* This function may modify any of the array values in the span. |
* span->interpMask and span->arrayMask may be changed but will be restored |
* to their original values before returning. |
*/ |
void |
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); |
const GLuint origInterpMask = span->interpMask; |
const GLuint origArrayMask = span->arrayMask; |
GLboolean monoColor; |
ASSERT(span->end <= MAX_WIDTH); |
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || |
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); |
ASSERT((span->interpMask & span->arrayMask) == 0); |
ASSERT((span->interpMask | span->arrayMask) & SPAN_RGBA); |
#ifdef DEBUG |
if (ctx->Fog.Enabled) |
ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); |
if (ctx->Depth.Test) |
ASSERT((span->interpMask | span->arrayMask) & SPAN_Z); |
#endif |
if (span->arrayMask & SPAN_MASK) { |
/* mask was initialized by caller, probably glBitmap */ |
span->writeAll = GL_FALSE; |
} |
else { |
MEMSET(span->array->mask, 1, span->end); |
span->writeAll = GL_TRUE; |
} |
/* Determine if we have mono-chromatic colors */ |
monoColor = (span->interpMask & SPAN_RGBA) && |
span->redStep == 0 && span->greenStep == 0 && |
span->blueStep == 0 && span->alphaStep == 0; |
/* Clipping */ |
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { |
if (!clip_span(ctx, span)) { |
return; |
} |
} |
#ifdef DEBUG |
if (span->arrayMask & SPAN_XY) { |
GLuint i; |
for (i = 0; i < span->end; i++) { |
if (span->array->mask[i]) { |
assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); |
assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); |
assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); |
assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); |
} |
} |
} |
#endif |
/* Polygon Stippling */ |
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { |
stipple_polygon_span(ctx, span); |
} |
/* Do the alpha test */ |
if (ctx->Color.AlphaEnabled) { |
if (!_mesa_alpha_test(ctx, span)) { |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
return; |
} |
} |
/* Stencil and Z testing */ |
if (ctx->Stencil.Enabled || ctx->Depth.Test) { |
if (span->interpMask & SPAN_Z) |
_mesa_span_interpolate_z(ctx, span); |
if (ctx->Stencil.Enabled) { |
if (!_mesa_stencil_and_ztest_span(ctx, span)) { |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
return; |
} |
} |
else { |
ASSERT(ctx->Depth.Test); |
ASSERT(span->arrayMask & SPAN_Z); |
/* regular depth testing */ |
if (!_mesa_depth_test_span(ctx, span)) { |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
return; |
} |
} |
} |
/* if we get here, something passed the depth test */ |
ctx->OcclusionResult = GL_TRUE; |
/* can't abort span-writing until after occlusion testing */ |
if (colorMask == 0x0) { |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
return; |
} |
/* Now we may need to interpolate the colors */ |
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) { |
interpolate_colors(ctx, span); |
/* clear the bit - this allows the WriteMonoCISpan optimization below */ |
span->interpMask &= ~SPAN_RGBA; |
} |
/* Fog */ |
if (ctx->Fog.Enabled) { |
_mesa_fog_rgba_span(ctx, span); |
monoColor = GL_FALSE; |
} |
/* Antialias coverage application */ |
if (span->arrayMask & SPAN_COVERAGE) { |
GLchan (*rgba)[4] = span->array->rgba; |
GLfloat *coverage = span->array->coverage; |
GLuint i; |
for (i = 0; i < span->end; i++) { |
rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); |
} |
monoColor = GL_FALSE; |
} |
if (swrast->_RasterMask & MULTI_DRAW_BIT) { |
multi_write_rgba_span(ctx, span); |
} |
else { |
/* normal: write to exactly one buffer */ |
if (ctx->Color.ColorLogicOpEnabled) { |
_mesa_logicop_rgba_span(ctx, span, span->array->rgba); |
monoColor = GL_FALSE; |
} |
else if (ctx->Color.BlendEnabled) { |
_mesa_blend_span(ctx, span, span->array->rgba); |
monoColor = GL_FALSE; |
} |
/* Color component masking */ |
if (colorMask != 0xffffffff) { |
_mesa_mask_rgba_span(ctx, span, span->array->rgba); |
monoColor = GL_FALSE; |
} |
/* write pixels */ |
if (span->arrayMask & SPAN_XY) { |
/* array of pixel coords */ |
/* XXX test for mono color */ |
(*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x, |
span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask); |
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_pixels(ctx, span->end, |
span->array->x, span->array->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->array->mask); |
} |
} |
else { |
/* horizontal run of pixels */ |
if (monoColor) { |
/* all pixels have same color */ |
GLchan color[4]; |
color[RCOMP] = FixedToChan(span->red); |
color[GCOMP] = FixedToChan(span->green); |
color[BCOMP] = FixedToChan(span->blue); |
color[ACOMP] = FixedToChan(span->alpha); |
(*swrast->Driver.WriteMonoRGBASpan)(ctx, span->end, span->x, |
span->y, color, span->array->mask); |
/* XXX software alpha buffer writes! */ |
} |
else { |
/* each pixel is a different color */ |
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->writeAll ? ((const GLubyte *) NULL) : span->array->mask); |
if (swrast->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_span(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->writeAll ? ((const GLubyte *) NULL) : span->array->mask); |
} |
} |
} |
} |
span->interpMask = origInterpMask; |
span->arrayMask = origArrayMask; |
} |
/** |
* Add specular color to base color. This is used only when |
* GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. |
*/ |
static void |
add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
#if CHAN_TYPE == GL_FLOAT |
/* no clamping */ |
rgba[i][RCOMP] += specular[i][RCOMP]; |
rgba[i][GCOMP] += specular[i][GCOMP]; |
rgba[i][BCOMP] += specular[i][BCOMP]; |
#else |
GLint r = rgba[i][RCOMP] + specular[i][RCOMP]; |
GLint g = rgba[i][GCOMP] + specular[i][GCOMP]; |
GLint b = rgba[i][BCOMP] + specular[i][BCOMP]; |
rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); |
rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); |
rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); |
#endif |
} |
} |
/** |
* This function may modify any of the array values in the span. |
* span->interpMask and span->arrayMask may be changed but will be restored |
* to their original values before returning. |
*/ |
void |
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span) |
{ |
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint origArrayMask = span->arrayMask; |
ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || |
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); |
ASSERT(span->end <= MAX_WIDTH); |
ASSERT((span->interpMask & span->arrayMask) == 0); |
ASSERT(ctx->Texture._EnabledUnits); |
/* |
printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask); |
*/ |
if (span->arrayMask & SPAN_MASK) { |
/* mask was initialized by caller, probably glBitmap */ |
span->writeAll = GL_FALSE; |
} |
else { |
MEMSET(span->array->mask, 1, span->end); |
span->writeAll = GL_TRUE; |
} |
/* Clipping */ |
if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { |
if (!clip_span(ctx, span)) { |
return; |
} |
} |
#ifdef DEBUG |
if (span->arrayMask & SPAN_XY) { |
GLuint i; |
for (i = 0; i < span->end; i++) { |
if (span->array->mask[i]) { |
assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); |
assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); |
assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); |
assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); |
} |
} |
} |
#endif |
/* Polygon Stippling */ |
if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { |
stipple_polygon_span(ctx, span); |
} |
/* Need texture coordinates now */ |
if ((span->interpMask & SPAN_TEXTURE) |
&& (span->arrayMask & SPAN_TEXTURE) == 0) |
interpolate_texcoords(ctx, span); |
/* Texture with alpha test */ |
if (ctx->Color.AlphaEnabled) { |
/* Now we need the rgba array, fill it in if needed */ |
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) |
interpolate_colors(ctx, span); |
/* Texturing without alpha is done after depth-testing which |
* gives a potential speed-up. |
*/ |
_swrast_texture_span( ctx, span ); |
/* Do the alpha test */ |
if (!_mesa_alpha_test(ctx, span)) { |
span->arrayMask = origArrayMask; |
return; |
} |
} |
/* Stencil and Z testing */ |
if (ctx->Stencil.Enabled || ctx->Depth.Test) { |
if (span->interpMask & SPAN_Z) |
_mesa_span_interpolate_z(ctx, span); |
if (ctx->Stencil.Enabled) { |
if (!_mesa_stencil_and_ztest_span(ctx, span)) { |
span->arrayMask = origArrayMask; |
return; |
} |
} |
else { |
ASSERT(ctx->Depth.Test); |
ASSERT(span->arrayMask & SPAN_Z); |
/* regular depth testing */ |
if (!_mesa_depth_test_span(ctx, span)) { |
span->arrayMask = origArrayMask; |
return; |
} |
} |
} |
/* if we get here, some fragments passed the depth test */ |
ctx->OcclusionResult = GL_TRUE; |
/* We had to wait until now to check for glColorMask(F,F,F,F) because of |
* the occlusion test. |
*/ |
if (colorMask == 0x0) { |
span->arrayMask = origArrayMask; |
return; |
} |
/* Texture without alpha test */ |
if (!ctx->Color.AlphaEnabled) { |
/* Now we need the rgba array, fill it in if needed */ |
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) |
interpolate_colors(ctx, span); |
_swrast_texture_span( ctx, span ); |
} |
ASSERT(span->arrayMask & SPAN_RGBA); |
/* Add base and specular colors */ |
if (ctx->Fog.ColorSumEnabled || |
(ctx->Light.Enabled && |
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { |
if (span->interpMask & SPAN_SPEC) { |
interpolate_specular(ctx, span); |
} |
ASSERT(span->arrayMask & SPAN_SPEC); |
add_colors( span->end, span->array->rgba, span->array->spec ); |
} |
/* Fog */ |
if (ctx->Fog.Enabled) { |
_mesa_fog_rgba_span(ctx, span); |
} |
/* Antialias coverage application */ |
if (span->arrayMask & SPAN_COVERAGE) { |
GLchan (*rgba)[4] = span->array->rgba; |
GLfloat *coverage = span->array->coverage; |
GLuint i; |
for (i = 0; i < span->end; i++) { |
rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); |
} |
} |
if (swrast->_RasterMask & MULTI_DRAW_BIT) { |
multi_write_rgba_span(ctx, span); |
} |
else { |
/* normal: write to exactly one buffer */ |
if (ctx->Color.ColorLogicOpEnabled) { |
_mesa_logicop_rgba_span(ctx, span, span->array->rgba); |
} |
else if (ctx->Color.BlendEnabled) { |
_mesa_blend_span(ctx, span, span->array->rgba); |
} |
if (colorMask != 0xffffffff) { |
_mesa_mask_rgba_span(ctx, span, span->array->rgba); |
} |
if (span->arrayMask & SPAN_XY) { |
/* array of pixel coords */ |
(*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x, |
span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask); |
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_pixels(ctx, span->end, |
span->array->x, span->array->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->array->mask); |
} |
} |
else { |
/* horizontal run of pixels */ |
(*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->writeAll ? NULL : span->array->mask); |
if (swrast->_RasterMask & ALPHABUF_BIT) { |
_mesa_write_alpha_span(ctx, span->end, span->x, span->y, |
(const GLchan (*)[4]) span->array->rgba, |
span->writeAll ? NULL : span->array->mask); |
} |
} |
} |
span->arrayMask = origArrayMask; |
} |
/** |
* Read RGBA pixels from frame buffer. Clipping will be done to prevent |
* reading ouside the buffer's boundaries. |
*/ |
void |
_mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, |
GLuint n, GLint x, GLint y, GLchan rgba[][4] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLint bufWidth = (GLint) buffer->Width; |
const GLint bufHeight = (GLint) buffer->Height; |
if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { |
/* completely above, below, or right */ |
/* XXX maybe leave undefined? */ |
_mesa_bzero(rgba, 4 * n * sizeof(GLchan)); |
} |
else { |
GLint skip, length; |
if (x < 0) { |
/* left edge clippping */ |
skip = -x; |
length = (GLint) n - skip; |
if (length < 0) { |
/* completely left of window */ |
return; |
} |
if (length > bufWidth) { |
length = bufWidth; |
} |
} |
else if ((GLint) (x + n) > bufWidth) { |
/* right edge clipping */ |
skip = 0; |
length = bufWidth - x; |
if (length < 0) { |
/* completely to right of window */ |
return; |
} |
} |
else { |
/* no clipping */ |
skip = 0; |
length = (GLint) n; |
} |
(*swrast->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip ); |
if (buffer->UseSoftwareAlphaBuffers) { |
_mesa_read_alpha_span(ctx, length, x + skip, y, rgba + skip); |
} |
} |
} |
/** |
* Read CI pixels from frame buffer. Clipping will be done to prevent |
* reading ouside the buffer's boundaries. |
*/ |
void |
_mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, |
GLuint n, GLint x, GLint y, GLuint indx[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLint bufWidth = (GLint) buffer->Width; |
const GLint bufHeight = (GLint) buffer->Height; |
if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { |
/* completely above, below, or right */ |
_mesa_bzero(indx, n * sizeof(GLuint)); |
} |
else { |
GLint skip, length; |
if (x < 0) { |
/* left edge clippping */ |
skip = -x; |
length = (GLint) n - skip; |
if (length < 0) { |
/* completely left of window */ |
return; |
} |
if (length > bufWidth) { |
length = bufWidth; |
} |
} |
else if ((GLint) (x + n) > bufWidth) { |
/* right edge clipping */ |
skip = 0; |
length = bufWidth - x; |
if (length < 0) { |
/* completely to right of window */ |
return; |
} |
} |
else { |
/* no clipping */ |
skip = 0; |
length = (GLint) n; |
} |
(*swrast->Driver.ReadCI32Span)( ctx, length, skip + x, y, indx + skip ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_histogram.h |
---|
0,0 → 1,41 |
/* $Id: s_histogram.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_HISTOGRAM_H |
#define S_HISTOGRAM_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); |
extern void |
_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_depth.c |
---|
0,0 → 1,1682 |
/* $Id: s_depth.c,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "s_depth.h" |
#include "s_context.h" |
/** |
* Return address of depth buffer value for given window coord. |
*/ |
GLvoid * |
_mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y) |
{ |
if (ctx->Visual.depthBits <= 16) |
return (GLushort *) ctx->DrawBuffer->DepthBuffer |
+ ctx->DrawBuffer->Width * y + x; |
else |
return (GLuint *) ctx->DrawBuffer->DepthBuffer |
+ ctx->DrawBuffer->Width * y + x; |
} |
#define Z_ADDRESS16( CTX, X, Y ) \ |
( ((GLushort *) (CTX)->DrawBuffer->DepthBuffer) \ |
+ (CTX)->DrawBuffer->Width * (Y) + (X) ) |
#define Z_ADDRESS32( CTX, X, Y ) \ |
( ((GLuint *) (CTX)->DrawBuffer->DepthBuffer) \ |
+ (CTX)->DrawBuffer->Width * (Y) + (X) ) |
/**********************************************************************/ |
/***** Depth Testing Functions *****/ |
/**********************************************************************/ |
/* |
* Do depth test for an array of fragments. This is used both for |
* software and hardware Z buffers. |
* Input: zbuffer - array of z values in the zbuffer |
* z - array of fragment z values |
* Return: number of fragments which pass the test. |
*/ |
static GLuint |
depth_test_span16( GLcontext *ctx, GLuint n, |
GLushort zbuffer[], const GLdepth z[], GLubyte mask[] ) |
{ |
GLuint passed = 0; |
/* switch cases ordered from most frequent to less frequent */ |
switch (ctx->Depth.Func) { |
case GL_LESS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_LEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GREATER: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_NOTEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_EQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_ALWAYS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
} |
} |
else { |
/* Don't update Z buffer or mask */ |
passed = n; |
} |
break; |
case GL_NEVER: |
_mesa_bzero(mask, n * sizeof(GLubyte)); |
break; |
default: |
_mesa_problem(ctx, "Bad depth func in depth_test_span16"); |
} |
return passed; |
} |
static GLuint |
depth_test_span32( GLcontext *ctx, GLuint n, |
GLuint zbuffer[], const GLdepth z[], GLubyte mask[] ) |
{ |
GLuint passed = 0; |
/* switch cases ordered from most frequent to less frequent */ |
switch (ctx->Depth.Func) { |
case GL_LESS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_LEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GREATER: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_NOTEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_EQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
/* pass */ |
passed++; |
} |
else { |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_ALWAYS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
zbuffer[i] = z[i]; |
passed++; |
} |
} |
} |
else { |
/* Don't update Z buffer or mask */ |
passed = n; |
} |
break; |
case GL_NEVER: |
_mesa_bzero(mask, n * sizeof(GLubyte)); |
break; |
default: |
_mesa_problem(ctx, "Bad depth func in depth_test_span32"); |
} |
return passed; |
} |
/* |
* Apply depth test to span of fragments. Hardware or software z buffer. |
*/ |
static GLuint |
depth_test_span( GLcontext *ctx, struct sw_span *span) |
{ |
const GLint x = span->x; |
const GLint y = span->y; |
const GLuint n = span->end; |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
ASSERT((span->arrayMask & SPAN_XY) == 0); |
ASSERT(span->arrayMask & SPAN_Z); |
if (swrast->Driver.ReadDepthSpan) { |
/* hardware-based depth buffer */ |
GLdepth zbuffer[MAX_WIDTH]; |
GLuint passed; |
(*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer); |
passed = depth_test_span32(ctx, n, zbuffer, span->array->z, |
span->array->mask); |
ASSERT(swrast->Driver.WriteDepthSpan); |
(*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, |
span->array->mask); |
if (passed < n) |
span->writeAll = GL_FALSE; |
return passed; |
} |
else { |
GLuint passed; |
/* software depth buffer */ |
if (ctx->Visual.depthBits <= 16) { |
GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y); |
passed = depth_test_span16(ctx, n, zptr, span->array->z, span->array->mask); |
} |
else { |
GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y); |
passed = depth_test_span32(ctx, n, zptr, span->array->z, span->array->mask); |
} |
#if 1 |
if (passed < span->end) { |
span->writeAll = GL_FALSE; |
} |
#else |
/* this causes a glDrawPixels(GL_DEPTH_COMPONENT) conformance failure */ |
if (passed < span->end) { |
span->writeAll = GL_FALSE; |
if (passed == 0) { |
span->end = 0; |
return 0; |
} |
while (span->end > 0 && span->mask[span->end - 1] == 0) |
span->end --; |
} |
#endif |
return passed; |
} |
} |
/* |
* Do depth testing for an array of fragments using software Z buffer. |
*/ |
static void |
software_depth_test_pixels16( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
const GLdepth z[], GLubyte mask[] ) |
{ |
/* switch cases ordered from most frequent to less frequent */ |
switch (ctx->Depth.Func) { |
case GL_LESS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] < *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] < *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_LEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] <= *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] <= *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] >= *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] >= *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GREATER: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] > *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] > *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_NOTEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] != *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] != *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_EQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] == *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
if (z[i] == *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_ALWAYS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLushort *zptr = Z_ADDRESS16(ctx,x[i],y[i]); |
*zptr = z[i]; |
} |
} |
} |
else { |
/* Don't update Z buffer or mask */ |
} |
break; |
case GL_NEVER: |
/* depth test never passes */ |
_mesa_bzero(mask, n * sizeof(GLubyte)); |
break; |
default: |
_mesa_problem(ctx, "Bad depth func in software_depth_test_pixels"); |
} |
} |
/* |
* Do depth testing for an array of fragments using software Z buffer. |
*/ |
static void |
software_depth_test_pixels32( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
const GLdepth z[], GLubyte mask[] ) |
{ |
/* switch cases ordered from most frequent to less frequent */ |
switch (ctx->Depth.Func) { |
case GL_LESS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] < *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] < *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_LEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] <= *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] <= *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] >= *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] >= *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GREATER: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] > *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] > *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_NOTEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] != *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] != *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_EQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] == *zptr) { |
/* pass */ |
*zptr = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
if (z[i] == *zptr) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_ALWAYS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
GLuint *zptr = Z_ADDRESS32(ctx,x[i],y[i]); |
*zptr = z[i]; |
} |
} |
} |
else { |
/* Don't update Z buffer or mask */ |
} |
break; |
case GL_NEVER: |
/* depth test never passes */ |
_mesa_bzero(mask, n * sizeof(GLubyte)); |
break; |
default: |
_mesa_problem(ctx, "Bad depth func in software_depth_test_pixels"); |
} |
} |
/* |
* Do depth testing for an array of pixels using hardware Z buffer. |
* Input/output: zbuffer - array of depth values from Z buffer |
* Input: z - array of fragment z values. |
*/ |
static void |
hardware_depth_test_pixels( GLcontext *ctx, GLuint n, GLdepth zbuffer[], |
const GLdepth z[], GLubyte mask[] ) |
{ |
/* switch cases ordered from most frequent to less frequent */ |
switch (ctx->Depth.Func) { |
case GL_LESS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] < zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_LEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] <= zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] >= zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_GREATER: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] > zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_NOTEQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] != zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_EQUAL: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
/* pass */ |
zbuffer[i] = z[i]; |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
else { |
/* Don't update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
if (z[i] == zbuffer[i]) { |
/* pass */ |
} |
else { |
/* fail */ |
mask[i] = 0; |
} |
} |
} |
} |
break; |
case GL_ALWAYS: |
if (ctx->Depth.Mask) { |
/* Update Z buffer */ |
GLuint i; |
for (i=0; i<n; i++) { |
if (mask[i]) { |
zbuffer[i] = z[i]; |
} |
} |
} |
else { |
/* Don't update Z buffer or mask */ |
} |
break; |
case GL_NEVER: |
/* depth test never passes */ |
_mesa_bzero(mask, n * sizeof(GLubyte)); |
break; |
default: |
_mesa_problem(ctx, "Bad depth func in hardware_depth_test_pixels"); |
} |
} |
static GLuint |
depth_test_pixels( GLcontext *ctx, struct sw_span *span ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLuint n = span->end; |
const GLint *x = span->array->x; |
const GLint *y = span->array->y; |
const GLdepth *z = span->array->z; |
GLubyte *mask = span->array->mask; |
if (swrast->Driver.ReadDepthPixels) { |
/* read depth values from hardware Z buffer */ |
GLdepth zbuffer[MAX_WIDTH]; |
(*swrast->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer); |
hardware_depth_test_pixels( ctx, n, zbuffer, z, mask ); |
/* update hardware Z buffer with new values */ |
assert(swrast->Driver.WriteDepthPixels); |
(*swrast->Driver.WriteDepthPixels)(ctx, n, x, y, zbuffer, mask ); |
} |
else { |
/* software depth testing */ |
if (ctx->Visual.depthBits <= 16) |
software_depth_test_pixels16(ctx, n, x, y, z, mask); |
else |
software_depth_test_pixels32(ctx, n, x, y, z, mask); |
} |
return n; /* not really correct, but OK */ |
} |
/** |
* Apply depth (Z) buffer testing to the span. |
* \return approx number of pixels that passed (only zero is reliable) |
*/ |
GLuint |
_mesa_depth_test_span( GLcontext *ctx, struct sw_span *span) |
{ |
if (span->arrayMask & SPAN_XY) |
return depth_test_pixels(ctx, span); |
else |
return depth_test_span(ctx, span); |
} |
/**********************************************************************/ |
/***** Read Depth Buffer *****/ |
/**********************************************************************/ |
/** |
* Read a span of depth values from the depth buffer. |
* This function does clipping before calling the device driver function. |
*/ |
void |
_mesa_read_depth_span( GLcontext *ctx, |
GLint n, GLint x, GLint y, GLdepth depth[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || |
x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { |
/* span is completely outside framebuffer */ |
GLint i; |
for (i = 0; i < n; i++) |
depth[i] = 0; |
return; |
} |
if (x < 0) { |
GLint dx = -x; |
GLint i; |
for (i = 0; i < dx; i++) |
depth[i] = 0; |
x = 0; |
n -= dx; |
depth += dx; |
} |
if (x + n > (GLint) ctx->DrawBuffer->Width) { |
GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; |
GLint i; |
for (i = 0; i < dx; i++) |
depth[n - i - 1] = 0; |
n -= dx; |
} |
if (n <= 0) { |
return; |
} |
if (ctx->DrawBuffer->DepthBuffer) { |
/* read from software depth buffer */ |
if (ctx->Visual.depthBits <= 16) { |
const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); |
GLint i; |
for (i = 0; i < n; i++) { |
depth[i] = zptr[i]; |
} |
} |
else { |
const GLuint *zptr = Z_ADDRESS32( ctx, x, y ); |
GLint i; |
for (i = 0; i < n; i++) { |
depth[i] = zptr[i]; |
} |
} |
} |
else if (swrast->Driver.ReadDepthSpan) { |
/* read from hardware depth buffer */ |
(*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, depth ); |
} |
else { |
/* no depth buffer */ |
_mesa_bzero(depth, n * sizeof(GLfloat)); |
} |
} |
/** |
* Return a span of depth values from the depth buffer as floats in [0,1]. |
* This is used for both hardware and software depth buffers. |
* Input: n - how many pixels |
* x,y - location of first pixel |
* Output: depth - the array of depth values |
*/ |
void |
_mesa_read_depth_span_float( GLcontext *ctx, |
GLint n, GLint x, GLint y, GLfloat depth[] ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLfloat scale = 1.0F / ctx->DepthMaxF; |
if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || |
x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { |
/* span is completely outside framebuffer */ |
GLint i; |
for (i = 0; i < n; i++) |
depth[i] = 0.0F; |
return; |
} |
if (x < 0) { |
GLint dx = -x; |
GLint i; |
for (i = 0; i < dx; i++) |
depth[i] = 0.0F; |
n -= dx; |
x = 0; |
} |
if (x + n > (GLint) ctx->DrawBuffer->Width) { |
GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; |
GLint i; |
for (i = 0; i < dx; i++) |
depth[n - i - 1] = 0.0F; |
n -= dx; |
} |
if (n <= 0) { |
return; |
} |
if (ctx->DrawBuffer->DepthBuffer) { |
/* read from software depth buffer */ |
if (ctx->Visual.depthBits <= 16) { |
const GLushort *zptr = Z_ADDRESS16( ctx, x, y ); |
GLint i; |
for (i = 0; i < n; i++) { |
depth[i] = (GLfloat) zptr[i] * scale; |
} |
} |
else { |
const GLuint *zptr = Z_ADDRESS32( ctx, x, y ); |
GLint i; |
for (i = 0; i < n; i++) { |
depth[i] = (GLfloat) zptr[i] * scale; |
} |
} |
} |
else if (swrast->Driver.ReadDepthSpan) { |
/* read from hardware depth buffer */ |
GLdepth d[MAX_WIDTH]; |
GLint i; |
assert(n <= MAX_WIDTH); |
(*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, d ); |
for (i = 0; i < n; i++) { |
depth[i] = d[i] * scale; |
} |
} |
else { |
/* no depth buffer */ |
_mesa_bzero(depth, n * sizeof(GLfloat)); |
} |
} |
/**********************************************************************/ |
/***** Allocate and Clear Depth Buffer *****/ |
/**********************************************************************/ |
/** |
* Allocate a new depth buffer. If there's already a depth buffer allocated |
* it will be free()'d. The new depth buffer will be uniniitalized. |
* This function is only called through Driver.alloc_depth_buffer. |
*/ |
void |
_mesa_alloc_depth_buffer( GLframebuffer *buffer ) |
{ |
GLint bytesPerValue; |
ASSERT(buffer->UseSoftwareDepthBuffer); |
/* deallocate current depth buffer if present */ |
if (buffer->DepthBuffer) { |
MESA_PBUFFER_FREE(buffer->DepthBuffer); |
buffer->DepthBuffer = NULL; |
} |
/* allocate new depth buffer, but don't initialize it */ |
if (buffer->Visual.depthBits <= 16) |
bytesPerValue = sizeof(GLushort); |
else |
bytesPerValue = sizeof(GLuint); |
buffer->DepthBuffer = MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height |
* bytesPerValue); |
if (!buffer->DepthBuffer) { |
/* out of memory */ |
GET_CURRENT_CONTEXT(ctx); |
if (ctx) { |
ctx->Depth.Test = GL_FALSE; |
ctx->NewState |= _NEW_DEPTH; |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Couldn't allocate depth buffer"); |
} |
} |
} |
/** |
* Clear the depth buffer. If the depth buffer doesn't exist yet we'll |
* allocate it now. |
* This function is only called through Driver.clear_depth_buffer. |
*/ |
void |
_mesa_clear_depth_buffer( GLcontext *ctx ) |
{ |
if (ctx->Visual.depthBits == 0 |
|| !ctx->DrawBuffer->DepthBuffer |
|| !ctx->Depth.Mask) { |
/* no depth buffer, or writing to it is disabled */ |
return; |
} |
/* The loops in this function have been written so the IRIX 5.3 |
* C compiler can unroll them. Hopefully other compilers can too! |
*/ |
if (ctx->Scissor.Enabled) { |
/* only clear scissor region */ |
if (ctx->Visual.depthBits <= 16) { |
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->DepthMax); |
const GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
const GLint cols = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
const GLint rowStride = ctx->DrawBuffer->Width; |
GLushort *dRow = (GLushort *) ctx->DrawBuffer->DepthBuffer |
+ ctx->DrawBuffer->_Ymin * rowStride + ctx->DrawBuffer->_Xmin; |
GLint i, j; |
for (i = 0; i < rows; i++) { |
for (j = 0; j < cols; j++) { |
dRow[j] = clearValue; |
} |
dRow += rowStride; |
} |
} |
else { |
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->DepthMax); |
const GLint rows = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
const GLint cols = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
const GLint rowStride = ctx->DrawBuffer->Width; |
GLuint *dRow = (GLuint *) ctx->DrawBuffer->DepthBuffer |
+ ctx->DrawBuffer->_Ymin * rowStride + ctx->DrawBuffer->_Xmin; |
GLint i, j; |
for (i = 0; i < rows; i++) { |
for (j = 0; j < cols; j++) { |
dRow[j] = clearValue; |
} |
dRow += rowStride; |
} |
} |
} |
else { |
/* clear whole buffer */ |
if (ctx->Visual.depthBits <= 16) { |
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->DepthMax); |
if ((clearValue & 0xff) == (clearValue >> 8)) { |
if (clearValue == 0) { |
_mesa_bzero(ctx->DrawBuffer->DepthBuffer, |
2*ctx->DrawBuffer->Width*ctx->DrawBuffer->Height); |
} |
else { |
/* lower and upper bytes of clear_value are same, use MEMSET */ |
MEMSET( ctx->DrawBuffer->DepthBuffer, clearValue & 0xff, |
2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height); |
} |
} |
else { |
GLushort *d = (GLushort *) ctx->DrawBuffer->DepthBuffer; |
GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
while (n >= 16) { |
d[0] = clearValue; d[1] = clearValue; |
d[2] = clearValue; d[3] = clearValue; |
d[4] = clearValue; d[5] = clearValue; |
d[6] = clearValue; d[7] = clearValue; |
d[8] = clearValue; d[9] = clearValue; |
d[10] = clearValue; d[11] = clearValue; |
d[12] = clearValue; d[13] = clearValue; |
d[14] = clearValue; d[15] = clearValue; |
d += 16; |
n -= 16; |
} |
while (n > 0) { |
*d++ = clearValue; |
n--; |
} |
} |
} |
else { |
/* >16 bit depth buffer */ |
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->DepthMax); |
if (clearValue == 0) { |
_mesa_bzero(ctx->DrawBuffer->DepthBuffer, |
ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint)); |
} |
else { |
GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; |
GLuint *d = (GLuint *) ctx->DrawBuffer->DepthBuffer; |
while (n >= 16) { |
d[0] = clearValue; d[1] = clearValue; |
d[2] = clearValue; d[3] = clearValue; |
d[4] = clearValue; d[5] = clearValue; |
d[6] = clearValue; d[7] = clearValue; |
d[8] = clearValue; d[9] = clearValue; |
d[10] = clearValue; d[11] = clearValue; |
d[12] = clearValue; d[13] = clearValue; |
d[14] = clearValue; d[15] = clearValue; |
d += 16; |
n -= 16; |
} |
while (n > 0) { |
*d++ = clearValue; |
n--; |
} |
} |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_triangle.c |
---|
0,0 → 1,1224 |
/* $Id: s_triangle.c,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* When the device driver doesn't implement triangle rasterization it |
* can hook in _swrast_Triangle, which eventually calls one of these |
* functions to draw triangles. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "colormac.h" |
#include "imports.h" |
#include "macros.h" |
#include "mmath.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "texstate.h" |
#include "s_aatriangle.h" |
#include "s_context.h" |
#include "s_depth.h" |
#include "s_feedback.h" |
#include "s_span.h" |
#include "s_triangle.h" |
/* |
* Just used for feedback mode. |
*/ |
GLboolean _mesa_cull_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
GLfloat ex = v1->win[0] - v0->win[0]; |
GLfloat ey = v1->win[1] - v0->win[1]; |
GLfloat fx = v2->win[0] - v0->win[0]; |
GLfloat fy = v2->win[1] - v0->win[1]; |
GLfloat c = ex*fy-ey*fx; |
if (c * SWRAST_CONTEXT(ctx)->_backface_sign > 0) |
return 0; |
return 1; |
} |
/* |
* Render a flat-shaded color index triangle. |
*/ |
static void flat_ci_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define SETUP_CODE \ |
span.interpMask |= SPAN_INDEX; \ |
span.index = IntToFixed(v2->index); \ |
span.indexStep = 0; |
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); |
#include "s_tritemp.h" |
} |
/* |
* Render a smooth-shaded color index triangle. |
*/ |
static void smooth_ci_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define INTERP_INDEX 1 |
#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); |
#include "s_tritemp.h" |
} |
/* |
* Render a flat-shaded RGBA triangle. |
*/ |
static void flat_rgba_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define SETUP_CODE \ |
ASSERT(ctx->Texture._EnabledUnits == 0); \ |
ASSERT(ctx->Light.ShadeModel==GL_FLAT); \ |
span.interpMask |= SPAN_RGBA; \ |
span.red = ChanToFixed(v2->color[0]); \ |
span.green = ChanToFixed(v2->color[1]); \ |
span.blue = ChanToFixed(v2->color[2]); \ |
span.alpha = ChanToFixed(v2->color[3]); \ |
span.redStep = 0; \ |
span.greenStep = 0; \ |
span.blueStep = 0; \ |
span.alphaStep = 0; |
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); |
#include "s_tritemp.h" |
} |
/* |
* Render a smooth-shaded RGBA triangle. |
*/ |
static void smooth_rgba_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define SETUP_CODE \ |
{ \ |
/* texturing must be off */ \ |
ASSERT(ctx->Texture._EnabledUnits == 0); \ |
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \ |
} |
#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); |
#include "s_tritemp.h" |
} |
/* |
* Render an RGB, GL_DECAL, textured triangle. |
* Interpolate S,T only w/out mipmapping or perspective correction. |
* |
* No fog. |
*/ |
static void simple_textured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_INT_TEX 1 |
#define S_SCALE twidth |
#define T_SCALE theight |
#define SETUP_CODE \ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); \ |
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ |
const GLint b = obj->BaseLevel; \ |
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ |
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ |
const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ |
const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ |
const GLint smask = obj->Image[b]->Width - 1; \ |
const GLint tmask = obj->Image[b]->Height - 1; \ |
if (!texture) { \ |
/* this shouldn't happen */ \ |
return; \ |
} |
#define RENDER_SPAN( span ) \ |
GLuint i; \ |
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ |
span.intTex[1] -= FIXED_HALF; \ |
for (i = 0; i < span.end; i++) { \ |
GLint s = FixedToInt(span.intTex[0]) & smask; \ |
GLint t = FixedToInt(span.intTex[1]) & tmask; \ |
GLint pos = (t << twidth_log2) + s; \ |
pos = pos + pos + pos; /* multiply by 3 */ \ |
span.array->rgb[i][RCOMP] = texture[pos]; \ |
span.array->rgb[i][GCOMP] = texture[pos+1]; \ |
span.array->rgb[i][BCOMP] = texture[pos+2]; \ |
span.intTex[0] += span.intTexStep[0]; \ |
span.intTex[1] += span.intTexStep[1]; \ |
} \ |
(*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \ |
(CONST GLchan (*)[3]) span.array->rgb,\ |
NULL ); |
#include "s_tritemp.h" |
} |
/* |
* Render an RGB, GL_DECAL, textured triangle. |
* Interpolate S,T, GL_LESS depth test, w/out mipmapping or |
* perspective correction. |
* |
* No fog. |
*/ |
static void simple_z_textured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_INT_TEX 1 |
#define S_SCALE twidth |
#define T_SCALE theight |
#define SETUP_CODE \ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); \ |
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ |
const GLint b = obj->BaseLevel; \ |
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ |
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ |
const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ |
const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ |
const GLint smask = obj->Image[b]->Width - 1; \ |
const GLint tmask = obj->Image[b]->Height - 1; \ |
if (!texture) { \ |
/* this shouldn't happen */ \ |
return; \ |
} |
#define RENDER_SPAN( span ) \ |
GLuint i; \ |
span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ |
span.intTex[1] -= FIXED_HALF; \ |
for (i = 0; i < span.end; i++) { \ |
const GLdepth z = FixedToDepth(span.z); \ |
if (z < zRow[i]) { \ |
GLint s = FixedToInt(span.intTex[0]) & smask; \ |
GLint t = FixedToInt(span.intTex[1]) & tmask; \ |
GLint pos = (t << twidth_log2) + s; \ |
pos = pos + pos + pos; /* multiply by 3 */ \ |
span.array->rgb[i][RCOMP] = texture[pos]; \ |
span.array->rgb[i][GCOMP] = texture[pos+1]; \ |
span.array->rgb[i][BCOMP] = texture[pos+2]; \ |
zRow[i] = z; \ |
span.array->mask[i] = 1; \ |
} \ |
else { \ |
span.array->mask[i] = 0; \ |
} \ |
span.intTex[0] += span.intTexStep[0]; \ |
span.intTex[1] += span.intTexStep[1]; \ |
span.z += span.zStep; \ |
} \ |
(*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \ |
(CONST GLchan (*)[3]) span.array->rgb,\ |
span.array->mask ); |
#include "s_tritemp.h" |
} |
#if CHAN_TYPE != GL_FLOAT |
struct affine_info |
{ |
GLenum filter; |
GLenum format; |
GLenum envmode; |
GLint smask, tmask; |
GLint twidth_log2; |
const GLchan *texture; |
GLfixed er, eg, eb, ea; |
GLint tbytesline, tsize; |
}; |
/* This function can handle GL_NEAREST or GL_LINEAR sampling of 2D RGB or RGBA |
* textures with GL_REPLACE, GL_MODULATE, GL_BLEND, GL_DECAL or GL_ADD |
* texture env modes. |
*/ |
static INLINE void |
affine_span(GLcontext *ctx, struct sw_span *span, |
struct affine_info *info) |
{ |
GLchan sample[4]; /* the filtered texture sample */ |
/* Instead of defining a function for each mode, a test is done |
* between the outer and inner loops. This is to reduce code size |
* and complexity. Observe that an optimizing compiler kills |
* unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). |
*/ |
#define NEAREST_RGB \ |
sample[RCOMP] = tex00[RCOMP]; \ |
sample[GCOMP] = tex00[GCOMP]; \ |
sample[BCOMP] = tex00[BCOMP]; \ |
sample[ACOMP] = CHAN_MAX |
#define LINEAR_RGB \ |
sample[RCOMP] = (ti * (si * tex00[0] + sf * tex01[0]) + \ |
tf * (si * tex10[0] + sf * tex11[0])) >> 2 * FIXED_SHIFT; \ |
sample[GCOMP] = (ti * (si * tex00[1] + sf * tex01[1]) + \ |
tf * (si * tex10[1] + sf * tex11[1])) >> 2 * FIXED_SHIFT; \ |
sample[BCOMP] = (ti * (si * tex00[2] + sf * tex01[2]) + \ |
tf * (si * tex10[2] + sf * tex11[2])) >> 2 * FIXED_SHIFT; \ |
sample[ACOMP] = CHAN_MAX |
#define NEAREST_RGBA COPY_CHAN4(sample, tex00) |
#define LINEAR_RGBA \ |
sample[RCOMP] = (ti * (si * tex00[0] + sf * tex01[0]) + \ |
tf * (si * tex10[0] + sf * tex11[0])) >> 2 * FIXED_SHIFT;\ |
sample[GCOMP] = (ti * (si * tex00[1] + sf * tex01[1]) + \ |
tf * (si * tex10[1] + sf * tex11[1])) >> 2 * FIXED_SHIFT;\ |
sample[BCOMP] = (ti * (si * tex00[2] + sf * tex01[2]) + \ |
tf * (si * tex10[2] + sf * tex11[2])) >> 2 * FIXED_SHIFT;\ |
sample[ACOMP] = (ti * (si * tex00[3] + sf * tex01[3]) + \ |
tf * (si * tex10[3] + sf * tex11[3])) >> 2 * FIXED_SHIFT |
#define MODULATE \ |
dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \ |
dest[GCOMP] = span->green * (sample[GCOMP] + 1u) >> (FIXED_SHIFT + 8); \ |
dest[BCOMP] = span->blue * (sample[BCOMP] + 1u) >> (FIXED_SHIFT + 8); \ |
dest[ACOMP] = span->alpha * (sample[ACOMP] + 1u) >> (FIXED_SHIFT + 8) |
#define DECAL \ |
dest[RCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->red + \ |
((sample[ACOMP] + 1) * sample[RCOMP] << FIXED_SHIFT)) \ |
>> (FIXED_SHIFT + 8); \ |
dest[GCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->green + \ |
((sample[ACOMP] + 1) * sample[GCOMP] << FIXED_SHIFT)) \ |
>> (FIXED_SHIFT + 8); \ |
dest[BCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->blue + \ |
((sample[ACOMP] + 1) * sample[BCOMP] << FIXED_SHIFT)) \ |
>> (FIXED_SHIFT + 8); \ |
dest[ACOMP] = FixedToInt(span->alpha) |
#define BLEND \ |
dest[RCOMP] = ((CHAN_MAX - sample[RCOMP]) * span->red \ |
+ (sample[RCOMP] + 1) * info->er) >> (FIXED_SHIFT + 8); \ |
dest[GCOMP] = ((CHAN_MAX - sample[GCOMP]) * span->green \ |
+ (sample[GCOMP] + 1) * info->eg) >> (FIXED_SHIFT + 8); \ |
dest[BCOMP] = ((CHAN_MAX - sample[BCOMP]) * span->blue \ |
+ (sample[BCOMP] + 1) * info->eb) >> (FIXED_SHIFT + 8); \ |
dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8) |
#define REPLACE COPY_CHAN4(dest, sample) |
#define ADD \ |
{ \ |
GLint rSum = FixedToInt(span->red) + (GLint) sample[RCOMP]; \ |
GLint gSum = FixedToInt(span->green) + (GLint) sample[GCOMP]; \ |
GLint bSum = FixedToInt(span->blue) + (GLint) sample[BCOMP]; \ |
dest[RCOMP] = MIN2(rSum, CHAN_MAX); \ |
dest[GCOMP] = MIN2(gSum, CHAN_MAX); \ |
dest[BCOMP] = MIN2(bSum, CHAN_MAX); \ |
dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8); \ |
} |
/* shortcuts */ |
#define NEAREST_RGB_REPLACE \ |
NEAREST_RGB; \ |
dest[0] = sample[0]; \ |
dest[1] = sample[1]; \ |
dest[2] = sample[2]; \ |
dest[3] = FixedToInt(span->alpha); |
#define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00) |
#define SPAN_NEAREST(DO_TEX,COMP) \ |
for (i = 0; i < span->end; i++) { \ |
/* Isn't it necessary to use FixedFloor below?? */ \ |
GLint s = FixedToInt(span->intTex[0]) & info->smask; \ |
GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ |
GLint pos = (t << info->twidth_log2) + s; \ |
const GLchan *tex00 = info->texture + COMP * pos; \ |
DO_TEX; \ |
span->red += span->redStep; \ |
span->green += span->greenStep; \ |
span->blue += span->blueStep; \ |
span->alpha += span->alphaStep; \ |
span->intTex[0] += span->intTexStep[0]; \ |
span->intTex[1] += span->intTexStep[1]; \ |
dest += 4; \ |
} |
#define SPAN_LINEAR(DO_TEX,COMP) \ |
for (i = 0; i < span->end; i++) { \ |
/* Isn't it necessary to use FixedFloor below?? */ \ |
GLint s = FixedToInt(span->intTex[0]) & info->smask; \ |
GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ |
GLfixed sf = span->intTex[0] & FIXED_FRAC_MASK; \ |
GLfixed tf = span->intTex[1] & FIXED_FRAC_MASK; \ |
GLfixed si = FIXED_FRAC_MASK - sf; \ |
GLfixed ti = FIXED_FRAC_MASK - tf; \ |
GLint pos = (t << info->twidth_log2) + s; \ |
const GLchan *tex00 = info->texture + COMP * pos; \ |
const GLchan *tex10 = tex00 + info->tbytesline; \ |
const GLchan *tex01 = tex00 + COMP; \ |
const GLchan *tex11 = tex10 + COMP; \ |
(void) ti; \ |
(void) si; \ |
if (t == info->tmask) { \ |
tex10 -= info->tsize; \ |
tex11 -= info->tsize; \ |
} \ |
if (s == info->smask) { \ |
tex01 -= info->tbytesline; \ |
tex11 -= info->tbytesline; \ |
} \ |
DO_TEX; \ |
span->red += span->redStep; \ |
span->green += span->greenStep; \ |
span->blue += span->blueStep; \ |
span->alpha += span->alphaStep; \ |
span->intTex[0] += span->intTexStep[0]; \ |
span->intTex[1] += span->intTexStep[1]; \ |
dest += 4; \ |
} |
GLuint i; |
GLchan *dest = span->array->rgba[0]; |
span->intTex[0] -= FIXED_HALF; |
span->intTex[1] -= FIXED_HALF; |
switch (info->filter) { |
case GL_NEAREST: |
switch (info->format) { |
case GL_RGB: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_NEAREST(NEAREST_RGB;MODULATE,3); |
break; |
case GL_DECAL: |
case GL_REPLACE: |
SPAN_NEAREST(NEAREST_RGB_REPLACE,3); |
break; |
case GL_BLEND: |
SPAN_NEAREST(NEAREST_RGB;BLEND,3); |
break; |
case GL_ADD: |
SPAN_NEAREST(NEAREST_RGB;ADD,3); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode in SPAN_LINEAR"); |
return; |
} |
break; |
case GL_RGBA: |
switch(info->envmode) { |
case GL_MODULATE: |
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); |
break; |
case GL_DECAL: |
SPAN_NEAREST(NEAREST_RGBA;DECAL,4); |
break; |
case GL_BLEND: |
SPAN_NEAREST(NEAREST_RGBA;BLEND,4); |
break; |
case GL_ADD: |
SPAN_NEAREST(NEAREST_RGBA;ADD,4); |
break; |
case GL_REPLACE: |
SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (2) in SPAN_LINEAR"); |
return; |
} |
break; |
} |
break; |
case GL_LINEAR: |
span->intTex[0] -= FIXED_HALF; |
span->intTex[1] -= FIXED_HALF; |
switch (info->format) { |
case GL_RGB: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_LINEAR(LINEAR_RGB;MODULATE,3); |
break; |
case GL_DECAL: |
case GL_REPLACE: |
SPAN_LINEAR(LINEAR_RGB;REPLACE,3); |
break; |
case GL_BLEND: |
SPAN_LINEAR(LINEAR_RGB;BLEND,3); |
break; |
case GL_ADD: |
SPAN_LINEAR(LINEAR_RGB;ADD,3); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (3) in SPAN_LINEAR"); |
return; |
} |
break; |
case GL_RGBA: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); |
break; |
case GL_DECAL: |
SPAN_LINEAR(LINEAR_RGBA;DECAL,4); |
break; |
case GL_BLEND: |
SPAN_LINEAR(LINEAR_RGBA;BLEND,4); |
break; |
case GL_ADD: |
SPAN_LINEAR(LINEAR_RGBA;ADD,4); |
break; |
case GL_REPLACE: |
SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (4) in SPAN_LINEAR"); |
return; |
} |
break; |
} |
break; |
} |
span->interpMask &= ~SPAN_RGBA; |
ASSERT(span->arrayMask & SPAN_RGBA); |
_mesa_write_rgba_span(ctx, span); |
#undef SPAN_NEAREST |
#undef SPAN_LINEAR |
} |
/* |
* Render an RGB/RGBA textured triangle without perspective correction. |
*/ |
static void affine_textured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define INTERP_INT_TEX 1 |
#define S_SCALE twidth |
#define T_SCALE theight |
#define SETUP_CODE \ |
struct affine_info info; \ |
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ |
struct gl_texture_object *obj = unit->Current2D; \ |
const GLint b = obj->BaseLevel; \ |
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ |
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ |
info.texture = (const GLchan *) obj->Image[b]->Data; \ |
info.twidth_log2 = obj->Image[b]->WidthLog2; \ |
info.smask = obj->Image[b]->Width - 1; \ |
info.tmask = obj->Image[b]->Height - 1; \ |
info.format = obj->Image[b]->Format; \ |
info.filter = obj->MinFilter; \ |
info.envmode = unit->EnvMode; \ |
span.arrayMask |= SPAN_RGBA; \ |
\ |
if (info.envmode == GL_BLEND) { \ |
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ |
info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ |
info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ |
info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ |
info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ |
} \ |
if (!info.texture) { \ |
/* this shouldn't happen */ \ |
return; \ |
} \ |
\ |
switch (info.format) { \ |
case GL_ALPHA: \ |
case GL_LUMINANCE: \ |
case GL_INTENSITY: \ |
info.tbytesline = obj->Image[b]->Width; \ |
break; \ |
case GL_LUMINANCE_ALPHA: \ |
info.tbytesline = obj->Image[b]->Width * 2; \ |
break; \ |
case GL_RGB: \ |
info.tbytesline = obj->Image[b]->Width * 3; \ |
break; \ |
case GL_RGBA: \ |
info.tbytesline = obj->Image[b]->Width * 4; \ |
break; \ |
default: \ |
_mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ |
return; \ |
} \ |
info.tsize = obj->Image[b]->Height * info.tbytesline; |
#define RENDER_SPAN( span ) affine_span(ctx, &span, &info); |
#include "s_tritemp.h" |
} |
struct persp_info |
{ |
GLenum filter; |
GLenum format; |
GLenum envmode; |
GLint smask, tmask; |
GLint twidth_log2; |
const GLchan *texture; |
GLfixed er, eg, eb, ea; /* texture env color */ |
GLint tbytesline, tsize; |
}; |
static INLINE void |
fast_persp_span(GLcontext *ctx, struct sw_span *span, |
struct persp_info *info) |
{ |
GLchan sample[4]; /* the filtered texture sample */ |
/* Instead of defining a function for each mode, a test is done |
* between the outer and inner loops. This is to reduce code size |
* and complexity. Observe that an optimizing compiler kills |
* unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). |
*/ |
#define SPAN_NEAREST(DO_TEX,COMP) \ |
for (i = 0; i < span->end; i++) { \ |
GLdouble invQ = tex_coord[2] ? \ |
(1.0 / tex_coord[2]) : 1.0; \ |
GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ |
GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ |
GLint s = IFLOOR(s_tmp) & info->smask; \ |
GLint t = IFLOOR(t_tmp) & info->tmask; \ |
GLint pos = (t << info->twidth_log2) + s; \ |
const GLchan *tex00 = info->texture + COMP * pos; \ |
DO_TEX; \ |
span->red += span->redStep; \ |
span->green += span->greenStep; \ |
span->blue += span->blueStep; \ |
span->alpha += span->alphaStep; \ |
tex_coord[0] += tex_step[0]; \ |
tex_coord[1] += tex_step[1]; \ |
tex_coord[2] += tex_step[2]; \ |
dest += 4; \ |
} |
#define SPAN_LINEAR(DO_TEX,COMP) \ |
for (i = 0; i < span->end; i++) { \ |
GLdouble invQ = tex_coord[2] ? \ |
(1.0 / tex_coord[2]) : 1.0; \ |
GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ |
GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ |
GLfixed s_fix = FloatToFixed(s_tmp) - FIXED_HALF; \ |
GLfixed t_fix = FloatToFixed(t_tmp) - FIXED_HALF; \ |
GLint s = FixedToInt(FixedFloor(s_fix)) & info->smask; \ |
GLint t = FixedToInt(FixedFloor(t_fix)) & info->tmask; \ |
GLfixed sf = s_fix & FIXED_FRAC_MASK; \ |
GLfixed tf = t_fix & FIXED_FRAC_MASK; \ |
GLfixed si = FIXED_FRAC_MASK - sf; \ |
GLfixed ti = FIXED_FRAC_MASK - tf; \ |
GLint pos = (t << info->twidth_log2) + s; \ |
const GLchan *tex00 = info->texture + COMP * pos; \ |
const GLchan *tex10 = tex00 + info->tbytesline; \ |
const GLchan *tex01 = tex00 + COMP; \ |
const GLchan *tex11 = tex10 + COMP; \ |
(void) ti; \ |
(void) si; \ |
if (t == info->tmask) { \ |
tex10 -= info->tsize; \ |
tex11 -= info->tsize; \ |
} \ |
if (s == info->smask) { \ |
tex01 -= info->tbytesline; \ |
tex11 -= info->tbytesline; \ |
} \ |
DO_TEX; \ |
span->red += span->redStep; \ |
span->green += span->greenStep; \ |
span->blue += span->blueStep; \ |
span->alpha += span->alphaStep; \ |
tex_coord[0] += tex_step[0]; \ |
tex_coord[1] += tex_step[1]; \ |
tex_coord[2] += tex_step[2]; \ |
dest += 4; \ |
} |
GLuint i; |
GLfloat tex_coord[3], tex_step[3]; |
GLchan *dest = span->array->rgba[0]; |
tex_coord[0] = span->tex[0][0] * (info->smask + 1); |
tex_step[0] = span->texStepX[0][0] * (info->smask + 1); |
tex_coord[1] = span->tex[0][1] * (info->tmask + 1); |
tex_step[1] = span->texStepX[0][1] * (info->tmask + 1); |
/* span->tex[0][2] only if 3D-texturing, here only 2D */ |
tex_coord[2] = span->tex[0][3]; |
tex_step[2] = span->texStepX[0][3]; |
switch (info->filter) { |
case GL_NEAREST: |
switch (info->format) { |
case GL_RGB: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_NEAREST(NEAREST_RGB;MODULATE,3); |
break; |
case GL_DECAL: |
case GL_REPLACE: |
SPAN_NEAREST(NEAREST_RGB_REPLACE,3); |
break; |
case GL_BLEND: |
SPAN_NEAREST(NEAREST_RGB;BLEND,3); |
break; |
case GL_ADD: |
SPAN_NEAREST(NEAREST_RGB;ADD,3); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (5) in SPAN_LINEAR"); |
return; |
} |
break; |
case GL_RGBA: |
switch(info->envmode) { |
case GL_MODULATE: |
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); |
break; |
case GL_DECAL: |
SPAN_NEAREST(NEAREST_RGBA;DECAL,4); |
break; |
case GL_BLEND: |
SPAN_NEAREST(NEAREST_RGBA;BLEND,4); |
break; |
case GL_ADD: |
SPAN_NEAREST(NEAREST_RGBA;ADD,4); |
break; |
case GL_REPLACE: |
SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (6) in SPAN_LINEAR"); |
return; |
} |
break; |
} |
break; |
case GL_LINEAR: |
switch (info->format) { |
case GL_RGB: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_LINEAR(LINEAR_RGB;MODULATE,3); |
break; |
case GL_DECAL: |
case GL_REPLACE: |
SPAN_LINEAR(LINEAR_RGB;REPLACE,3); |
break; |
case GL_BLEND: |
SPAN_LINEAR(LINEAR_RGB;BLEND,3); |
break; |
case GL_ADD: |
SPAN_LINEAR(LINEAR_RGB;ADD,3); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (7) in SPAN_LINEAR"); |
return; |
} |
break; |
case GL_RGBA: |
switch (info->envmode) { |
case GL_MODULATE: |
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); |
break; |
case GL_DECAL: |
SPAN_LINEAR(LINEAR_RGBA;DECAL,4); |
break; |
case GL_BLEND: |
SPAN_LINEAR(LINEAR_RGBA;BLEND,4); |
break; |
case GL_ADD: |
SPAN_LINEAR(LINEAR_RGBA;ADD,4); |
break; |
case GL_REPLACE: |
SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); |
break; |
default: |
_mesa_problem(ctx, "bad tex env mode (8) in SPAN_LINEAR"); |
return; |
} |
break; |
} |
break; |
} |
ASSERT(span->arrayMask & SPAN_RGBA); |
_mesa_write_rgba_span(ctx, span); |
#undef SPAN_NEAREST |
#undef SPAN_LINEAR |
} |
/* |
* Render an perspective corrected RGB/RGBA textured triangle. |
* The Q (aka V in Mesa) coordinate must be zero such that the divide |
* by interpolated Q/W comes out right. |
* |
*/ |
static void persp_textured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define INTERP_TEX 1 |
#define SETUP_CODE \ |
struct persp_info info; \ |
const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ |
const struct gl_texture_object *obj = unit->Current2D; \ |
const GLint b = obj->BaseLevel; \ |
info.texture = (const GLchan *) obj->Image[b]->Data; \ |
info.twidth_log2 = obj->Image[b]->WidthLog2; \ |
info.smask = obj->Image[b]->Width - 1; \ |
info.tmask = obj->Image[b]->Height - 1; \ |
info.format = obj->Image[b]->Format; \ |
info.filter = obj->MinFilter; \ |
info.envmode = unit->EnvMode; \ |
\ |
if (info.envmode == GL_BLEND) { \ |
/* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ |
info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ |
info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ |
info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ |
info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ |
} \ |
if (!info.texture) { \ |
/* this shouldn't happen */ \ |
return; \ |
} \ |
\ |
switch (info.format) { \ |
case GL_ALPHA: \ |
case GL_LUMINANCE: \ |
case GL_INTENSITY: \ |
info.tbytesline = obj->Image[b]->Width; \ |
break; \ |
case GL_LUMINANCE_ALPHA: \ |
info.tbytesline = obj->Image[b]->Width * 2; \ |
break; \ |
case GL_RGB: \ |
info.tbytesline = obj->Image[b]->Width * 3; \ |
break; \ |
case GL_RGBA: \ |
info.tbytesline = obj->Image[b]->Width * 4; \ |
break; \ |
default: \ |
_mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ |
return; \ |
} \ |
info.tsize = obj->Image[b]->Height * info.tbytesline; |
#define RENDER_SPAN( span ) \ |
span.interpMask &= ~SPAN_RGBA; \ |
span.arrayMask |= SPAN_RGBA; \ |
fast_persp_span(ctx, &span, &info); |
#include "s_tritemp.h" |
} |
#endif /* CHAN_BITS != GL_FLOAT */ |
/* |
* Render a smooth-shaded, textured, RGBA triangle. |
* Interpolate S,T,R with perspective correction, w/out mipmapping. |
*/ |
static void general_textured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_SPEC 1 |
#define INTERP_ALPHA 1 |
#define INTERP_TEX 1 |
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); |
#include "s_tritemp.h" |
} |
/* |
* This is the big one! |
* Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates. |
* Yup, it's slow. |
*/ |
static void |
multitextured_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
#define INTERP_Z 1 |
#define INTERP_FOG 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define INTERP_SPEC 1 |
#define INTERP_MULTITEX 1 |
#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); |
#include "s_tritemp.h" |
} |
static void occlusion_zless_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
if (ctx->OcclusionResult) { |
return; |
} |
#define DO_OCCLUSION_TEST |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define RENDER_SPAN( span ) \ |
GLuint i; \ |
for (i = 0; i < span.end; i++) { \ |
GLdepth z = FixedToDepth(span.z); \ |
if (z < zRow[i]) { \ |
ctx->OcclusionResult = GL_TRUE; \ |
return; \ |
} \ |
span.z += span.zStep; \ |
} |
#include "s_tritemp.h" |
} |
static void nodraw_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
(void) (ctx && v0 && v1 && v2); |
} |
/* |
* This is used when separate specular color is enabled, but not |
* texturing. We add the specular color to the primary color, |
* draw the triangle, then restore the original primary color. |
* Inefficient, but seldom needed. |
*/ |
void _swrast_add_spec_terms_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */ |
SWvertex *ncv1 = (SWvertex *)v1; |
SWvertex *ncv2 = (SWvertex *)v2; |
#if CHAN_TYPE == GL_FLOAT |
GLfloat rSum, gSum, bSum; |
#else |
GLint rSum, gSum, bSum; |
#endif |
GLchan c[3][4]; |
/* save original colors */ |
COPY_CHAN4( c[0], ncv0->color ); |
COPY_CHAN4( c[1], ncv1->color ); |
COPY_CHAN4( c[2], ncv2->color ); |
/* sum v0 */ |
rSum = ncv0->color[0] + ncv0->specular[0]; |
gSum = ncv0->color[1] + ncv0->specular[1]; |
bSum = ncv0->color[2] + ncv0->specular[2]; |
ncv0->color[0] = MIN2(rSum, CHAN_MAX); |
ncv0->color[1] = MIN2(gSum, CHAN_MAX); |
ncv0->color[2] = MIN2(bSum, CHAN_MAX); |
/* sum v1 */ |
rSum = ncv1->color[0] + ncv1->specular[0]; |
gSum = ncv1->color[1] + ncv1->specular[1]; |
bSum = ncv1->color[2] + ncv1->specular[2]; |
ncv1->color[0] = MIN2(rSum, CHAN_MAX); |
ncv1->color[1] = MIN2(gSum, CHAN_MAX); |
ncv1->color[2] = MIN2(bSum, CHAN_MAX); |
/* sum v2 */ |
rSum = ncv2->color[0] + ncv2->specular[0]; |
gSum = ncv2->color[1] + ncv2->specular[1]; |
bSum = ncv2->color[2] + ncv2->specular[2]; |
ncv2->color[0] = MIN2(rSum, CHAN_MAX); |
ncv2->color[1] = MIN2(gSum, CHAN_MAX); |
ncv2->color[2] = MIN2(bSum, CHAN_MAX); |
/* draw */ |
SWRAST_CONTEXT(ctx)->SpecTriangle( ctx, ncv0, ncv1, ncv2 ); |
/* restore original colors */ |
COPY_CHAN4( ncv0->color, c[0] ); |
COPY_CHAN4( ncv1->color, c[1] ); |
COPY_CHAN4( ncv2->color, c[2] ); |
} |
#ifdef DEBUG |
/* record the current triangle function name */ |
const char *_mesa_triFuncName = NULL; |
#define USE(triFunc) \ |
do { \ |
_mesa_triFuncName = #triFunc; \ |
/*printf("%s\n", _mesa_triFuncName);*/ \ |
swrast->Triangle = triFunc; \ |
} while (0) |
#else |
#define USE(triFunc) swrast->Triangle = triFunc; |
#endif |
/* |
* Determine which triangle rendering function to use given the current |
* rendering context. |
* |
* Please update the summary flag _SWRAST_NEW_TRIANGLE if you add or |
* remove tests to this code. |
*/ |
void |
_swrast_choose_triangle( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
const GLboolean rgbmode = ctx->Visual.rgbMode; |
if (ctx->Polygon.CullFlag && |
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) { |
USE(nodraw_triangle); |
return; |
} |
if (ctx->RenderMode==GL_RENDER) { |
if (ctx->Polygon.SmoothFlag) { |
_mesa_set_aa_triangle_function(ctx); |
ASSERT(swrast->Triangle); |
return; |
} |
if (ctx->Depth.OcclusionTest && |
ctx->Depth.Test && |
ctx->Depth.Mask == GL_FALSE && |
ctx->Depth.Func == GL_LESS && |
!ctx->Stencil.Enabled) { |
if ((rgbmode && |
ctx->Color.ColorMask[0] == 0 && |
ctx->Color.ColorMask[1] == 0 && |
ctx->Color.ColorMask[2] == 0 && |
ctx->Color.ColorMask[3] == 0) |
|| |
(!rgbmode && ctx->Color.IndexMask == 0)) { |
USE(occlusion_zless_triangle); |
return; |
} |
} |
if (ctx->Texture._EnabledUnits) { |
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */ |
const struct gl_texture_object *texObj2D; |
const struct gl_texture_image *texImg; |
GLenum minFilter, magFilter, envMode; |
GLint format; |
texObj2D = ctx->Texture.Unit[0].Current2D; |
texImg = texObj2D ? texObj2D->Image[texObj2D->BaseLevel] : NULL; |
format = texImg ? texImg->TexFormat->MesaFormat : -1; |
minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; |
magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; |
envMode = ctx->Texture.Unit[0].EnvMode; |
/* First see if we can used an optimized 2-D texture function */ |
if (ctx->Texture._EnabledUnits == 1 |
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT |
&& texObj2D->WrapS==GL_REPEAT |
&& texObj2D->WrapT==GL_REPEAT |
&& texImg->Border==0 |
&& texImg->Width == texImg->RowStride |
&& (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) |
&& minFilter == magFilter |
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR |
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE_EXT) { |
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { |
if (minFilter == GL_NEAREST |
&& format == MESA_FORMAT_RGB |
&& (envMode == GL_REPLACE || envMode == GL_DECAL) |
&& ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) |
&& ctx->Depth.Func == GL_LESS |
&& ctx->Depth.Mask == GL_TRUE) |
|| swrast->_RasterMask == TEXTURE_BIT) |
&& ctx->Polygon.StippleFlag == GL_FALSE) { |
if (swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)) { |
USE(simple_z_textured_triangle); |
} |
else { |
USE(simple_textured_triangle); |
} |
} |
else { |
#if (CHAN_BITS == 16 || CHAN_BITS == 32) |
USE(general_textured_triangle); |
#else |
USE(affine_textured_triangle); |
#endif |
} |
} |
else { |
#if (CHAN_BITS == 16 || CHAN_BITS == 32) |
USE(general_textured_triangle); |
#else |
USE(persp_textured_triangle); |
#endif |
} |
} |
else { |
/* general case textured triangles */ |
if (ctx->Texture._EnabledUnits > 1) { |
USE(multitextured_triangle); |
} |
else { |
USE(general_textured_triangle); |
} |
} |
} |
else { |
ASSERT(!ctx->Texture._EnabledUnits); |
if (ctx->Light.ShadeModel==GL_SMOOTH) { |
/* smooth shaded, no texturing, stippled or some raster ops */ |
if (rgbmode) { |
USE(smooth_rgba_triangle); |
} |
else { |
USE(smooth_ci_triangle); |
} |
} |
else { |
/* flat shaded, no texturing, stippled or some raster ops */ |
if (rgbmode) { |
USE(flat_rgba_triangle); |
} |
else { |
USE(flat_ci_triangle); |
} |
} |
} |
} |
else if (ctx->RenderMode==GL_FEEDBACK) { |
USE(_mesa_feedback_triangle); |
} |
else { |
/* GL_SELECT mode */ |
USE(_mesa_select_triangle); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_texture.h |
---|
0,0 → 1,45 |
/* $Id: s_texture.h,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_TEXTURE_H |
#define S_TEXTURE_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_swrast_choose_texture_sample_func( GLcontext *ctx, |
GLuint texUnit, |
const struct gl_texture_object *tObj ); |
extern void |
_swrast_texture_span( GLcontext *ctx, struct sw_span *span ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/swrast.h |
---|
0,0 → 1,602 |
/* $Id: swrast.h,v 1.1 2003-02-28 11:49:44 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
*/ |
/** |
* \file swrast/swrast.h |
* \brief Defines basic structures for sw_rasterizer. |
* \author Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef SWRAST_H |
#define SWRAST_H |
#include "mtypes.h" |
/** |
* \struct SWvertex |
* \brief Data-structure to handle vertices in the software rasterizer. |
* |
* The software rasterizer now uses this format for vertices. Thus a |
* 'RasterSetup' stage or other translation is required between the |
* tnl module and the swrast rasterization functions. This serves to |
* isolate the swrast module from the internals of the tnl module, and |
* improve its usefulness as a fallback mechanism for hardware |
* drivers. |
* |
* Full software drivers: |
* - Register the rastersetup and triangle functions from |
* utils/software_helper. |
* - On statechange, update the rasterization pointers in that module. |
* |
* Rasterization hardware drivers: |
* - Keep native rastersetup. |
* - Implement native twoside,offset and unfilled triangle setup. |
* - Implement a translator from native vertices to swrast vertices. |
* - On partial fallback (mix of accelerated and unaccelerated |
* prims), call a pass-through function which translates native |
* vertices to SWvertices and calls the appropriate swrast function. |
* - On total fallback (vertex format insufficient for state or all |
* primitives unaccelerated), hook in swrast_setup instead. |
*/ |
typedef struct { |
/** win[0], win[1] are the screen-coords of SWvertex. win[2] is the |
* z-coord. what is win[3]? */ |
GLfloat win[4]; |
GLfloat texcoord[MAX_TEXTURE_UNITS][4]; |
GLchan color[4]; |
GLchan specular[4]; |
GLfloat fog; |
GLuint index; |
GLfloat pointSize; |
} SWvertex; |
/** |
* \struct sw_span |
* \brief Contains data for either a horizontal line or a set of |
* pixels that are passed through a pipeline of functions before being |
* drawn. |
* |
* The sw_span structure describes the colors, Z, fogcoord, texcoords, |
* etc for either a horizontal run or a set of independent pixels. We |
* can either specify a base/step to indicate interpolated values, or |
* fill in arrays of values. The interpMask and arrayMask bitfields |
* indicate which are active. |
* |
* With this structure it's easy to hand-off span rasterization to |
* subroutines instead of doing it all inline in the triangle functions |
* like we used to do. |
* It also cleans up the local variable namespace a great deal. |
* |
* It would be interesting to experiment with multiprocessor rasterization |
* with this structure. The triangle rasterizer could simply emit a |
* stream of these structures which would be consumed by one or more |
* span-processing threads which could run in parallel. |
*/ |
/** |
* \defgroup SpanFlags SPAN_XXX-flags |
* Bitmasks to indicate which span_arrays need to be computed |
* (sw_span::interpMask) or have already been filled |
* (sw_span::arrayMask) |
*/ |
/*@{*/ |
#define SPAN_RGBA 0x001 |
#define SPAN_SPEC 0x002 |
#define SPAN_INDEX 0x004 |
#define SPAN_Z 0x008 |
#define SPAN_FOG 0x010 |
#define SPAN_TEXTURE 0x020 |
#define SPAN_INT_TEXTURE 0x040 |
#define SPAN_LAMBDA 0x080 |
#define SPAN_COVERAGE 0x100 |
#define SPAN_FLAT 0x200 /**< flat shading? */ |
/** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */ |
#define SPAN_XY 0x400 |
#define SPAN_MASK 0x800 /**< sw_span::arrayMask only */ |
/*@}*/ |
/** |
* \struct span_arrays |
* \brief Arrays of fragment values. |
* |
* These will either be computed from the x/xStep values above or |
* filled in by glDraw/CopyPixels, etc. |
*/ |
struct span_arrays { |
GLchan rgb[MAX_WIDTH][3]; |
GLchan rgba[MAX_WIDTH][4]; |
GLuint index[MAX_WIDTH]; |
GLchan spec[MAX_WIDTH][4]; /* specular color */ |
GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ |
GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ |
GLdepth z[MAX_WIDTH]; |
GLfloat fog[MAX_WIDTH]; |
GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4]; |
GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; |
GLfloat coverage[MAX_WIDTH]; |
/** This mask indicates if fragment is alive or culled */ |
GLubyte mask[MAX_WIDTH]; |
}; |
struct sw_span { |
GLint x, y; |
/** Only need to process pixels between start <= i < end */ |
/** At this time, start is always zero. */ |
GLuint start, end; |
/** This flag indicates that mask[] array is effectively filled with ones */ |
GLboolean writeAll; |
/** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ |
GLenum primitive; |
/** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ |
GLuint facing; |
/** |
* This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates |
* which of the x/xStep variables are relevant. |
*/ |
GLuint interpMask; |
#if CHAN_TYPE == GL_FLOAT |
GLfloat red, redStep; |
GLfloat green, greenStep; |
GLfloat blue, blueStep; |
GLfloat alpha, alphaStep; |
GLfloat specRed, specRedStep; |
GLfloat specGreen, specGreenStep; |
GLfloat specBlue, specBlueStep; |
#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED SHORT */ |
GLfixed red, redStep; |
GLfixed green, greenStep; |
GLfixed blue, blueStep; |
GLfixed alpha, alphaStep; |
GLfixed specRed, specRedStep; |
GLfixed specGreen, specGreenStep; |
GLfixed specBlue, specBlueStep; |
#endif |
GLfixed index, indexStep; |
GLfixed z, zStep; |
GLfloat fog, fogStep; |
GLfloat tex[MAX_TEXTURE_UNITS][4]; |
GLfloat texStepX[MAX_TEXTURE_UNITS][4]; |
GLfloat texStepY[MAX_TEXTURE_UNITS][4]; |
GLfixed intTex[2], intTexStep[2]; |
/** |
* This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates |
* which of the fragment arrays in the span_arrays struct are relevant. |
*/ |
GLuint arrayMask; |
/** |
* We store the arrays of fragment values in a separate struct so |
* that we can allocate sw_span structs on the stack without using |
* a lot of memory. The span_arrays struct is about 400KB while the |
* sw_span struct is only about 512 bytes. |
*/ |
struct span_arrays *array; |
}; |
#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ |
do { \ |
(S).primitive = (PRIMITIVE); \ |
(S).interpMask = (INTERP_MASK); \ |
(S).arrayMask = (ARRAY_MASK); \ |
(S).start = 0; \ |
(S).end = (END); \ |
(S).facing = 0; \ |
(S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ |
} while (0) |
struct swrast_device_driver; |
/* These are the public-access functions exported from swrast. |
*/ |
extern void |
_swrast_alloc_buffers( GLframebuffer *buffer ); |
extern void |
_swrast_use_read_buffer( GLcontext *ctx ); |
extern void |
_swrast_use_draw_buffer( GLcontext *ctx ); |
extern GLboolean |
_swrast_CreateContext( GLcontext *ctx ); |
extern void |
_swrast_DestroyContext( GLcontext *ctx ); |
/* Get a (non-const) reference to the device driver struct for swrast. |
*/ |
extern struct swrast_device_driver * |
_swrast_GetDeviceDriverReference( GLcontext *ctx ); |
extern void |
_swrast_Bitmap( GLcontext *ctx, |
GLint px, GLint py, |
GLsizei width, GLsizei height, |
const struct gl_pixelstore_attrib *unpack, |
const GLubyte *bitmap ); |
extern void |
_swrast_CopyPixels( GLcontext *ctx, |
GLint srcx, GLint srcy, |
GLint destx, GLint desty, |
GLsizei width, GLsizei height, |
GLenum type ); |
extern void |
_swrast_DrawPixels( GLcontext *ctx, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *unpack, |
const GLvoid *pixels ); |
extern void |
_swrast_ReadPixels( GLcontext *ctx, |
GLint x, GLint y, GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *unpack, |
GLvoid *pixels ); |
extern void |
_swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, |
GLint x, GLint y, GLint width, GLint height ); |
extern void |
_swrast_Accum( GLcontext *ctx, GLenum op, |
GLfloat value, GLint xpos, GLint ypos, |
GLint width, GLint height ); |
extern void |
_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); |
/* Reset the stipple counter |
*/ |
extern void |
_swrast_ResetLineStipple( GLcontext *ctx ); |
/* These will always render the correct point/line/triangle for the |
* current state. |
* |
* For flatshaded primitives, the provoking vertex is the final one. |
*/ |
extern void |
_swrast_Point( GLcontext *ctx, const SWvertex *v ); |
extern void |
_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); |
extern void |
_swrast_Triangle( GLcontext *ctx, const SWvertex *v0, |
const SWvertex *v1, const SWvertex *v2 ); |
extern void |
_swrast_Quad( GLcontext *ctx, |
const SWvertex *v0, const SWvertex *v1, |
const SWvertex *v2, const SWvertex *v3); |
extern void |
_swrast_flush( GLcontext *ctx ); |
extern void |
_swrast_render_primitive( GLcontext *ctx, GLenum mode ); |
extern void |
_swrast_render_start( GLcontext *ctx ); |
extern void |
_swrast_render_finish( GLcontext *ctx ); |
/* Tell the software rasterizer about core state changes. |
*/ |
extern void |
_swrast_InvalidateState( GLcontext *ctx, GLuint new_state ); |
/* Configure software rasterizer to match hardware rasterizer characteristics: |
*/ |
extern void |
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); |
extern void |
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); |
/* Debug: |
*/ |
extern void |
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); |
/* |
* Imaging fallbacks (a better solution should be found, perhaps |
* moving all the imaging fallback code to a new module) |
*/ |
extern void |
_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, |
GLsizei height); |
extern void |
_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width); |
extern void |
_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width); |
extern void |
_swrast_CopyColorTable( GLcontext *ctx, |
GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width); |
/* |
* Texture fallbacks, Brian Paul. Could also live in a new module |
* with the rest of the texture store fallbacks? |
*/ |
extern void |
_swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLint border); |
extern void |
_swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLsizei height, |
GLint border); |
extern void |
_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint x, GLint y, GLsizei width); |
extern void |
_swrast_copy_texsubimage2d(GLcontext *ctx, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, GLsizei width, GLsizei height); |
extern void |
_swrast_copy_texsubimage3d(GLcontext *ctx, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint x, GLint y, GLsizei width, GLsizei height); |
/* The driver interface for the software rasterizer. |
* Unless otherwise noted, all functions are mandatory. |
*/ |
struct swrast_device_driver { |
void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); |
/* |
* Specifies the current buffer for span/pixel writing/reading. |
* buffer indicates which window to write to / read from. Normally, |
* this'll be the buffer currently bound to the context, but it doesn't |
* have to be! |
* bufferBit indicates which color buffer, one of: |
* FRONT_LEFT_BIT - this buffer always exists |
* BACK_LEFT_BIT - when double buffering |
* FRONT_RIGHT_BIT - when using stereo |
* BACK_RIGHT_BIT - when using stereo and double buffering |
* AUXn_BIT - if aux buffers are implemented |
*/ |
/*** |
*** Functions for synchronizing access to the framebuffer: |
***/ |
void (*SpanRenderStart)(GLcontext *ctx); |
void (*SpanRenderFinish)(GLcontext *ctx); |
/* OPTIONAL. |
* |
* Called before and after all rendering operations, including DrawPixels, |
* ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. |
* These are a suitable place for grabbing/releasing hardware locks. |
* |
* NOTE: The swrast triangle/line/point routines *DO NOT* call |
* these functions. Locking in that case must be organized by the |
* driver by other mechanisms. |
*/ |
/*** |
*** Functions for writing pixels to the frame buffer: |
***/ |
void (*WriteRGBASpan)( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ); |
void (*WriteRGBSpan)( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
CONST GLchan rgb[][3], const GLubyte mask[] ); |
/* Write a horizontal run of RGBA or RGB pixels. |
* If mask is NULL, draw all pixels. |
* If mask is not null, only draw pixel [i] when mask [i] is true. |
*/ |
void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLchan color[4], const GLubyte mask[] ); |
/* Write a horizontal run of RGBA pixels all with the same color. |
*/ |
void (*WriteRGBAPixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ); |
/* Write array of RGBA pixels at random locations. |
*/ |
void (*WriteMonoRGBAPixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLchan color[4], const GLubyte mask[] ); |
/* Write an array of mono-RGBA pixels at random locations. |
*/ |
void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLuint index[], const GLubyte mask[] ); |
void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLubyte index[], const GLubyte mask[] ); |
/* Write a horizontal run of CI pixels. One function is for 32bpp |
* indexes and the other for 8bpp pixels (the common case). You mus |
* implement both for color index mode. |
*/ |
void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLuint colorIndex, const GLubyte mask[] ); |
/* Write a horizontal run of color index pixels using the color index |
* last specified by the Index() function. |
*/ |
void (*WriteCI32Pixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLuint index[], const GLubyte mask[] ); |
/* |
* Write a random array of CI pixels. |
*/ |
void (*WriteMonoCIPixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLuint colorIndex, const GLubyte mask[] ); |
/* Write a random array of color index pixels using the color index |
* last specified by the Index() function. |
*/ |
/*** |
*** Functions to read pixels from frame buffer: |
***/ |
void (*ReadCI32Span)( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLuint index[] ); |
/* Read a horizontal run of color index pixels. |
*/ |
void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ); |
/* Read a horizontal run of RGBA pixels. |
*/ |
void (*ReadCI32Pixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLuint indx[], const GLubyte mask[] ); |
/* Read a random array of CI pixels. |
*/ |
void (*ReadRGBAPixels)( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ); |
/* Read a random array of RGBA pixels. |
*/ |
/*** |
*** For supporting hardware Z buffers: |
*** Either ALL or NONE of these functions must be implemented! |
*** NOTE that Each depth value is a 32-bit GLuint. If the depth |
*** buffer is less than 32 bits deep then the extra upperbits are zero. |
***/ |
void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLdepth depth[], const GLubyte mask[] ); |
/* Write a horizontal span of values into the depth buffer. Only write |
* depth[i] value if mask[i] is nonzero. |
*/ |
void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLdepth depth[] ); |
/* Read a horizontal span of values from the depth buffer. |
*/ |
void (*WriteDepthPixels)( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
const GLdepth depth[], const GLubyte mask[] ); |
/* Write an array of randomly positioned depth values into the |
* depth buffer. Only write depth[i] value if mask[i] is nonzero. |
*/ |
void (*ReadDepthPixels)( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
GLdepth depth[] ); |
/* Read an array of randomly positioned depth values from the depth buffer. |
*/ |
/*** |
*** For supporting hardware stencil buffers: |
*** Either ALL or NONE of these functions must be implemented! |
***/ |
void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLstencil stencil[], const GLubyte mask[] ); |
/* Write a horizontal span of stencil values into the stencil buffer. |
* If mask is NULL, write all stencil values. |
* Else, only write stencil[i] if mask[i] is non-zero. |
*/ |
void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLstencil stencil[] ); |
/* Read a horizontal span of stencil values from the stencil buffer. |
*/ |
void (*WriteStencilPixels)( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
const GLstencil stencil[], |
const GLubyte mask[] ); |
/* Write an array of stencil values into the stencil buffer. |
* If mask is NULL, write all stencil values. |
* Else, only write stencil[i] if mask[i] is non-zero. |
*/ |
void (*ReadStencilPixels)( GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
GLstencil stencil[] ); |
/* Read an array of stencil values from the stencil buffer. |
*/ |
}; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_span.h |
---|
0,0 → 1,71 |
/* $Id: s_span.h,v 1.1 2003-02-28 11:49:42 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_SPAN_H |
#define S_SPAN_H |
#include "mtypes.h" |
#include "swrast.h" |
extern void |
_mesa_span_default_z( GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_span_default_fog( GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_span_default_color( GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span ); |
extern void |
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span); |
extern void |
_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span); |
extern void |
_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span); |
extern void |
_mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, |
GLuint n, GLint x, GLint y, GLchan rgba[][4] ); |
extern void |
_mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, |
GLuint n, GLint x, GLint y, GLuint indx[] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_depth.h |
---|
0,0 → 1,64 |
/* $Id: s_depth.h,v 1.1 2003-02-28 11:49:41 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_DEPTH_H |
#define S_DEPTH_H |
#include "mtypes.h" |
#include "swrast.h" |
extern GLvoid * |
_mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y); |
extern GLuint |
_mesa_depth_test_span( GLcontext *ctx, struct sw_span *span); |
extern void |
_mesa_read_depth_span( GLcontext *ctx, |
GLint n, GLint x, GLint y, GLdepth depth[] ); |
extern void |
_mesa_read_depth_span_float( GLcontext *ctx, GLint n, GLint x, GLint y, |
GLfloat depth[] ); |
extern void |
_mesa_alloc_depth_buffer( GLframebuffer *buffer ); |
extern void |
_mesa_clear_depth_buffer( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast/s_triangle.h |
---|
0,0 → 1,55 |
/* $Id: s_triangle.h,v 1.1 2003-02-28 11:49:43 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef S_TRIANGLES_H |
#define S_TRIANGLES_H |
#include "mtypes.h" |
#include "swrast.h" |
GLboolean _mesa_cull_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2); |
void |
_swrast_choose_triangle( GLcontext *ctx ); |
void |
_swrast_add_spec_terms_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/imports.h |
---|
0,0 → 1,193 |
/* $Id: imports.h,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* This file provides wrappers for all the standard C library functions |
* like malloc, free, printf, getenv, etc. |
*/ |
#ifndef IMPORTS_H |
#define IMPORTS_H |
#define MALLOC(BYTES) _mesa_malloc(BYTES) |
#define CALLOC(BYTES) _mesa_calloc(BYTES) |
#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) |
#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) |
#define FREE(PTR) _mesa_free(PTR) |
#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) |
#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) |
#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) |
#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) |
#define ALIGN_FREE(PTR) _mesa_align_free(PTR) |
#define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) |
#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) |
/* MACs and BeOS don't support static larger than 32kb, so... */ |
#if defined(macintosh) && !defined(__MRC__) |
/*extern char *AGLAlloc(int size);*/ |
/*extern void AGLFree(char* ptr);*/ |
# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE)) |
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) |
# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) |
# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) |
# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) |
#elif defined(__BEOS__) |
# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE)) |
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) |
# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) |
# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) |
# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) |
#else |
# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] |
# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] |
# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] |
# define CHECKARRAY(NAME,CMD) do {} while(0) |
# define UNDEFARRAY(NAME) |
#endif |
#ifdef MESA_EXTERNAL_BUFFERALLOC |
/* |
* If you want Mesa's depth/stencil/accum/etc buffers to be allocated |
* with a specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC |
* and implement _ext_mesa_alloc/free_pixelbuffer() in your app. |
* Contributed by Gerk Huisma (gerk@five-d.demon.nl). |
*/ |
extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size ); |
extern void _ext_mesa_free_pixelbuffer( void *pb ); |
#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES) |
#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR) |
#else |
/* Default buffer allocation uses the aligned allocation routines: */ |
#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512) |
#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR) |
#endif |
extern void * |
_mesa_malloc( size_t bytes ); |
extern void * |
_mesa_calloc( size_t bytes ); |
extern void |
_mesa_free( void *ptr ); |
extern void * |
_mesa_align_malloc( size_t bytes, unsigned long alignment ); |
extern void * |
_mesa_align_calloc( size_t bytes, unsigned long alignment ); |
extern void |
_mesa_align_free( void *ptr ); |
extern void * |
_mesa_memcpy( void *dest, const void *src, size_t n ); |
extern void |
_mesa_memset( void *dst, int val, size_t n ); |
extern void |
_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); |
extern void |
_mesa_bzero( void *dst, size_t n ); |
extern double |
_mesa_sin(double a); |
extern double |
_mesa_cos(double a); |
extern double |
_mesa_sqrt(double x); |
extern double |
_mesa_pow(double x, double y); |
extern char * |
_mesa_getenv( const char *var ); |
extern char * |
_mesa_strstr( const char *haystack, const char *needle ); |
extern char * |
_mesa_strncat( char *dest, const char *src, size_t n ); |
extern char * |
_mesa_strcpy( char *dest, const char *src ); |
extern char * |
_mesa_strncpy( char *dest, const char *src, size_t n ); |
extern size_t |
_mesa_strlen( const char *s ); |
extern int |
_mesa_strcmp( const char *s1, const char *s2 ); |
extern int |
_mesa_strncmp( const char *s1, const char *s2, size_t n ); |
extern int |
_mesa_atoi( const char *s ); |
extern int |
_mesa_sprintf( char *str, const char *fmt, ... ); |
extern void |
_mesa_printf( const char *fmtString, ... ); |
extern void |
_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); |
extern void |
_mesa_problem( const __GLcontext *ctx, const char *s ); |
extern void |
_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); |
extern void |
_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); |
extern void |
_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); |
#endif /* IMPORTS_H */ |
/shark/tags/rel_0_4/ports/mesa/src/mtypes.h |
---|
0,0 → 1,1898 |
/* $Id: mtypes.h,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** |
* \file mtypes.h |
* \brief Main Mesa data structures. |
*/ |
#ifndef TYPES_H |
#define TYPES_H |
#include "glheader.h" |
#include "config.h" /* Hardwired parameters */ |
#include "glapitable.h" |
#include "glthread.h" |
#include "math/m_matrix.h" /* GLmatrix */ |
#if defined(MESA_TRACE) |
#include "trace/tr_context.h" |
#endif |
/* Please try to mark derived values with a leading underscore ('_'). |
*/ |
/* |
* Color channel data type: |
*/ |
#if CHAN_BITS == 8 |
typedef GLubyte GLchan; |
#define CHAN_MAX 255 |
#define CHAN_MAXF 255.0F |
#define CHAN_TYPE GL_UNSIGNED_BYTE |
#elif CHAN_BITS == 16 |
typedef GLushort GLchan; |
#define CHAN_MAX 65535 |
#define CHAN_MAXF 65535.0F |
#define CHAN_TYPE GL_UNSIGNED_SHORT |
#elif CHAN_BITS == 32 |
typedef GLfloat GLchan; |
#define CHAN_MAX 1.0 |
#define CHAN_MAXF 1.0F |
#define CHAN_TYPE GL_FLOAT |
#else |
#error "illegal number of color channel bits" |
#endif |
/** |
* Accumulation buffer data type: |
*/ |
#if ACCUM_BITS==8 |
typedef GLbyte GLaccum; |
#elif ACCUM_BITS==16 |
typedef GLshort GLaccum; |
#elif ACCUM_BITS==32 |
typedef GLfloat GLaccum; |
#else |
# error "illegal number of accumulation bits" |
#endif |
/** |
* Stencil buffer data type: |
*/ |
#if STENCIL_BITS==8 |
typedef GLubyte GLstencil; |
# define STENCIL_MAX 0xff |
#elif STENCIL_BITS==16 |
typedef GLushort GLstencil; |
# define STENCIL_MAX 0xffff |
#else |
# error "illegal number of stencil bits" |
#endif |
/** |
* Depth buffer data type: |
*/ |
typedef GLuint GLdepth; /* Must be 32-bits! */ |
/** |
* Fixed point data type: |
*/ |
typedef int GLfixed; |
/** |
* Some forward type declarations |
*/ |
struct _mesa_HashTable; |
struct gl_texture_image; |
struct gl_texture_object; |
typedef struct __GLcontextRec GLcontext; |
typedef struct __GLcontextModesRec GLvisual; |
typedef struct gl_frame_buffer GLframebuffer; |
/* These define the aliases between numbered vertex attributes and |
* conventional OpenGL vertex attributes. We use these values in |
* quite a few places. New in Mesa 4.1. |
*/ |
#define VERT_ATTRIB_POS 0 |
#define VERT_ATTRIB_WEIGHT 1 |
#define VERT_ATTRIB_NORMAL 2 |
#define VERT_ATTRIB_COLOR0 3 |
#define VERT_ATTRIB_COLOR1 4 |
#define VERT_ATTRIB_FOG 5 |
#define VERT_ATTRIB_SIX 6 |
#define VERT_ATTRIB_SEVEN 7 |
#define VERT_ATTRIB_TEX0 8 |
#define VERT_ATTRIB_TEX1 9 |
#define VERT_ATTRIB_TEX2 10 |
#define VERT_ATTRIB_TEX3 11 |
#define VERT_ATTRIB_TEX4 12 |
#define VERT_ATTRIB_TEX5 13 |
#define VERT_ATTRIB_TEX6 14 |
#define VERT_ATTRIB_TEX7 15 |
#define VERT_ATTRIB_MAX 16 |
/* These are used in bitfields in many places */ |
#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) |
#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) |
#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) |
#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) |
#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) |
#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) |
#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX) |
#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) |
#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) |
#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) |
#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) |
#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) |
#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) |
#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) |
#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) |
#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) |
#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) |
/** |
* Maximum number of temporary vertices required for clipping. (Used |
* in array_cache and tnl modules). |
*/ |
#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) |
/* Data structure for color tables */ |
struct gl_color_table { |
GLenum Format; /* GL_ALPHA, GL_RGB, GL_RGB, etc */ |
GLenum IntFormat; |
GLuint Size; /* number of entries (rows) in table */ |
GLvoid *Table; /* either GLfloat * or GLchan * */ |
GLboolean FloatTable; /* are entries stored as floats? */ |
GLubyte RedSize; |
GLubyte GreenSize; |
GLubyte BlueSize; |
GLubyte AlphaSize; |
GLubyte LuminanceSize; |
GLubyte IntensitySize; |
}; |
/* |
* Bit flags used for updating material values. |
*/ |
#define FRONT_AMBIENT_BIT 0x1 |
#define BACK_AMBIENT_BIT 0x2 |
#define FRONT_DIFFUSE_BIT 0x4 |
#define BACK_DIFFUSE_BIT 0x8 |
#define FRONT_SPECULAR_BIT 0x10 |
#define BACK_SPECULAR_BIT 0x20 |
#define FRONT_EMISSION_BIT 0x40 |
#define BACK_EMISSION_BIT 0x80 |
#define FRONT_SHININESS_BIT 0x100 |
#define BACK_SHININESS_BIT 0x200 |
#define FRONT_INDEXES_BIT 0x400 |
#define BACK_INDEXES_BIT 0x800 |
#define FRONT_MATERIAL_BITS (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \ |
FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \ |
FRONT_SHININESS_BIT | FRONT_INDEXES_BIT) |
#define BACK_MATERIAL_BITS (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \ |
BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \ |
BACK_SHININESS_BIT | BACK_INDEXES_BIT) |
#define ALL_MATERIAL_BITS (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS) |
/* |
* Specular exponent and material shininess lookup table sizes: |
*/ |
#define EXP_TABLE_SIZE 512 |
#define SHINE_TABLE_SIZE 256 |
struct gl_shine_tab { |
struct gl_shine_tab *next, *prev; |
GLfloat tab[SHINE_TABLE_SIZE+1]; |
GLfloat shininess; |
GLuint refcount; |
}; |
struct gl_light { |
struct gl_light *next; /* double linked list with sentinel */ |
struct gl_light *prev; |
GLfloat Ambient[4]; /* ambient color */ |
GLfloat Diffuse[4]; /* diffuse color */ |
GLfloat Specular[4]; /* specular color */ |
GLfloat EyePosition[4]; /* position in eye coordinates */ |
GLfloat EyeDirection[4]; /* spotlight dir in eye coordinates */ |
GLfloat SpotExponent; |
GLfloat SpotCutoff; /* in degress */ |
GLfloat _CosCutoff; /* = MAX(0, cos(SpotCutoff)) */ |
GLfloat ConstantAttenuation; |
GLfloat LinearAttenuation; |
GLfloat QuadraticAttenuation; |
GLboolean Enabled; /* On/off flag */ |
/* Derived fields */ |
GLuint _Flags; /* State */ |
GLfloat _Position[4]; /* position in eye/obj coordinates */ |
GLfloat _VP_inf_norm[3]; /* Norm direction to infinite light */ |
GLfloat _h_inf_norm[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */ |
GLfloat _NormDirection[4]; /* normalized spotlight direction */ |
GLfloat _VP_inf_spot_attenuation; |
GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ |
GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */ |
GLfloat _MatDiffuse[2][3]; /* material diffuse * light diffuse */ |
GLfloat _MatSpecular[2][3]; /* material spec * light specular */ |
GLfloat _dli; /* CI diffuse light intensity */ |
GLfloat _sli; /* CI specular light intensity */ |
}; |
struct gl_lightmodel { |
GLfloat Ambient[4]; /* ambient color */ |
GLboolean LocalViewer; /* Local (or infinite) view point? */ |
GLboolean TwoSide; /* Two (or one) sided lighting? */ |
GLenum ColorControl; /* either GL_SINGLE_COLOR */ |
/* or GL_SEPARATE_SPECULAR_COLOR */ |
}; |
struct gl_material |
{ |
GLfloat Ambient[4]; |
GLfloat Diffuse[4]; |
GLfloat Specular[4]; |
GLfloat Emission[4]; |
GLfloat Shininess; |
GLfloat AmbientIndex; /* for color index lighting */ |
GLfloat DiffuseIndex; /* for color index lighting */ |
GLfloat SpecularIndex; /* for color index lighting */ |
}; |
/* |
* Attribute structures: |
* We define a struct for each attribute group to make pushing and |
* popping attributes easy. Also it's a good organization. |
*/ |
struct gl_accum_attrib { |
GLfloat ClearColor[4]; /* Accumulation buffer clear color */ |
}; |
/* |
* Used in _DrawDestMask and _ReadSrcMask below to identify color buffers. |
*/ |
#define FRONT_LEFT_BIT 0x1 |
#define FRONT_RIGHT_BIT 0x2 |
#define BACK_LEFT_BIT 0x4 |
#define BACK_RIGHT_BIT 0x8 |
#define AUX0_BIT 0x10 |
#define AUX1_BIT 0x20 |
#define AUX2_BIT 0x40 |
#define AUX3_BIT 0x80 |
struct gl_colorbuffer_attrib { |
GLuint ClearIndex; /* Index to use for glClear */ |
GLclampf ClearColor[4]; /* Color to use for glClear */ |
GLuint IndexMask; /* Color index write mask */ |
GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ |
GLenum DrawBuffer; /* Which buffer to draw into */ |
GLubyte _DrawDestMask; /* bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */ |
/* alpha testing */ |
GLboolean AlphaEnabled; /* Alpha test enabled flag */ |
GLenum AlphaFunc; /* Alpha test function */ |
GLclampf AlphaRef; |
/* blending */ |
GLboolean BlendEnabled; /* Blending enabled flag */ |
GLenum BlendSrcRGB; /* Blending source operator */ |
GLenum BlendDstRGB; /* Blending destination operator */ |
GLenum BlendSrcA; /* GL_INGR_blend_func_separate */ |
GLenum BlendDstA; /* GL_INGR_blend_func_separate */ |
GLenum BlendEquation; |
GLfloat BlendColor[4]; |
/* logic op */ |
GLenum LogicOp; /* Logic operator */ |
GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */ |
GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */ |
GLboolean DitherFlag; /* Dither enable flag */ |
}; |
struct gl_current_attrib { |
/* These values valid only when FLUSH_VERTICES has been called. |
*/ |
GLfloat Attrib[VERT_ATTRIB_MAX][4]; /* Current vertex attributes */ |
/* indexed by VERT_ATTRIB_* */ |
GLuint Index; /* Current color index */ |
GLboolean EdgeFlag; /* Current edge flag */ |
/* These values are always valid. BTW, note how similar this set of |
* attributes is to the SWvertex datatype in the software rasterizer... |
*/ |
GLfloat RasterPos[4]; /* Current raster position */ |
GLfloat RasterDistance; /* Current raster distance */ |
GLfloat RasterColor[4]; /* Current raster color */ |
GLfloat RasterSecondaryColor[4]; /* Current rast 2ndary color */ |
GLuint RasterIndex; /* Current raster index */ |
GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/* Current raster texcoords */ |
GLboolean RasterPosValid; /* Raster pos valid flag */ |
}; |
struct gl_depthbuffer_attrib { |
GLenum Func; /* Function for depth buffer compare */ |
GLfloat Clear; /* Value to clear depth buffer to */ |
GLboolean Test; /* Depth buffering enabled flag */ |
GLboolean Mask; /* Depth buffer writable? */ |
GLboolean OcclusionTest; /* GL_HP_occlusion_test */ |
}; |
struct gl_enable_attrib { |
GLboolean AlphaTest; |
GLboolean AutoNormal; |
GLboolean Blend; |
GLuint ClipPlanes; |
GLboolean ColorMaterial; |
GLboolean Convolution1D; |
GLboolean Convolution2D; |
GLboolean Separable2D; |
GLboolean CullFace; |
GLboolean DepthTest; |
GLboolean Dither; |
GLboolean Fog; |
GLboolean Histogram; |
GLboolean Light[MAX_LIGHTS]; |
GLboolean Lighting; |
GLboolean LineSmooth; |
GLboolean LineStipple; |
GLboolean IndexLogicOp; |
GLboolean ColorLogicOp; |
GLboolean Map1Color4; |
GLboolean Map1Index; |
GLboolean Map1Normal; |
GLboolean Map1TextureCoord1; |
GLboolean Map1TextureCoord2; |
GLboolean Map1TextureCoord3; |
GLboolean Map1TextureCoord4; |
GLboolean Map1Vertex3; |
GLboolean Map1Vertex4; |
GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ |
GLboolean Map2Color4; |
GLboolean Map2Index; |
GLboolean Map2Normal; |
GLboolean Map2TextureCoord1; |
GLboolean Map2TextureCoord2; |
GLboolean Map2TextureCoord3; |
GLboolean Map2TextureCoord4; |
GLboolean Map2Vertex3; |
GLboolean Map2Vertex4; |
GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ |
GLboolean MinMax; |
GLboolean Normalize; |
GLboolean PixelTexture; |
GLboolean PointSmooth; |
GLboolean PolygonOffsetPoint; |
GLboolean PolygonOffsetLine; |
GLboolean PolygonOffsetFill; |
GLboolean PolygonSmooth; |
GLboolean PolygonStipple; |
GLboolean RescaleNormals; |
GLboolean Scissor; |
GLboolean Stencil; |
GLboolean MultisampleEnabled; /* GL_ARB_multisample */ |
GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ |
GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ |
GLboolean SampleCoverage; /* GL_ARB_multisample */ |
GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ |
GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ |
GLuint Texture[MAX_TEXTURE_UNITS]; |
GLuint TexGen[MAX_TEXTURE_UNITS]; |
GLboolean VertexProgram; /* GL_NV_vertex_program */ |
GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */ |
GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */ |
GLboolean PointSprite; /* GL_NV_point_sprite */ |
}; |
struct gl_eval_attrib { |
/* Enable bits */ |
GLboolean Map1Color4; |
GLboolean Map1Index; |
GLboolean Map1Normal; |
GLboolean Map1TextureCoord1; |
GLboolean Map1TextureCoord2; |
GLboolean Map1TextureCoord3; |
GLboolean Map1TextureCoord4; |
GLboolean Map1Vertex3; |
GLboolean Map1Vertex4; |
GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ |
GLboolean Map2Color4; |
GLboolean Map2Index; |
GLboolean Map2Normal; |
GLboolean Map2TextureCoord1; |
GLboolean Map2TextureCoord2; |
GLboolean Map2TextureCoord3; |
GLboolean Map2TextureCoord4; |
GLboolean Map2Vertex3; |
GLboolean Map2Vertex4; |
GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ |
GLboolean AutoNormal; |
/* Map Grid endpoints and divisions and calculated du values */ |
GLint MapGrid1un; |
GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; |
GLint MapGrid2un, MapGrid2vn; |
GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; |
GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; |
}; |
struct gl_fog_attrib { |
GLboolean Enabled; /* Fog enabled flag */ |
GLfloat Color[4]; /* Fog color */ |
GLfloat Density; /* Density >= 0.0 */ |
GLfloat Start; /* Start distance in eye coords */ |
GLfloat End; /* End distance in eye coords */ |
GLfloat Index; /* Fog index */ |
GLenum Mode; /* Fog mode */ |
GLboolean ColorSumEnabled; |
GLenum FogCoordinateSource; /* GL_EXT_fog_coord */ |
}; |
struct gl_hint_attrib { |
/* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */ |
GLenum PerspectiveCorrection; |
GLenum PointSmooth; |
GLenum LineSmooth; |
GLenum PolygonSmooth; |
GLenum Fog; |
GLenum ClipVolumeClipping; /* GL_EXT_clip_volume_hint */ |
GLenum TextureCompression; /* GL_ARB_texture_compression */ |
GLenum GenerateMipmap; /* GL_SGIS_generate_mipmap */ |
}; |
struct gl_histogram_attrib { |
GLuint Width; /* number of table entries */ |
GLint Format; /* GL_ALPHA, GL_RGB, etc */ |
GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /* the histogram */ |
GLboolean Sink; /* terminate image transfer? */ |
GLubyte RedSize; /* Bits per counter */ |
GLubyte GreenSize; |
GLubyte BlueSize; |
GLubyte AlphaSize; |
GLubyte LuminanceSize; |
}; |
struct gl_minmax_attrib { |
GLenum Format; |
GLboolean Sink; |
GLfloat Min[4], Max[4]; /* RGBA */ |
}; |
struct gl_convolution_attrib { |
GLenum Format; |
GLenum InternalFormat; |
GLuint Width; |
GLuint Height; |
GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; |
}; |
#define LIGHT_SPOT 0x1 |
#define LIGHT_LOCAL_VIEWER 0x2 |
#define LIGHT_POSITIONAL 0x4 |
#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) |
struct gl_light_attrib { |
struct gl_light Light[MAX_LIGHTS]; /* Array of lights */ |
struct gl_lightmodel Model; /* Lighting model */ |
/* Must flush FLUSH_VERTICES before referencing: |
*/ |
struct gl_material Material[2]; /* Material 0=front, 1=back */ |
GLboolean Enabled; /* Lighting enabled flag */ |
GLenum ShadeModel; /* GL_FLAT or GL_SMOOTH */ |
GLenum ColorMaterialFace; /* GL_FRONT, BACK or FRONT_AND_BACK */ |
GLenum ColorMaterialMode; /* GL_AMBIENT, GL_DIFFUSE, etc */ |
GLuint ColorMaterialBitmask; /* bitmask formed from Face and Mode */ |
GLboolean ColorMaterialEnabled; |
struct gl_light EnabledList; /* List sentinel */ |
/* Derived for optimizations: */ |
GLboolean _NeedVertices; /* Use fast shader? */ |
GLuint _Flags; /* LIGHT_* flags, see above */ |
GLfloat _BaseColor[2][3]; |
}; |
struct gl_line_attrib { |
GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ |
GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ |
GLushort StipplePattern; /* Stipple pattern */ |
GLint StippleFactor; /* Stipple repeat factor */ |
GLfloat Width; /* Line width */ |
GLfloat _Width; /* Clamped Line width */ |
}; |
struct gl_list_attrib { |
GLuint ListBase; |
}; |
struct gl_list_opcode { |
GLuint size; |
void (*execute)( GLcontext *ctx, void *data ); |
void (*destroy)( GLcontext *ctx, void *data ); |
void (*print)( GLcontext *ctx, void *data ); |
}; |
#define GL_MAX_EXT_OPCODES 16 |
struct gl_list_extensions { |
struct gl_list_opcode opcode[GL_MAX_EXT_OPCODES]; |
GLuint nr_opcodes; |
}; |
struct gl_multisample_attrib { |
GLboolean Enabled; |
GLboolean SampleAlphaToCoverage; |
GLboolean SampleAlphaToOne; |
GLboolean SampleCoverage; |
GLfloat SampleCoverageValue; |
GLboolean SampleCoverageInvert; |
}; |
struct gl_pixel_attrib { |
GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ |
GLubyte _ReadSrcMask; /* Not really a mask, but like _DrawDestMask */ |
/* May be: FRONT_LEFT_BIT, BACK_LEFT_BIT, */ |
/* FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */ |
GLfloat RedBias, RedScale; |
GLfloat GreenBias, GreenScale; |
GLfloat BlueBias, BlueScale; |
GLfloat AlphaBias, AlphaScale; |
GLfloat DepthBias, DepthScale; |
GLint IndexShift, IndexOffset; |
GLboolean MapColorFlag; |
GLboolean MapStencilFlag; |
GLfloat ZoomX, ZoomY; |
/* XXX move these out of gl_pixel_attrib */ |
GLint MapStoSsize; /* Size of each pixel map */ |
GLint MapItoIsize; |
GLint MapItoRsize; |
GLint MapItoGsize; |
GLint MapItoBsize; |
GLint MapItoAsize; |
GLint MapRtoRsize; |
GLint MapGtoGsize; |
GLint MapBtoBsize; |
GLint MapAtoAsize; |
GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */ |
GLint MapItoI[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; |
GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /* converted to 8-bit color */ |
GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; |
GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; |
GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; |
GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; |
/* GL_EXT_histogram */ |
GLboolean HistogramEnabled; |
GLboolean MinMaxEnabled; |
/* GL_SGIS_pixel_texture */ |
GLboolean PixelTextureEnabled; |
GLenum FragmentRgbSource; |
GLenum FragmentAlphaSource; |
/* GL_SGI_color_matrix */ |
GLfloat PostColorMatrixScale[4]; /* RGBA */ |
GLfloat PostColorMatrixBias[4]; /* RGBA */ |
/* GL_SGI_color_table */ |
GLfloat ColorTableScale[4]; |
GLfloat ColorTableBias[4]; |
GLboolean ColorTableEnabled; |
GLfloat PCCTscale[4]; |
GLfloat PCCTbias[4]; |
GLboolean PostConvolutionColorTableEnabled; |
GLfloat PCMCTscale[4]; |
GLfloat PCMCTbias[4]; |
GLboolean PostColorMatrixColorTableEnabled; |
/* Convolution */ |
GLboolean Convolution1DEnabled; |
GLboolean Convolution2DEnabled; |
GLboolean Separable2DEnabled; |
GLfloat ConvolutionBorderColor[3][4]; |
GLenum ConvolutionBorderMode[3]; |
GLfloat ConvolutionFilterScale[3][4]; |
GLfloat ConvolutionFilterBias[3][4]; |
GLfloat PostConvolutionScale[4]; /* RGBA */ |
GLfloat PostConvolutionBias[4]; /* RGBA */ |
}; |
struct gl_point_attrib { |
GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ |
GLfloat Size; /* User-specified point size */ |
GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */ |
GLfloat Params[3]; /* GL_EXT_point_parameters */ |
GLfloat MinSize, MaxSize; /* GL_EXT_point_parameters */ |
GLfloat Threshold; /* GL_EXT_point_parameters */ |
GLboolean _Attenuated; /* True if Params != [1, 0, 0] */ |
GLboolean PointSprite; /* GL_NV_point_sprite */ |
GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /* GL_NV_point_sprite */ |
GLenum SpriteRMode; /* GL_NV_point_sprite */ |
}; |
struct gl_polygon_attrib { |
GLenum FrontFace; /* Either GL_CW or GL_CCW */ |
GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */ |
GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */ |
GLboolean _FrontBit; /* 0=GL_CCW, 1=GL_CW */ |
GLboolean CullFlag; /* Culling on/off flag */ |
GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */ |
GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */ |
GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */ |
GLfloat OffsetFactor; /* Polygon offset factor, from user */ |
GLfloat OffsetUnits; /* Polygon offset units, from user */ |
GLboolean OffsetPoint; /* Offset in GL_POINT mode */ |
GLboolean OffsetLine; /* Offset in GL_LINE mode */ |
GLboolean OffsetFill; /* Offset in GL_FILL mode */ |
}; |
struct gl_scissor_attrib { |
GLboolean Enabled; /* Scissor test enabled? */ |
GLint X, Y; /* Lower left corner of box */ |
GLsizei Width, Height; /* Size of box */ |
}; |
struct gl_stencil_attrib { |
GLboolean Enabled; /* Enabled flag */ |
GLboolean TestTwoSide; /* GL_EXT_stencil_two_side */ |
GLubyte ActiveFace; /* GL_EXT_stencil_two_side (0 or 1) */ |
GLenum Function[2]; /* Stencil function */ |
GLenum FailFunc[2]; /* Fail function */ |
GLenum ZPassFunc[2]; /* Depth buffer pass function */ |
GLenum ZFailFunc[2]; /* Depth buffer fail function */ |
GLstencil Ref[2]; /* Reference value */ |
GLstencil ValueMask[2]; /* Value mask */ |
GLstencil WriteMask[2]; /* Write mask */ |
GLstencil Clear; /* Clear value */ |
}; |
/* TexGenEnabled flags */ |
#define S_BIT 1 |
#define T_BIT 2 |
#define R_BIT 4 |
#define Q_BIT 8 |
/* Texture.Unit[]._ReallyEnabled flags: */ |
#define TEXTURE_1D_BIT 0x01 |
#define TEXTURE_2D_BIT 0x02 |
#define TEXTURE_3D_BIT 0x04 |
#define TEXTURE_CUBE_BIT 0x08 |
#define TEXTURE_RECT_BIT 0x10 |
#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */ |
/* Bitmap versions of the GL_ constants. */ |
#define TEXGEN_SPHERE_MAP 0x1 |
#define TEXGEN_OBJ_LINEAR 0x2 |
#define TEXGEN_EYE_LINEAR 0x4 |
#define TEXGEN_REFLECTION_MAP_NV 0x8 |
#define TEXGEN_NORMAL_MAP_NV 0x10 |
#define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \ |
TEXGEN_REFLECTION_MAP_NV | \ |
TEXGEN_NORMAL_MAP_NV) |
#define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \ |
TEXGEN_REFLECTION_MAP_NV | \ |
TEXGEN_NORMAL_MAP_NV | \ |
TEXGEN_EYE_LINEAR) |
/* A selection of state flags to make driver and module's lives easier. */ |
#define ENABLE_TEXGEN0 0x1 |
#define ENABLE_TEXGEN1 0x2 |
#define ENABLE_TEXGEN2 0x4 |
#define ENABLE_TEXGEN3 0x8 |
#define ENABLE_TEXGEN4 0x10 |
#define ENABLE_TEXGEN5 0x20 |
#define ENABLE_TEXGEN6 0x40 |
#define ENABLE_TEXGEN7 0x80 |
#define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */ |
#define ENABLE_TEXMAT1 0x2 |
#define ENABLE_TEXMAT2 0x4 |
#define ENABLE_TEXMAT3 0x8 |
#define ENABLE_TEXMAT4 0x10 |
#define ENABLE_TEXMAT5 0x20 |
#define ENABLE_TEXMAT6 0x40 |
#define ENABLE_TEXMAT7 0x80 |
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) |
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) |
/* |
* If teximage is color-index, texelOut returns GLchan[1]. |
* If teximage is depth, texelOut returns GLfloat[1]. |
* Otherwise, texelOut returns GLchan[4]. |
*/ |
typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage, |
GLint col, GLint row, GLint img, |
GLvoid *texelOut ); |
/* Texture format record */ |
struct gl_texture_format { |
GLint MesaFormat; /* One of the MESA_FORMAT_* values */ |
GLenum BaseFormat; /* Either GL_ALPHA, GL_INTENSITY, GL_LUMINANCE, |
* GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA, |
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT. |
*/ |
GLubyte RedBits; /* Bits per texel component */ |
GLubyte GreenBits; /* These are just rough approximations for */ |
GLubyte BlueBits; /* compressed texture formats. */ |
GLubyte AlphaBits; |
GLubyte LuminanceBits; |
GLubyte IntensityBits; |
GLubyte IndexBits; |
GLubyte DepthBits; |
GLint TexelBytes; /* Bytes per texel (0 for compressed formats */ |
FetchTexelFunc FetchTexel1D; /* Texel fetch function pointers */ |
FetchTexelFunc FetchTexel2D; |
FetchTexelFunc FetchTexel3D; |
}; |
/* Texture image record */ |
struct gl_texture_image { |
GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, |
* GL_INTENSITY, GL_RGB, GL_RGBA, |
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT only. |
* Used for choosing TexEnv arithmetic. |
*/ |
GLint IntFormat; /* Internal format as given by the user */ |
GLuint Border; /* 0 or 1 */ |
GLuint Width; /* = 2^WidthLog2 + 2*Border */ |
GLuint Height; /* = 2^HeightLog2 + 2*Border */ |
GLuint Depth; /* = 2^DepthLog2 + 2*Border */ |
GLuint RowStride; /* == Width unless IsClientData and padded */ |
GLuint Width2; /* = Width - 2*Border */ |
GLuint Height2; /* = Height - 2*Border */ |
GLuint Depth2; /* = Depth - 2*Border */ |
GLuint WidthLog2; /* = log2(Width2) */ |
GLuint HeightLog2; /* = log2(Height2) */ |
GLuint DepthLog2; /* = log2(Depth2) */ |
GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ |
GLfloat WidthScale; /* used for mipmap lod computation */ |
GLfloat HeightScale; /* used for mipmap lod computation */ |
GLfloat DepthScale; /* used for mipmap lod computation */ |
GLvoid *Data; /* Image data, accessed via FetchTexel() */ |
GLboolean IsClientData; /* Data owned by client? */ |
const struct gl_texture_format *TexFormat; |
FetchTexelFunc FetchTexel; /* Texel fetch function pointer */ |
GLboolean IsCompressed; /* GL_ARB_texture_compression */ |
GLuint CompressedSize; /* GL_ARB_texture_compression */ |
/* For device driver: */ |
void *DriverData; /* Arbitrary device driver data */ |
}; |
/* Texture object record */ |
struct gl_texture_object { |
_glthread_Mutex Mutex; /* for thread safety */ |
GLint RefCount; /* reference count */ |
GLuint Name; /* an unsigned integer */ |
GLenum Target; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ |
GLfloat Priority; /* in [0,1] */ |
GLfloat BorderColor[4]; /* unclamped */ |
GLchan _BorderChan[4]; /* clamped, as GLchan */ |
GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */ |
GLenum WrapT; /* GL_CLAMP_TO_EDGE, and */ |
GLenum WrapR; /* GL_CLAMP_TO_BORDER_ARB */ |
GLenum MinFilter; /* minification filter */ |
GLenum MagFilter; /* magnification filter */ |
GLfloat MinLod; /* min lambda, OpenGL 1.2 */ |
GLfloat MaxLod; /* max lambda, OpenGL 1.2 */ |
GLint BaseLevel; /* min mipmap level, OpenGL 1.2 */ |
GLint MaxLevel; /* max mipmap level, OpenGL 1.2 */ |
GLfloat MaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ |
GLboolean CompareFlag; /* GL_SGIX_shadow */ |
GLenum CompareOperator; /* GL_SGIX_shadow */ |
GLfloat ShadowAmbient; |
GLenum CompareMode; /* GL_ARB_shadow */ |
GLenum CompareFunc; /* GL_ARB_shadow */ |
GLenum DepthMode; /* GL_ARB_depth_texture */ |
GLint _MaxLevel; /* actual max mipmap level (q in the spec) */ |
GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */ |
GLboolean GenerateMipmap; /* GL_SGIS_generate_mipmap */ |
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; |
/* Texture cube faces */ |
/* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */ |
struct gl_texture_image *NegX[MAX_TEXTURE_LEVELS]; |
struct gl_texture_image *PosY[MAX_TEXTURE_LEVELS]; |
struct gl_texture_image *NegY[MAX_TEXTURE_LEVELS]; |
struct gl_texture_image *PosZ[MAX_TEXTURE_LEVELS]; |
struct gl_texture_image *NegZ[MAX_TEXTURE_LEVELS]; |
/* GL_EXT_paletted_texture */ |
struct gl_color_table Palette; |
GLboolean Complete; /* Is texture object complete? */ |
struct gl_texture_object *Next; /* Next in linked list */ |
/* For device driver: */ |
void *DriverData; /* Arbitrary device driver data */ |
}; |
/* Texture unit record */ |
struct gl_texture_unit { |
GLuint Enabled; /* bitmask of TEXTURE_*_BIT flags */ |
GLuint _ReallyEnabled; /* 0 or exactly one of TEXTURE_*_BIT flags */ |
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ |
GLfloat EnvColor[4]; |
GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */ |
GLenum GenModeS; /* Tex coord generation mode, either */ |
GLenum GenModeT; /* GL_OBJECT_LINEAR, or */ |
GLenum GenModeR; /* GL_EYE_LINEAR, or */ |
GLenum GenModeQ; /* GL_SPHERE_MAP */ |
GLuint _GenBitS; |
GLuint _GenBitT; |
GLuint _GenBitR; |
GLuint _GenBitQ; |
GLuint _GenFlags; /* bitwise or of GenBit[STRQ] */ |
GLfloat ObjectPlaneS[4]; |
GLfloat ObjectPlaneT[4]; |
GLfloat ObjectPlaneR[4]; |
GLfloat ObjectPlaneQ[4]; |
GLfloat EyePlaneS[4]; |
GLfloat EyePlaneT[4]; |
GLfloat EyePlaneR[4]; |
GLfloat EyePlaneQ[4]; |
GLfloat LodBias; /* for biasing mipmap levels */ |
/* GL_EXT_texture_env_combine */ |
GLenum CombineModeRGB; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */ |
GLenum CombineModeA; /* GL_REPLACE, GL_DECAL, GL_ADD, etc. */ |
GLenum CombineSourceRGB[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ |
GLenum CombineSourceA[3]; /* GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ |
GLenum CombineOperandRGB[3]; /* SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */ |
GLenum CombineOperandA[3]; /* SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */ |
GLuint CombineScaleShiftRGB; /* 0, 1 or 2 */ |
GLuint CombineScaleShiftA; /* 0, 1 or 2 */ |
struct gl_texture_object *Current1D; |
struct gl_texture_object *Current2D; |
struct gl_texture_object *Current3D; |
struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */ |
struct gl_texture_object *CurrentRect; /* GL_NV_texture_rectangle */ |
struct gl_texture_object *_Current; /* Points to really enabled tex obj */ |
struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ |
struct gl_texture_object Saved2D; |
struct gl_texture_object Saved3D; |
struct gl_texture_object SavedCubeMap; |
struct gl_texture_object SavedRect; |
}; |
/* The texture attribute group */ |
struct gl_texture_attrib { |
/* multitexture */ |
GLuint CurrentUnit; /* Active texture unit */ |
GLuint _EnabledUnits; /* one bit set for each really-enabled unit */ |
GLuint _GenFlags; /* for texgen */ |
GLuint _TexGenEnabled; |
GLuint _TexMatEnabled; |
struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; |
struct gl_texture_object *Proxy1D; |
struct gl_texture_object *Proxy2D; |
struct gl_texture_object *Proxy3D; |
struct gl_texture_object *ProxyCubeMap; |
struct gl_texture_object *ProxyRect; |
/* GL_EXT_shared_texture_palette */ |
GLboolean SharedPalette; |
struct gl_color_table Palette; |
}; |
struct gl_transform_attrib { |
GLenum MatrixMode; /* Matrix mode */ |
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; |
GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */ |
GLuint ClipPlanesEnabled; /* on/off bitmask */ |
GLboolean Normalize; /* Normalize all normals? */ |
GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ |
GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ |
}; |
struct gl_viewport_attrib { |
GLint X, Y; /* position */ |
GLsizei Width, Height; /* size */ |
GLfloat Near, Far; /* Depth buffer range */ |
GLmatrix _WindowMap; /* Mapping transformation as a matrix. */ |
}; |
/* For the attribute stack: */ |
struct gl_attrib_node { |
GLbitfield kind; |
void *data; |
struct gl_attrib_node *next; |
}; |
/* |
* Client pixel packing/unpacking attributes |
*/ |
struct gl_pixelstore_attrib { |
GLint Alignment; |
GLint RowLength; |
GLint SkipPixels; |
GLint SkipRows; |
GLint ImageHeight; /* for GL_EXT_texture3D */ |
GLint SkipImages; /* for GL_EXT_texture3D */ |
GLboolean SwapBytes; |
GLboolean LsbFirst; |
GLboolean ClientStorage; /* GL_APPLE_client_storage */ |
GLboolean Invert; /* GL_MESA_pack_invert */ |
}; |
#define CA_CLIENT_DATA 0x1 /* Data not alloced by mesa */ |
/* |
* Client vertex array attributes |
*/ |
struct gl_client_array { |
GLint Size; |
GLenum Type; |
GLsizei Stride; /* user-specified stride */ |
GLsizei StrideB; /* actual stride in bytes */ |
void *Ptr; |
GLuint Flags; |
GLuint Enabled; /* one of the _NEW_ARRAY_ bits */ |
}; |
struct gl_array_attrib { |
struct gl_client_array Vertex; /* client data descriptors */ |
struct gl_client_array Normal; |
struct gl_client_array Color; |
struct gl_client_array SecondaryColor; |
struct gl_client_array FogCoord; |
struct gl_client_array Index; |
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; |
struct gl_client_array EdgeFlag; |
struct gl_client_array VertexAttrib[16]; /* GL_NV_vertex_program */ |
GLint TexCoordInterleaveFactor; |
GLint ActiveTexture; /* Client Active Texture */ |
GLuint LockFirst; |
GLuint LockCount; |
GLuint _Enabled; /* _NEW_ARRAY_* - bit set if array enabled */ |
GLuint NewState; /* _NEW_ARRAY_* */ |
}; |
struct gl_feedback { |
GLenum Type; |
GLuint _Mask; /* FB_* bits */ |
GLfloat *Buffer; |
GLuint BufferSize; |
GLuint Count; |
}; |
struct gl_selection { |
GLuint *Buffer; |
GLuint BufferSize; /* size of SelectBuffer */ |
GLuint BufferCount; /* number of values in SelectBuffer */ |
GLuint Hits; /* number of records in SelectBuffer */ |
GLuint NameStackDepth; |
GLuint NameStack[MAX_NAME_STACK_DEPTH]; |
GLboolean HitFlag; |
GLfloat HitMinZ, HitMaxZ; |
}; |
/* |
* 1-D Evaluator control points |
*/ |
struct gl_1d_map { |
GLuint Order; /* Number of control points */ |
GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ |
GLfloat *Points; /* Points to contiguous control points */ |
}; |
/* |
* 2-D Evaluator control points |
*/ |
struct gl_2d_map { |
GLuint Uorder; /* Number of control points in U dimension */ |
GLuint Vorder; /* Number of control points in V dimension */ |
GLfloat u1, u2, du; |
GLfloat v1, v2, dv; |
GLfloat *Points; /* Points to contiguous control points */ |
}; |
/* |
* All evalutator control points |
*/ |
struct gl_evaluators { |
/* 1-D maps */ |
struct gl_1d_map Map1Vertex3; |
struct gl_1d_map Map1Vertex4; |
struct gl_1d_map Map1Index; |
struct gl_1d_map Map1Color4; |
struct gl_1d_map Map1Normal; |
struct gl_1d_map Map1Texture1; |
struct gl_1d_map Map1Texture2; |
struct gl_1d_map Map1Texture3; |
struct gl_1d_map Map1Texture4; |
struct gl_1d_map Map1Attrib[16]; /* GL_NV_vertex_program */ |
/* 2-D maps */ |
struct gl_2d_map Map2Vertex3; |
struct gl_2d_map Map2Vertex4; |
struct gl_2d_map Map2Index; |
struct gl_2d_map Map2Color4; |
struct gl_2d_map Map2Normal; |
struct gl_2d_map Map2Texture1; |
struct gl_2d_map Map2Texture2; |
struct gl_2d_map Map2Texture3; |
struct gl_2d_map Map2Texture4; |
struct gl_2d_map Map2Attrib[16]; /* GL_NV_vertex_program */ |
}; |
/* |
* Vertex program tokens and datatypes |
*/ |
#define VP_MAX_INSTRUCTIONS 128 |
#define VP_NUM_INPUT_REGS VERT_ATTRIB_MAX |
#define VP_NUM_OUTPUT_REGS 15 |
#define VP_NUM_TEMP_REGS 12 |
#define VP_NUM_PROG_REGS 96 |
#define VP_NUM_TOTAL_REGISTERS (VP_NUM_INPUT_REGS + VP_NUM_OUTPUT_REGS + VP_NUM_TEMP_REGS + VP_NUM_PROG_REGS) |
/* Location of register sets within the whole register file */ |
#define VP_INPUT_REG_START 0 |
#define VP_INPUT_REG_END (VP_INPUT_REG_START + VP_NUM_INPUT_REGS - 1) |
#define VP_OUTPUT_REG_START (VP_INPUT_REG_END + 1) |
#define VP_OUTPUT_REG_END (VP_OUTPUT_REG_START + VP_NUM_OUTPUT_REGS - 1) |
#define VP_TEMP_REG_START (VP_OUTPUT_REG_END + 1) |
#define VP_TEMP_REG_END (VP_TEMP_REG_START + VP_NUM_TEMP_REGS - 1) |
#define VP_PROG_REG_START (VP_TEMP_REG_END + 1) |
#define VP_PROG_REG_END (VP_PROG_REG_START + VP_NUM_PROG_REGS - 1) |
/* Machine state (i.e. the register file) */ |
struct vp_machine |
{ |
GLfloat Registers[VP_NUM_TOTAL_REGISTERS][4]; |
GLint AddressReg; /* might someday be a 4-vector */ |
}; |
/* Vertex program opcodes */ |
enum vp_opcode |
{ |
MOV, |
LIT, |
RCP, |
RSQ, |
EXP, |
LOG, |
MUL, |
ADD, |
DP3, |
DP4, |
DST, |
MIN, |
MAX, |
SLT, |
SGE, |
MAD, |
ARL, |
DPH, |
RCC, |
SUB, |
ABS, |
END |
}; |
/* Instruction source register */ |
struct vp_src_register |
{ |
GLint Register; /* or the offset from the address register */ |
GLuint Swizzle[4]; |
GLboolean Negate; |
GLboolean RelAddr; |
}; |
/* Instruction destination register */ |
struct vp_dst_register |
{ |
GLint Register; |
GLboolean WriteMask[4]; |
}; |
/* Vertex program instruction */ |
struct vp_instruction |
{ |
enum vp_opcode Opcode; |
struct vp_src_register SrcReg[3]; |
struct vp_dst_register DstReg; |
}; |
/* The actual vertex program, stored in the hash table */ |
struct vp_program |
{ |
GLubyte *String; /* Original user code */ |
struct vp_instruction *Instructions; /* Compiled instructions */ |
GLenum Target; /* GL_VERTEX_PROGRAM_NV or GL_VERTEX_STATE_PROGRAM_NV */ |
GLint RefCount; /* Since programs can be shared among contexts */ |
GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ |
GLboolean Resident; |
GLuint InputsRead; /* Bitmask of which input regs are read */ |
GLuint OutputsWritten; /* Bitmask of which output regs are written to */ |
}; |
/* |
* State vars for GL_NV_vertex_program |
*/ |
struct vertex_program_state |
{ |
GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ |
GLboolean PointSizeEnabled; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ |
GLboolean TwoSideEnabled; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ |
GLuint CurrentID; /* currently bound program's ID */ |
GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_NV */ |
struct vp_program *Current; /* ptr to currently bound program */ |
struct vp_machine Machine; /* machine state */ |
GLenum TrackMatrix[VP_NUM_PROG_REGS / 4]; |
GLenum TrackMatrixTransform[VP_NUM_PROG_REGS / 4]; |
}; |
/* |
* State which can be shared by multiple contexts: |
*/ |
struct gl_shared_state { |
_glthread_Mutex Mutex; /* for thread safety */ |
GLint RefCount; /* Reference count */ |
struct _mesa_HashTable *DisplayList; /* Display lists hash table */ |
struct _mesa_HashTable *TexObjects; /* Texture objects hash table */ |
struct gl_texture_object *TexObjectList;/* Linked list of texture objects */ |
/* Default texture objects (shared by all multi-texture units) */ |
struct gl_texture_object *Default1D; |
struct gl_texture_object *Default2D; |
struct gl_texture_object *Default3D; |
struct gl_texture_object *DefaultCubeMap; |
struct gl_texture_object *DefaultRect; |
/* GL_NV_vertex_program */ |
struct _mesa_HashTable *VertexPrograms; |
void *DriverData; /* Device driver shared state */ |
}; |
/* |
* A "frame buffer" is a color buffer and its optional ancillary buffers: |
* depth, accum, stencil, and software-simulated alpha buffers. |
* In C++ terms, think of this as a base class from which device drivers |
* will make derived classes. |
*/ |
struct gl_frame_buffer { |
GLvisual Visual; /* The corresponding visual */ |
GLuint Width, Height; /* size of frame buffer in pixels */ |
GLboolean UseSoftwareDepthBuffer; |
GLboolean UseSoftwareAccumBuffer; |
GLboolean UseSoftwareStencilBuffer; |
GLboolean UseSoftwareAlphaBuffers; |
/* Software depth (aka Z) buffer */ |
GLvoid *DepthBuffer; /* array [Width*Height] of GLushort or GLuint*/ |
/* Software stencil buffer */ |
GLstencil *Stencil; /* array [Width*Height] of GLstencil values */ |
/* Software accumulation buffer */ |
GLaccum *Accum; /* array [4*Width*Height] of GLaccum values */ |
/* Software alpha planes */ |
GLvoid *FrontLeftAlpha; /* array [Width*Height] of GLubyte */ |
GLvoid *BackLeftAlpha; /* array [Width*Height] of GLubyte */ |
GLvoid *FrontRightAlpha; /* array [Width*Height] of GLubyte */ |
GLvoid *BackRightAlpha; /* array [Width*Height] of GLubyte */ |
/* Drawing bounds: intersection of window size and scissor box */ |
GLint _Xmin, _Ymin; /* inclusive */ |
GLint _Xmax, _Ymax; /* exclusive */ |
}; |
/* |
* Constants which may be overriden by device driver during context creation |
* but are never changed after that. |
*/ |
struct gl_constants { |
GLint MaxTextureLevels; |
GLint Max3DTextureLevels; |
GLint MaxCubeTextureLevels; /* GL_ARB_texture_cube_map */ |
GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ |
GLuint MaxTextureUnits; |
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ |
GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */ |
GLuint MaxArrayLockSize; |
GLint SubPixelBits; |
GLfloat MinPointSize, MaxPointSize; /* aliased */ |
GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */ |
GLfloat PointSizeGranularity; |
GLfloat MinLineWidth, MaxLineWidth; /* aliased */ |
GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ |
GLfloat LineWidthGranularity; |
GLuint NumAuxBuffers; |
GLuint MaxColorTableSize; |
GLuint MaxConvolutionWidth; |
GLuint MaxConvolutionHeight; |
GLuint MaxClipPlanes; |
GLuint MaxLights; |
}; |
/* |
* List of extensions. |
*/ |
struct extension; |
struct gl_extensions { |
char *ext_string; |
struct extension *ext_list; |
/* Flags to quickly test if certain extensions are available. |
* Not every extension needs to have such a flag, but it's encouraged. |
*/ |
GLboolean ARB_depth_texture; |
GLboolean ARB_imaging; |
GLboolean ARB_multisample; |
GLboolean ARB_multitexture; |
GLboolean ARB_shadow; |
GLboolean ARB_texture_border_clamp; |
GLboolean ARB_texture_compression; |
GLboolean ARB_texture_cube_map; |
GLboolean ARB_texture_env_combine; |
GLboolean ARB_texture_env_crossbar; |
GLboolean ARB_texture_env_dot3; |
GLboolean ARB_texture_mirrored_repeat; |
GLboolean ARB_window_pos; |
GLboolean ATI_texture_mirror_once; |
GLboolean EXT_blend_color; |
GLboolean EXT_blend_func_separate; |
GLboolean EXT_blend_logic_op; |
GLboolean EXT_blend_minmax; |
GLboolean EXT_blend_subtract; |
GLboolean EXT_clip_volume_hint; |
GLboolean EXT_convolution; |
GLboolean EXT_compiled_vertex_array; |
GLboolean EXT_fog_coord; |
GLboolean EXT_histogram; |
GLboolean EXT_multi_draw_arrays; |
GLboolean EXT_packed_pixels; |
GLboolean EXT_paletted_texture; |
GLboolean EXT_point_parameters; |
GLboolean EXT_polygon_offset; |
GLboolean EXT_rescale_normal; |
GLboolean EXT_shadow_funcs; |
GLboolean EXT_secondary_color; |
GLboolean EXT_shared_texture_palette; |
GLboolean EXT_stencil_wrap; |
GLboolean EXT_stencil_two_side; |
GLboolean EXT_texture3D; |
GLboolean EXT_texture_compression_s3tc; |
GLboolean EXT_texture_env_add; |
GLboolean EXT_texture_env_combine; |
GLboolean EXT_texture_env_dot3; |
GLboolean EXT_texture_filter_anisotropic; |
GLboolean EXT_texture_object; |
GLboolean EXT_texture_lod_bias; |
GLboolean EXT_vertex_array_set; |
GLboolean HP_occlusion_test; |
GLboolean IBM_rasterpos_clip; |
GLboolean INGR_blend_func_separate; |
GLboolean MESA_pack_invert; |
GLboolean MESA_window_pos; |
GLboolean MESA_resize_buffers; |
GLboolean MESA_ycbcr_texture; |
GLboolean NV_blend_square; |
GLboolean NV_point_sprite; |
GLboolean NV_texture_rectangle; |
GLboolean NV_texgen_reflection; |
GLboolean NV_vertex_program; |
GLboolean NV_vertex_program1_1; |
GLboolean SGI_color_matrix; |
GLboolean SGI_color_table; |
GLboolean SGIS_generate_mipmap; |
GLboolean SGIS_pixel_texture; |
GLboolean SGIS_texture_edge_clamp; |
GLboolean SGIX_depth_texture; |
GLboolean SGIX_pixel_texture; |
GLboolean SGIX_shadow; |
GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ |
GLboolean TDFX_texture_compression_FXT1; |
GLboolean APPLE_client_storage; |
}; |
/* |
* A stack of matrices (projection, modelview, color, texture, etc). |
*/ |
struct matrix_stack |
{ |
GLmatrix *Top; /* points into Stack */ |
GLmatrix *Stack; /* array [MaxDepth] of GLmatrix */ |
GLuint Depth; /* 0 <= Depth < MaxDepth */ |
GLuint MaxDepth; /* size of Stack[] array */ |
GLuint DirtyFlag; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */ |
}; |
/* |
* Bits for image transfer operations (ctx->ImageTransferState). |
*/ |
#define IMAGE_SCALE_BIAS_BIT 0x1 |
#define IMAGE_SHIFT_OFFSET_BIT 0x2 |
#define IMAGE_MAP_COLOR_BIT 0x4 |
#define IMAGE_COLOR_TABLE_BIT 0x8 |
#define IMAGE_CONVOLUTION_BIT 0x10 |
#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 |
#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40 |
#define IMAGE_COLOR_MATRIX_BIT 0x80 |
#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 |
#define IMAGE_HISTOGRAM_BIT 0x200 |
#define IMAGE_MIN_MAX_BIT 0x400 |
/* transfer ops up to convolution: */ |
#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \ |
IMAGE_SHIFT_OFFSET_BIT | \ |
IMAGE_MAP_COLOR_BIT | \ |
IMAGE_COLOR_TABLE_BIT) |
/* transfer ops after convolution: */ |
#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ |
IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \ |
IMAGE_COLOR_MATRIX_BIT | \ |
IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\ |
IMAGE_HISTOGRAM_BIT | \ |
IMAGE_MIN_MAX_BIT) |
/* |
* Bits to indicate what state has changed. 6 unused flags. |
*/ |
#define _NEW_MODELVIEW 0x1 /* ctx->ModelView */ |
#define _NEW_PROJECTION 0x2 /* ctx->Projection */ |
#define _NEW_TEXTURE_MATRIX 0x4 /* ctx->TextureMatrix */ |
#define _NEW_COLOR_MATRIX 0x8 /* ctx->ColorMatrix */ |
#define _NEW_ACCUM 0x10 /* ctx->Accum */ |
#define _NEW_COLOR 0x20 /* ctx->Color */ |
#define _NEW_DEPTH 0x40 /* ctx->Depth */ |
#define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */ |
#define _NEW_FOG 0x100 /* ctx->Fog */ |
#define _NEW_HINT 0x200 /* ctx->Hint */ |
#define _NEW_LIGHT 0x400 /* ctx->Light */ |
#define _NEW_LINE 0x800 /* ctx->Line */ |
#define _NEW_PIXEL 0x1000 /* ctx->Pixel */ |
#define _NEW_POINT 0x2000 /* ctx->Point */ |
#define _NEW_POLYGON 0x4000 /* ctx->Polygon */ |
#define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */ |
#define _NEW_SCISSOR 0x10000 /* ctx->Scissor */ |
#define _NEW_STENCIL 0x20000 /* ctx->Stencil */ |
#define _NEW_TEXTURE 0x40000 /* ctx->Texture */ |
#define _NEW_TRANSFORM 0x80000 /* ctx->Transform */ |
#define _NEW_VIEWPORT 0x100000 /* ctx->Viewport */ |
#define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */ |
#define _NEW_ARRAY 0x400000 /* ctx->Array */ |
#define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */ |
#define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */ |
#define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */ |
#define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */ |
#define _NEW_PROGRAM 0x8000000 /* ctx->VertexProgram */ |
#define _NEW_ALL ~0 |
/* Bits to track array state changes (also used to summarize array enabled) |
*/ |
#define _NEW_ARRAY_VERTEX VERT_BIT_POS |
#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT |
#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL |
#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0 |
#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1 |
#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG |
#define _NEW_ARRAY_INDEX VERT_BIT_SIX |
#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN |
#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 |
#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 |
#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2 |
#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3 |
#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4 |
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5 |
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6 |
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7 |
#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */ |
#define _NEW_ARRAY_ALL 0xffffffff |
#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i)) |
#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i)) |
/* A bunch of flags that we think might be useful to drivers. |
* Set in the ctx->_TriangleCaps bitfield. |
*/ |
#define DD_FLATSHADE 0x1 |
#define DD_SEPARATE_SPECULAR 0x2 |
#define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */ |
#define DD_TRI_LIGHT_TWOSIDE 0x8 |
#define DD_TRI_UNFILLED 0x10 |
#define DD_TRI_SMOOTH 0x20 |
#define DD_TRI_STIPPLE 0x40 |
#define DD_TRI_OFFSET 0x80 |
#define DD_LINE_SMOOTH 0x100 |
#define DD_LINE_STIPPLE 0x200 |
#define DD_LINE_WIDTH 0x400 |
#define DD_POINT_SMOOTH 0x800 |
#define DD_POINT_SIZE 0x1000 |
#define DD_POINT_ATTEN 0x2000 |
/* Define the state changes under which each of these bits might change |
*/ |
#define _DD_NEW_FLATSHADE _NEW_LIGHT |
#define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG) |
#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON |
#define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT |
#define _DD_NEW_TRI_UNFILLED _NEW_POLYGON |
#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON |
#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON |
#define _DD_NEW_TRI_OFFSET _NEW_POLYGON |
#define _DD_NEW_LINE_SMOOTH _NEW_LINE |
#define _DD_NEW_LINE_STIPPLE _NEW_LINE |
#define _DD_NEW_LINE_WIDTH _NEW_LINE |
#define _DD_NEW_POINT_SMOOTH _NEW_POINT |
#define _DD_NEW_POINT_SIZE _NEW_POINT |
#define _DD_NEW_POINT_ATTEN _NEW_POINT |
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \ |
_NEW_TEXTURE | \ |
_NEW_POINT | \ |
_NEW_MODELVIEW) |
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \ |
_NEW_TEXTURE) |
#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX) |
/* Bits for ctx->_NeedNormals */ |
#define NEED_NORMALS_TEXGEN 0x1 |
#define NEED_NORMALS_LIGHT 0x2 |
/* Bits for ctx->_NeedEyeCoords */ |
#define NEED_EYE_TEXGEN 0x1 |
#define NEED_EYE_LIGHT 0x2 |
#define NEED_EYE_LIGHT_MODELVIEW 0x4 |
#define NEED_EYE_POINT_ATTEN 0x8 |
#define NEED_EYE_DRIVER 0x10 |
/* |
* Forward declaration of display list datatypes: |
*/ |
union node; |
typedef union node Node; |
/* This has to be included here. */ |
#include "dd.h" |
/* |
* Core Mesa's support for tnl modules: |
*/ |
#define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *)) |
struct gl_tnl_module { |
/* Vertex format to be lazily swapped into current dispatch. |
*/ |
GLvertexformat *Current; |
/* Record of functions swapped out. On restore, only need to swap |
* these functions back in. |
*/ |
void *Swapped[NUM_VERTEX_FORMAT_ENTRIES][2]; |
GLuint SwapCount; |
}; |
/** |
* This is the central context data structure for Mesa. Almost all |
* OpenGL state is contained in this structure. |
* Think of this as a base class from which device drivers will derive |
* sub classes. |
*/ |
struct __GLcontextRec { |
/** |
* OS related interfaces; these *must* be the first members of this |
* structure, because they are exposed to the outside world (i.e. GLX |
* extension). |
*/ |
__GLimports imports; |
__GLexports exports; |
/* State possibly shared with other contexts in the address space */ |
struct gl_shared_state *Shared; |
/* API function pointer tables */ |
struct _glapi_table *Save; /**< Display list save funcs */ |
struct _glapi_table *Exec; /**< Execute funcs */ |
struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ |
GLboolean ExecPrefersFloat; /**< What preference for color conversion? */ |
GLboolean SavePrefersFloat; |
GLvisual Visual; |
GLframebuffer *DrawBuffer; /**< buffer for writing */ |
GLframebuffer *ReadBuffer; /**< buffer for reading */ |
/** |
* Device driver function pointer table |
*/ |
struct dd_function_table Driver; |
void *DriverCtx; /**< Points to device driver context/state */ |
void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ |
/* Core/Driver constants */ |
struct gl_constants Const; |
/* The various 4x4 matrix stacks */ |
struct matrix_stack ModelviewMatrixStack; |
struct matrix_stack ProjectionMatrixStack; |
struct matrix_stack ColorMatrixStack; |
struct matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS]; |
struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; |
struct matrix_stack *CurrentStack; /* Points to one of the above stacks */ |
/* Combined modelview and projection matrix */ |
GLmatrix _ModelProjectMatrix; |
/* Display lists */ |
GLuint CallDepth; /* Current recursion calling depth */ |
GLboolean ExecuteFlag; /* Execute GL commands? */ |
GLboolean CompileFlag; /* Compile GL commands into display list? */ |
Node *CurrentListPtr; /* Head of list being compiled */ |
GLuint CurrentListNum; /* Number of the list being compiled */ |
Node *CurrentBlock; /* Pointer to current block of nodes */ |
GLuint CurrentPos; /* Index into current block of nodes */ |
/* Extensions */ |
struct gl_extensions Extensions; |
/* Renderer attribute stack */ |
GLuint AttribStackDepth; |
struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; |
/* Renderer attribute groups */ |
struct gl_accum_attrib Accum; |
struct gl_colorbuffer_attrib Color; |
struct gl_current_attrib Current; |
struct gl_depthbuffer_attrib Depth; |
struct gl_eval_attrib Eval; |
struct gl_fog_attrib Fog; |
struct gl_hint_attrib Hint; |
struct gl_light_attrib Light; |
struct gl_line_attrib Line; |
struct gl_list_attrib List; |
struct gl_multisample_attrib Multisample; |
struct gl_pixel_attrib Pixel; |
struct gl_point_attrib Point; |
struct gl_polygon_attrib Polygon; |
GLuint PolygonStipple[32]; |
struct gl_scissor_attrib Scissor; |
struct gl_stencil_attrib Stencil; |
struct gl_texture_attrib Texture; |
struct gl_transform_attrib Transform; |
struct gl_viewport_attrib Viewport; |
/* Other attribute groups */ |
struct gl_histogram_attrib Histogram; |
struct gl_minmax_attrib MinMax; |
struct gl_convolution_attrib Convolution1D; |
struct gl_convolution_attrib Convolution2D; |
struct gl_convolution_attrib Separable2D; |
/* Client attribute stack */ |
GLuint ClientAttribStackDepth; |
struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; |
/* Client attribute groups */ |
struct gl_array_attrib Array; /* Vertex arrays */ |
struct gl_pixelstore_attrib Pack; /* Pixel packing */ |
struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */ |
struct gl_evaluators EvalMap; /* All evaluators */ |
struct gl_feedback Feedback; /* Feedback */ |
struct gl_selection Select; /* Selection */ |
struct gl_color_table ColorTable; /* Pre-convolution */ |
struct gl_color_table ProxyColorTable; /* Pre-convolution */ |
struct gl_color_table PostConvolutionColorTable; |
struct gl_color_table ProxyPostConvolutionColorTable; |
struct gl_color_table PostColorMatrixColorTable; |
struct gl_color_table ProxyPostColorMatrixColorTable; |
struct vertex_program_state VertexProgram; /* GL_NV_vertex_program */ |
GLenum ErrorValue; /* Last error code */ |
GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ |
GLuint NewState; /* bitwise-or of _NEW_* flags */ |
/* Derived */ |
GLuint _TriangleCaps; /* bitwise-or of DD_* flags */ |
GLuint _ImageTransferState;/* bitwise-or of IMAGE_*_BIT flags */ |
GLfloat _EyeZDir[3]; |
GLfloat _ModelViewInvScale; |
GLuint _NeedEyeCoords; |
GLuint _NeedNormals; /* Are vertex normal vectors needed? */ |
struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */ |
struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */ |
struct gl_list_extensions listext; /* driver dlist extensions */ |
GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */ |
GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */ |
GLuint _Facing; /* This is a hack for 2-sided stencil test. We don't */ |
/* have a better way to communicate this value from */ |
/* swrast_setup to swrast. */ |
/* Z buffer stuff */ |
GLuint DepthMax; /**< Max depth buffer value */ |
GLfloat DepthMaxF; /**< Float max depth buffer value */ |
GLfloat MRD; /**< minimum resolvable difference in Z values */ |
/** Should 3Dfx Glide driver catch signals? */ |
GLboolean CatchSignals; |
/** For debugging/development only */ |
GLboolean NoRaster; |
GLboolean FirstTimeCurrent; |
/** Dither disable via MESA_NO_DITHER env var */ |
GLboolean NoDither; |
GLboolean Rendering; |
#if defined(MESA_TRACE) |
struct _glapi_table *TraceDispatch; |
trace_context_t *TraceCtx; |
#else |
void *TraceDispatch; |
void *TraceCtx; |
#endif |
/* Core tnl module support */ |
struct gl_tnl_module TnlModule; |
/* Hooks for module contexts. These will eventually live |
* in the driver or elsewhere. |
*/ |
void *swrast_context; |
void *swsetup_context; |
void *swtnl_context; |
void *swtnl_im; |
void *acache_context; |
void *aelt_context; |
}; |
/* The string names for GL_POINT, GL_LINE_LOOP, etc */ |
extern const char *_mesa_prim_name[GL_POLYGON+4]; |
#ifndef MESA_DEBUG |
#define MESA_DEBUG |
#endif |
#ifdef MESA_DEBUG |
extern int MESA_VERBOSE; |
extern int MESA_DEBUG_FLAGS; |
#else |
# define MESA_VERBOSE 0 |
# define MESA_DEBUG_FLAGS 0 |
# ifndef NDEBUG |
# define NDEBUG |
# endif |
#endif |
enum _verbose { |
VERBOSE_VARRAY = 0x0001, |
VERBOSE_TEXTURE = 0x0002, |
VERBOSE_IMMEDIATE = 0x0004, |
VERBOSE_PIPELINE = 0x0008, |
VERBOSE_DRIVER = 0x0010, |
VERBOSE_STATE = 0x0020, |
VERBOSE_API = 0x0040, |
VERBOSE_DISPLAY_LIST = 0x0100, |
VERBOSE_LIGHTING = 0x0200, |
VERBOSE_PRIMS = 0x0400, |
VERBOSE_VERTS = 0x0800 |
}; |
enum _debug { |
DEBUG_ALWAYS_FLUSH = 0x1 |
}; |
#define Elements(x) sizeof(x)/sizeof(*(x)) |
/* Eventually let the driver specify what statechanges require a flush: |
*/ |
#define FLUSH_VERTICES(ctx, newstate) \ |
do { \ |
if (MESA_VERBOSE & VERBOSE_STATE) \ |
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ |
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ |
ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ |
ctx->NewState |= newstate; \ |
} while (0) |
#define FLUSH_CURRENT(ctx, newstate) \ |
do { \ |
if (MESA_VERBOSE & VERBOSE_STATE) \ |
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ |
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ |
ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ |
ctx->NewState |= newstate; \ |
} while (0) |
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \ |
do { \ |
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ |
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ |
return retval; \ |
} \ |
} while (0) |
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \ |
do { \ |
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ |
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ |
return; \ |
} \ |
} while (0) |
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \ |
do { \ |
ASSERT_OUTSIDE_BEGIN_END(ctx); \ |
FLUSH_VERTICES(ctx, 0); \ |
} while (0) |
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \ |
do { \ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \ |
FLUSH_VERTICES(ctx, 0); \ |
} while (0) |
#endif /* TYPES_H */ |
/shark/tags/rel_0_4/ports/mesa/src/makefile |
---|
0,0 → 1,50 |
# The Frame Buffer Device |
ifndef BASE |
BASE=../../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = osmesa |
OBJS_PATH = $(BASE)/drivers/mesa/src/ |
OSMESA = accum.o api_arrayelt.o api_eval.o api_loopback.o api_noop.o api_validate.o\ |
attrib.o blend.o buffers.o clip.o colortab.o context.o convolve.o\ |
debug.o depth.o dispatch.o dlist.o drawpix.o enable.o enums.o eval.o\ |
extensions.o feedback.o fog.o get.o glapi.o glthread.o hash.o hint.o\ |
histogram.o image.o light.o lines.o matrix.o mmath.o pixel.o\ |
points.o polygon.o rastpos.o state.o stencil.o texcompress.o texformat.o\ |
teximage.o texobj.o texstate.o texstore.o texutil.o varray.o vpexec.o\ |
vpparse.o vpstate.o vtxfmt.o ./array_cache/ac_context.o\ |
./array_cache/ac_import.o ./swrast/s_aaline.o ./swrast/s_aatriangle.o\ |
./swrast/s_accum.o ./swrast/s_alphabuf.o ./swrast/s_alpha.o ./swrast/s_bitmap.o\ |
./swrast/s_blend.o ./swrast/s_buffers.o ./swrast/s_context.o ./swrast/s_copypix.o\ |
./swrast/s_depth.o ./swrast/s_drawpix.o ./swrast/s_feedback.o ./swrast/s_fog.o\ |
./swrast/s_histogram.o ./swrast/s_imaging.o ./swrast/s_lines.o ./swrast/s_logic.o\ |
./swrast/s_masking.o ./swrast/s_pixeltex.o ./swrast/s_points.o ./swrast/s_readpix.o\ |
./swrast/s_span.o ./swrast/s_stencil.o ./swrast/s_texstore.o ./swrast/s_texture.o\ |
./swrast/s_triangle.o ./swrast/s_zoom.o ./swrast_setup/ss_context.o\ |
./swrast_setup/ss_triangle.o ./swrast_setup/ss_vb.o ./tnl/t_array_api.o\ |
./tnl/t_array_import.o ./tnl/t_context.o ./tnl/t_eval_api.o ./tnl/t_imm_alloc.o\ |
./tnl/t_imm_api.o ./tnl/t_imm_debug.o ./tnl/t_imm_dlist.o ./tnl/t_imm_elt.o\ |
./tnl/t_imm_eval.o ./tnl/t_imm_exec.o ./tnl/t_imm_fixup.o ./tnl/t_pipeline.o\ |
./tnl/t_vb_fog.o ./tnl/t_vb_light.o\ |
./tnl/t_vb_normals.o ./tnl/t_vb_points.o ./tnl/t_vb_program.o ./tnl/t_vb_render.o\ |
./tnl/t_vb_texgen.o ./tnl/t_vb_texmat.o ./tnl/t_vb_vertex.o\ |
./math/m_debug_clip.o ./math/m_debug_norm.o\ |
./math/m_debug_xform.o ./math/m_eval.o ./math/m_matrix.o ./math/m_translate.o\ |
./math/m_vector.o ./math/m_xform.o\ |
./x86/common_x86_asm.o ./x86/common_x86.o ./x86/glapi_x86.o\ |
./x86/mmx_blend.o ./x86/x86.o ./x86/x86_cliptest.o ./x86/x86_xform2.o\ |
./x86/x86_xform3.o ./x86/x86_xform4.o ./osmesa/osmesa.o imports.o \ |
OBJS = $(OSMESA) |
C_OPT += -I../../../drivers/linuxc24/include -I../include -I. -I.. |
ASM_OPT += -I../../../drivers/linuxc24/include -I../include -I. -I.. |
include $(BASE)/config/lib.mk |
/shark/tags/rel_0_4/ports/mesa/src/osmesa/osmesa.c |
---|
0,0 → 1,2180 |
/* $Id: osmesa.c,v 1.2 2003-03-13 12:20:29 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Off-Screen Mesa rendering / Rendering into client memory space |
* |
* Note on thread safety: this driver is thread safe. All |
* functions are reentrant. The notion of current context is |
* managed by the core _mesa_make_current() and _mesa_get_current_context() |
* functions. Those functions are thread-safe. |
*/ |
#include "glheader.h" |
#include "GL/osmesa.h" |
#include "buffers.h" |
#include "context.h" |
#include "colormac.h" |
#include "depth.h" |
#include "extensions.h" |
#include "imports.h" |
#include "macros.h" |
#include "matrix.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "texformat.h" |
#include "texstore.h" |
#include "array_cache/acache.h" |
#include "swrast/swrast.h" |
#include "swrast_setup/swrast_setup.h" |
#include "swrast/s_context.h" |
#include "swrast/s_depth.h" |
#include "swrast/s_lines.h" |
#include "swrast/s_triangle.h" |
#include "tnl/tnl.h" |
#include "tnl/t_context.h" |
#include "tnl/t_pipeline.h" |
/* |
* This is the OS/Mesa context struct. |
* Notice how it includes a GLcontext. By doing this we're mimicking |
* C++ inheritance/derivation. |
* Later, we can cast a GLcontext pointer into an OSMesaContext pointer |
* or vice versa. |
*/ |
struct osmesa_context { |
GLcontext gl_ctx; /* The core GL/Mesa context */ |
GLvisual *gl_visual; /* Describes the buffers */ |
GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */ |
GLenum format; /* either GL_RGBA or GL_COLOR_INDEX */ |
void *buffer; /* the image buffer */ |
GLint width, height; /* size of image buffer */ |
GLint rowlength; /* number of pixels per row */ |
GLint userRowLength; /* user-specified number of pixels per row */ |
GLint rshift, gshift; /* bit shifts for RGBA formats */ |
GLint bshift, ashift; |
GLint rInd, gInd, bInd, aInd;/* index offsets for RGBA formats */ |
GLchan *rowaddr[MAX_HEIGHT]; /* address of first pixel in each image row */ |
GLboolean yup; /* TRUE -> Y increases upward */ |
/* FALSE -> Y increases downward */ |
}; |
/* A forward declaration: */ |
static void osmesa_update_state( GLcontext *ctx, GLuint newstate ); |
static void osmesa_register_swrast_functions( GLcontext *ctx ); |
#define OSMESA_CONTEXT(ctx) ((OSMesaContext) (ctx->DriverCtx)) |
/**********************************************************************/ |
/***** Public Functions *****/ |
/**********************************************************************/ |
/* |
* Create an Off-Screen Mesa rendering context. The only attribute needed is |
* an RGBA vs Color-Index mode flag. |
* |
* Input: format - either GL_RGBA or GL_COLOR_INDEX |
* sharelist - specifies another OSMesaContext with which to share |
* display lists. NULL indicates no sharing. |
* Return: an OSMesaContext or 0 if error |
*/ |
GLAPI OSMesaContext GLAPIENTRY |
OSMesaCreateContext( GLenum format, OSMesaContext sharelist ) |
{ |
return OSMesaCreateContextExt(format, DEFAULT_SOFTWARE_DEPTH_BITS, |
8, 16, sharelist); |
} |
/* |
* New in Mesa 3.5 |
* |
* Create context and specify size of ancillary buffers. |
*/ |
GLAPI OSMesaContext GLAPIENTRY |
OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, |
GLint accumBits, OSMesaContext sharelist ) |
{ |
OSMesaContext osmesa; |
GLint rshift, gshift, bshift, ashift; |
GLint rind, gind, bind, aind; |
GLint indexBits = 0, redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0; |
GLboolean rgbmode; |
const GLuint i4 = 1; |
const GLubyte *i1 = (GLubyte *) &i4; |
const GLint little_endian = *i1; |
rind = gind = bind = aind = 0; |
if (format==OSMESA_COLOR_INDEX) { |
indexBits = 8; |
rshift = gshift = bshift = ashift = 0; |
rgbmode = GL_FALSE; |
} |
else if (format==OSMESA_RGBA) { |
indexBits = 0; |
redBits = CHAN_BITS; |
greenBits = CHAN_BITS; |
blueBits = CHAN_BITS; |
alphaBits = CHAN_BITS; |
rind = 0; |
gind = 1; |
bind = 2; |
aind = 3; |
if (little_endian) { |
rshift = 0; |
gshift = 8; |
bshift = 16; |
ashift = 24; |
} |
else { |
rshift = 24; |
gshift = 16; |
bshift = 8; |
ashift = 0; |
} |
rgbmode = GL_TRUE; |
} |
else if (format==OSMESA_BGRA) { |
indexBits = 0; |
redBits = CHAN_BITS; |
greenBits = CHAN_BITS; |
blueBits = CHAN_BITS; |
alphaBits = CHAN_BITS; |
bind = 0; |
gind = 1; |
rind = 2; |
aind = 3; |
if (little_endian) { |
bshift = 0; |
gshift = 8; |
rshift = 16; |
ashift = 24; |
} |
else { |
bshift = 24; |
gshift = 16; |
rshift = 8; |
ashift = 0; |
} |
rgbmode = GL_TRUE; |
} |
else if (format==OSMESA_ARGB) { |
indexBits = 0; |
redBits = CHAN_BITS; |
greenBits = CHAN_BITS; |
blueBits = CHAN_BITS; |
alphaBits = CHAN_BITS; |
aind = 0; |
rind = 1; |
gind = 2; |
bind = 3; |
if (little_endian) { |
ashift = 0; |
rshift = 8; |
gshift = 16; |
bshift = 24; |
} |
else { |
ashift = 24; |
rshift = 16; |
gshift = 8; |
bshift = 0; |
} |
rgbmode = GL_TRUE; |
} |
else if (format==OSMESA_RGB) { |
indexBits = 0; |
redBits = CHAN_BITS; |
greenBits = CHAN_BITS; |
blueBits = CHAN_BITS; |
alphaBits = 0; |
bshift = 0; |
gshift = 8; |
rshift = 16; |
ashift = 24; |
rind = 0; |
gind = 1; |
bind = 2; |
rgbmode = GL_TRUE; |
} |
else if (format==OSMESA_BGR) { |
indexBits = 0; |
redBits = CHAN_BITS; |
greenBits = CHAN_BITS; |
blueBits = CHAN_BITS; |
alphaBits = 0; |
bshift = 0; |
gshift = 8; |
rshift = 16; |
ashift = 24; |
rind = 2; |
gind = 1; |
bind = 0; |
rgbmode = GL_TRUE; |
} |
else if (format==OSMESA_RGB_565) { |
indexBits = 0; |
redBits = 5; |
greenBits = 6; |
blueBits = 5; |
alphaBits = 0; |
rshift = 11; |
gshift = 5; |
bshift = 0; |
ashift = 0; |
rind = 0; /* not used */ |
gind = 0; |
bind = 0; |
rgbmode = GL_TRUE; |
} |
else { |
return NULL; |
} |
osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context); |
if (osmesa) { |
osmesa->gl_visual = _mesa_create_visual( rgbmode, |
GL_FALSE, /* double buffer */ |
GL_FALSE, /* stereo */ |
redBits, |
greenBits, |
blueBits, |
alphaBits, |
indexBits, |
depthBits, |
stencilBits, |
accumBits, |
accumBits, |
accumBits, |
alphaBits ? accumBits : 0, |
1 /* num samples */ |
); |
if (!osmesa->gl_visual) { |
FREE(osmesa); |
return NULL; |
} |
if (!_mesa_initialize_context(&osmesa->gl_ctx, |
osmesa->gl_visual, |
sharelist ? &sharelist->gl_ctx |
: (GLcontext *) NULL, |
(void *) osmesa, |
GL_FALSE)) { |
_mesa_destroy_visual( osmesa->gl_visual ); |
FREE(osmesa); |
return NULL; |
} |
_mesa_enable_sw_extensions(&(osmesa->gl_ctx)); |
_mesa_enable_1_3_extensions(&(osmesa->gl_ctx)); |
_mesa_enable_1_4_extensions(&(osmesa->gl_ctx)); |
osmesa->gl_buffer = _mesa_create_framebuffer( osmesa->gl_visual, |
(GLboolean) ( osmesa->gl_visual->depthBits > 0 ), |
(GLboolean) ( osmesa->gl_visual->stencilBits > 0 ), |
(GLboolean) ( osmesa->gl_visual->accumRedBits > 0 ), |
GL_FALSE /* s/w alpha */ ); |
if (!osmesa->gl_buffer) { |
_mesa_destroy_visual( osmesa->gl_visual ); |
_mesa_free_context_data( &osmesa->gl_ctx ); |
FREE(osmesa); |
return NULL; |
} |
osmesa->format = format; |
osmesa->buffer = NULL; |
osmesa->width = 0; |
osmesa->height = 0; |
osmesa->userRowLength = 0; |
osmesa->rowlength = 0; |
osmesa->yup = GL_TRUE; |
osmesa->rshift = rshift; |
osmesa->gshift = gshift; |
osmesa->bshift = bshift; |
osmesa->ashift = ashift; |
osmesa->rInd = rind; |
osmesa->gInd = gind; |
osmesa->bInd = bind; |
osmesa->aInd = aind; |
/* Initialize the software rasterizer and helper modules. |
*/ |
{ |
GLcontext *ctx = &osmesa->gl_ctx; |
_swrast_CreateContext( ctx ); |
_ac_CreateContext( ctx ); |
_tnl_CreateContext( ctx ); |
_swsetup_CreateContext( ctx ); |
_swsetup_Wakeup( ctx ); |
osmesa_register_swrast_functions( ctx ); |
} |
} |
return osmesa; |
} |
/* |
* Destroy an Off-Screen Mesa rendering context. |
* |
* Input: ctx - the context to destroy |
*/ |
GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) |
{ |
if (ctx) { |
_swsetup_DestroyContext( &ctx->gl_ctx ); |
_tnl_DestroyContext( &ctx->gl_ctx ); |
_ac_DestroyContext( &ctx->gl_ctx ); |
_swrast_DestroyContext( &ctx->gl_ctx ); |
_mesa_destroy_visual( ctx->gl_visual ); |
_mesa_destroy_framebuffer( ctx->gl_buffer ); |
_mesa_free_context_data( &ctx->gl_ctx ); |
FREE( ctx ); |
} |
} |
/* |
* Recompute the values of the context's rowaddr array. |
*/ |
static void compute_row_addresses( OSMesaContext ctx ) |
{ |
GLint bytesPerPixel, bytesPerRow, i; |
GLubyte *origin = (GLubyte *) ctx->buffer; |
if (ctx->format == OSMESA_COLOR_INDEX) { |
/* CI mode */ |
bytesPerPixel = 1 * sizeof(GLchan); |
} |
else if ((ctx->format == OSMESA_RGB) || (ctx->format == OSMESA_BGR)) { |
/* RGB mode */ |
bytesPerPixel = 3 * sizeof(GLchan); |
} |
else if (ctx->format == OSMESA_RGB_565) { |
/* 5/6/5 RGB pixel in 16 bits */ |
bytesPerPixel = 2; |
} |
else { |
/* RGBA mode */ |
bytesPerPixel = 4 * sizeof(GLchan); |
} |
bytesPerRow = ctx->rowlength * bytesPerPixel; |
if (ctx->yup) { |
/* Y=0 is bottom line of window */ |
for (i = 0; i < MAX_HEIGHT; i++) { |
ctx->rowaddr[i] = (GLchan *) ((GLubyte *) origin + i * bytesPerRow); |
} |
} |
else { |
/* Y=0 is top line of window */ |
for (i = 0; i < MAX_HEIGHT; i++) { |
GLint j = ctx->height - i - 1; |
ctx->rowaddr[i] = (GLchan *) ((GLubyte *) origin + j * bytesPerRow); |
} |
} |
} |
/* |
* Bind an OSMesaContext to an image buffer. The image buffer is just a |
* block of memory which the client provides. Its size must be at least |
* as large as width*height*sizeof(type). Its address should be a multiple |
* of 4 if using RGBA mode. |
* |
* Image data is stored in the order of glDrawPixels: row-major order |
* with the lower-left image pixel stored in the first array position |
* (ie. bottom-to-top). |
* |
* If the context's viewport hasn't been initialized yet, it will now be |
* initialized to (0,0,width,height). |
* |
* Input: ctx - the rendering context |
* buffer - the image buffer memory |
* type - data type for pixel components |
* Normally, only GL_UNSIGNED_BYTE and GL_UNSIGNED_SHORT_5_6_5 |
* are supported. But if Mesa's been compiled with CHAN_BITS==16 |
* then type must be GL_UNSIGNED_SHORT. And if Mesa's been build |
* with CHAN_BITS==32 then type must be GL_FLOAT. |
* width, height - size of image buffer in pixels, at least 1 |
* Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, |
* invalid buffer address, invalid type, width<1, height<1, |
* width>internal limit or height>internal limit. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, |
GLsizei width, GLsizei height ) |
{ |
if (!ctx || !buffer || |
width < 1 || height < 1 || |
width > MAX_WIDTH || height > MAX_HEIGHT) { |
return GL_FALSE; |
} |
if (ctx->format == OSMESA_RGB_565) { |
if (type != GL_UNSIGNED_SHORT_5_6_5) |
return GL_FALSE; |
} |
else if (type != CHAN_TYPE) { |
return GL_FALSE; |
} |
osmesa_update_state( &ctx->gl_ctx, 0 ); |
_mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer ); |
ctx->buffer = buffer; |
ctx->width = width; |
ctx->height = height; |
if (ctx->userRowLength) |
ctx->rowlength = ctx->userRowLength; |
else |
ctx->rowlength = width; |
compute_row_addresses( ctx ); |
/* init viewport */ |
if (ctx->gl_ctx.Viewport.Width == 0) { |
/* initialize viewport and scissor box to buffer size */ |
_mesa_Viewport( 0, 0, width, height ); |
ctx->gl_ctx.Scissor.Width = width; |
ctx->gl_ctx.Scissor.Height = height; |
} |
else { |
/* this will make ensure we recognize the new buffer size */ |
_mesa_ResizeBuffersMESA(); |
} |
/* Added by Gerk Huisma: */ |
_tnl_MakeCurrent( &ctx->gl_ctx, ctx->gl_ctx.DrawBuffer, |
ctx->gl_ctx.ReadBuffer ); |
return GL_TRUE; |
} |
GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) |
{ |
GLcontext *ctx = _mesa_get_current_context(); |
if (ctx) |
return (OSMesaContext) ctx; |
else |
return NULL; |
} |
GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value ) |
{ |
OSMesaContext ctx = OSMesaGetCurrentContext(); |
switch (pname) { |
case OSMESA_ROW_LENGTH: |
if (value<0) { |
_mesa_error( &ctx->gl_ctx, GL_INVALID_VALUE, |
"OSMesaPixelStore(value)" ); |
return; |
} |
ctx->userRowLength = value; |
ctx->rowlength = value; |
break; |
case OSMESA_Y_UP: |
ctx->yup = value ? GL_TRUE : GL_FALSE; |
break; |
default: |
_mesa_error( &ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" ); |
return; |
} |
compute_row_addresses( ctx ); |
} |
GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value ) |
{ |
OSMesaContext ctx = OSMesaGetCurrentContext(); |
switch (pname) { |
case OSMESA_WIDTH: |
*value = ctx->width; |
return; |
case OSMESA_HEIGHT: |
*value = ctx->height; |
return; |
case OSMESA_FORMAT: |
*value = ctx->format; |
return; |
case OSMESA_TYPE: |
*value = CHAN_TYPE; |
return; |
case OSMESA_ROW_LENGTH: |
*value = ctx->rowlength; |
return; |
case OSMESA_Y_UP: |
*value = ctx->yup; |
return; |
case OSMESA_MAX_WIDTH: |
*value = MAX_WIDTH; |
return; |
case OSMESA_MAX_HEIGHT: |
*value = MAX_HEIGHT; |
return; |
default: |
_mesa_error(&ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)"); |
return; |
} |
} |
/* |
* Return the depth buffer associated with an OSMesa context. |
* Input: c - the OSMesa context |
* Output: width, height - size of buffer in pixels |
* bytesPerValue - bytes per depth value (2 or 4) |
* buffer - pointer to depth buffer values |
* Return: GL_TRUE or GL_FALSE to indicate success or failure. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, |
GLint *bytesPerValue, void **buffer ) |
{ |
if ((!c->gl_buffer) || (!c->gl_buffer->DepthBuffer)) { |
*width = 0; |
*height = 0; |
*bytesPerValue = 0; |
*buffer = 0; |
return GL_FALSE; |
} |
else { |
*width = c->gl_buffer->Width; |
*height = c->gl_buffer->Height; |
if (c->gl_visual->depthBits <= 16) |
*bytesPerValue = sizeof(GLushort); |
else |
*bytesPerValue = sizeof(GLuint); |
*buffer = c->gl_buffer->DepthBuffer; |
return GL_TRUE; |
} |
} |
/* |
* Return the color buffer associated with an OSMesa context. |
* Input: c - the OSMesa context |
* Output: width, height - size of buffer in pixels |
* format - the pixel format (OSMESA_FORMAT) |
* buffer - pointer to color buffer values |
* Return: GL_TRUE or GL_FALSE to indicate success or failure. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaGetColorBuffer( OSMesaContext c, GLint *width, |
GLint *height, GLint *format, void **buffer ) |
{ |
if (!c->buffer) { |
*width = 0; |
*height = 0; |
*format = 0; |
*buffer = 0; |
return GL_FALSE; |
} |
else { |
*width = c->width; |
*height = c->height; |
*format = c->format; |
*buffer = c->buffer; |
return GL_TRUE; |
} |
} |
struct name_address { |
const char *Name; |
GLvoid *Address; |
}; |
static struct name_address functions[] = { |
{ "OSMesaCreateContext", (void *) OSMesaCreateContext }, |
{ "OSMesaCreateContextExt", (void *) OSMesaCreateContextExt }, |
{ "OSMesaDestroyContext", (void *) OSMesaDestroyContext }, |
{ "OSMesaMakeCurrent", (void *) OSMesaMakeCurrent }, |
{ "OSMesaGetCurrentContext", (void *) OSMesaGetCurrentContext }, |
{ "OSMesaPixelsStore", (void *) OSMesaPixelStore }, |
{ "OSMesaGetIntegerv", (void *) OSMesaGetIntegerv }, |
{ "OSMesaGetDepthBuffer", (void *) OSMesaGetDepthBuffer }, |
{ "OSMesaGetColorBuffer", (void *) OSMesaGetColorBuffer }, |
{ "OSMesaGetProcAddress", (void *) OSMesaGetProcAddress }, |
{ NULL, NULL } |
}; |
GLAPI void * GLAPIENTRY |
OSMesaGetProcAddress( const char *funcName ) |
{ |
int i; |
for (i = 0; functions[i].Name; i++) { |
if (_mesa_strcmp(functions[i].Name, funcName) == 0) |
return (void *) functions[i].Address; |
} |
return (void *) _glapi_get_proc_address(funcName); |
} |
/**********************************************************************/ |
/*** Device Driver Functions ***/ |
/**********************************************************************/ |
/* |
* Useful macros: |
*/ |
#if CHAN_TYPE == GL_FLOAT |
#define PACK_RGBA(DST, R, G, B, A) \ |
do { \ |
(DST)[0] = MAX2( R, 0.0F ); \ |
(DST)[1] = MAX2( G, 0.0F ); \ |
(DST)[2] = MAX2( B, 0.0F ); \ |
(DST)[3] = CLAMP(A, 0.0F, CHAN_MAXF);\ |
} while (0) |
#else |
#define PACK_RGBA(DST, R, G, B, A) \ |
do { \ |
(DST)[osmesa->rInd] = R; \ |
(DST)[osmesa->gInd] = G; \ |
(DST)[osmesa->bInd] = B; \ |
(DST)[osmesa->aInd] = A; \ |
} while (0) |
#endif |
#define PACK_RGB(DST, R, G, B) \ |
do { \ |
(DST)[0] = R; \ |
(DST)[1] = G; \ |
(DST)[2] = B; \ |
} while (0) |
#define PACK_BGR(DST, R, G, B) \ |
do { \ |
(DST)[0] = B; \ |
(DST)[1] = G; \ |
(DST)[2] = R; \ |
} while (0) |
#define PACK_RGB_565(DST, R, G, B) \ |
do { \ |
(DST) = (((int) (R) << 8) & 0xf800) | (((int) (G) << 3) & 0x7e0) | ((int) (B) >> 3);\ |
} while (0) |
#define UNPACK_RED(P) ( (P)[osmesa->rInd] ) |
#define UNPACK_GREEN(P) ( (P)[osmesa->gInd] ) |
#define UNPACK_BLUE(P) ( (P)[osmesa->bInd] ) |
#define UNPACK_ALPHA(P) ( (P)[osmesa->aInd] ) |
#define PIXELADDR1(X,Y) (osmesa->rowaddr[Y] + (X)) |
#define PIXELADDR2(X,Y) (osmesa->rowaddr[Y] + 2 * (X)) |
#define PIXELADDR3(X,Y) (osmesa->rowaddr[Y] + 3 * (X)) |
#define PIXELADDR4(X,Y) (osmesa->rowaddr[Y] + 4 * (X)) |
static void set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) |
{ |
/* separate read buffer not supported */ |
ASSERT(buffer == ctx->DrawBuffer); |
ASSERT(bufferBit == FRONT_LEFT_BIT); |
} |
static void mesa_clear( GLcontext *ctx, GLbitfield mask, GLboolean all, |
GLint x, GLint y, GLint width, GLint height ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; |
/* sanity check - we only have a front-left buffer */ |
ASSERT((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_LEFT_BIT | DD_BACK_RIGHT_BIT)) == 0); |
if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { |
if (mask & DD_FRONT_LEFT_BIT) { |
if (osmesa->format == OSMESA_COLOR_INDEX) { |
if (all) { |
/* Clear whole CI buffer */ |
#if CHAN_TYPE == GL_UNSIGNED_BYTE |
MEMSET(osmesa->buffer, ctx->Color.ClearIndex, |
osmesa->rowlength * osmesa->height); |
#else |
const GLint n = osmesa->rowlength * osmesa->height; |
GLchan *buffer = (GLchan *) osmesa->buffer; |
GLint i; |
for (i = 0; i < n; i ++) { |
buffer[i] = ctx->Color.ClearIndex; |
} |
#endif |
} |
else { |
/* Clear part of CI buffer */ |
const GLchan clearIndex = (GLchan) ctx->Color.ClearIndex; |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLchan *ptr1 = PIXELADDR1(x, (y + i)); |
for (j = 0; j < width; j++) { |
*ptr1++ = clearIndex; |
} |
} |
} |
} |
else if (osmesa->format == OSMESA_RGB) { |
GLchan r, g, b; |
CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); |
if (all) { |
/* Clear whole RGB buffer */ |
GLuint n = osmesa->rowlength * osmesa->height; |
GLchan *ptr3 = (GLchan *) osmesa->buffer; |
GLuint i; |
for (i = 0; i < n; i++) { |
PACK_RGB(ptr3, r, g, b); |
ptr3 += 3; |
} |
} |
else { |
/* Clear part of RGB buffer */ |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLchan *ptr3 = PIXELADDR3(x, (y + i)); |
for (j = 0; j < width; j++) { |
PACK_RGB(ptr3, r, g, b); |
ptr3 += 3; |
} |
} |
} |
} |
else if (osmesa->format == OSMESA_BGR) { |
GLchan r, g, b; |
CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); |
if (all) { |
/* Clear whole RGB buffer */ |
const GLint n = osmesa->rowlength * osmesa->height; |
GLchan *ptr3 = (GLchan *) osmesa->buffer; |
GLint i; |
for (i = 0; i < n; i++) { |
PACK_BGR(ptr3, r, g, b); |
ptr3 += 3; |
} |
} |
else { |
/* Clear part of RGB buffer */ |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLchan *ptr3 = PIXELADDR3(x, (y + i)); |
for (j = 0; j < width; j++) { |
PACK_BGR(ptr3, r, g, b); |
ptr3 += 3; |
} |
} |
} |
} |
else if (osmesa->format == OSMESA_RGB_565) { |
GLushort clearPixel; |
GLchan r, g, b; |
CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); |
PACK_RGB_565(clearPixel, r, g, b); |
if (all) { |
/* Clear whole RGB buffer */ |
const GLuint n = osmesa->rowlength * osmesa->height; |
GLushort *ptr2 = (GLushort *) osmesa->buffer; |
GLuint i; |
for (i = 0; i < n; i++) { |
*ptr2 = clearPixel; |
ptr2++; |
} |
} |
else { |
/* clear scissored region */ |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x, (y + i)); |
for (j = 0; j < width; j++) { |
*ptr2 = clearPixel; |
ptr2++; |
} |
} |
} |
} |
else { |
#if CHAN_TYPE == GL_UNSIGNED_BYTE |
/* 4-byte pixel value */ |
GLuint clearPixel; |
GLchan *clr = (GLchan *) &clearPixel; |
CLAMPED_FLOAT_TO_CHAN(clr[osmesa->rInd], ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(clr[osmesa->gInd], ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(clr[osmesa->bInd], ctx->Color.ClearColor[2]); |
CLAMPED_FLOAT_TO_CHAN(clr[osmesa->aInd], ctx->Color.ClearColor[3]); |
if (all) { |
/* Clear whole RGBA buffer */ |
const GLuint n = osmesa->rowlength * osmesa->height; |
GLuint *ptr4 = (GLuint *) osmesa->buffer; |
GLuint i; |
if (clearPixel) { |
for (i = 0; i < n; i++) { |
*ptr4++ = clearPixel; |
} |
} |
else { |
_mesa_bzero(ptr4, n * sizeof(GLuint)); |
} |
} |
else { |
/* Clear part of RGBA buffer */ |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLuint *ptr4 = (GLuint *) PIXELADDR4(x, (y + i)); |
for (j = 0; j < width; j++) { |
*ptr4++ = clearPixel; |
} |
} |
} |
#else |
GLchan r, g, b, a; |
CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); |
CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); |
CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); |
CLAMPED_FLOAT_TO_CHAN(a, ctx->Color.ClearColor[3]); |
if (all) { |
/* Clear whole RGBA buffer */ |
const GLuint n = osmesa->rowlength * osmesa->height; |
GLchan *p = (GLchan *) osmesa->buffer; |
GLuint i; |
for (i = 0; i < n; i++) { |
PACK_RGBA(p, r, g, b, a); |
p += 4; |
} |
} |
else { |
/* Clear part of RGBA buffer */ |
GLint i, j; |
for (i = 0; i < height; i++) { |
GLchan *p = PIXELADDR4(x, (y + i)); |
for (j = 0; j < width; j++) { |
PACK_RGBA(p, r, g, b, a); |
p += 4; |
} |
} |
} |
#endif |
} |
mask &= ~DD_FRONT_LEFT_BIT; |
} |
} |
if (mask) |
_swrast_Clear( ctx, mask, all, x, y, width, height ); |
} |
static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) |
{ |
/* don't use GET_CURRENT_CONTEXT(ctx) here - it's a problem on Windows */ |
GLcontext *ctx = (GLcontext *) _glapi_get_context(); |
(void) buffer; |
if (ctx) { |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
*width = osmesa->width; |
*height = osmesa->height; |
} |
} |
/**********************************************************************/ |
/***** Read/write spans/arrays of RGBA pixels *****/ |
/**********************************************************************/ |
/* Write RGBA pixels to an RGBA (or permuted) buffer. */ |
static void |
write_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR4(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p += 4) { |
if (mask[i]) { |
PACK_RGBA(p, rgba[i][RCOMP], rgba[i][GCOMP], |
rgba[i][BCOMP], rgba[i][ACOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p += 4) { |
PACK_RGBA(p, rgba[i][RCOMP], rgba[i][GCOMP], |
rgba[i][BCOMP], rgba[i][ACOMP]); |
} |
} |
} |
/* Write RGBA pixels to an RGBA buffer. This is the fastest span-writer. */ |
static void |
write_rgba_span_rgba( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint *ptr4 = (GLuint *) PIXELADDR4(x, y); |
const GLuint *rgba4 = (const GLuint *) rgba; |
GLuint i; |
ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); |
if (mask) { |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
ptr4[i] = rgba4[i]; |
} |
} |
} |
else { |
MEMCPY( ptr4, rgba4, n * 4 ); |
} |
} |
/* Write RGB pixels to an RGBA (or permuted) buffer. */ |
static void |
write_rgb_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgb[][3], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR4(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p+=4) { |
if (mask[i]) { |
PACK_RGBA(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], CHAN_MAX); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p+=4) { |
PACK_RGBA(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], CHAN_MAX); |
} |
} |
} |
static void |
write_monocolor_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR4(x, y); |
GLuint i; |
for (i = 0; i < n; i++, p += 4) { |
if (mask[i]) { |
PACK_RGBA(p, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP]); |
} |
} |
} |
static void |
write_rgba_pixels( const GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR4(x[i], y[i]); |
PACK_RGBA(p, rgba[i][RCOMP], rgba[i][GCOMP], |
rgba[i][BCOMP], rgba[i][ACOMP]); |
} |
} |
} |
static void |
write_monocolor_pixels( const GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR4(x[i], y[i]); |
PACK_RGBA(p, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP]); |
} |
} |
} |
static void |
read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
GLchan *p = PIXELADDR4(x, y); |
for (i = 0; i < n; i++, p += 4) { |
rgba[i][RCOMP] = UNPACK_RED(p); |
rgba[i][GCOMP] = UNPACK_GREEN(p); |
rgba[i][BCOMP] = UNPACK_BLUE(p); |
rgba[i][ACOMP] = UNPACK_ALPHA(p); |
} |
} |
/* Read RGBA pixels from an RGBA buffer */ |
static void |
read_rgba_span_rgba( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint *ptr4 = (GLuint *) PIXELADDR4(x, y); |
MEMCPY( rgba, ptr4, n * 4 * sizeof(GLchan) ); |
} |
static void |
read_rgba_pixels( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
const GLchan *p = PIXELADDR4(x[i], y[i]); |
rgba[i][RCOMP] = UNPACK_RED(p); |
rgba[i][GCOMP] = UNPACK_GREEN(p); |
rgba[i][BCOMP] = UNPACK_BLUE(p); |
rgba[i][ACOMP] = UNPACK_ALPHA(p); |
} |
} |
} |
/**********************************************************************/ |
/***** 3 byte RGB pixel support funcs *****/ |
/**********************************************************************/ |
/* Write RGBA pixels to an RGB buffer. */ |
static void |
write_rgba_span_RGB( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_RGB(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p += 3) { |
PACK_RGB(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
/* Write RGBA pixels to an BGR buffer. */ |
static void |
write_rgba_span_BGR( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_BGR(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p += 3) { |
PACK_BGR(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
/* Write RGB pixels to an RGB buffer. */ |
static void |
write_rgb_span_RGB( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgb[][3], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_RGB(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p += 3) { |
PACK_RGB(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
/* Write RGB pixels to an BGR buffer. */ |
static void |
write_rgb_span_BGR( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
CONST GLchan rgb[][3], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_BGR(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, p += 3) { |
PACK_BGR(p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
static void |
write_monocolor_span_RGB( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_RGB(p, color[RCOMP], color[GCOMP], color[BCOMP]); |
} |
} |
} |
static void |
write_monocolor_span_BGR( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *p = PIXELADDR3(x, y); |
GLuint i; |
for (i = 0; i < n; i++, p += 3) { |
if (mask[i]) { |
PACK_BGR(p, color[RCOMP], color[GCOMP], color[BCOMP]); |
} |
} |
} |
static void |
write_rgba_pixels_RGB( const GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = (const OSMesaContext) ctx; |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR3(x[i], y[i]); |
PACK_RGB(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
static void |
write_rgba_pixels_BGR( const GLcontext *ctx, GLuint n, |
const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = (const OSMesaContext) ctx; |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR3(x[i], y[i]); |
PACK_BGR(p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
static void |
write_monocolor_pixels_RGB( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR3(x[i], y[i]); |
PACK_RGB(p, color[RCOMP], color[GCOMP], color[BCOMP]); |
} |
} |
} |
static void |
write_monocolor_pixels_BGR( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLchan color[4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLchan *p = PIXELADDR3(x[i], y[i]); |
PACK_BGR(p, color[RCOMP], color[GCOMP], color[BCOMP]); |
} |
} |
} |
static void |
read_rgba_span3( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
const GLchan *p = PIXELADDR3(x, y); |
for (i = 0; i < n; i++, p += 3) { |
rgba[i][RCOMP] = UNPACK_RED(p); |
rgba[i][GCOMP] = UNPACK_GREEN(p); |
rgba[i][BCOMP] = UNPACK_BLUE(p); |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
static void |
read_rgba_pixels3( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
const GLchan *p = PIXELADDR3(x[i], y[i]); |
rgba[i][RCOMP] = UNPACK_RED(p); |
rgba[i][GCOMP] = UNPACK_GREEN(p); |
rgba[i][BCOMP] = UNPACK_BLUE(p); |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
} |
/**********************************************************************/ |
/***** 2 byte RGB pixel support funcs *****/ |
/**********************************************************************/ |
/* Write RGBA pixels to an RGB_565 buffer. */ |
static void |
write_rgba_span2( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, ptr2++) { |
if (mask[i]) { |
PACK_RGB_565(*ptr2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, ptr2++) { |
PACK_RGB_565(*ptr2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
/* Write RGB pixels to an RGB_565 buffer. */ |
static void |
write_rgb_span2( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
CONST GLchan rgb[][3], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x, y); |
GLuint i; |
if (mask) { |
for (i = 0; i < n; i++, ptr2++) { |
if (mask[i]) { |
PACK_RGB_565(*ptr2, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
else { |
for (i = 0; i < n; i++, ptr2++) { |
PACK_RGB_565(*ptr2, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); |
} |
} |
} |
static void |
write_monocolor_span2( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLchan color[4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLushort pixel; |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x, y); |
GLuint i; |
PACK_RGB_565(pixel, color[RCOMP], color[GCOMP], color[BCOMP]); |
for (i = 0; i < n; i++, ptr2++) { |
if (mask[i]) { |
*ptr2 = pixel; |
} |
} |
} |
static void |
write_rgba_pixels2( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
CONST GLchan rgba[][4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x[i],y[i]); |
PACK_RGB_565(*ptr2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); |
} |
} |
} |
static void |
write_monocolor_pixels2( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLchan color[4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
GLushort pixel; |
PACK_RGB_565(pixel, color[RCOMP], color[GCOMP], color[BCOMP]); |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
GLushort *ptr2 = (GLushort *) PIXELADDR2(x[i],y[i]); |
*ptr2 = pixel; |
} |
} |
} |
static void |
read_rgba_span2( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, |
GLchan rgba[][4] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
const GLushort *ptr2 = (const GLushort *) PIXELADDR2(x, y); |
for (i = 0; i < n; i++, ptr2++) { |
/* This should be fixed to get the low bits right */ |
rgba[i][RCOMP] = (*ptr2 >> 8) & 0xFe; |
rgba[i][GCOMP] = (*ptr2 >> 3) & 0xFc; |
rgba[i][BCOMP] = (*ptr2 << 3) & 0xFe; |
rgba[i][ACOMP] = 0; |
} |
} |
static void |
read_rgba_pixels2( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLchan rgba[][4], const GLubyte mask[] ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i = 0; i < n; i++) { |
if (mask[i]) { |
/* This should be fixed to get the low bits right */ |
const GLushort *ptr2 = (const GLushort *) PIXELADDR2(x[i],y[i]); |
rgba[i][RCOMP] = (*ptr2 >> 8) & 0xFE; |
rgba[i][GCOMP] = (*ptr2 >> 3) & 0xFC; |
rgba[i][BCOMP] = (*ptr2 << 3) & 0xFE; |
rgba[i][ACOMP] = 0; |
} |
} |
} |
/**********************************************************************/ |
/***** Read/write spans/arrays of CI pixels *****/ |
/**********************************************************************/ |
/* Write 32-bit color index to buffer */ |
static void |
write_index32_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLuint index[], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *ptr1 = PIXELADDR1(x, y); |
GLuint i; |
if (mask) { |
for (i=0;i<n;i++,ptr1++) { |
if (mask[i]) { |
*ptr1 = (GLchan) index[i]; |
} |
} |
} |
else { |
for (i=0;i<n;i++,ptr1++) { |
*ptr1 = (GLchan) index[i]; |
} |
} |
} |
/* Write 8-bit color index to buffer */ |
static void |
write_index8_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
const GLubyte index[], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *ptr1 = PIXELADDR1(x, y); |
GLuint i; |
if (mask) { |
for (i=0;i<n;i++,ptr1++) { |
if (mask[i]) { |
*ptr1 = (GLchan) index[i]; |
} |
} |
} |
else { |
MEMCPY(ptr1, index, n * sizeof(GLchan)); |
} |
} |
static void |
write_monoindex_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
GLuint colorIndex, const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLchan *ptr1 = PIXELADDR1(x, y); |
GLuint i; |
for (i=0;i<n;i++,ptr1++) { |
if (mask[i]) { |
*ptr1 = (GLchan) colorIndex; |
} |
} |
} |
static void |
write_index_pixels( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
const GLuint index[], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLchan *ptr1 = PIXELADDR1(x[i], y[i]); |
*ptr1 = (GLchan) index[i]; |
} |
} |
} |
static void |
write_monoindex_pixels( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLuint colorIndex, const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i]) { |
GLchan *ptr1 = PIXELADDR1(x[i], y[i]); |
*ptr1 = (GLchan) colorIndex; |
} |
} |
} |
static void |
read_index_span( const GLcontext *ctx, |
GLuint n, GLint x, GLint y, GLuint index[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
const GLchan *ptr1 = (const GLchan *) PIXELADDR1(x, y); |
for (i=0;i<n;i++,ptr1++) { |
index[i] = (GLuint) *ptr1; |
} |
} |
static void |
read_index_pixels( const GLcontext *ctx, |
GLuint n, const GLint x[], const GLint y[], |
GLuint index[], const GLubyte mask[] ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
GLuint i; |
for (i=0;i<n;i++) { |
if (mask[i] ) { |
const GLchan *ptr1 = PIXELADDR1(x[i], y[i]); |
index[i] = (GLuint) *ptr1; |
} |
} |
} |
/**********************************************************************/ |
/***** Optimized line rendering *****/ |
/**********************************************************************/ |
/* |
* Draw a flat-shaded, RGB line into an osmesa buffer. |
*/ |
static void |
flat_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLchan *color = vert1->color; |
#define INTERP_XY 1 |
#define CLIP_HACK 1 |
#define PLOT(X, Y) \ |
do { \ |
GLchan *p = PIXELADDR4(X, Y); \ |
PACK_RGBA(p, color[0], color[1], color[2], color[3]); \ |
} while (0) |
#ifdef WIN32 |
#include "..\swrast\s_linetemp.h" |
#else |
#include "swrast/s_linetemp.h" |
#endif |
} |
/* |
* Draw a flat-shaded, Z-less, RGB line into an osmesa buffer. |
*/ |
static void |
flat_rgba_z_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLchan *color = vert1->color; |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define CLIP_HACK 1 |
#define PLOT(X, Y) \ |
do { \ |
if (Z < *zPtr) { \ |
GLchan *p = PIXELADDR4(X, Y); \ |
PACK_RGBA(p, color[RCOMP], color[GCOMP], \ |
color[BCOMP], color[ACOMP]); \ |
*zPtr = Z; \ |
} \ |
} while (0) |
#ifdef WIN32 |
#include "..\swrast\s_linetemp.h" |
#else |
#include "swrast/s_linetemp.h" |
#endif |
} |
/* |
* Draw a flat-shaded, alpha-blended, RGB line into an osmesa buffer. |
* XXX update for GLchan |
*/ |
static void |
flat_blend_rgba_line( GLcontext *ctx, |
const SWvertex *vert0, const SWvertex *vert1 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLint rshift = osmesa->rshift; |
const GLint gshift = osmesa->gshift; |
const GLint bshift = osmesa->bshift; |
const GLint avalue = vert0->color[3]; |
const GLint msavalue = CHAN_MAX - avalue; |
const GLint rvalue = vert1->color[0]*avalue; |
const GLint gvalue = vert1->color[1]*avalue; |
const GLint bvalue = vert1->color[2]*avalue; |
#define INTERP_XY 1 |
#define CLIP_HACK 1 |
#define PLOT(X,Y) \ |
{ GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ |
GLuint pixel = 0; \ |
pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift);\ |
pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift);\ |
pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift);\ |
*ptr4 = pixel; \ |
} |
#if 0 /* XXX use this in the future */ |
#define PLOT(X,Y) \ |
{ \ |
GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ |
pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ |
pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ |
pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ |
pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ |
} |
#endif |
#ifdef WIN32 |
#include "..\swrast\s_linetemp.h" |
#else |
#include "swrast/s_linetemp.h" |
#endif |
} |
/* |
* Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. |
* But don't write to Z buffer. |
* XXX update for GLchan |
*/ |
static void |
flat_blend_rgba_z_line( GLcontext *ctx, |
const SWvertex *vert0, const SWvertex *vert1 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLint rshift = osmesa->rshift; |
const GLint gshift = osmesa->gshift; |
const GLint bshift = osmesa->bshift; |
const GLint avalue = vert0->color[3]; |
const GLint msavalue = 256 - avalue; |
const GLint rvalue = vert1->color[0]*avalue; |
const GLint gvalue = vert1->color[1]*avalue; |
const GLint bvalue = vert1->color[2]*avalue; |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define CLIP_HACK 1 |
#define PLOT(X,Y) \ |
if (Z < *zPtr) { \ |
GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ |
GLuint pixel = 0; \ |
pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ |
pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ |
pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ |
*ptr4 = pixel; \ |
} |
#if 0 /* XXX use this in the future */ |
#define PLOT(X,Y) \ |
if (Z < *zPtr) { \ |
GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ |
pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ |
pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ |
pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ |
pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ |
} |
#endif |
#ifdef WIN32 |
#include "..\swrast\s_linetemp.h" |
#else |
#include "swrast/s_linetemp.h" |
#endif |
} |
/* |
* Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. |
* XXX update for GLchan |
*/ |
static void |
flat_blend_rgba_z_line_write( GLcontext *ctx, |
const SWvertex *vert0, const SWvertex *vert1 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const GLint rshift = osmesa->rshift; |
const GLint gshift = osmesa->gshift; |
const GLint bshift = osmesa->bshift; |
const GLint avalue = vert0->color[3]; |
const GLint msavalue = 256 - avalue; |
const GLint rvalue = vert1->color[0]*avalue; |
const GLint gvalue = vert1->color[1]*avalue; |
const GLint bvalue = vert1->color[2]*avalue; |
#define INTERP_XY 1 |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define CLIP_HACK 1 |
#define PLOT(X,Y) \ |
if (Z < *zPtr) { \ |
GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ |
GLuint pixel = 0; \ |
pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ |
pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ |
pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ |
*ptr4 = pixel; \ |
*zPtr = Z; \ |
} |
#if 0 /* XXX use this in the future */ |
#define PLOT(X,Y) \ |
if (Z < *zPtr) { \ |
GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ |
pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ |
pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ |
pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ |
pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ |
*zPtr = Z; \ |
} |
#endif |
#ifdef WIN32 |
#include "..\swrast\s_linetemp.h" |
#else |
#include "swrast/s_linetemp.h" |
#endif |
} |
/* |
* Analyze context state to see if we can provide a fast line drawing |
* function, like those in lines.c. Otherwise, return NULL. |
*/ |
static swrast_line_func |
osmesa_choose_line_function( GLcontext *ctx ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (CHAN_BITS != 8) return NULL; |
if (ctx->RenderMode != GL_RENDER) return NULL; |
if (ctx->Line.SmoothFlag) return NULL; |
if (ctx->Texture._EnabledUnits) return NULL; |
if (ctx->Light.ShadeModel != GL_FLAT) return NULL; |
if (ctx->Line.Width != 1.0F) return NULL; |
if (ctx->Line.StippleFlag) return NULL; |
if (ctx->Line.SmoothFlag) return NULL; |
if (osmesa->format != OSMESA_RGBA && |
osmesa->format != OSMESA_BGRA && |
osmesa->format != OSMESA_ARGB) return NULL; |
if (swrast->_RasterMask==DEPTH_BIT |
&& ctx->Depth.Func==GL_LESS |
&& ctx->Depth.Mask==GL_TRUE |
&& ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { |
return (swrast_line_func) flat_rgba_z_line; |
} |
if (swrast->_RasterMask == 0) { |
return (swrast_line_func) flat_rgba_line; |
} |
if (swrast->_RasterMask==(DEPTH_BIT|BLEND_BIT) |
&& ctx->Depth.Func==GL_LESS |
&& ctx->Depth.Mask==GL_TRUE |
&& ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS |
&& ctx->Color.BlendSrcRGB==GL_SRC_ALPHA |
&& ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendSrcA==GL_SRC_ALPHA |
&& ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { |
return (swrast_line_func) flat_blend_rgba_z_line_write; |
} |
if (swrast->_RasterMask==(DEPTH_BIT|BLEND_BIT) |
&& ctx->Depth.Func==GL_LESS |
&& ctx->Depth.Mask==GL_FALSE |
&& ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS |
&& ctx->Color.BlendSrcRGB==GL_SRC_ALPHA |
&& ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendSrcA==GL_SRC_ALPHA |
&& ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { |
return (swrast_line_func) flat_blend_rgba_z_line; |
} |
if (swrast->_RasterMask==BLEND_BIT |
&& ctx->Color.BlendSrcRGB==GL_SRC_ALPHA |
&& ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendSrcA==GL_SRC_ALPHA |
&& ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA |
&& ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { |
return (swrast_line_func) flat_blend_rgba_line; |
} |
return (swrast_line_func) NULL; |
} |
/**********************************************************************/ |
/***** Optimized triangle rendering *****/ |
/**********************************************************************/ |
/* |
* Smooth-shaded, z-less triangle, RGBA color. |
*/ |
static void smooth_rgba_z_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define INTERP_RGB 1 |
#define INTERP_ALPHA 1 |
#define RENDER_SPAN( span ) \ |
GLuint i; \ |
GLchan *img = PIXELADDR4(span.x, span.y); \ |
for (i = 0; i < span.end; i++, img += 4) { \ |
const GLdepth z = FixedToDepth(span.z); \ |
if (z < zRow[i]) { \ |
PACK_RGBA(img, FixedToChan(span.red), \ |
FixedToChan(span.green), FixedToChan(span.blue), \ |
FixedToChan(span.alpha)); \ |
zRow[i] = z; \ |
} \ |
span.red += span.redStep; \ |
span.green += span.greenStep; \ |
span.blue += span.blueStep; \ |
span.alpha += span.alphaStep; \ |
span.z += span.zStep; \ |
} |
#ifdef WIN32 |
#include "..\swrast\s_tritemp.h" |
#else |
#include "swrast/s_tritemp.h" |
#endif |
} |
/* |
* Flat-shaded, z-less triangle, RGBA color. |
*/ |
static void flat_rgba_z_triangle( GLcontext *ctx, |
const SWvertex *v0, |
const SWvertex *v1, |
const SWvertex *v2 ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
#define INTERP_Z 1 |
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE |
#define SETUP_CODE \ |
GLuint pixel; \ |
PACK_RGBA((GLchan *) &pixel, v2->color[0], v2->color[1], \ |
v2->color[2], v2->color[3]); |
#define RENDER_SPAN( span ) \ |
GLuint i; \ |
GLuint *img = (GLuint *) PIXELADDR4(span.x, span.y); \ |
for (i = 0; i < span.end; i++) { \ |
const GLdepth z = FixedToDepth(span.z); \ |
if (z < zRow[i]) { \ |
img[i] = pixel; \ |
zRow[i] = z; \ |
} \ |
span.z += span.zStep; \ |
} |
#ifdef WIN32 |
#include "..\swrast\s_tritemp.h" |
#else |
#include "swrast/s_tritemp.h" |
#endif |
} |
/* |
* Return pointer to an accelerated triangle function if possible. |
*/ |
static swrast_tri_func |
osmesa_choose_triangle_function( GLcontext *ctx ) |
{ |
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
const SWcontext *swrast = SWRAST_CONTEXT(ctx); |
if (CHAN_BITS != 8) return (swrast_tri_func) NULL; |
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; |
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; |
if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL; |
if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL; |
if (osmesa->format != OSMESA_RGBA && |
osmesa->format != OSMESA_BGRA && |
osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL; |
if (ctx->Polygon.CullFlag && |
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) |
return (swrast_tri_func) NULL; |
if (swrast->_RasterMask == DEPTH_BIT && |
ctx->Depth.Func == GL_LESS && |
ctx->Depth.Mask == GL_TRUE && |
ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { |
if (ctx->Light.ShadeModel == GL_SMOOTH) { |
return (swrast_tri_func) smooth_rgba_z_triangle; |
} |
else { |
return (swrast_tri_func) flat_rgba_z_triangle; |
} |
} |
return (swrast_tri_func) NULL; |
} |
/* Override for the swrast triangle-selection function. Try to use one |
* of our internal triangle functions, otherwise fall back to the |
* standard swrast functions. |
*/ |
static void osmesa_choose_triangle( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
swrast->Triangle = osmesa_choose_triangle_function( ctx ); |
if (!swrast->Triangle) |
_swrast_choose_triangle( ctx ); |
} |
static void osmesa_choose_line( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT(ctx); |
swrast->Line = osmesa_choose_line_function( ctx ); |
if (!swrast->Line) |
_swrast_choose_line( ctx ); |
} |
#define OSMESA_NEW_LINE (_NEW_LINE | \ |
_NEW_TEXTURE | \ |
_NEW_LIGHT | \ |
_NEW_DEPTH | \ |
_NEW_RENDERMODE | \ |
_SWRAST_NEW_RASTERMASK) |
#define OSMESA_NEW_TRIANGLE (_NEW_POLYGON | \ |
_NEW_TEXTURE | \ |
_NEW_LIGHT | \ |
_NEW_DEPTH | \ |
_NEW_RENDERMODE | \ |
_SWRAST_NEW_RASTERMASK) |
/* Extend the software rasterizer with our line and triangle |
* functions. |
*/ |
static void osmesa_register_swrast_functions( GLcontext *ctx ) |
{ |
SWcontext *swrast = SWRAST_CONTEXT( ctx ); |
swrast->choose_line = osmesa_choose_line; |
swrast->choose_triangle = osmesa_choose_triangle; |
swrast->invalidate_line |= OSMESA_NEW_LINE; |
swrast->invalidate_triangle |= OSMESA_NEW_TRIANGLE; |
} |
static const GLubyte *get_string( GLcontext *ctx, GLenum name ) |
{ |
(void) ctx; |
switch (name) { |
case GL_RENDERER: |
#if CHAN_BITS == 32 |
return (const GLubyte *) "Mesa OffScreen32"; |
#elif CHAN_BITS == 16 |
return (const GLubyte *) "Mesa OffScreen16"; |
#else |
return (const GLubyte *) "Mesa OffScreen"; |
#endif |
default: |
return NULL; |
} |
} |
static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) |
{ |
OSMesaContext osmesa = OSMESA_CONTEXT(ctx); |
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
ASSERT((void *) osmesa == (void *) ctx->DriverCtx); |
/* |
* XXX these function pointers could be initialized just once during |
* context creation since they don't depend on any state changes. |
*/ |
ctx->Driver.GetString = get_string; |
ctx->Driver.UpdateState = osmesa_update_state; |
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; |
ctx->Driver.GetBufferSize = buffer_size; |
ctx->Driver.Accum = _swrast_Accum; |
ctx->Driver.Bitmap = _swrast_Bitmap; |
ctx->Driver.Clear = mesa_clear; |
ctx->Driver.CopyPixels = _swrast_CopyPixels; |
ctx->Driver.DrawPixels = _swrast_DrawPixels; |
ctx->Driver.ReadPixels = _swrast_ReadPixels; |
ctx->Driver.DrawBuffer = _swrast_DrawBuffer; |
ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format; |
ctx->Driver.TexImage1D = _mesa_store_teximage1d; |
ctx->Driver.TexImage2D = _mesa_store_teximage2d; |
ctx->Driver.TexImage3D = _mesa_store_teximage3d; |
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; |
ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d; |
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; |
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; |
ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; |
ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; |
ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; |
ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; |
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; |
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; |
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; |
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; |
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; |
ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; |
ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; |
ctx->Driver.CopyColorTable = _swrast_CopyColorTable; |
ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; |
ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; |
ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; |
swdd->SetBuffer = set_buffer; |
/* RGB(A) span/pixel functions */ |
if (osmesa->format == OSMESA_RGB) { |
swdd->WriteRGBASpan = write_rgba_span_RGB; |
swdd->WriteRGBSpan = write_rgb_span_RGB; |
swdd->WriteMonoRGBASpan = write_monocolor_span_RGB; |
swdd->WriteRGBAPixels = write_rgba_pixels_RGB; |
swdd->WriteMonoRGBAPixels = write_monocolor_pixels_RGB; |
swdd->ReadRGBASpan = read_rgba_span3; |
swdd->ReadRGBAPixels = read_rgba_pixels3; |
} |
else if (osmesa->format == OSMESA_BGR) { |
swdd->WriteRGBASpan = write_rgba_span_BGR; |
swdd->WriteRGBSpan = write_rgb_span_BGR; |
swdd->WriteMonoRGBASpan = write_monocolor_span_BGR; |
swdd->WriteRGBAPixels = write_rgba_pixels_BGR; |
swdd->WriteMonoRGBAPixels = write_monocolor_pixels_BGR; |
swdd->ReadRGBASpan = read_rgba_span3; |
swdd->ReadRGBAPixels = read_rgba_pixels3; |
} |
else if (osmesa->format == OSMESA_RGB_565) { |
swdd->WriteRGBASpan = write_rgba_span2; |
swdd->WriteRGBSpan = write_rgb_span2; |
swdd->WriteMonoRGBASpan = write_monocolor_span2; |
swdd->WriteRGBAPixels = write_rgba_pixels2; |
swdd->WriteMonoRGBAPixels = write_monocolor_pixels2; |
swdd->ReadRGBASpan = read_rgba_span2; |
swdd->ReadRGBAPixels = read_rgba_pixels2; |
} |
else { |
/* 4 GLchan / pixel in frame buffer */ |
swdd->WriteRGBSpan = write_rgb_span; |
swdd->WriteRGBAPixels = write_rgba_pixels; |
swdd->WriteMonoRGBASpan = write_monocolor_span; |
swdd->WriteMonoRGBAPixels = write_monocolor_pixels; |
if (osmesa->format == OSMESA_RGBA && |
CHAN_TYPE == GL_UNSIGNED_BYTE && |
RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) { |
/* special, fast case */ |
swdd->WriteRGBASpan = write_rgba_span_rgba; |
swdd->ReadRGBASpan = read_rgba_span_rgba; |
} |
else { |
swdd->WriteRGBASpan = write_rgba_span; |
swdd->ReadRGBASpan = read_rgba_span; |
} |
swdd->ReadRGBAPixels = read_rgba_pixels; |
} |
/* CI span/pixel functions */ |
swdd->WriteCI32Span = write_index32_span; |
swdd->WriteCI8Span = write_index8_span; |
swdd->WriteMonoCISpan = write_monoindex_span; |
swdd->WriteCI32Pixels = write_index_pixels; |
swdd->WriteMonoCIPixels = write_monoindex_pixels; |
swdd->ReadCI32Span = read_index_span; |
swdd->ReadCI32Pixels = read_index_pixels; |
tnl->Driver.RunPipeline = _tnl_run_pipeline; |
_swrast_InvalidateState( ctx, new_state ); |
_swsetup_InvalidateState( ctx, new_state ); |
_ac_InvalidateState( ctx, new_state ); |
_tnl_InvalidateState( ctx, new_state ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/context.c |
---|
0,0 → 1,2382 |
/* $Id: context.c,v 1.2 2003-03-13 12:20:28 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "buffers.h" |
#include "clip.h" |
#include "colortab.h" |
#include "context.h" |
#include "dlist.h" |
#include "eval.h" |
#include "enums.h" |
#include "extensions.h" |
#include "fog.h" |
#include "get.h" |
#include "glthread.h" |
#include "hash.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "state.h" |
#include "teximage.h" |
#include "texobj.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "varray.h" |
#include "vpstate.h" |
#include "vtxfmt.h" |
#include "math/m_translate.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
#include "math/mathmod.h" |
#if defined(MESA_TRACE) |
#include "trace/tr_context.h" |
#include "trace/tr_wrapper.h" |
#endif |
#ifdef USE_SPARC_ASM |
#include "SPARC/sparc.h" |
#endif |
#ifndef MESA_VERBOSE |
int MESA_VERBOSE = 1; |
#endif |
#ifndef MESA_DEBUG_FLAGS |
int MESA_DEBUG_FLAGS = 0; |
#endif |
static void |
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); |
/**********************************************************************/ |
/***** OpenGL SI-style interface (new in Mesa 3.5) *****/ |
/**********************************************************************/ |
/* Called by window system/device driver (via gc->exports.destroyCurrent()) |
* when the rendering context is to be destroyed. |
*/ |
GLboolean |
_mesa_destroyContext(__GLcontext *gc) |
{ |
if (gc) { |
_mesa_free_context_data(gc); |
_mesa_free(gc); |
} |
return GL_TRUE; |
} |
/* Called by window system/device driver (via gc->exports.loseCurrent()) |
* when the rendering context is made non-current. |
*/ |
GLboolean |
_mesa_loseCurrent(__GLcontext *gc) |
{ |
/* XXX unbind context from thread */ |
return GL_TRUE; |
} |
/* Called by window system/device driver (via gc->exports.makeCurrent()) |
* when the rendering context is made current. |
*/ |
GLboolean |
_mesa_makeCurrent(__GLcontext *gc) |
{ |
/* XXX bind context to thread */ |
return GL_TRUE; |
} |
/* Called by window system/device driver - yadda, yadda, yadda. |
* See above comments. |
*/ |
GLboolean |
_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) |
{ |
if (gc && gcShare && gc->Shared && gcShare->Shared) { |
gc->Shared->RefCount--; |
if (gc->Shared->RefCount == 0) { |
free_shared_state(gc, gc->Shared); |
} |
gc->Shared = gcShare->Shared; |
gc->Shared->RefCount++; |
return GL_TRUE; |
} |
else { |
return GL_FALSE; |
} |
} |
GLboolean |
_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) |
{ |
if (dst && src) { |
_mesa_copy_context( src, dst, mask ); |
return GL_TRUE; |
} |
else { |
return GL_FALSE; |
} |
} |
GLboolean |
_mesa_forceCurrent(__GLcontext *gc) |
{ |
return GL_TRUE; |
} |
GLboolean |
_mesa_notifyResize(__GLcontext *gc) |
{ |
GLint x, y; |
GLuint width, height; |
__GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); |
if (!d || !d->getDrawableSize) |
return GL_FALSE; |
d->getDrawableSize( d, &x, &y, &width, &height ); |
/* update viewport, resize software buffers, etc. */ |
return GL_TRUE; |
} |
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. |
* We have to finish any pending rendering. |
*/ |
void |
_mesa_notifySwapBuffers(__GLcontext *gc) |
{ |
FLUSH_VERTICES( gc, 0 ); |
} |
struct __GLdispatchStateRec * |
_mesa_dispatchExec(__GLcontext *gc) |
{ |
return NULL; |
} |
void |
_mesa_beginDispatchOverride(__GLcontext *gc) |
{ |
} |
void |
_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, |
* 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 |
* (inheritance and virtual functions). |
*/ |
static void |
_mesa_init_default_exports(__GLexports *exports) |
{ |
exports->destroyContext = _mesa_destroyContext; |
exports->loseCurrent = _mesa_loseCurrent; |
exports->makeCurrent = _mesa_makeCurrent; |
exports->shareContext = _mesa_shareContext; |
exports->copyContext = _mesa_copyContext; |
exports->forceCurrent = _mesa_forceCurrent; |
exports->notifyResize = _mesa_notifyResize; |
exports->notifyDestroy = _mesa_notifyDestroy; |
exports->notifySwapBuffers = _mesa_notifySwapBuffers; |
exports->dispatchExec = _mesa_dispatchExec; |
exports->beginDispatchOverride = _mesa_beginDispatchOverride; |
exports->endDispatchOverride = _mesa_endDispatchOverride; |
} |
/* exported OpenGL SI interface */ |
__GLcontext * |
__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) |
{ |
GLcontext *ctx; |
ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); |
if (ctx == NULL) { |
return NULL; |
} |
_mesa_initialize_context(ctx, modes, NULL, imports, GL_FALSE); |
ctx->imports = *imports; |
return ctx; |
} |
/* exported OpenGL SI interface */ |
void |
__glCoreNopDispatch(void) |
{ |
#if 0 |
/* SI */ |
__gl_dispatch = __glNopDispatchState; |
#else |
/* Mesa */ |
_glapi_set_dispatch(NULL); |
#endif |
} |
/**********************************************************************/ |
/***** 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. |
*/ |
GLvisual * |
_mesa_create_visual( GLboolean rgbFlag, |
GLboolean dbFlag, |
GLboolean stereoFlag, |
GLint redBits, |
GLint greenBits, |
GLint blueBits, |
GLint alphaBits, |
GLint indexBits, |
GLint depthBits, |
GLint stencilBits, |
GLint accumRedBits, |
GLint accumGreenBits, |
GLint accumBlueBits, |
GLint accumAlphaBits, |
GLint numSamples ) |
{ |
GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); |
if (vis) { |
if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, |
redBits, greenBits, blueBits, alphaBits, |
indexBits, depthBits, stencilBits, |
accumRedBits, accumGreenBits, |
accumBlueBits, accumAlphaBits, |
numSamples)) { |
FREE(vis); |
return NULL; |
} |
} |
return vis; |
} |
/* |
* Initialize the fields of the given GLvisual. |
* Input: see _mesa_create_visual() above. |
* Return: GL_TRUE = success |
* GL_FALSE = failure. |
*/ |
GLboolean |
_mesa_initialize_visual( GLvisual *vis, |
GLboolean rgbFlag, |
GLboolean dbFlag, |
GLboolean stereoFlag, |
GLint redBits, |
GLint greenBits, |
GLint blueBits, |
GLint alphaBits, |
GLint indexBits, |
GLint depthBits, |
GLint stencilBits, |
GLint accumRedBits, |
GLint accumGreenBits, |
GLint accumBlueBits, |
GLint accumAlphaBits, |
GLint numSamples ) |
{ |
(void) numSamples; |
assert(vis); |
/* This is to catch bad values from device drivers not updated for |
* Mesa 3.3. Some device drivers just passed 1. That's a REALLY |
* bad value now (a 1-bit depth buffer!?!). |
*/ |
assert(depthBits == 0 || depthBits > 1); |
if (depthBits < 0 || depthBits > 32) { |
return GL_FALSE; |
} |
if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) { |
return GL_FALSE; |
} |
if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) { |
return GL_FALSE; |
} |
if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) { |
return GL_FALSE; |
} |
if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) { |
return GL_FALSE; |
} |
if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) { |
return GL_FALSE; |
} |
vis->rgbMode = rgbFlag; |
vis->doubleBufferMode = dbFlag; |
vis->stereoMode = stereoFlag; |
vis->redBits = redBits; |
vis->greenBits = greenBits; |
vis->blueBits = blueBits; |
vis->alphaBits = alphaBits; |
vis->indexBits = indexBits; |
vis->depthBits = depthBits; |
vis->accumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0; |
vis->accumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0; |
vis->accumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0; |
vis->accumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0; |
vis->stencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0; |
vis->haveAccumBuffer = accumRedBits > 0; |
vis->haveDepthBuffer = depthBits > 0; |
vis->haveStencilBuffer = stencilBits > 0; |
vis->numAuxBuffers = 0; |
vis->level = 0; |
vis->pixmapMode = 0; |
return GL_TRUE; |
} |
void |
_mesa_destroy_visual( GLvisual *vis ) |
{ |
FREE(vis); |
} |
/**********************************************************************/ |
/***** 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. |
*/ |
GLframebuffer * |
_mesa_create_framebuffer( const GLvisual *visual, |
GLboolean softwareDepth, |
GLboolean softwareStencil, |
GLboolean softwareAccum, |
GLboolean softwareAlpha ) |
{ |
GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer); |
assert(visual); |
if (buffer) { |
_mesa_initialize_framebuffer(buffer, visual, |
softwareDepth, softwareStencil, |
softwareAccum, softwareAlpha ); |
} |
return buffer; |
} |
/* |
* Initialize a GLframebuffer object. |
* Input: See _mesa_create_framebuffer() above. |
*/ |
void |
_mesa_initialize_framebuffer( GLframebuffer *buffer, |
const GLvisual *visual, |
GLboolean softwareDepth, |
GLboolean softwareStencil, |
GLboolean softwareAccum, |
GLboolean softwareAlpha ) |
{ |
assert(buffer); |
assert(visual); |
_mesa_bzero(buffer, sizeof(GLframebuffer)); |
/* sanity checks */ |
if (softwareDepth ) { |
assert(visual->depthBits > 0); |
} |
if (softwareStencil) { |
assert(visual->stencilBits > 0); |
} |
if (softwareAccum) { |
assert(visual->rgbMode); |
assert(visual->accumRedBits > 0); |
assert(visual->accumGreenBits > 0); |
assert(visual->accumBlueBits > 0); |
} |
if (softwareAlpha) { |
assert(visual->rgbMode); |
assert(visual->alphaBits > 0); |
} |
buffer->Visual = *visual; |
buffer->UseSoftwareDepthBuffer = softwareDepth; |
buffer->UseSoftwareStencilBuffer = softwareStencil; |
buffer->UseSoftwareAccumBuffer = softwareAccum; |
buffer->UseSoftwareAlphaBuffers = softwareAlpha; |
} |
/* |
* Free a framebuffer struct and its buffers. |
*/ |
void |
_mesa_destroy_framebuffer( GLframebuffer *buffer ) |
{ |
if (buffer) { |
_mesa_free_framebuffer_data(buffer); |
FREE(buffer); |
} |
} |
/* |
* Free the data hanging off of <buffer>, but not <buffer> itself. |
*/ |
void |
_mesa_free_framebuffer_data( GLframebuffer *buffer ) |
{ |
if (!buffer) |
return; |
if (buffer->DepthBuffer) { |
MESA_PBUFFER_FREE( buffer->DepthBuffer ); |
buffer->DepthBuffer = NULL; |
} |
if (buffer->Accum) { |
MESA_PBUFFER_FREE( buffer->Accum ); |
buffer->Accum = NULL; |
} |
if (buffer->Stencil) { |
MESA_PBUFFER_FREE( buffer->Stencil ); |
buffer->Stencil = NULL; |
} |
if (buffer->FrontLeftAlpha) { |
MESA_PBUFFER_FREE( buffer->FrontLeftAlpha ); |
buffer->FrontLeftAlpha = NULL; |
} |
if (buffer->BackLeftAlpha) { |
MESA_PBUFFER_FREE( buffer->BackLeftAlpha ); |
buffer->BackLeftAlpha = NULL; |
} |
if (buffer->FrontRightAlpha) { |
MESA_PBUFFER_FREE( buffer->FrontRightAlpha ); |
buffer->FrontRightAlpha = NULL; |
} |
if (buffer->BackRightAlpha) { |
MESA_PBUFFER_FREE( buffer->BackRightAlpha ); |
buffer->BackRightAlpha = NULL; |
} |
} |
/**********************************************************************/ |
/***** Context allocation, initialization, destroying *****/ |
/**********************************************************************/ |
_glthread_DECLARE_STATIC_MUTEX(OneTimeLock); |
/* |
* This function just calls all the various one-time-init functions in Mesa. |
*/ |
static void |
one_time_init( GLcontext *ctx ) |
{ |
static GLboolean alreadyCalled = GL_FALSE; |
_glthread_LOCK_MUTEX(OneTimeLock); |
if (!alreadyCalled) { |
/* do some implementation tests */ |
assert( sizeof(GLbyte) == 1 ); |
assert( sizeof(GLshort) >= 2 ); |
assert( sizeof(GLint) >= 4 ); |
assert( sizeof(GLubyte) == 1 ); |
assert( sizeof(GLushort) >= 2 ); |
assert( sizeof(GLuint) >= 4 ); |
_mesa_init_lists(); |
_math_init(); |
_mesa_init_math(); |
#ifdef USE_SPARC_ASM |
_mesa_init_sparc_glapi_relocs(); |
#endif |
if (_mesa_getenv("MESA_DEBUG")) { |
_glapi_noop_enable_warnings(GL_TRUE); |
#ifndef GLX_DIRECT_RENDERING |
/* libGL from before 2002/06/28 don't have this function. Someday, |
* when newer libGL libs are common, remove the #ifdef test. This |
* only serves to print warnings when calling undefined GL functions. |
*/ |
_glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); |
#endif |
} |
else { |
_glapi_noop_enable_warnings(GL_FALSE); |
} |
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) |
_mesa_debug(ctx, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__); |
#endif |
alreadyCalled = GL_TRUE; |
} |
_glthread_UNLOCK_MUTEX(OneTimeLock); |
} |
static void |
init_matrix_stack( struct matrix_stack *stack, |
GLuint maxDepth, GLuint dirtyFlag ) |
{ |
GLuint i; |
stack->Depth = 0; |
stack->MaxDepth = maxDepth; |
stack->DirtyFlag = dirtyFlag; |
/* The stack */ |
stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix)); |
for (i = 0; i < maxDepth; i++) { |
_math_matrix_ctr(&stack->Stack[i]); |
_math_matrix_alloc_inv(&stack->Stack[i]); |
} |
stack->Top = stack->Stack; |
} |
static void |
free_matrix_stack( struct matrix_stack *stack ) |
{ |
GLuint i; |
for (i = 0; i < stack->MaxDepth; i++) { |
_math_matrix_dtr(&stack->Stack[i]); |
} |
FREE(stack->Stack); |
stack->Stack = stack->Top = NULL; |
} |
/* |
* Allocate and initialize a shared context state structure. |
*/ |
static struct gl_shared_state * |
alloc_shared_state( void ) |
{ |
struct gl_shared_state *ss; |
GLboolean outOfMemory; |
ss = CALLOC_STRUCT(gl_shared_state); |
if (!ss) |
return NULL; |
_glthread_INIT_MUTEX(ss->Mutex); |
ss->DisplayList = _mesa_NewHashTable(); |
ss->TexObjects = _mesa_NewHashTable(); |
#if FEATURE_NV_vertex_program |
ss->VertexPrograms = _mesa_NewHashTable(); |
#endif |
/* Default Texture objects */ |
outOfMemory = GL_FALSE; |
ss->Default1D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_1D); |
if (!ss->Default1D) { |
outOfMemory = GL_TRUE; |
} |
ss->Default2D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_2D); |
if (!ss->Default2D) { |
outOfMemory = GL_TRUE; |
} |
ss->Default3D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_3D); |
if (!ss->Default3D) { |
outOfMemory = GL_TRUE; |
} |
ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, |
GL_TEXTURE_CUBE_MAP_ARB); |
if (!ss->DefaultCubeMap) { |
outOfMemory = GL_TRUE; |
} |
ss->DefaultRect = _mesa_alloc_texture_object(ss, 0, |
GL_TEXTURE_RECTANGLE_NV); |
if (!ss->DefaultRect) { |
outOfMemory = GL_TRUE; |
} |
if (!ss->DisplayList || !ss->TexObjects |
#if FEATURE_NV_vertex_program |
|| !ss->VertexPrograms |
#endif |
|| outOfMemory) { |
/* Ran out of memory at some point. Free everything and return NULL */ |
if (ss->DisplayList) |
_mesa_DeleteHashTable(ss->DisplayList); |
if (ss->TexObjects) |
_mesa_DeleteHashTable(ss->TexObjects); |
if (ss->VertexPrograms) |
_mesa_DeleteHashTable(ss->VertexPrograms); |
if (ss->Default1D) |
_mesa_free_texture_object(ss, ss->Default1D); |
if (ss->Default2D) |
_mesa_free_texture_object(ss, ss->Default2D); |
if (ss->Default3D) |
_mesa_free_texture_object(ss, ss->Default3D); |
if (ss->DefaultCubeMap) |
_mesa_free_texture_object(ss, ss->DefaultCubeMap); |
if (ss->DefaultRect) |
_mesa_free_texture_object(ss, ss->DefaultRect); |
FREE(ss); |
return NULL; |
} |
else { |
return ss; |
} |
} |
/* |
* Deallocate a shared state context and all children structures. |
*/ |
static void |
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) |
{ |
/* Free display lists */ |
while (1) { |
GLuint list = _mesa_HashFirstEntry(ss->DisplayList); |
if (list) { |
_mesa_destroy_list(ctx, list); |
} |
else { |
break; |
} |
} |
_mesa_DeleteHashTable(ss->DisplayList); |
/* Free texture objects */ |
while (ss->TexObjectList) { |
if (ctx->Driver.DeleteTexture) |
(*ctx->Driver.DeleteTexture)( ctx, ss->TexObjectList ); |
/* this function removes from linked list too! */ |
_mesa_free_texture_object(ss, ss->TexObjectList); |
} |
_mesa_DeleteHashTable(ss->TexObjects); |
#if FEATURE_NV_vertex_program |
/* Free vertex programs */ |
while (1) { |
GLuint prog = _mesa_HashFirstEntry(ss->VertexPrograms); |
if (prog) { |
_mesa_delete_program(ctx, prog); |
} |
else { |
break; |
} |
} |
_mesa_DeleteHashTable(ss->VertexPrograms); |
#endif |
FREE(ss); |
} |
/* |
* Initialize the nth light. Note that the defaults for light 0 are |
* different than the other lights. |
*/ |
static void |
init_light( struct gl_light *l, GLuint n ) |
{ |
make_empty_list( l ); |
ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 ); |
if (n==0) { |
ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 ); |
ASSIGN_4V( l->Specular, 1.0, 1.0, 1.0, 1.0 ); |
} |
else { |
ASSIGN_4V( l->Diffuse, 0.0, 0.0, 0.0, 1.0 ); |
ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 ); |
} |
ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); |
ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); |
l->SpotExponent = 0.0; |
_mesa_invalidate_spot_exp_table( l ); |
l->SpotCutoff = 180.0; |
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */ |
l->ConstantAttenuation = 1.0; |
l->LinearAttenuation = 0.0; |
l->QuadraticAttenuation = 0.0; |
l->Enabled = GL_FALSE; |
} |
static void |
init_lightmodel( struct gl_lightmodel *lm ) |
{ |
ASSIGN_4V( lm->Ambient, 0.2F, 0.2F, 0.2F, 1.0F ); |
lm->LocalViewer = GL_FALSE; |
lm->TwoSide = GL_FALSE; |
lm->ColorControl = GL_SINGLE_COLOR; |
} |
static void |
init_material( struct gl_material *m ) |
{ |
ASSIGN_4V( m->Ambient, 0.2F, 0.2F, 0.2F, 1.0F ); |
ASSIGN_4V( m->Diffuse, 0.8F, 0.8F, 0.8F, 1.0F ); |
ASSIGN_4V( m->Specular, 0.0F, 0.0F, 0.0F, 1.0F ); |
ASSIGN_4V( m->Emission, 0.0F, 0.0F, 0.0F, 1.0F ); |
m->Shininess = 0.0; |
m->AmbientIndex = 0; |
m->DiffuseIndex = 1; |
m->SpecularIndex = 1; |
} |
static void |
init_texture_unit( GLcontext *ctx, GLuint unit ) |
{ |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
texUnit->EnvMode = GL_MODULATE; |
texUnit->CombineModeRGB = GL_MODULATE; |
texUnit->CombineModeA = GL_MODULATE; |
texUnit->CombineSourceRGB[0] = GL_TEXTURE; |
texUnit->CombineSourceRGB[1] = GL_PREVIOUS_EXT; |
texUnit->CombineSourceRGB[2] = GL_CONSTANT_EXT; |
texUnit->CombineSourceA[0] = GL_TEXTURE; |
texUnit->CombineSourceA[1] = GL_PREVIOUS_EXT; |
texUnit->CombineSourceA[2] = GL_CONSTANT_EXT; |
texUnit->CombineOperandRGB[0] = GL_SRC_COLOR; |
texUnit->CombineOperandRGB[1] = GL_SRC_COLOR; |
texUnit->CombineOperandRGB[2] = GL_SRC_ALPHA; |
texUnit->CombineOperandA[0] = GL_SRC_ALPHA; |
texUnit->CombineOperandA[1] = GL_SRC_ALPHA; |
texUnit->CombineOperandA[2] = GL_SRC_ALPHA; |
texUnit->CombineScaleShiftRGB = 0; |
texUnit->CombineScaleShiftA = 0; |
ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 ); |
texUnit->TexGenEnabled = 0; |
texUnit->GenModeS = GL_EYE_LINEAR; |
texUnit->GenModeT = GL_EYE_LINEAR; |
texUnit->GenModeR = GL_EYE_LINEAR; |
texUnit->GenModeQ = GL_EYE_LINEAR; |
texUnit->_GenBitS = TEXGEN_EYE_LINEAR; |
texUnit->_GenBitT = TEXGEN_EYE_LINEAR; |
texUnit->_GenBitR = TEXGEN_EYE_LINEAR; |
texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; |
/* Yes, these plane coefficients are correct! */ |
ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->EyePlaneS, 1.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->EyePlaneT, 0.0, 1.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 ); |
texUnit->Current1D = ctx->Shared->Default1D; |
texUnit->Current2D = ctx->Shared->Default2D; |
texUnit->Current3D = ctx->Shared->Default3D; |
texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; |
texUnit->CurrentRect = ctx->Shared->DefaultRect; |
} |
/* Initialize a 1-D evaluator map */ |
static void |
init_1d_map( struct gl_1d_map *map, int n, const float *initial ) |
{ |
map->Order = 1; |
map->u1 = 0.0; |
map->u2 = 1.0; |
map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); |
if (map->Points) { |
GLint i; |
for (i=0;i<n;i++) |
map->Points[i] = initial[i]; |
} |
} |
/* Initialize a 2-D evaluator map */ |
static void |
init_2d_map( struct gl_2d_map *map, int n, const float *initial ) |
{ |
map->Uorder = 1; |
map->Vorder = 1; |
map->u1 = 0.0; |
map->u2 = 1.0; |
map->v1 = 0.0; |
map->v2 = 1.0; |
map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); |
if (map->Points) { |
GLint i; |
for (i=0;i<n;i++) |
map->Points[i] = initial[i]; |
} |
} |
/* |
* Initialize the attribute groups in a GLcontext. |
*/ |
static void |
init_attrib_groups( GLcontext *ctx ) |
{ |
GLuint i; |
assert(ctx); |
assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); |
assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); |
/* Constants, may be overriden by device drivers */ |
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; |
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; |
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; |
ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; |
ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; |
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; |
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; |
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; |
ctx->Const.SubPixelBits = SUB_PIXEL_BITS; |
ctx->Const.MinPointSize = MIN_POINT_SIZE; |
ctx->Const.MaxPointSize = MAX_POINT_SIZE; |
ctx->Const.MinPointSizeAA = MIN_POINT_SIZE; |
ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE; |
ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY; |
ctx->Const.MinLineWidth = MIN_LINE_WIDTH; |
ctx->Const.MaxLineWidth = MAX_LINE_WIDTH; |
ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; |
ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; |
ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; |
ctx->Const.NumAuxBuffers = NUM_AUX_BUFFERS; |
ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; |
ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; |
ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; |
ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; |
ctx->Const.MaxLights = MAX_LIGHTS; |
/* Initialize matrix stacks */ |
init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH, |
_NEW_MODELVIEW); |
init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH, |
_NEW_PROJECTION); |
init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, |
_NEW_COLOR_MATRIX); |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) |
init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, |
_NEW_TEXTURE_MATRIX); |
for (i = 0; i < MAX_PROGRAM_MATRICES; i++) |
init_matrix_stack(&ctx->ProgramMatrixStack[i], MAX_PROGRAM_STACK_DEPTH, |
_NEW_TRACK_MATRIX); |
ctx->CurrentStack = &ctx->ModelviewMatrixStack; |
/* Init combined Modelview*Projection matrix */ |
_math_matrix_ctr( &ctx->_ModelProjectMatrix ); |
/* Accumulate buffer group */ |
ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); |
/* Color buffer group */ |
ctx->Color.IndexMask = 0xffffffff; |
ctx->Color.ColorMask[0] = 0xff; |
ctx->Color.ColorMask[1] = 0xff; |
ctx->Color.ColorMask[2] = 0xff; |
ctx->Color.ColorMask[3] = 0xff; |
ctx->Color.ClearIndex = 0; |
ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 ); |
ctx->Color.DrawBuffer = GL_FRONT; |
ctx->Color.AlphaEnabled = GL_FALSE; |
ctx->Color.AlphaFunc = GL_ALWAYS; |
ctx->Color.AlphaRef = 0; |
ctx->Color.BlendEnabled = GL_FALSE; |
ctx->Color.BlendSrcRGB = GL_ONE; |
ctx->Color.BlendDstRGB = GL_ZERO; |
ctx->Color.BlendSrcA = GL_ONE; |
ctx->Color.BlendDstA = GL_ZERO; |
ctx->Color.BlendEquation = GL_FUNC_ADD_EXT; |
ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 ); |
ctx->Color.IndexLogicOpEnabled = GL_FALSE; |
ctx->Color.ColorLogicOpEnabled = GL_FALSE; |
ctx->Color.LogicOp = GL_COPY; |
ctx->Color.DitherFlag = GL_TRUE; |
/* Current group */ |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 0.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 0.0 ); |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 0.0 ); |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) |
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], 0.0, 0.0, 0.0, 1.0 ); |
ctx->Current.Index = 1; |
ctx->Current.EdgeFlag = GL_TRUE; |
ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); |
ctx->Current.RasterDistance = 0.0; |
ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); |
ctx->Current.RasterIndex = 1; |
for (i=0; i<MAX_TEXTURE_UNITS; i++) |
ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); |
ctx->Current.RasterPosValid = GL_TRUE; |
/* Depth buffer group */ |
ctx->Depth.Test = GL_FALSE; |
ctx->Depth.Clear = 1.0; |
ctx->Depth.Func = GL_LESS; |
ctx->Depth.Mask = GL_TRUE; |
ctx->Depth.OcclusionTest = GL_FALSE; |
/* Evaluators group */ |
ctx->Eval.Map1Color4 = GL_FALSE; |
ctx->Eval.Map1Index = GL_FALSE; |
ctx->Eval.Map1Normal = GL_FALSE; |
ctx->Eval.Map1TextureCoord1 = GL_FALSE; |
ctx->Eval.Map1TextureCoord2 = GL_FALSE; |
ctx->Eval.Map1TextureCoord3 = GL_FALSE; |
ctx->Eval.Map1TextureCoord4 = GL_FALSE; |
ctx->Eval.Map1Vertex3 = GL_FALSE; |
ctx->Eval.Map1Vertex4 = GL_FALSE; |
MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib)); |
ctx->Eval.Map2Color4 = GL_FALSE; |
ctx->Eval.Map2Index = GL_FALSE; |
ctx->Eval.Map2Normal = GL_FALSE; |
ctx->Eval.Map2TextureCoord1 = GL_FALSE; |
ctx->Eval.Map2TextureCoord2 = GL_FALSE; |
ctx->Eval.Map2TextureCoord3 = GL_FALSE; |
ctx->Eval.Map2TextureCoord4 = GL_FALSE; |
ctx->Eval.Map2Vertex3 = GL_FALSE; |
ctx->Eval.Map2Vertex4 = GL_FALSE; |
MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib)); |
ctx->Eval.AutoNormal = GL_FALSE; |
ctx->Eval.MapGrid1un = 1; |
ctx->Eval.MapGrid1u1 = 0.0; |
ctx->Eval.MapGrid1u2 = 1.0; |
ctx->Eval.MapGrid2un = 1; |
ctx->Eval.MapGrid2vn = 1; |
ctx->Eval.MapGrid2u1 = 0.0; |
ctx->Eval.MapGrid2u2 = 1.0; |
ctx->Eval.MapGrid2v1 = 0.0; |
ctx->Eval.MapGrid2v2 = 1.0; |
/* Evaluator data */ |
{ |
static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 }; |
static GLfloat normal[3] = { 0.0, 0.0, 1.0 }; |
static GLfloat index[1] = { 1.0 }; |
static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 }; |
static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 }; |
static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 }; |
init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex ); |
init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex ); |
init_1d_map( &ctx->EvalMap.Map1Index, 1, index ); |
init_1d_map( &ctx->EvalMap.Map1Color4, 4, color ); |
init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal ); |
init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord ); |
init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord ); |
init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord ); |
init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord ); |
for (i = 0; i < 16; i++) |
init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib ); |
init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex ); |
init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex ); |
init_2d_map( &ctx->EvalMap.Map2Index, 1, index ); |
init_2d_map( &ctx->EvalMap.Map2Color4, 4, color ); |
init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal ); |
init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord ); |
init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord ); |
init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord ); |
init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord ); |
for (i = 0; i < 16; i++) |
init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib ); |
} |
/* Fog group */ |
ctx->Fog.Enabled = GL_FALSE; |
ctx->Fog.Mode = GL_EXP; |
ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 ); |
ctx->Fog.Index = 0.0; |
ctx->Fog.Density = 1.0; |
ctx->Fog.Start = 0.0; |
ctx->Fog.End = 1.0; |
ctx->Fog.ColorSumEnabled = GL_FALSE; |
ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT; |
/* Hint group */ |
ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; |
ctx->Hint.PointSmooth = GL_DONT_CARE; |
ctx->Hint.LineSmooth = GL_DONT_CARE; |
ctx->Hint.PolygonSmooth = GL_DONT_CARE; |
ctx->Hint.Fog = GL_DONT_CARE; |
ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; |
ctx->Hint.TextureCompression = GL_DONT_CARE; |
ctx->Hint.GenerateMipmap = GL_DONT_CARE; |
/* Histogram group */ |
ctx->Histogram.Width = 0; |
ctx->Histogram.Format = GL_RGBA; |
ctx->Histogram.Sink = GL_FALSE; |
ctx->Histogram.RedSize = 0; |
ctx->Histogram.GreenSize = 0; |
ctx->Histogram.BlueSize = 0; |
ctx->Histogram.AlphaSize = 0; |
ctx->Histogram.LuminanceSize = 0; |
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { |
ctx->Histogram.Count[i][0] = 0; |
ctx->Histogram.Count[i][1] = 0; |
ctx->Histogram.Count[i][2] = 0; |
ctx->Histogram.Count[i][3] = 0; |
} |
/* Min/Max group */ |
ctx->MinMax.Format = GL_RGBA; |
ctx->MinMax.Sink = GL_FALSE; |
ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; |
ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; |
ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; |
ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; |
/* Extensions */ |
_mesa_extensions_ctr( ctx ); |
/* Lighting group */ |
for (i=0;i<MAX_LIGHTS;i++) { |
init_light( &ctx->Light.Light[i], i ); |
} |
make_empty_list( &ctx->Light.EnabledList ); |
init_lightmodel( &ctx->Light.Model ); |
init_material( &ctx->Light.Material[0] ); |
init_material( &ctx->Light.Material[1] ); |
ctx->Light.ShadeModel = GL_SMOOTH; |
ctx->Light.Enabled = GL_FALSE; |
ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK; |
ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE; |
ctx->Light.ColorMaterialBitmask = _mesa_material_bitmask( ctx, |
GL_FRONT_AND_BACK, |
GL_AMBIENT_AND_DIFFUSE, ~0, 0 ); |
ctx->Light.ColorMaterialEnabled = GL_FALSE; |
/* Lighting miscellaneous */ |
ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab ); |
make_empty_list( ctx->_ShineTabList ); |
for (i = 0 ; i < 10 ; i++) { |
struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab ); |
s->shininess = -1; |
s->refcount = 0; |
insert_at_tail( ctx->_ShineTabList, s ); |
} |
/* Line group */ |
ctx->Line.SmoothFlag = GL_FALSE; |
ctx->Line.StippleFlag = GL_FALSE; |
ctx->Line.Width = 1.0; |
ctx->Line._Width = 1.0; |
ctx->Line.StipplePattern = 0xffff; |
ctx->Line.StippleFactor = 1; |
/* Display List group */ |
ctx->List.ListBase = 0; |
/* Multisample */ |
ctx->Multisample.Enabled = GL_FALSE; |
ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; |
ctx->Multisample.SampleAlphaToOne = GL_FALSE; |
ctx->Multisample.SampleCoverage = GL_FALSE; |
ctx->Multisample.SampleCoverageValue = 1.0; |
ctx->Multisample.SampleCoverageInvert = GL_FALSE; |
/* Pixel group */ |
ctx->Pixel.RedBias = 0.0; |
ctx->Pixel.RedScale = 1.0; |
ctx->Pixel.GreenBias = 0.0; |
ctx->Pixel.GreenScale = 1.0; |
ctx->Pixel.BlueBias = 0.0; |
ctx->Pixel.BlueScale = 1.0; |
ctx->Pixel.AlphaBias = 0.0; |
ctx->Pixel.AlphaScale = 1.0; |
ctx->Pixel.DepthBias = 0.0; |
ctx->Pixel.DepthScale = 1.0; |
ctx->Pixel.IndexOffset = 0; |
ctx->Pixel.IndexShift = 0; |
ctx->Pixel.ZoomX = 1.0; |
ctx->Pixel.ZoomY = 1.0; |
ctx->Pixel.MapColorFlag = GL_FALSE; |
ctx->Pixel.MapStencilFlag = GL_FALSE; |
ctx->Pixel.MapStoSsize = 1; |
ctx->Pixel.MapItoIsize = 1; |
ctx->Pixel.MapItoRsize = 1; |
ctx->Pixel.MapItoGsize = 1; |
ctx->Pixel.MapItoBsize = 1; |
ctx->Pixel.MapItoAsize = 1; |
ctx->Pixel.MapRtoRsize = 1; |
ctx->Pixel.MapGtoGsize = 1; |
ctx->Pixel.MapBtoBsize = 1; |
ctx->Pixel.MapAtoAsize = 1; |
ctx->Pixel.MapStoS[0] = 0; |
ctx->Pixel.MapItoI[0] = 0; |
ctx->Pixel.MapItoR[0] = 0.0; |
ctx->Pixel.MapItoG[0] = 0.0; |
ctx->Pixel.MapItoB[0] = 0.0; |
ctx->Pixel.MapItoA[0] = 0.0; |
ctx->Pixel.MapItoR8[0] = 0; |
ctx->Pixel.MapItoG8[0] = 0; |
ctx->Pixel.MapItoB8[0] = 0; |
ctx->Pixel.MapItoA8[0] = 0; |
ctx->Pixel.MapRtoR[0] = 0.0; |
ctx->Pixel.MapGtoG[0] = 0.0; |
ctx->Pixel.MapBtoB[0] = 0.0; |
ctx->Pixel.MapAtoA[0] = 0.0; |
ctx->Pixel.HistogramEnabled = GL_FALSE; |
ctx->Pixel.MinMaxEnabled = GL_FALSE; |
ctx->Pixel.PixelTextureEnabled = GL_FALSE; |
ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; |
ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; |
ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); |
ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0); |
ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0); |
ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0); |
ctx->Pixel.ColorTableEnabled = GL_FALSE; |
ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; |
ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; |
ctx->Pixel.Convolution1DEnabled = GL_FALSE; |
ctx->Pixel.Convolution2DEnabled = GL_FALSE; |
ctx->Pixel.Separable2DEnabled = GL_FALSE; |
for (i = 0; i < 3; i++) { |
ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); |
ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; |
ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); |
} |
for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) { |
ctx->Convolution1D.Filter[i] = 0.0; |
ctx->Convolution2D.Filter[i] = 0.0; |
ctx->Separable2D.Filter[i] = 0.0; |
} |
ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); |
ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); |
/* Point group */ |
ctx->Point.SmoothFlag = GL_FALSE; |
ctx->Point.Size = 1.0; |
ctx->Point._Size = 1.0; |
ctx->Point.Params[0] = 1.0; |
ctx->Point.Params[1] = 0.0; |
ctx->Point.Params[2] = 0.0; |
ctx->Point._Attenuated = GL_FALSE; |
ctx->Point.MinSize = 0.0; |
ctx->Point.MaxSize = ctx->Const.MaxPointSize; |
ctx->Point.Threshold = 1.0; |
ctx->Point.PointSprite = GL_FALSE; /* GL_NV_point_sprite */ |
ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite */ |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) { |
ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_NV_point_sprite */ |
} |
/* Polygon group */ |
ctx->Polygon.CullFlag = GL_FALSE; |
ctx->Polygon.CullFaceMode = GL_BACK; |
ctx->Polygon.FrontFace = GL_CCW; |
ctx->Polygon._FrontBit = 0; |
ctx->Polygon.FrontMode = GL_FILL; |
ctx->Polygon.BackMode = GL_FILL; |
ctx->Polygon.SmoothFlag = GL_FALSE; |
ctx->Polygon.StippleFlag = GL_FALSE; |
ctx->Polygon.OffsetFactor = 0.0F; |
ctx->Polygon.OffsetUnits = 0.0F; |
ctx->Polygon.OffsetPoint = GL_FALSE; |
ctx->Polygon.OffsetLine = GL_FALSE; |
ctx->Polygon.OffsetFill = GL_FALSE; |
/* Polygon Stipple group */ |
MEMSET( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) ); |
/* Scissor group */ |
ctx->Scissor.Enabled = GL_FALSE; |
ctx->Scissor.X = 0; |
ctx->Scissor.Y = 0; |
ctx->Scissor.Width = 0; |
ctx->Scissor.Height = 0; |
/* Stencil group */ |
ctx->Stencil.Enabled = GL_FALSE; |
ctx->Stencil.TestTwoSide = GL_FALSE; |
ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 1 = GL_BACK */ |
ctx->Stencil.Function[0] = GL_ALWAYS; |
ctx->Stencil.Function[1] = GL_ALWAYS; |
ctx->Stencil.FailFunc[0] = GL_KEEP; |
ctx->Stencil.FailFunc[1] = GL_KEEP; |
ctx->Stencil.ZPassFunc[0] = GL_KEEP; |
ctx->Stencil.ZPassFunc[1] = GL_KEEP; |
ctx->Stencil.ZFailFunc[0] = GL_KEEP; |
ctx->Stencil.ZFailFunc[1] = GL_KEEP; |
ctx->Stencil.Ref[0] = 0; |
ctx->Stencil.Ref[1] = 0; |
ctx->Stencil.ValueMask[0] = STENCIL_MAX; |
ctx->Stencil.ValueMask[1] = STENCIL_MAX; |
ctx->Stencil.WriteMask[0] = STENCIL_MAX; |
ctx->Stencil.WriteMask[1] = STENCIL_MAX; |
ctx->Stencil.Clear = 0; |
/* Texture group */ |
ctx->Texture.CurrentUnit = 0; /* multitexture */ |
ctx->Texture._EnabledUnits = 0; |
for (i=0; i<MAX_TEXTURE_UNITS; i++) |
init_texture_unit( ctx, i ); |
ctx->Texture.SharedPalette = GL_FALSE; |
_mesa_init_colortable(&ctx->Texture.Palette); |
/* Transformation group */ |
ctx->Transform.MatrixMode = GL_MODELVIEW; |
ctx->Transform.Normalize = GL_FALSE; |
ctx->Transform.RescaleNormals = GL_FALSE; |
ctx->Transform.RasterPositionUnclipped = GL_FALSE; |
for (i=0;i<MAX_CLIP_PLANES;i++) { |
ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); |
} |
ctx->Transform.ClipPlanesEnabled = 0; |
/* Viewport group */ |
ctx->Viewport.X = 0; |
ctx->Viewport.Y = 0; |
ctx->Viewport.Width = 0; |
ctx->Viewport.Height = 0; |
ctx->Viewport.Near = 0.0; |
ctx->Viewport.Far = 1.0; |
_math_matrix_ctr(&ctx->Viewport._WindowMap); |
#define Sz 10 |
#define Tz 14 |
ctx->Viewport._WindowMap.m[Sz] = 0.5F * ctx->DepthMaxF; |
ctx->Viewport._WindowMap.m[Tz] = 0.5F * ctx->DepthMaxF; |
#undef Sz |
#undef Tz |
ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; |
ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT; |
/* Vertex arrays */ |
ctx->Array.Vertex.Size = 4; |
ctx->Array.Vertex.Type = GL_FLOAT; |
ctx->Array.Vertex.Stride = 0; |
ctx->Array.Vertex.StrideB = 0; |
ctx->Array.Vertex.Ptr = NULL; |
ctx->Array.Vertex.Enabled = GL_FALSE; |
ctx->Array.Vertex.Flags = CA_CLIENT_DATA; |
ctx->Array.Normal.Type = GL_FLOAT; |
ctx->Array.Normal.Stride = 0; |
ctx->Array.Normal.StrideB = 0; |
ctx->Array.Normal.Ptr = NULL; |
ctx->Array.Normal.Enabled = GL_FALSE; |
ctx->Array.Normal.Flags = CA_CLIENT_DATA; |
ctx->Array.Color.Size = 4; |
ctx->Array.Color.Type = GL_FLOAT; |
ctx->Array.Color.Stride = 0; |
ctx->Array.Color.StrideB = 0; |
ctx->Array.Color.Ptr = NULL; |
ctx->Array.Color.Enabled = GL_FALSE; |
ctx->Array.Color.Flags = CA_CLIENT_DATA; |
ctx->Array.SecondaryColor.Size = 4; |
ctx->Array.SecondaryColor.Type = GL_FLOAT; |
ctx->Array.SecondaryColor.Stride = 0; |
ctx->Array.SecondaryColor.StrideB = 0; |
ctx->Array.SecondaryColor.Ptr = NULL; |
ctx->Array.SecondaryColor.Enabled = GL_FALSE; |
ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA; |
ctx->Array.FogCoord.Size = 1; |
ctx->Array.FogCoord.Type = GL_FLOAT; |
ctx->Array.FogCoord.Stride = 0; |
ctx->Array.FogCoord.StrideB = 0; |
ctx->Array.FogCoord.Ptr = NULL; |
ctx->Array.FogCoord.Enabled = GL_FALSE; |
ctx->Array.FogCoord.Flags = CA_CLIENT_DATA; |
ctx->Array.Index.Type = GL_FLOAT; |
ctx->Array.Index.Stride = 0; |
ctx->Array.Index.StrideB = 0; |
ctx->Array.Index.Ptr = NULL; |
ctx->Array.Index.Enabled = GL_FALSE; |
ctx->Array.Index.Flags = CA_CLIENT_DATA; |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) { |
ctx->Array.TexCoord[i].Size = 4; |
ctx->Array.TexCoord[i].Type = GL_FLOAT; |
ctx->Array.TexCoord[i].Stride = 0; |
ctx->Array.TexCoord[i].StrideB = 0; |
ctx->Array.TexCoord[i].Ptr = NULL; |
ctx->Array.TexCoord[i].Enabled = GL_FALSE; |
ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA; |
} |
ctx->Array.TexCoordInterleaveFactor = 1; |
ctx->Array.EdgeFlag.Stride = 0; |
ctx->Array.EdgeFlag.StrideB = 0; |
ctx->Array.EdgeFlag.Ptr = NULL; |
ctx->Array.EdgeFlag.Enabled = GL_FALSE; |
ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; |
ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ |
/* Pixel transfer */ |
ctx->Pack.Alignment = 4; |
ctx->Pack.RowLength = 0; |
ctx->Pack.ImageHeight = 0; |
ctx->Pack.SkipPixels = 0; |
ctx->Pack.SkipRows = 0; |
ctx->Pack.SkipImages = 0; |
ctx->Pack.SwapBytes = GL_FALSE; |
ctx->Pack.LsbFirst = GL_FALSE; |
ctx->Unpack.Alignment = 4; |
ctx->Unpack.RowLength = 0; |
ctx->Unpack.ImageHeight = 0; |
ctx->Unpack.SkipPixels = 0; |
ctx->Unpack.SkipRows = 0; |
ctx->Unpack.SkipImages = 0; |
ctx->Unpack.SwapBytes = GL_FALSE; |
ctx->Unpack.LsbFirst = GL_FALSE; |
/* Feedback */ |
ctx->Feedback.Type = GL_2D; /* TODO: verify */ |
ctx->Feedback.Buffer = NULL; |
ctx->Feedback.BufferSize = 0; |
ctx->Feedback.Count = 0; |
/* Selection/picking */ |
ctx->Select.Buffer = NULL; |
ctx->Select.BufferSize = 0; |
ctx->Select.BufferCount = 0; |
ctx->Select.Hits = 0; |
ctx->Select.NameStackDepth = 0; |
/* Renderer and client attribute stacks */ |
ctx->AttribStackDepth = 0; |
ctx->ClientAttribStackDepth = 0; |
/* Display list */ |
ctx->CallDepth = 0; |
ctx->ExecuteFlag = GL_TRUE; |
ctx->CompileFlag = GL_FALSE; |
ctx->CurrentListPtr = NULL; |
ctx->CurrentBlock = NULL; |
ctx->CurrentListNum = 0; |
ctx->CurrentPos = 0; |
/* Color tables */ |
_mesa_init_colortable(&ctx->ColorTable); |
_mesa_init_colortable(&ctx->ProxyColorTable); |
_mesa_init_colortable(&ctx->PostConvolutionColorTable); |
_mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); |
_mesa_init_colortable(&ctx->PostColorMatrixColorTable); |
_mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); |
/* GL_NV_vertex_program */ |
ctx->VertexProgram.Enabled = GL_FALSE; |
ctx->VertexProgram.PointSizeEnabled = GL_FALSE; |
ctx->VertexProgram.TwoSideEnabled = GL_FALSE; |
ctx->VertexProgram.CurrentID = 0; |
ctx->VertexProgram.ErrorPos = -1; |
ctx->VertexProgram.Current = NULL; |
for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) { |
ctx->VertexProgram.TrackMatrix[i] = GL_NONE; |
ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; |
} |
/* Miscellaneous */ |
ctx->NewState = _NEW_ALL; |
ctx->RenderMode = GL_RENDER; |
ctx->_ImageTransferState = 0; |
ctx->_NeedNormals = 0; |
ctx->_NeedEyeCoords = 0; |
ctx->_ModelViewInvScale = 1.0; |
ctx->ErrorValue = (GLenum) GL_NO_ERROR; |
ctx->CatchSignals = GL_TRUE; |
ctx->OcclusionResult = GL_FALSE; |
ctx->OcclusionResultSaved = GL_FALSE; |
ctx->_Facing = 0; |
/* For debug/development only */ |
ctx->NoRaster = _mesa_getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; |
ctx->FirstTimeCurrent = GL_TRUE; |
/* Dither disable */ |
ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; |
if (ctx->NoDither) { |
if (_mesa_getenv("MESA_DEBUG")) { |
_mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); |
} |
ctx->Color.DitherFlag = GL_FALSE; |
} |
} |
/* |
* 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 |
*/ |
static GLboolean |
alloc_proxy_textures( GLcontext *ctx ) |
{ |
GLboolean out_of_memory; |
GLint i; |
ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_1D); |
if (!ctx->Texture.Proxy1D) { |
return GL_FALSE; |
} |
ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_2D); |
if (!ctx->Texture.Proxy2D) { |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); |
return GL_FALSE; |
} |
ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_3D); |
if (!ctx->Texture.Proxy3D) { |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); |
return GL_FALSE; |
} |
ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, |
GL_TEXTURE_CUBE_MAP_ARB); |
if (!ctx->Texture.ProxyCubeMap) { |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D); |
return GL_FALSE; |
} |
ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0, |
GL_TEXTURE_RECTANGLE_NV); |
if (!ctx->Texture.ProxyRect) { |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D); |
_mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap); |
return GL_FALSE; |
} |
out_of_memory = GL_FALSE; |
for (i=0;i<MAX_TEXTURE_LEVELS;i++) { |
ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image(); |
ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image(); |
ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image(); |
ctx->Texture.ProxyCubeMap->Image[i] = _mesa_alloc_texture_image(); |
if (!ctx->Texture.Proxy1D->Image[i] |
|| !ctx->Texture.Proxy2D->Image[i] |
|| !ctx->Texture.Proxy3D->Image[i] |
|| !ctx->Texture.ProxyCubeMap->Image[i]) { |
out_of_memory = GL_TRUE; |
} |
} |
ctx->Texture.ProxyRect->Image[0] = _mesa_alloc_texture_image(); |
if (!ctx->Texture.ProxyRect->Image[0]) |
out_of_memory = GL_TRUE; |
if (out_of_memory) { |
for (i=0;i<MAX_TEXTURE_LEVELS;i++) { |
if (ctx->Texture.Proxy1D->Image[i]) { |
_mesa_free_texture_image(ctx->Texture.Proxy1D->Image[i]); |
} |
if (ctx->Texture.Proxy2D->Image[i]) { |
_mesa_free_texture_image(ctx->Texture.Proxy2D->Image[i]); |
} |
if (ctx->Texture.Proxy3D->Image[i]) { |
_mesa_free_texture_image(ctx->Texture.Proxy3D->Image[i]); |
} |
if (ctx->Texture.ProxyCubeMap->Image[i]) { |
_mesa_free_texture_image(ctx->Texture.ProxyCubeMap->Image[i]); |
} |
} |
if (ctx->Texture.ProxyRect->Image[0]) { |
_mesa_free_texture_image(ctx->Texture.ProxyRect->Image[0]); |
} |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); |
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D); |
_mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap); |
_mesa_free_texture_object(NULL, ctx->Texture.ProxyRect); |
return GL_FALSE; |
} |
else { |
return GL_TRUE; |
} |
} |
static void add_debug_flags( const char *debug ) |
{ |
#ifdef MESA_DEBUG |
if (_mesa_strstr(debug, "varray")) |
MESA_VERBOSE |= VERBOSE_VARRAY; |
if (_mesa_strstr(debug, "tex")) |
MESA_VERBOSE |= VERBOSE_TEXTURE; |
if (_mesa_strstr(debug, "imm")) |
MESA_VERBOSE |= VERBOSE_IMMEDIATE; |
if (_mesa_strstr(debug, "pipe")) |
MESA_VERBOSE |= VERBOSE_PIPELINE; |
if (_mesa_strstr(debug, "driver")) |
MESA_VERBOSE |= VERBOSE_DRIVER; |
if (_mesa_strstr(debug, "state")) |
MESA_VERBOSE |= VERBOSE_STATE; |
if (_mesa_strstr(debug, "api")) |
MESA_VERBOSE |= VERBOSE_API; |
if (_mesa_strstr(debug, "list")) |
MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; |
if (_mesa_strstr(debug, "lighting")) |
MESA_VERBOSE |= VERBOSE_LIGHTING; |
/* Debug flag: |
*/ |
if (_mesa_strstr(debug, "flush")) |
MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; |
#endif |
} |
/* |
* 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, |
const GLvisual *visual, |
GLcontext *share_list, |
void *driver_ctx, |
GLboolean direct ) |
{ |
GLuint dispatchSize; |
const char *c; |
ASSERT(driver_ctx); |
/* If the driver wants core Mesa to use special imports, it'll have to |
* override these defaults. |
*/ |
_mesa_init_default_imports( &(ctx->imports), driver_ctx ); |
/* initialize the exports (Mesa functions called by the window system) */ |
_mesa_init_default_exports( &(ctx->exports) ); |
/* misc one-time initializations */ |
one_time_init(ctx); |
ctx->DriverCtx = driver_ctx; |
ctx->Visual = *visual; |
ctx->DrawBuffer = NULL; |
ctx->ReadBuffer = NULL; |
if (share_list) { |
/* share state with another context */ |
ctx->Shared = share_list->Shared; |
} |
else { |
/* allocate new, unshared state */ |
ctx->Shared = alloc_shared_state(); |
if (!ctx->Shared) { |
return GL_FALSE; |
} |
} |
_glthread_LOCK_MUTEX(ctx->Shared->Mutex); |
ctx->Shared->RefCount++; |
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); |
/* Effectively bind the default textures to all texture units */ |
ctx->Shared->Default1D->RefCount += MAX_TEXTURE_UNITS; |
ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS; |
ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS; |
ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS; |
ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS; |
init_attrib_groups( ctx ); |
if (visual->doubleBufferMode) { |
ctx->Color.DrawBuffer = GL_BACK; |
ctx->Color._DrawDestMask = BACK_LEFT_BIT; |
ctx->Pixel.ReadBuffer = GL_BACK; |
ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; |
} |
else { |
ctx->Color.DrawBuffer = GL_FRONT; |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT; |
ctx->Pixel.ReadBuffer = GL_FRONT; |
ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; |
} |
if (!alloc_proxy_textures(ctx)) { |
free_shared_state(ctx, ctx->Shared); |
return GL_FALSE; |
} |
/* |
* For XFree86/DRI: tell libGL to add these functions to the dispatcher. |
* Basically, we should add all extension functions above offset 577. |
* This enables older libGL libraries to work with newer drivers that |
* have newer extensions. |
*/ |
/* GL_ARB_window_pos aliases with GL_MESA_window_pos */ |
_glapi_add_entrypoint("glWindowPos2dARB", 513); |
_glapi_add_entrypoint("glWindowPos2dvARB", 514); |
_glapi_add_entrypoint("glWindowPos2fARB", 515); |
_glapi_add_entrypoint("glWindowPos2fvARB", 516); |
_glapi_add_entrypoint("glWindowPos2iARB", 517); |
_glapi_add_entrypoint("glWindowPos2ivARB", 518); |
_glapi_add_entrypoint("glWindowPos2sARB", 519); |
_glapi_add_entrypoint("glWindowPos2svARB", 520); |
_glapi_add_entrypoint("glWindowPos3dARB", 521); |
_glapi_add_entrypoint("glWindowPos3dvARB", 522); |
_glapi_add_entrypoint("glWindowPos3fARB", 523); |
_glapi_add_entrypoint("glWindowPos3fvARB", 524); |
_glapi_add_entrypoint("glWindowPos3iARB", 525); |
_glapi_add_entrypoint("glWindowPos3ivARB", 526); |
_glapi_add_entrypoint("glWindowPos3sARB", 527); |
_glapi_add_entrypoint("glWindowPos3svARB", 528); |
/* new extension functions */ |
_glapi_add_entrypoint("glAreProgramsResidentNV", 578); |
_glapi_add_entrypoint("glBindProgramNV", 579); |
_glapi_add_entrypoint("glDeleteProgramsNV", 580); |
_glapi_add_entrypoint("glExecuteProgramNV", 581); |
_glapi_add_entrypoint("glGenProgramsNV", 582); |
_glapi_add_entrypoint("glGetProgramParameterdvNV", 583); |
_glapi_add_entrypoint("glGetProgramParameterfvNV", 584); |
_glapi_add_entrypoint("glGetProgramivNV", 585); |
_glapi_add_entrypoint("glGetProgramStringNV", 586); |
_glapi_add_entrypoint("glGetTrackMatrixivNV", 587); |
_glapi_add_entrypoint("glGetVertexAttribdvNV", 588); |
_glapi_add_entrypoint("glGetVertexAttribfvNV", 589); |
_glapi_add_entrypoint("glGetVertexAttribivNV", 590); |
_glapi_add_entrypoint("glGetVertexAttribPointervNV", 591); |
_glapi_add_entrypoint("glIsProgramNV", 592); |
_glapi_add_entrypoint("glLoadProgramNV", 593); |
_glapi_add_entrypoint("glProgramParameter4dNV", 594); |
_glapi_add_entrypoint("glProgramParameter4dvNV", 595); |
_glapi_add_entrypoint("glProgramParameter4fNV", 596); |
_glapi_add_entrypoint("glProgramParameter4fvNV", 597); |
_glapi_add_entrypoint("glProgramParameters4dvNV", 598); |
_glapi_add_entrypoint("glProgramParameters4fvNV", 599); |
_glapi_add_entrypoint("glRequestResidentProgramsNV", 600); |
_glapi_add_entrypoint("glTrackMatrixNV", 601); |
_glapi_add_entrypoint("glVertexAttribPointerNV", 602); |
_glapi_add_entrypoint("glVertexAttrib1dNV", 603); |
_glapi_add_entrypoint("glVertexAttrib1dvNV", 604); |
_glapi_add_entrypoint("glVertexAttrib1fNV", 605); |
_glapi_add_entrypoint("glVertexAttrib1fvNV", 606); |
_glapi_add_entrypoint("glVertexAttrib1sNV", 607); |
_glapi_add_entrypoint("glVertexAttrib1svNV", 608); |
_glapi_add_entrypoint("glVertexAttrib2dNV", 609); |
_glapi_add_entrypoint("glVertexAttrib2dvNV", 610); |
_glapi_add_entrypoint("glVertexAttrib2fNV", 611); |
_glapi_add_entrypoint("glVertexAttrib2fvNV", 612); |
_glapi_add_entrypoint("glVertexAttrib2sNV", 613); |
_glapi_add_entrypoint("glVertexAttrib2svNV", 614); |
_glapi_add_entrypoint("glVertexAttrib3dNV", 615); |
_glapi_add_entrypoint("glVertexAttrib3dvNV", 616); |
_glapi_add_entrypoint("glVertexAttrib3fNV", 617); |
_glapi_add_entrypoint("glVertexAttrib3fvNV", 618); |
_glapi_add_entrypoint("glVertexAttrib3sNV", 619); |
_glapi_add_entrypoint("glVertexAttrib3svNV", 620); |
_glapi_add_entrypoint("glVertexAttrib4dNV", 621); |
_glapi_add_entrypoint("glVertexAttrib4dvNV", 622); |
_glapi_add_entrypoint("glVertexAttrib4fNV", 623); |
_glapi_add_entrypoint("glVertexAttrib4fvNV", 624); |
_glapi_add_entrypoint("glVertexAttrib4sNV", 625); |
_glapi_add_entrypoint("glVertexAttrib4svNV", 626); |
_glapi_add_entrypoint("glVertexAttrib4ubNV", 627); |
_glapi_add_entrypoint("glVertexAttrib4ubvNV", 628); |
_glapi_add_entrypoint("glVertexAttribs1dvNV", 629); |
_glapi_add_entrypoint("glVertexAttribs1fvNV", 630); |
_glapi_add_entrypoint("glVertexAttribs1svNV", 631); |
_glapi_add_entrypoint("glVertexAttribs2dvNV", 632); |
_glapi_add_entrypoint("glVertexAttribs2fvNV", 633); |
_glapi_add_entrypoint("glVertexAttribs2svNV", 634); |
_glapi_add_entrypoint("glVertexAttribs3dvNV", 635); |
_glapi_add_entrypoint("glVertexAttribs3fvNV", 636); |
_glapi_add_entrypoint("glVertexAttribs3svNV", 637); |
_glapi_add_entrypoint("glVertexAttribs4dvNV", 638); |
_glapi_add_entrypoint("glVertexAttribs4fvNV", 639); |
_glapi_add_entrypoint("glVertexAttribs4svNV", 640); |
_glapi_add_entrypoint("glVertexAttribs4ubvNV", 641); |
_glapi_add_entrypoint("glPointParameteriNV", 642); |
_glapi_add_entrypoint("glPointParameterivNV", 643); |
_glapi_add_entrypoint("glMultiDrawArraysEXT", 644); |
_glapi_add_entrypoint("glMultiDrawElementsEXT", 645); |
_glapi_add_entrypoint("glActiveStencilFaceEXT", 646); |
_glapi_add_entrypoint("glDeleteFencesNV", 647); |
_glapi_add_entrypoint("glGenFencesNV", 648); |
_glapi_add_entrypoint("glIsFenceNV", 649); |
_glapi_add_entrypoint("glTestFenceNV", 650); |
_glapi_add_entrypoint("glGetFenceivNV", 651); |
_glapi_add_entrypoint("glFinishFenceNV", 652); |
_glapi_add_entrypoint("glSetFenceNV", 653); |
/* Find the larger of Mesa's dispatch table and libGL's dispatch table. |
* In practice, this'll be the same for stand-alone Mesa. But for DRI |
* Mesa we do this to accomodate different versions of libGL and various |
* DRI drivers. |
*/ |
dispatchSize = MAX2(_glapi_get_dispatch_table_size(), |
sizeof(struct _glapi_table) / sizeof(void *)); |
/* setup API dispatch tables */ |
ctx->Exec = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); |
ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); |
if (!ctx->Exec || !ctx->Save) { |
free_shared_state(ctx, ctx->Shared); |
if (ctx->Exec) |
FREE( ctx->Exec ); |
} |
_mesa_init_exec_table(ctx->Exec, dispatchSize); |
_mesa_init_dlist_table(ctx->Save, dispatchSize); |
ctx->CurrentDispatch = ctx->Exec; |
ctx->ExecPrefersFloat = GL_FALSE; |
ctx->SavePrefersFloat = GL_FALSE; |
/* Neutral tnl module stuff */ |
_mesa_init_exec_vtxfmt( ctx ); |
ctx->TnlModule.Current = NULL; |
ctx->TnlModule.SwapCount = 0; |
/* Z buffer stuff */ |
if (ctx->Visual.depthBits == 0) { |
/* Special case. Even if we don't have a depth buffer we need |
* good values for DepthMax for Z vertex transformation purposes |
* and for per-fragment fog computation. |
*/ |
ctx->DepthMax = 1 << 16; |
ctx->DepthMaxF = (GLfloat) ctx->DepthMax; |
} |
else if (ctx->Visual.depthBits < 32) { |
ctx->DepthMax = (1 << ctx->Visual.depthBits) - 1; |
ctx->DepthMaxF = (GLfloat) ctx->DepthMax; |
} |
else { |
/* Special case since shift values greater than or equal to the |
* number of bits in the left hand expression's type are undefined. |
*/ |
ctx->DepthMax = 0xffffffff; |
ctx->DepthMaxF = (GLfloat) ctx->DepthMax; |
} |
ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ |
c = _mesa_getenv("MESA_DEBUG"); |
if (c) |
add_debug_flags(c); |
c = _mesa_getenv("MESA_VERBOSE"); |
if (c) |
add_debug_flags(c); |
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. |
*/ |
GLcontext * |
_mesa_create_context( const GLvisual *visual, |
GLcontext *share_list, |
void *driver_ctx, |
GLboolean direct ) |
{ |
GLcontext *ctx; |
ASSERT(visual); |
ASSERT(driver_ctx); |
ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); |
if (!ctx) |
return NULL; |
if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) { |
return ctx; |
} |
else { |
_mesa_free(ctx); |
return NULL; |
} |
} |
/* |
* Free the data associated with the given context. |
* But don't free() the GLcontext struct itself! |
*/ |
void |
_mesa_free_context_data( GLcontext *ctx ) |
{ |
struct gl_shine_tab *s, *tmps; |
GLuint i; |
/* if we're destroying the current context, unbind it first */ |
if (ctx == _mesa_get_current_context()) { |
_mesa_make_current(NULL, NULL); |
} |
/* |
* Free transformation matrix stacks |
*/ |
free_matrix_stack(&ctx->ModelviewMatrixStack); |
free_matrix_stack(&ctx->ProjectionMatrixStack); |
free_matrix_stack(&ctx->ColorMatrixStack); |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) |
free_matrix_stack(&ctx->TextureMatrixStack[i]); |
for (i = 0; i < MAX_PROGRAM_MATRICES; i++) |
free_matrix_stack(&ctx->ProgramMatrixStack[i]); |
/* combined Modelview*Projection matrix */ |
_math_matrix_dtr( &ctx->_ModelProjectMatrix ); |
#if FEATURE_NV_vertex_program |
if (ctx->VertexProgram.Current) { |
ctx->VertexProgram.Current->RefCount--; |
if (ctx->VertexProgram.Current->RefCount <= 0) |
_mesa_delete_program(ctx, ctx->VertexProgram.CurrentID); |
} |
#endif |
/* Shared context state (display lists, textures, etc) */ |
_glthread_LOCK_MUTEX(ctx->Shared->Mutex); |
ctx->Shared->RefCount--; |
assert(ctx->Shared->RefCount >= 0); |
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); |
if (ctx->Shared->RefCount == 0) { |
/* free shared state */ |
free_shared_state( ctx, ctx->Shared ); |
} |
/* Free lighting shininess exponentiation table */ |
foreach_s( s, tmps, ctx->_ShineTabList ) { |
FREE( s ); |
} |
FREE( ctx->_ShineTabList ); |
/* Free proxy texture objects */ |
_mesa_free_texture_object( NULL, ctx->Texture.Proxy1D ); |
_mesa_free_texture_object( NULL, ctx->Texture.Proxy2D ); |
_mesa_free_texture_object( NULL, ctx->Texture.Proxy3D ); |
_mesa_free_texture_object( NULL, ctx->Texture.ProxyCubeMap ); |
_mesa_free_texture_object( NULL, ctx->Texture.ProxyRect ); |
/* Free evaluator data */ |
if (ctx->EvalMap.Map1Vertex3.Points) |
FREE( ctx->EvalMap.Map1Vertex3.Points ); |
if (ctx->EvalMap.Map1Vertex4.Points) |
FREE( ctx->EvalMap.Map1Vertex4.Points ); |
if (ctx->EvalMap.Map1Index.Points) |
FREE( ctx->EvalMap.Map1Index.Points ); |
if (ctx->EvalMap.Map1Color4.Points) |
FREE( ctx->EvalMap.Map1Color4.Points ); |
if (ctx->EvalMap.Map1Normal.Points) |
FREE( ctx->EvalMap.Map1Normal.Points ); |
if (ctx->EvalMap.Map1Texture1.Points) |
FREE( ctx->EvalMap.Map1Texture1.Points ); |
if (ctx->EvalMap.Map1Texture2.Points) |
FREE( ctx->EvalMap.Map1Texture2.Points ); |
if (ctx->EvalMap.Map1Texture3.Points) |
FREE( ctx->EvalMap.Map1Texture3.Points ); |
if (ctx->EvalMap.Map1Texture4.Points) |
FREE( ctx->EvalMap.Map1Texture4.Points ); |
for (i = 0; i < 16; i++) |
FREE((ctx->EvalMap.Map1Attrib[i].Points)); |
if (ctx->EvalMap.Map2Vertex3.Points) |
FREE( ctx->EvalMap.Map2Vertex3.Points ); |
if (ctx->EvalMap.Map2Vertex4.Points) |
FREE( ctx->EvalMap.Map2Vertex4.Points ); |
if (ctx->EvalMap.Map2Index.Points) |
FREE( ctx->EvalMap.Map2Index.Points ); |
if (ctx->EvalMap.Map2Color4.Points) |
FREE( ctx->EvalMap.Map2Color4.Points ); |
if (ctx->EvalMap.Map2Normal.Points) |
FREE( ctx->EvalMap.Map2Normal.Points ); |
if (ctx->EvalMap.Map2Texture1.Points) |
FREE( ctx->EvalMap.Map2Texture1.Points ); |
if (ctx->EvalMap.Map2Texture2.Points) |
FREE( ctx->EvalMap.Map2Texture2.Points ); |
if (ctx->EvalMap.Map2Texture3.Points) |
FREE( ctx->EvalMap.Map2Texture3.Points ); |
if (ctx->EvalMap.Map2Texture4.Points) |
FREE( ctx->EvalMap.Map2Texture4.Points ); |
for (i = 0; i < 16; i++) |
FREE((ctx->EvalMap.Map2Attrib[i].Points)); |
_mesa_free_colortable_data( &ctx->ColorTable ); |
_mesa_free_colortable_data( &ctx->PostConvolutionColorTable ); |
_mesa_free_colortable_data( &ctx->PostColorMatrixColorTable ); |
_mesa_free_colortable_data( &ctx->Texture.Palette ); |
_math_matrix_dtr(&ctx->Viewport._WindowMap); |
_mesa_extensions_dtr(ctx); |
FREE(ctx->Exec); |
FREE(ctx->Save); |
} |
/* |
* Destroy a GLcontext structure. |
*/ |
void |
_mesa_destroy_context( GLcontext *ctx ) |
{ |
if (ctx) { |
_mesa_free_context_data(ctx); |
FREE( (void *) ctx ); |
} |
} |
/* |
* Copy attribute groups from one context to another. |
* Input: src - source context |
* dst - destination context |
* mask - bitwise OR of GL_*_BIT flags |
*/ |
void |
_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) |
{ |
if (mask & GL_ACCUM_BUFFER_BIT) { |
/* OK to memcpy */ |
dst->Accum = src->Accum; |
} |
if (mask & GL_COLOR_BUFFER_BIT) { |
/* OK to memcpy */ |
dst->Color = src->Color; |
} |
if (mask & GL_CURRENT_BIT) { |
/* OK to memcpy */ |
dst->Current = src->Current; |
} |
if (mask & GL_DEPTH_BUFFER_BIT) { |
/* OK to memcpy */ |
dst->Depth = src->Depth; |
} |
if (mask & GL_ENABLE_BIT) { |
/* no op */ |
} |
if (mask & GL_EVAL_BIT) { |
/* OK to memcpy */ |
dst->Eval = src->Eval; |
} |
if (mask & GL_FOG_BIT) { |
/* OK to memcpy */ |
dst->Fog = src->Fog; |
} |
if (mask & GL_HINT_BIT) { |
/* OK to memcpy */ |
dst->Hint = src->Hint; |
} |
if (mask & GL_LIGHTING_BIT) { |
GLuint i; |
/* begin with memcpy */ |
MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) ); |
/* fixup linked lists to prevent pointer insanity */ |
make_empty_list( &(dst->Light.EnabledList) ); |
for (i = 0; i < MAX_LIGHTS; i++) { |
if (dst->Light.Light[i].Enabled) { |
insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i])); |
} |
} |
} |
if (mask & GL_LINE_BIT) { |
/* OK to memcpy */ |
dst->Line = src->Line; |
} |
if (mask & GL_LIST_BIT) { |
/* OK to memcpy */ |
dst->List = src->List; |
} |
if (mask & GL_PIXEL_MODE_BIT) { |
/* OK to memcpy */ |
dst->Pixel = src->Pixel; |
} |
if (mask & GL_POINT_BIT) { |
/* OK to memcpy */ |
dst->Point = src->Point; |
} |
if (mask & GL_POLYGON_BIT) { |
/* OK to memcpy */ |
dst->Polygon = src->Polygon; |
} |
if (mask & GL_POLYGON_STIPPLE_BIT) { |
/* Use loop instead of MEMCPY due to problem with Portland Group's |
* C compiler. Reported by John Stone. |
*/ |
GLuint i; |
for (i = 0; i < 32; i++) { |
dst->PolygonStipple[i] = src->PolygonStipple[i]; |
} |
} |
if (mask & GL_SCISSOR_BIT) { |
/* OK to memcpy */ |
dst->Scissor = src->Scissor; |
} |
if (mask & GL_STENCIL_BUFFER_BIT) { |
/* OK to memcpy */ |
dst->Stencil = src->Stencil; |
} |
if (mask & GL_TEXTURE_BIT) { |
/* Cannot memcpy because of pointers */ |
_mesa_copy_texture_state(src, dst); |
} |
if (mask & GL_TRANSFORM_BIT) { |
/* OK to memcpy */ |
dst->Transform = src->Transform; |
} |
if (mask & GL_VIEWPORT_BIT) { |
/* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ |
dst->Viewport.X = src->Viewport.X; |
dst->Viewport.Y = src->Viewport.Y; |
dst->Viewport.Width = src->Viewport.Width; |
dst->Viewport.Height = src->Viewport.Height; |
dst->Viewport.Near = src->Viewport.Near; |
dst->Viewport.Far = src->Viewport.Far; |
_math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); |
} |
/* XXX FIXME: Call callbacks? |
*/ |
dst->NewState = _NEW_ALL; |
} |
static void print_info( void ) |
{ |
_mesa_debug(NULL, "Mesa GL_VERSION = %s\n", |
(char *) _mesa_GetString(GL_VERSION)); |
_mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", |
(char *) _mesa_GetString(GL_RENDERER)); |
_mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", |
(char *) _mesa_GetString(GL_VENDOR)); |
_mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", |
(char *) _mesa_GetString(GL_EXTENSIONS)); |
#if defined(THREADS) |
_mesa_debug(NULL, "Mesa thread-safe: YES\n"); |
#else |
_mesa_debug(NULL, "Mesa thread-safe: NO\n"); |
#endif |
#if defined(USE_X86_ASM) |
_mesa_debug(NULL, "Mesa x86-optimized: YES\n"); |
#else |
_mesa_debug(NULL, "Mesa x86-optimized: NO\n"); |
#endif |
#if defined(USE_SPARC_ASM) |
_mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); |
#else |
_mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); |
#endif |
} |
/* |
* Set the current context, binding the given frame buffer to the context. |
*/ |
void |
_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer ) |
{ |
_mesa_make_current2( newCtx, buffer, buffer ); |
} |
/* |
* 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, |
GLframebuffer *readBuffer ) |
{ |
if (MESA_VERBOSE) |
_mesa_debug(newCtx, "_mesa_make_current2()\n"); |
/* Check that the context's and framebuffer's visuals are compatible. |
* We could do a lot more checking here but this'll catch obvious |
* problems. |
*/ |
if (newCtx && drawBuffer && readBuffer) { |
if (newCtx->Visual.rgbMode != drawBuffer->Visual.rgbMode || |
newCtx->Visual.redBits != drawBuffer->Visual.redBits || |
newCtx->Visual.depthBits != drawBuffer->Visual.depthBits || |
newCtx->Visual.stencilBits != drawBuffer->Visual.stencilBits || |
newCtx->Visual.accumRedBits != drawBuffer->Visual.accumRedBits) { |
return; /* incompatible */ |
} |
} |
/* We call this function periodically (just here for now) in |
* order to detect when multithreading has begun. |
*/ |
_glapi_check_multithread(); |
_glapi_set_context((void *) newCtx); |
ASSERT(_mesa_get_current_context() == newCtx); |
if (!newCtx) { |
_glapi_set_dispatch(NULL); /* none current */ |
} |
else { |
_glapi_set_dispatch(newCtx->CurrentDispatch); |
if (drawBuffer && readBuffer) { |
/* TODO: check if newCtx and buffer's visual match??? */ |
newCtx->DrawBuffer = drawBuffer; |
newCtx->ReadBuffer = readBuffer; |
newCtx->NewState |= _NEW_BUFFERS; |
if (drawBuffer->Width == 0 && drawBuffer->Height == 0) { |
/* get initial window size */ |
GLuint bufWidth, bufHeight; |
/* ask device driver for size of output buffer */ |
(*newCtx->Driver.GetBufferSize)( drawBuffer, &bufWidth, &bufHeight ); |
if (drawBuffer->Width == bufWidth && drawBuffer->Height == bufHeight) |
return; /* size is as expected */ |
drawBuffer->Width = bufWidth; |
drawBuffer->Height = bufHeight; |
newCtx->Driver.ResizeBuffers( drawBuffer ); |
} |
if (readBuffer != drawBuffer && |
readBuffer->Width == 0 && readBuffer->Height == 0) { |
/* get initial window size */ |
GLuint bufWidth, bufHeight; |
/* ask device driver for size of output buffer */ |
(*newCtx->Driver.GetBufferSize)( readBuffer, &bufWidth, &bufHeight ); |
if (readBuffer->Width == bufWidth && readBuffer->Height == bufHeight) |
return; /* size is as expected */ |
readBuffer->Width = bufWidth; |
readBuffer->Height = bufHeight; |
newCtx->Driver.ResizeBuffers( readBuffer ); |
} |
} |
/* This is only for T&L - a bit out of place, or misnamed (BP) */ |
if (newCtx->Driver.MakeCurrent) |
newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); |
/* We can use this to help debug user's problems. Tell them to set |
* the MESA_INFO env variable before running their app. Then the |
* first time each context is made current we'll print some useful |
* information. |
*/ |
if (newCtx->FirstTimeCurrent) { |
if (_mesa_getenv("MESA_INFO")) { |
print_info(); |
} |
newCtx->FirstTimeCurrent = GL_FALSE; |
} |
} |
} |
/* |
* 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 |
*/ |
GLcontext * |
_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. |
*/ |
struct _glapi_table * |
_mesa_get_dispatch(GLcontext *ctx) |
{ |
return ctx->CurrentDispatch; |
} |
/**********************************************************************/ |
/***** Miscellaneous functions *****/ |
/**********************************************************************/ |
/* |
* Record the given error code and call the driver's Error function if defined. |
* This is called via _mesa_error(). |
*/ |
void |
_mesa_record_error( GLcontext *ctx, GLenum error ) |
{ |
if (!ctx) |
return; |
if (ctx->ErrorValue == GL_NO_ERROR) { |
ctx->ErrorValue = error; |
} |
/* Call device driver's error handler, if any. This is used on the Mac. */ |
if (ctx->Driver.Error) { |
(*ctx->Driver.Error)( ctx ); |
} |
} |
void |
_mesa_Finish( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->Driver.Finish) { |
(*ctx->Driver.Finish)( ctx ); |
} |
} |
void |
_mesa_Flush( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->Driver.Flush) { |
(*ctx->Driver.Flush)( ctx ); |
} |
} |
const char *_mesa_prim_name[GL_POLYGON+4] = { |
"GL_POINTS", |
"GL_LINES", |
"GL_LINE_LOOP", |
"GL_LINE_STRIP", |
"GL_TRIANGLES", |
"GL_TRIANGLE_STRIP", |
"GL_TRIANGLE_FAN", |
"GL_QUADS", |
"GL_QUAD_STRIP", |
"GL_POLYGON", |
"outside begin/end", |
"inside unkown primitive", |
"unknown state" |
}; |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse.h |
---|
0,0 → 1,39 |
/* $Id: sse.h,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* PentiumIII-SIMD (SSE) optimizations contributed by |
* Andre Werthmann <wertmann@cs.uni-potsdam.de> |
*/ |
#ifndef __SSE_H__ |
#define __SSE_H__ |
#include "math/m_xform.h" |
void _mesa_init_sse_transform_asm( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/common_x86_features.h |
---|
0,0 → 1,80 |
/* $Id: common_x86_features.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* x86 CPUID feature information. The raw data is returned by |
* _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* |
* helper macros. |
* |
* Gareth Hughes |
*/ |
#ifndef __COMMON_X86_FEATURES_H__ |
#define __COMMON_X86_FEATURES_H__ |
/* Capabilities of CPUs |
*/ |
#define X86_FEATURE_FPU 0x00000001 |
#define X86_FEATURE_VME 0x00000002 |
#define X86_FEATURE_DE 0x00000004 |
#define X86_FEATURE_PSE 0x00000008 |
#define X86_FEATURE_TSC 0x00000010 |
#define X86_FEATURE_MSR 0x00000020 |
#define X86_FEATURE_PAE 0x00000040 |
#define X86_FEATURE_MCE 0x00000080 |
#define X86_FEATURE_CX8 0x00000100 |
#define X86_FEATURE_APIC 0x00000200 |
#define X86_FEATURE_10 0x00000400 |
#define X86_FEATURE_SEP 0x00000800 |
#define X86_FEATURE_MTRR 0x00001000 |
#define X86_FEATURE_PGE 0x00002000 |
#define X86_FEATURE_MCA 0x00004000 |
#define X86_FEATURE_CMOV 0x00008000 |
#define X86_FEATURE_PAT 0x00010000 |
#define X86_FEATURE_PSE36 0x00020000 |
#define X86_FEATURE_18 0x00040000 |
#define X86_FEATURE_19 0x00080000 |
#define X86_FEATURE_20 0x00100000 |
#define X86_FEATURE_21 0x00200000 |
#define X86_FEATURE_MMXEXT 0x00400000 |
#define X86_FEATURE_MMX 0x00800000 |
#define X86_FEATURE_FXSR 0x01000000 |
#define X86_FEATURE_XMM 0x02000000 |
#define X86_FEATURE_XMM2 0x04000000 |
#define X86_FEATURE_27 0x08000000 |
#define X86_FEATURE_28 0x10000000 |
#define X86_FEATURE_29 0x20000000 |
#define X86_FEATURE_3DNOWEXT 0x40000000 |
#define X86_FEATURE_3DNOW 0x80000000 |
#define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) |
#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) |
#define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) |
#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) |
#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) |
#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86_xform2.s |
---|
0,0 → 1,563 |
/* $Id: x86_xform2.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* NOTE: Avoid using spaces in between '(' ')' and arguments, especially |
* with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces |
* in there will break the build on some platforms. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FP_ONE 1065353216 |
#define FP_ZERO 0 |
#define SRC0 REGOFF(0, ESI) |
#define SRC1 REGOFF(4, ESI) |
#define SRC2 REGOFF(8, ESI) |
#define SRC3 REGOFF(12, ESI) |
#define DST0 REGOFF(0, EDI) |
#define DST1 REGOFF(4, EDI) |
#define DST2 REGOFF(8, EDI) |
#define DST3 REGOFF(12, EDI) |
#define MAT0 REGOFF(0, EDX) |
#define MAT1 REGOFF(4, EDX) |
#define MAT2 REGOFF(8, EDX) |
#define MAT3 REGOFF(12, EDX) |
#define MAT4 REGOFF(16, EDX) |
#define MAT5 REGOFF(20, EDX) |
#define MAT6 REGOFF(24, EDX) |
#define MAT7 REGOFF(28, EDX) |
#define MAT8 REGOFF(32, EDX) |
#define MAT9 REGOFF(36, EDX) |
#define MAT10 REGOFF(40, EDX) |
#define MAT11 REGOFF(44, EDX) |
#define MAT12 REGOFF(48, EDX) |
#define MAT13 REGOFF(52, EDX) |
#define MAT14 REGOFF(56, EDX) |
#define MAT15 REGOFF(60, EDX) |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_general ) |
GLNAME( _mesa_x86_transform_points2_general ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_gr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p2_gr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC0 ) /* F7 F6 F5 F4 */ |
FMUL_S( MAT3 ) |
FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT7 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FXCH( ST(3) ) /* F4 F6 F5 F7 */ |
FADD_S( MAT12 ) |
FXCH( ST(2) ) /* F5 F6 F4 F7 */ |
FADD_S( MAT13 ) |
FXCH( ST(1) ) /* F6 F5 F4 F7 */ |
FADD_S( MAT14 ) |
FXCH( ST(3) ) /* F7 F5 F4 F6 */ |
FADD_S( MAT15 ) |
FXCH( ST(2) ) /* F4 F5 F7 F6 */ |
FSTP_S( DST0 ) /* F5 F7 F6 */ |
FSTP_S( DST1 ) /* F7 F6 */ |
FXCH( ST(1) ) /* F6 F7 */ |
FSTP_S( DST2 ) /* F7 */ |
FSTP_S( DST3 ) /* */ |
LLBL(x86_p2_gr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_gr_loop) ) |
LLBL(x86_p2_gr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_perspective ) |
GLNAME( _mesa_x86_transform_points2_perspective ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_pr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
MOV_L( MAT14, EBX ) |
ALIGNTEXT16 |
LLBL(x86_p2_pr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F1 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F4 F1 */ |
FSTP_S( DST0 ) /* F1 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
MOV_L( CONST(FP_ZERO), DST3 ) |
LLBL(x86_p2_pr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_pr_loop) ) |
LLBL(x86_p2_pr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_3d ) |
GLNAME( _mesa_x86_transform_points2_3d ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_3dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p2_3dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC1 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FADD_S( MAT12 ) |
FXCH( ST(1) ) /* F5 F4 F6 */ |
FADD_S( MAT13 ) |
FXCH( ST(2) ) /* F6 F4 F5 */ |
FADD_S( MAT14 ) |
FXCH( ST(1) ) /* F4 F6 F5 */ |
FSTP_S( DST0 ) /* F6 F5 */ |
FXCH( ST(1) ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
LLBL(x86_p2_3dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_3dr_loop) ) |
LLBL(x86_p2_3dr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_3d_no_rot ) |
GLNAME( _mesa_x86_transform_points2_3d_no_rot ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_3dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
MOV_L( MAT14, EBX ) |
ALIGNTEXT16 |
LLBL(x86_p2_3dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F1 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F4 F1 */ |
FADD_S( MAT12 ) |
FLD_S( MAT13 ) /* F5 F4 F1 */ |
FXCH( ST(2) ) /* F1 F4 F5 */ |
FADDP( ST0, ST(2) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
LLBL(x86_p2_3dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_3dnrr_loop) ) |
LLBL(x86_p2_3dnrr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_2d ) |
GLNAME( _mesa_x86_transform_points2_2d ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_2dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p2_2dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC1 ) /* F0 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F0 F1 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F1 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F5 F4 */ |
FXCH( ST(1) ) /* F4 F5 */ |
FADD_S( MAT12 ) |
FXCH( ST(1) ) /* F5 F4 */ |
FADD_S( MAT13 ) |
FXCH( ST(1) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
LLBL(x86_p2_2dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_2dr_loop) ) |
LLBL(x86_p2_2dr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME( _mesa_x86_transform_points2_2d_no_rot ) |
GLNAME( _mesa_x86_transform_points2_2d_no_rot ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_2dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p2_2dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F1 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F4 F1 */ |
FADD_S( MAT12 ) |
FLD_S( MAT13 ) /* F5 F4 F1 */ |
FXCH( ST(2) ) /* F1 F4 F5 */ |
FADDP( ST0, ST(2) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
LLBL(x86_p2_2dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_2dnrr_loop) ) |
LLBL(x86_p2_2dnrr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points2_identity ) |
GLNAME( _mesa_x86_transform_points2_identity ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p2_ir_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
CMP_L( ESI, EDI ) |
JE( LLBL(x86_p2_ir_done) ) |
ALIGNTEXT16 |
LLBL(x86_p2_ir_loop): |
MOV_L( SRC0, EBX ) |
MOV_L( SRC1, EDX ) |
MOV_L( EBX, DST0 ) |
MOV_L( EDX, DST1 ) |
LLBL(x86_p2_ir_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p2_ir_loop) ) |
LLBL(x86_p2_ir_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
/shark/tags/rel_0_4/ports/mesa/src/x86/common_x86_asm.h |
---|
0,0 → 1,64 |
/* $Id: common_x86_asm.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Check CPU capabilities & initialize optimized funtions for this particular |
* processor. |
* |
* Written by Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> |
* Changed by Andre Werthmann <wertmann@cs.uni-potsdam.de> for using the |
* new Katmai functions |
* |
* Reimplemented by Gareth Hughes in a more |
* future-proof manner, based on code in the Linux kernel. |
*/ |
#ifndef __COMMON_X86_ASM_H__ |
#define __COMMON_X86_ASM_H__ |
/* Do not reference mtypes.h from this file. |
*/ |
#include "common_x86_features.h" |
#ifdef HAVE_CONFIG_H |
#include "conf.h" |
#endif |
#ifdef USE_X86_ASM |
#include "x86.h" |
#ifdef USE_3DNOW_ASM |
#include "3dnow.h" |
#endif |
#ifdef USE_SSE_ASM |
#include "sse.h" |
#endif |
#endif |
extern int _mesa_x86_cpu_features; |
extern void _mesa_init_all_x86_transform_asm( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86_xform3.s |
---|
0,0 → 1,633 |
/* $Id: x86_xform3.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* NOTE: Avoid using spaces in between '(' ')' and arguments, especially |
* with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces |
* in there will break the build on some platforms. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FP_ONE 1065353216 |
#define FP_ZERO 0 |
#define SRC0 REGOFF(0, ESI) |
#define SRC1 REGOFF(4, ESI) |
#define SRC2 REGOFF(8, ESI) |
#define SRC3 REGOFF(12, ESI) |
#define DST0 REGOFF(0, EDI) |
#define DST1 REGOFF(4, EDI) |
#define DST2 REGOFF(8, EDI) |
#define DST3 REGOFF(12, EDI) |
#define MAT0 REGOFF(0, EDX) |
#define MAT1 REGOFF(4, EDX) |
#define MAT2 REGOFF(8, EDX) |
#define MAT3 REGOFF(12, EDX) |
#define MAT4 REGOFF(16, EDX) |
#define MAT5 REGOFF(20, EDX) |
#define MAT6 REGOFF(24, EDX) |
#define MAT7 REGOFF(28, EDX) |
#define MAT8 REGOFF(32, EDX) |
#define MAT9 REGOFF(36, EDX) |
#define MAT10 REGOFF(40, EDX) |
#define MAT11 REGOFF(44, EDX) |
#define MAT12 REGOFF(48, EDX) |
#define MAT13 REGOFF(52, EDX) |
#define MAT14 REGOFF(56, EDX) |
#define MAT15 REGOFF(60, EDX) |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_general ) |
GLNAME( _mesa_x86_transform_points3_general ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_gr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_gr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC0 ) /* F7 F6 F5 F4 */ |
FMUL_S( MAT3 ) |
FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT7 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT10 ) |
FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT11 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FXCH( ST(3) ) /* F4 F6 F5 F7 */ |
FADD_S( MAT12 ) |
FXCH( ST(2) ) /* F5 F6 F4 F7 */ |
FADD_S( MAT13 ) |
FXCH( ST(1) ) /* F6 F5 F4 F7 */ |
FADD_S( MAT14 ) |
FXCH( ST(3) ) /* F7 F5 F4 F6 */ |
FADD_S( MAT15 ) |
FXCH( ST(2) ) /* F4 F5 F7 F6 */ |
FSTP_S( DST0 ) /* F5 F7 F6 */ |
FSTP_S( DST1 ) /* F7 F6 */ |
FXCH( ST(1) ) /* F6 F7 */ |
FSTP_S( DST2 ) /* F7 */ |
FSTP_S( DST3 ) /* */ |
LLBL(x86_p3_gr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_gr_loop) ) |
LLBL(x86_p3_gr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_perspective ) |
GLNAME( _mesa_x86_transform_points3_perspective ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_pr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_pr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC2 ) /* F0 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F5 F4 */ |
FMUL_S( MAT10 ) |
FXCH( ST(2) ) /* F0 F1 F2 F5 F4 */ |
FADDP( ST0, ST(4) ) /* F1 F2 F5 F4 */ |
FADDP( ST0, ST(2) ) /* F2 F5 F4 */ |
FLD_S( MAT14 ) /* F6 F2 F5 F4 */ |
FXCH( ST(1) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
MOV_L( SRC2, EBX ) |
XOR_L( CONST(-2147483648), EBX )/* change sign */ |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FSTP_S( DST0 ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
MOV_L( EBX, DST3 ) |
LLBL(x86_p3_pr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_pr_loop) ) |
LLBL(x86_p3_pr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_3d ) |
GLNAME( _mesa_x86_transform_points3_3d ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_3dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_3dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC1 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
FLD_S( SRC2 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT10 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FADD_S( MAT12 ) |
FXCH( ST(1) ) /* F5 F4 F6 */ |
FADD_S( MAT13 ) |
FXCH( ST(2) ) /* F6 F4 F5 */ |
FADD_S( MAT14 ) |
FXCH( ST(1) ) /* F4 F6 F5 */ |
FSTP_S( DST0 ) /* F6 F5 */ |
FXCH( ST(1) ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
LLBL(x86_p3_3dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_3dr_loop) ) |
LLBL(x86_p3_3dr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_3d_no_rot ) |
GLNAME( _mesa_x86_transform_points3_3d_no_rot ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_3dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_3dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F1 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC2 ) /* F2 F1 F4 */ |
FMUL_S( MAT10 ) |
FXCH( ST(2) ) /* F4 F1 F2 */ |
FADD_S( MAT12 ) |
FLD_S( MAT13 ) /* F5 F4 F1 F2 */ |
FXCH( ST(2) ) /* F1 F4 F5 F2 */ |
FADDP( ST0, ST(2) ) /* F4 F5 F2 */ |
FLD_S( MAT14 ) /* F6 F4 F5 F2 */ |
FXCH( ST(3) ) /* F2 F4 F5 F6 */ |
FADDP( ST0, ST(3) ) /* F4 F5 F6 */ |
FSTP_S( DST0 ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
LLBL(x86_p3_3dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_3dnrr_loop) ) |
LLBL(x86_p3_3dnrr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_2d ) |
GLNAME( _mesa_x86_transform_points3_2d ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_2dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_2dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC1 ) /* F0 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F0 F1 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F1 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F5 F4 */ |
FXCH( ST(1) ) /* F4 F5 */ |
FADD_S( MAT12 ) |
FXCH( ST(1) ) /* F5 F4 */ |
FADD_S( MAT13 ) |
MOV_L( SRC2, EBX ) |
FXCH( ST(1) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
LLBL(x86_p3_2dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_2dr_loop) ) |
LLBL(x86_p3_2dr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_2d_no_rot ) |
GLNAME( _mesa_x86_transform_points3_2d_no_rot ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_2dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p3_2dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F1 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F4 F1 */ |
FADD_S( MAT12 ) |
FLD_S( MAT13 ) /* F5 F4 F1 */ |
FXCH( ST(2) ) /* F1 F4 F5 */ |
FADDP( ST0, ST(2) ) /* F4 F5 */ |
MOV_L( SRC2, EBX ) |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
LLBL(x86_p3_2dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_2dnrr_loop) ) |
LLBL(x86_p3_2dnrr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points3_identity ) |
GLNAME(_mesa_x86_transform_points3_identity ): |
#define FRAME_OFFSET 16 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
PUSH_L( EBP ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p3_ir_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
CMP_L( ESI, EDI ) |
JE( LLBL(x86_p3_ir_done) ) |
ALIGNTEXT16 |
LLBL(x86_p3_ir_loop): |
#if 1 |
MOV_L( SRC0, EBX ) |
MOV_L( SRC1, EBP ) |
MOV_L( SRC2, EDX ) |
MOV_L( EBX, DST0 ) |
MOV_L( EBP, DST1 ) |
MOV_L( EDX, DST2 ) |
#else |
FLD_S( SRC0 ) |
FLD_S( SRC1 ) |
FLD_S( SRC2 ) |
FSTP_S( DST2 ) |
FSTP_S( DST1 ) |
FSTP_S( DST0 ) |
#endif |
LLBL(x86_p3_ir_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p3_ir_loop) ) |
LLBL(x86_p3_ir_done): |
POP_L( EBP ) |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86_xform4.s |
---|
0,0 → 1,666 |
/* $Id: x86_xform4.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* NOTE: Avoid using spaces in between '(' ')' and arguments, especially |
* with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces |
* in there will break the build on some platforms. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FP_ONE 1065353216 |
#define FP_ZERO 0 |
#define SRC0 REGOFF(0, ESI) |
#define SRC1 REGOFF(4, ESI) |
#define SRC2 REGOFF(8, ESI) |
#define SRC3 REGOFF(12, ESI) |
#define DST0 REGOFF(0, EDI) |
#define DST1 REGOFF(4, EDI) |
#define DST2 REGOFF(8, EDI) |
#define DST3 REGOFF(12, EDI) |
#define MAT0 REGOFF(0, EDX) |
#define MAT1 REGOFF(4, EDX) |
#define MAT2 REGOFF(8, EDX) |
#define MAT3 REGOFF(12, EDX) |
#define MAT4 REGOFF(16, EDX) |
#define MAT5 REGOFF(20, EDX) |
#define MAT6 REGOFF(24, EDX) |
#define MAT7 REGOFF(28, EDX) |
#define MAT8 REGOFF(32, EDX) |
#define MAT9 REGOFF(36, EDX) |
#define MAT10 REGOFF(40, EDX) |
#define MAT11 REGOFF(44, EDX) |
#define MAT12 REGOFF(48, EDX) |
#define MAT13 REGOFF(52, EDX) |
#define MAT14 REGOFF(56, EDX) |
#define MAT15 REGOFF(60, EDX) |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_general ) |
GLNAME( _mesa_x86_transform_points4_general ): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_gr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_gr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC0 ) /* F7 F6 F5 F4 */ |
FMUL_S( MAT3 ) |
FLD_S( SRC1 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FLD_S( SRC1 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT7 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FLD_S( SRC2 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT10 ) |
FLD_S( SRC2 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT11 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FLD_S( SRC3 ) /* F0 F7 F6 F5 F4 */ |
FMUL_S( MAT12 ) |
FLD_S( SRC3 ) /* F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT13 ) |
FLD_S( SRC3 ) /* F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT14 ) |
FLD_S( SRC3 ) /* F3 F2 F1 F0 F7 F6 F5 F4 */ |
FMUL_S( MAT15 ) |
FXCH( ST(3) ) /* F0 F2 F1 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(7) ) /* F2 F1 F3 F7 F6 F5 F4 */ |
FXCH( ST(1) ) /* F1 F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F2 F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F3 F7 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F7 F6 F5 F4 */ |
FXCH( ST(3) ) /* F4 F6 F5 F7 */ |
FSTP_S( DST0 ) /* F6 F5 F7 */ |
FXCH( ST(1) ) /* F5 F6 F7 */ |
FSTP_S( DST1 ) /* F6 F7 */ |
FSTP_S( DST2 ) /* F7 */ |
FSTP_S( DST3 ) /* */ |
LLBL(x86_p4_gr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_gr_loop) ) |
LLBL(x86_p4_gr_done): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_perspective ) |
GLNAME( _mesa_x86_transform_points4_perspective ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_pr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_pr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC2 ) /* F0 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F6 F1 F0 F5 F4 */ |
FMUL_S( MAT10 ) |
FXCH( ST(2) ) /* F0 F1 F6 F5 F4 */ |
FADDP( ST0, ST(4) ) /* F1 F6 F5 F4 */ |
FADDP( ST0, ST(2) ) /* F6 F5 F4 */ |
FLD_S( SRC3 ) /* F2 F6 F5 F4 */ |
FMUL_S( MAT14 ) |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
MOV_L( SRC2, EBX ) |
XOR_L( CONST(-2147483648), EBX )/* change sign */ |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FSTP_S( DST0 ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
MOV_L( EBX, DST3 ) |
LLBL(x86_p4_pr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_pr_loop) ) |
LLBL(x86_p4_pr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_3d ) |
GLNAME( _mesa_x86_transform_points4_3d ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_3dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_3dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC0 ) /* F6 F5 F4 */ |
FMUL_S( MAT2 ) |
FLD_S( SRC1 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC1 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT6 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
FLD_S( SRC2 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT8 ) |
FLD_S( SRC2 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT9 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT10 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
FLD_S( SRC3 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT12 ) |
FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT13 ) |
FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT14 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
MOV_L( SRC3, EBX ) |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FSTP_S( DST0 ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
MOV_L( EBX, DST3 ) |
LLBL(x86_p4_3dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_3dr_loop) ) |
LLBL(x86_p4_3dr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_x86_transform_points4_3d_no_rot) |
GLNAME(_mesa_x86_transform_points4_3d_no_rot): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_3dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_3dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC2 ) /* F6 F5 F4 */ |
FMUL_S( MAT10 ) |
FLD_S( SRC3 ) /* F0 F6 F5 F4 */ |
FMUL_S( MAT12 ) |
FLD_S( SRC3 ) /* F1 F0 F6 F5 F4 */ |
FMUL_S( MAT13 ) |
FLD_S( SRC3 ) /* F2 F1 F0 F6 F5 F4 */ |
FMUL_S( MAT14 ) |
FXCH( ST(2) ) /* F0 F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(5) ) /* F1 F2 F6 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F2 F6 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F6 F5 F4 */ |
MOV_L( SRC3, EBX ) |
FXCH( ST(2) ) /* F4 F5 F6 */ |
FSTP_S( DST0 ) /* F5 F6 */ |
FSTP_S( DST1 ) /* F6 */ |
FSTP_S( DST2 ) /* */ |
MOV_L( EBX, DST3 ) |
LLBL(x86_p4_3dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_3dnrr_loop) ) |
LLBL(x86_p4_3dnrr_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_2d ) |
GLNAME( _mesa_x86_transform_points4_2d ): |
#define FRAME_OFFSET 16 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
PUSH_L( EBP ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_2dr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_2dr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC0 ) /* F5 F4 */ |
FMUL_S( MAT1 ) |
FLD_S( SRC1 ) /* F0 F5 F4 */ |
FMUL_S( MAT4 ) |
FLD_S( SRC1 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT5 ) |
FXCH( ST(1) ) /* F0 F1 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F1 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F5 F4 */ |
FLD_S( SRC3 ) /* F0 F5 F4 */ |
FMUL_S( MAT12 ) |
FLD_S( SRC3 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT13 ) |
FXCH( ST(1) ) /* F0 F1 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F1 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F5 F4 */ |
MOV_L( SRC2, EBX ) |
MOV_L( SRC3, EBP ) |
FXCH( ST(1) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
MOV_L( EBP, DST3 ) |
LLBL(x86_p4_2dr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_2dr_loop) ) |
LLBL(x86_p4_2dr_done): |
POP_L( EBP ) |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_2d_no_rot ) |
GLNAME( _mesa_x86_transform_points4_2d_no_rot ): |
#define FRAME_OFFSET 16 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
PUSH_L( EBP ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_2dnrr_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
ALIGNTEXT16 |
LLBL(x86_p4_2dnrr_loop): |
FLD_S( SRC0 ) /* F4 */ |
FMUL_S( MAT0 ) |
FLD_S( SRC1 ) /* F5 F4 */ |
FMUL_S( MAT5 ) |
FLD_S( SRC3 ) /* F0 F5 F4 */ |
FMUL_S( MAT12 ) |
FLD_S( SRC3 ) /* F1 F0 F5 F4 */ |
FMUL_S( MAT13 ) |
FXCH( ST(1) ) /* F0 F1 F5 F4 */ |
FADDP( ST0, ST(3) ) /* F1 F5 F4 */ |
FADDP( ST0, ST(1) ) /* F5 F4 */ |
MOV_L( SRC2, EBX ) |
MOV_L( SRC3, EBP ) |
FXCH( ST(1) ) /* F4 F5 */ |
FSTP_S( DST0 ) /* F5 */ |
FSTP_S( DST1 ) /* */ |
MOV_L( EBX, DST2 ) |
MOV_L( EBP, DST3 ) |
LLBL(x86_p4_2dnrr_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_2dnrr_loop) ) |
LLBL(x86_p4_2dnrr_done): |
POP_L( EBP ) |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_transform_points4_identity ) |
GLNAME( _mesa_x86_transform_points4_identity ): |
#define FRAME_OFFSET 12 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBX ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) |
JZ( LLBL(x86_p4_ir_done) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
SHL_L( CONST(4), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDI, ECX ) |
CMP_L( ESI, EDI ) |
JE( LLBL(x86_p4_ir_done) ) |
ALIGNTEXT16 |
LLBL(x86_p4_ir_loop): |
MOV_L( SRC0, EBX ) |
MOV_L( SRC1, EDX ) |
MOV_L( EBX, DST0 ) |
MOV_L( EDX, DST1 ) |
MOV_L( SRC2, EBX ) |
MOV_L( SRC3, EDX ) |
MOV_L( EBX, DST2 ) |
MOV_L( EDX, DST3 ) |
LLBL(x86_p4_ir_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(x86_p4_ir_loop) ) |
LLBL(x86_p4_ir_done): |
POP_L( EBX ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow_xform1.s |
---|
0,0 → 1,423 |
/* $Id: 3dnow_xform1.s,v 1.1 2003-03-13 12:11:47 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FRAME_OFFSET 4 |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_general ) |
GLNAME( _mesa_3dnow_transform_points1_general ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPGR_3 ) ) |
MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ |
MOVQ ( REGOFF(8, ECX), MM1 ) /* m03 | m02 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
MOVQ ( REGOFF(56, ECX), MM3 ) /* m33 | m32 */ |
ALIGNTEXT16 |
LLBL( G3TPGR_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ |
MOVQ ( MM4, MM5 ) /* x0 | x0 */ |
PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ |
PFMUL ( MM1, MM5 ) /* x0*m03 | x0*m02 */ |
PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ |
PFADD ( MM3, MM5 ) /* x0*m03+m33 | x0*m02+m32 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVQ ( MM5, REGOFF(8, EDX) ) /* write r3, r2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPGR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_identity ) |
GLNAME( _mesa_3dnow_transform_points1_identity ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(1), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPIR_4) ) |
ALIGNTEXT16 |
LLBL( G3TPIR_3 ): |
MOVD ( REGIND(EAX), MM0 ) /* | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
MOVD ( MM0, REGIND(EDX) ) /* | r0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPIR_4 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3NRR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TP3NRR_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
PFMUL ( MM0, MM4 ) /* | x0*m00 */ |
PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3NRR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective ) |
GLNAME( _mesa_3dnow_transform_points1_perspective ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPPR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TPPR_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* 0 | x0 */ |
PFMUL ( MM0, MM4 ) /* 0 | x0*m00 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPPR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_2d ) |
GLNAME( _mesa_3dnow_transform_points1_2d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2R_3 ) ) |
MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2R_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ |
PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ |
PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2R_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2NRR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2NRR_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PFMUL ( MM0, MM4 ) /* | x0*m00 */ |
PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2NRR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points1_3d ) |
GLNAME( _mesa_3dnow_transform_points1_3d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(4, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3R_3 ) ) |
MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ |
MOVD ( REGOFF(8, ECX), MM1 ) /* | m02 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TP3R_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ |
MOVQ ( MM4, MM5 ) /* | x0 */ |
PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ |
PFMUL ( MM1, MM5 ) /* | x0*m02 */ |
PFADD ( MM2, MM4 ) /* x0*m01+m31 | x0*m00+m30 */ |
PFADD ( MM3, MM5 ) /* | x0*m02+m32 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVD ( MM5, REGOFF(8, EDX) ) /* write r2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3R_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/mmx.h |
---|
0,0 → 1,51 |
/* $Id: mmx.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef ASM_MMX_H |
#define ASM_MMX_H |
extern void _ASMAPI |
_mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLubyte rgba[][4], const GLubyte dest[][4] ); |
extern void _ASMAPI |
_mesa_mmx_blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLubyte rgba[][4], const GLubyte dest[][4] ); |
extern void _ASMAPI |
_mesa_mmx_blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLubyte rgba[][4], const GLubyte dest[][4] ); |
extern void _ASMAPI |
_mesa_mmx_blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLubyte rgba[][4], const GLubyte dest[][4] ); |
extern void _ASMAPI |
_mesa_mmx_blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], |
GLubyte rgba[][4], const GLubyte dest[][4] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow_xform2.s |
---|
0,0 → 1,464 |
/* $Id: 3dnow_xform2.s,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FRAME_OFFSET 4 |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_general ) |
GLNAME( _mesa_3dnow_transform_points2_general ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPGR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ |
MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ |
MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ |
MOVD ( REGOFF(12, ECX), MM3 ) /* | m03 */ |
PUNPCKLDQ ( REGOFF(28, ECX), MM3 ) /* m13 | m03 */ |
MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ |
MOVQ ( REGOFF(56, ECX), MM5 ) /* m33 | m32 */ |
ALIGNTEXT16 |
LLBL( G3TPGR_2 ): |
MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ |
MOVQ ( MM6, MM7 ) /* x1 | x0 */ |
PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ |
PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ |
PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ |
PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ |
MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ |
MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ |
MOVQ ( MM6, MM7 ) /* x1 | x0 */ |
PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ |
PFMUL ( MM3, MM7 ) /* x1*m13 | x0*m03 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PFACC ( MM7, MM6 ) /* x0*m03+x1*m13 | x0*x02+x1*m12 */ |
PFADD ( MM5, MM6 ) /* x0*...*m13+m33 | x0*...*m12+m32 */ |
MOVQ ( MM6, REGOFF(8, EDX) ) /* write r3, r2 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPGR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPGR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective ) |
GLNAME( _mesa_3dnow_transform_points2_perspective ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPPR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TPPR_2 ): |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVQ ( MM3, REGOFF(8, EDX) ) /* write r2 (=m32), r3 (=0) */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPPR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPPR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_3d ) |
GLNAME( _mesa_3dnow_transform_points2_3d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3R_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ |
MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ |
MOVD ( REGOFF(8, ECX), MM2 ) /* | m02 */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM2 ) /* m12 | m02 */ |
MOVQ ( REGOFF(48, ECX), MM4 ) /* m31 | m30 */ |
MOVD ( REGOFF(56, ECX), MM5 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TP3R_2 ): |
MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ |
MOVQ ( MM6, MM7 ) /* x1 | x0 */ |
PFMUL ( MM0, MM6 ) /* x1*m10 | x0*m00 */ |
PFMUL ( MM1, MM7 ) /* x1*m11 | x0*m01 */ |
PFACC ( MM7, MM6 ) /* x0*m01+x1*m11 | x0*x00+x1*m10 */ |
PFADD ( MM4, MM6 ) /* x0*...*m11+m31 | x0*...*m10+m30 */ |
MOVQ ( MM6, REGIND(EDX) ) /* write r1, r0 */ |
MOVQ ( REGIND(EAX), MM6 ) /* x1 | x0 */ |
MOVQ ( MM6, MM7 ) /* x1 | x0 */ |
PFMUL ( MM2, MM6 ) /* x1*m12 | x0*m02 */ |
PFACC ( MM7, MM6 ) /* ***trash*** | x0*x02+x1*m12 */ |
PFADD ( MM5, MM6 ) /* ***trash*** | x0*...*m12+m32 */ |
MOVD ( MM6, REGOFF(8, EDX) ) /* write r2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3R_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3R_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3 ), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3NRR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TP3NRR_2 ): |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PFADD ( MM2, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
MOVD ( MM3, REGOFF(8, EDX) ) /* write r2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3NRR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_2d ) |
GLNAME( _mesa_3dnow_transform_points2_2d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2R_3 ) ) |
MOVQ ( REGIND(ECX), MM0 ) /* m01 | m00 */ |
MOVQ ( REGOFF(16, ECX), MM1 ) /* m11 | m10 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2R_2 ): |
MOVD ( REGIND(EAX), MM4 ) /* | x0 */ |
MOVD ( REGOFF(4, EAX), MM5 ) /* | x1 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x0 | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PFMUL ( MM0, MM4 ) /* x0*m01 | x0*m00 */ |
PUNPCKLDQ ( MM5, MM5 ) /* x1 | x1 */ |
PFMUL ( MM1, MM5 ) /* x1*m11 | x1*m10 */ |
PFADD ( MM2, MM4 ) /* x...x1*m11+31 | x0*..*m10+m30 */ |
PFADD ( MM5, MM4 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2R_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2NRR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2NRR_2 ): |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PFADD ( MM2, MM4 ) /* m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r1, r0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2NRR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points2_identity ) |
GLNAME( _mesa_3dnow_transform_points2_identity ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(2), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPIR_3 ) ) |
ALIGNTEXT16 |
LLBL( G3TPIR_3 ): |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
MOVQ ( MM0, REGIND(EDX) ) /* r1 | r0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPIR_3 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPIR_4 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/clip_args.h |
---|
0,0 → 1,60 |
/* $Id: clip_args.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Clip test function interface for assembly code. Simply define |
* FRAME_OFFSET to the number of bytes pushed onto the stack before |
* using the ARG_* argument macros. |
* |
* Gareth Hughes |
*/ |
#ifndef __CLIP_ARGS_H__ |
#define __CLIP_ARGS_H__ |
/* |
* Offsets for clip_func arguments |
* |
* typedef GLvector4f *(*clip_func)( GLvector4f *clip_vec, |
* GLvector4f *proj_vec, |
* GLubyte clipMask[], |
* GLubyte *orMask, |
* GLubyte *andMask ); |
*/ |
#define OFFSET_SOURCE 4 |
#define OFFSET_DEST 8 |
#define OFFSET_CLIP 12 |
#define OFFSET_OR 16 |
#define OFFSET_AND 20 |
#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) |
#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) |
#define ARG_CLIP REGOFF(FRAME_OFFSET+OFFSET_CLIP, ESP) |
#define ARG_OR REGOFF(FRAME_OFFSET+OFFSET_OR, ESP) |
#define ARG_AND REGOFF(FRAME_OFFSET+OFFSET_AND, ESP) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow_xform3.s |
---|
0,0 → 1,548 |
/* $Id: 3dnow_xform3.s,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FRAME_OFFSET 4 |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_general ) |
GLNAME( _mesa_3dnow_transform_points3_general ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPGR_2 ) ) |
PREFETCHW ( REGIND(EDX) ) |
ALIGNTEXT16 |
LLBL( G3TPGR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM2 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( MM0, MM1 ) /* x1 | x0 */ |
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ |
PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ |
MOVQ ( MM2, MM5 ) /* x2 | x2 */ |
PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ |
PFMUL ( REGOFF(32, ECX), MM2 ) /* x2*m9 | x2*m8 */ |
MOVQ ( MM0, MM3 ) /* x0 | x0 */ |
PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ |
MOVQ ( MM1, MM4 ) /* x1 | x1 */ |
PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ |
PFADD ( REGOFF(48, ECX), MM2 ) /* x2*m9+m13 | x2*m8+m12 */ |
PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ |
PFADD ( REGOFF(56, ECX), MM5 ) /* x2*m11+m15 | x2*m10+m14 */ |
PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ |
PFMUL ( REGOFF(8, ECX), MM3 ) /* x0*m3 | x0*m2 */ |
PFADD ( MM1, MM2 ) /* r1 | r0 */ |
PFMUL ( REGOFF(24, ECX), MM4 ) /* x1*m7 | x1*m6 */ |
ADD_L ( CONST(16), EDX ) /* next output vertex */ |
PFADD ( MM3, MM4 ) /* x0*m3+x1*m7 | x0*m2+x1*m6 */ |
MOVQ ( MM2, REGOFF(-16, EDX) ) /* write r0, r1 */ |
PFADD ( MM4, MM5 ) /* r3 | r2 */ |
MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPGR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective ) |
GLNAME( _mesa_3dnow_transform_points3_perspective ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPPR_2 ) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCHW ( REGIND(EDX) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVQ ( REGOFF(32, ECX), MM1 ) /* m21 | m20 */ |
MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
ALIGNTEXT16 |
LLBL( G3TPPR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
PXOR ( MM7, MM7 ) /* 0 | 0 */ |
MOVQ ( MM5, MM6 ) /* | x2 */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PFSUB ( MM5, MM7 ) /* | -x2 */ |
PFMUL ( MM2, MM6 ) /* | x2*m22 */ |
PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFMUL ( MM1, MM5 ) /* x2*m21 | x2*m20 */ |
PFADD ( MM3, MM6 ) /* | x2*m22+m32 */ |
PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ |
MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVD ( MM6, REGOFF(-8, EDX) ) /* write r2 */ |
MOVD ( MM7, REGOFF(-4, EDX) ) /* write r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPPR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_3d ) |
GLNAME( _mesa_3dnow_transform_points3_3d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3R_2 ) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCH ( REGIND(EDX) ) |
MOVD ( REGOFF(8, ECX), MM7 ) /* | m2 */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM7 ) /* m6 | m2 */ |
ALIGNTEXT16 |
LLBL( G3TP3R_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( MM0, MM2 ) /* x1 | x0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PUNPCKLDQ ( MM2, MM2 ) /* x0 | x0 */ |
MOVQ ( MM0, MM3 ) /* x1 | x0 */ |
PFMUL ( REGIND(ECX), MM2 ) /* x0*m1 | x0*m0 */ |
PUNPCKHDQ ( MM3, MM3 ) /* x1 | x1 */ |
MOVQ ( MM1, MM4 ) /* | x2 */ |
PFMUL ( REGOFF(16, ECX), MM3 ) /* x1*m5 | x1*m4 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ |
PFADD ( MM2, MM3 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ |
PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ |
PFADD ( REGOFF(48, ECX), MM3 ) /* x0*m1+...+m11 | x0*m0+x1*m4+m12 */ |
PFMUL ( MM7, MM0 ) /* x1*m6 | x0*m2 */ |
PFADD ( MM4, MM3 ) /* r1 | r0 */ |
PFMUL ( REGOFF(40, ECX), MM1 ) /* | x2*m10 */ |
PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m14 | x2*m10 */ |
PFACC ( MM0, MM1 ) |
MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ |
PFACC ( MM1, MM1 ) /* | r2 */ |
MOVD ( MM1, REGOFF(-8, EDX) ) /* write r2 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3R_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3NRR_2 ) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCHW ( REGIND(EDX) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ |
PUNPCKLDQ ( MM2, MM2 ) /* m22 | m22 */ |
MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ |
MOVD ( REGOFF(56, ECX), MM3 ) /* | m32 */ |
PUNPCKLDQ ( MM3, MM3 ) /* m32 | m32 */ |
ALIGNTEXT16 |
LLBL( G3TP3NRR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCHW ( REGIND(EAX) ) |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ |
PFMUL ( MM2, MM5 ) /* | x2*m22 */ |
PFADD ( MM3, MM5 ) /* | x2*m22+m32 */ |
MOVQ ( MM4, REGIND(EDX) ) /* write r0, r1 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 */ |
JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3NRR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_2d ) |
GLNAME( _mesa_3dnow_transform_points3_2d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2R_3) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCHW ( REGIND(EDX) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ |
MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2R_2 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( MM3, MM4 ) /* x1 | x0 */ |
PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ |
PFACC ( MM4, MM3 ) /* x0*m00+x1*m10 | x0*m01+x1*m11 */ |
MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ |
PFADD ( MM2, MM3 ) /* x0*...*m10+m30 | x0*...*m11+m31 */ |
MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2R_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2R_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2NRR_2 ) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCHW ( REGIND(EDX) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2NRR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM5 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFADD ( MM1, MM4 ) /* x1*m11+m31 | x0*m00+m30 */ |
MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVD ( MM5, REGOFF(-8, EDX) ) /* write r2 (=x2) */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2NRR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points3_identity ) |
GLNAME( _mesa_3dnow_transform_points3_identity ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(3), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPIR_2 ) ) |
PREFETCHW ( REGIND(EDX) ) |
ALIGNTEXT16 |
LLBL( G3TPIR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ |
MOVD ( MM1, REGOFF(-8, EDX) ) /* | r2 */ |
JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPIR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow_xform4.s |
---|
0,0 → 1,557 |
/* $Id: 3dnow_xform4.s,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FRAME_OFFSET 4 |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_general ) |
GLNAME( _mesa_3dnow_transform_points4_general ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPGR_2 ) ) |
PREFETCHW ( REGIND(EDX) ) |
ALIGNTEXT16 |
LLBL( G3TPGR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM4 ) /* x3 | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( MM0, MM2 ) /* x1 | x0 */ |
MOVQ ( MM4, MM6 ) /* x3 | x2 */ |
PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ |
PUNPCKHDQ ( MM2, MM2 ) /* x1 | x1 */ |
MOVQ ( MM0, MM1 ) /* x0 | x0 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ |
MOVQ ( MM2, MM3 ) /* x1 | x1 */ |
PFMUL ( REGOFF(8, ECX), MM1 ) /* x0*m3 | x0*m2 */ |
PUNPCKLDQ ( MM4, MM4 ) /* x2 | x2 */ |
PFMUL ( REGOFF(16, ECX), MM2 ) /* x1*m5 | x1*m4 */ |
MOVQ ( MM4, MM5 ) /* x2 | x2 */ |
PFMUL ( REGOFF(24, ECX), MM3 ) /* x1*m7 | x1*m6 */ |
PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ |
PFMUL ( REGOFF(32, ECX), MM4 ) /* x2*m9 | x2*m8 */ |
MOVQ ( MM6, MM7 ) /* x3 | x3 */ |
PFMUL ( REGOFF(40, ECX), MM5 ) /* x2*m11 | x2*m10 */ |
PFADD ( MM0, MM2 ) |
PFMUL ( REGOFF(48, ECX), MM6 ) /* x3*m13 | x3*m12 */ |
PFADD ( MM1, MM3 ) |
PFMUL ( REGOFF(56, ECX), MM7 ) /* x3*m15 | x3*m14 */ |
PFADD ( MM4, MM6 ) |
PFADD ( MM5, MM7 ) |
PFADD ( MM2, MM6 ) |
PFADD ( MM3, MM7 ) |
MOVQ ( MM6, REGOFF(-16, EDX) ) |
MOVQ ( MM7, REGOFF(-8, EDX) ) |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPGR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPGR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective ) |
GLNAME( _mesa_3dnow_transform_points4_perspective ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPPR_2 ) ) |
PREFETCH ( REGIND(EAX) ) |
PREFETCHW ( REGIND(EDX) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVD ( REGOFF(40, ECX), MM1 ) /* | m22 */ |
PUNPCKLDQ ( REGOFF(56, ECX), MM1 ) /* m32 | m22 */ |
MOVQ ( REGOFF(32, ECX), MM2 ) /* m21 | m20 */ |
PXOR ( MM7, MM7 ) /* 0 | 0 */ |
ALIGNTEXT16 |
LLBL( G3TPPR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ |
MOVD ( REGOFF(8, EAX), MM3 ) /* | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ |
MOVQ ( MM5, MM6 ) /* x3 | x2 */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PUNPCKLDQ ( MM5, MM5 ) /* x2 | x2 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFMUL ( MM2, MM5 ) /* x2*m21 | x2*m20 */ |
PFSUBR ( MM7, MM3 ) /* | -x2 */ |
PFMUL ( MM1, MM6 ) /* x3*m32 | x2*m22 */ |
PFADD ( MM4, MM5 ) /* x1*m11+x2*m21 | x0*m00+x2*m20 */ |
PFACC ( MM3, MM6 ) /* -x2 | x2*m22+x3*m32 */ |
MOVQ ( MM5, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVQ ( MM6, REGOFF(-8, EDX) ) /* write r2, r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPPR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPPR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_3d ) |
GLNAME( _mesa_3dnow_transform_points4_3d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3R_2 ) ) |
MOVD ( REGOFF(8, ECX), MM6 ) /* | m2 */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM6 ) /* m6 | m2 */ |
MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ |
PUNPCKLDQ ( REGOFF(56, ECX), MM7 ) /* m14 | m10 */ |
ALIGNTEXT16 |
LLBL( G3TP3R_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
PREFETCH ( REGOFF(32, EAX) ) /* hopefully array is tightly packed */ |
MOVQ ( REGIND(EAX), MM2 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM3 ) /* x3 | x2 */ |
MOVQ ( MM2, MM0 ) /* x1 | x0 */ |
MOVQ ( MM3, MM4 ) /* x3 | x2 */ |
MOVQ ( MM0, MM1 ) /* x1 | x0 */ |
MOVQ ( MM4, MM5 ) /* x3 | x2 */ |
PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ |
PUNPCKHDQ ( MM1, MM1 ) /* x1 | x1 */ |
PFMUL ( REGIND(ECX), MM0 ) /* x0*m1 | x0*m0 */ |
PUNPCKLDQ ( MM3, MM3 ) /* x2 | x2 */ |
PFMUL ( REGOFF(16, ECX), MM1 ) /* x1*m5 | x1*m4 */ |
PUNPCKHDQ ( MM4, MM4 ) /* x3 | x3 */ |
PFMUL ( MM6, MM2 ) /* x1*m6 | x0*m2 */ |
PFADD ( MM0, MM1 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ |
PFMUL ( REGOFF(32, ECX), MM3 ) /* x2*m9 | x2*m8 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFMUL ( REGOFF(48, ECX), MM4 ) /* x3*m13 | x3*m12 */ |
PFADD ( MM1, MM3 ) /* x0*m1+..+x2*m9 | x0*m0+...+x2*m8 */ |
PFMUL ( MM7, MM5 ) /* x3*m14 | x2*m10 */ |
PFADD ( MM3, MM4 ) /* r1 | r0 */ |
PFACC ( MM2, MM5 ) /* x0*m2+x1*m6 | x2*m10+x3*m14 */ |
MOVD ( REGOFF(12, EAX), MM0 ) /* | x3 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PFACC ( MM0, MM5 ) /* r3 | r2 */ |
MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3R_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3R_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP3NRR_2 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVD ( REGOFF(40, ECX), MM2 ) /* | m22 */ |
PUNPCKLDQ ( REGOFF(56, ECX), MM2 ) /* m32 | m22 */ |
MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP3NRR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ |
MOVD ( REGOFF(12, EAX), MM7 ) /* | x3 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGOFF(32, EAX) ) /* hopefully stride is zero */ |
MOVQ ( MM5, MM6 ) /* x3 | x2 */ |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ |
PFMUL ( MM2, MM5 ) /* x3*m32 | x2*m22 */ |
PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ |
PFACC ( MM7, MM5 ) /* x3 | x2*m22+x3*m32 */ |
PFADD ( MM6, MM4 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
MOVQ ( MM4, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP3NRR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP3NRR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_2d ) |
GLNAME( _mesa_3dnow_transform_points4_2d ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2R_2 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(16, ECX), MM0 ) /* m10 | m00 */ |
MOVD ( REGOFF(4, ECX), MM1 ) /* | m01 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM1 ) /* m11 | m01 */ |
MOVQ ( REGOFF(48, ECX), MM2 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2R_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM3 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( MM3, MM4 ) /* x1 | x0 */ |
MOVQ ( MM5, MM6 ) /* x3 | x2 */ |
PFMUL ( MM1, MM4 ) /* x1*m11 | x0*m01 */ |
PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ |
PFMUL ( MM0, MM3 ) /* x1*m10 | x0*m00 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PFACC ( MM4, MM3 ) /* x0*m01+x1*m11 | x0*m00+x1*m10 */ |
PFMUL ( MM2, MM6 ) /* x3*m31 | x3*m30 */ |
PFADD ( MM6, MM3 ) /* r1 | r0 */ |
MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ |
MOVQ ( MM3, REGOFF(-16, EDX) ) /* write r0, r1 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2R_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2R_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ) |
GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TP2NRR_3 ) ) |
MOVD ( REGIND(ECX), MM0 ) /* | m00 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m11 | m00 */ |
MOVQ ( REGOFF(48, ECX), MM1 ) /* m31 | m30 */ |
ALIGNTEXT16 |
LLBL( G3TP2NRR_2 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM4 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM5 ) /* x3 | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
PFMUL ( MM0, MM4 ) /* x1*m11 | x0*m00 */ |
MOVQ ( MM5, MM6 ) /* x3 | x2 */ |
ADD_L ( CONST(16), EDX ) /* next r */ |
PUNPCKHDQ ( MM6, MM6 ) /* x3 | x3 */ |
PFMUL ( MM1, MM6 ) /* x3*m31 | x3*m30 */ |
PFADD ( MM4, MM6 ) /* x1*m11+x3*m31 | x0*m00+x3*m30 */ |
MOVQ ( MM6, REGOFF(-16, EDX) ) /* write r0, r1 */ |
MOVQ ( MM5, REGOFF(-8, EDX) ) /* write r2, r3 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TP2NRR_2 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TP2NRR_3 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_3dnow_transform_points4_identity ) |
GLNAME( _mesa_3dnow_transform_points4_identity ): |
PUSH_L ( ESI ) |
MOV_L ( ARG_DEST, ECX ) |
MOV_L ( ARG_MATRIX, ESI ) |
MOV_L ( ARG_SOURCE, EAX ) |
MOV_L ( CONST(4), REGOFF(V4F_SIZE, ECX) ) |
OR_B ( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, ECX) ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), EDX ) |
MOV_L ( EDX, REGOFF(V4F_COUNT, ECX) ) |
PUSH_L ( EDI ) |
MOV_L ( REGOFF(V4F_START, ECX), EDX ) |
MOV_L ( ESI, ECX ) |
MOV_L ( REGOFF(V4F_COUNT, EAX), ESI ) |
MOV_L ( REGOFF(V4F_STRIDE, EAX), EDI ) |
MOV_L ( REGOFF(V4F_START, EAX), EAX ) |
TEST_L ( ESI, ESI ) |
JZ ( LLBL( G3TPIR_2 ) ) |
ALIGNTEXT16 |
LLBL( G3TPIR_1 ): |
PREFETCHW ( REGOFF(32, EDX) ) /* prefetch 2 vertices ahead */ |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVQ ( REGOFF(8, EAX), MM1 ) /* x3 | x2 */ |
ADD_L ( EDI, EAX ) /* next vertex */ |
PREFETCH ( REGIND(EAX) ) |
ADD_L ( CONST(16), EDX ) /* next r */ |
MOVQ ( MM0, REGOFF(-16, EDX) ) /* r1 | r0 */ |
MOVQ ( MM1, REGOFF(-8, EDX) ) /* r3 | r2 */ |
DEC_L ( ESI ) /* decrement vertex counter */ |
JNZ ( LLBL( G3TPIR_1 ) ) /* cnt > 0 ? -> process next vertex */ |
LLBL( G3TPIR_2 ): |
FEMMS |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/xform_args.h |
---|
0,0 → 1,52 |
/* $Id: xform_args.h,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Transform function interface for assembly code. Simply define |
* FRAME_OFFSET to the number of bytes pushed onto the stack before |
* using the ARG_* argument macros. |
* |
* Gareth Hughes |
*/ |
#ifndef __XFORM_ARGS_H__ |
#define __XFORM_ARGS_H__ |
/* Offsets for transform_func arguments |
* |
* typedef void (*transform_func)( GLvector4f *to_vec, |
* const GLfloat m[16], |
* const GLvector4f *from_vec ); |
*/ |
#define OFFSET_DEST 4 |
#define OFFSET_MATRIX 8 |
#define OFFSET_SOURCE 12 |
#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) |
#define ARG_MATRIX REGOFF(FRAME_OFFSET+OFFSET_MATRIX, ESP) |
#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/common_x86_asm.s |
---|
0,0 → 1,239 |
/* $Id: common_x86_asm.s,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.3 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Check extended CPU capabilities. Now justs returns the raw CPUID |
* feature information, allowing the higher level code to interpret the |
* results. |
* |
* Written by Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> |
* |
* Cleaned up and simplified by Gareth Hughes <gareth@valinux.com> |
*/ |
/* |
* NOTE: Avoid using spaces in between '(' ')' and arguments, especially |
* with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces |
* in there will break the build on some platforms. |
*/ |
#include "matypes.h" |
#include "common_x86_features.h" |
/* Intel vendor string |
*/ |
#define GENU 0x756e6547 /* "Genu" */ |
#define INEI 0x49656e69 /* "ineI" */ |
#define NTEL 0x6c65746e /* "ntel" */ |
/* AMD vendor string |
*/ |
#define AUTH 0x68747541 /* "Auth" */ |
#define ENTI 0x69746e65 /* "enti" */ |
#define CAMD 0x444d4163 /* "cAMD" */ |
SEG_DATA |
/* We might want to print out some useful messages. |
*/ |
GLNAME( found_intel ): STRING( "Genuine Intel processor found\n\0" ) |
GLNAME( found_amd ): STRING( "Authentic AMD processor found\n\0" ) |
SEG_TEXT |
ALIGNTEXT4 |
GLOBL GLNAME( _mesa_identify_x86_cpu_features ) |
GLNAME( _mesa_identify_x86_cpu_features ): |
PUSH_L ( EBX ) |
PUSH_L ( ESI ) |
/* Test for the CPUID command. If the ID Flag bit in EFLAGS |
* (bit 21) is writable, the CPUID command is present. |
*/ |
PUSHF_L |
POP_L ( EAX ) |
MOV_L ( EAX, ECX ) |
XOR_L ( CONST(0x00200000), EAX ) |
PUSH_L ( EAX ) |
POPF_L |
PUSHF_L |
POP_L ( EAX ) |
/* Verify the ID Flag bit has been written. |
*/ |
CMP_L ( ECX, EAX ) |
JZ ( LLBL (cpuid_done) ) |
/* Get the CPU vendor info. |
*/ |
XOR_L ( EAX, EAX ) |
CPUID |
/* Test for Intel processors. We must look for the |
* "GenuineIntel" string in EBX, ECX and EDX. |
*/ |
CMP_L ( CONST(GENU), EBX ) |
JNE ( LLBL(cpuid_amd) ) |
CMP_L ( CONST(INEI), EDX ) |
JNE ( LLBL(cpuid_amd) ) |
CMP_L ( CONST(NTEL), ECX ) |
JNE ( LLBL(cpuid_amd) ) |
/* We have an Intel processor, so we can get the feature |
* information with an CPUID input value of 1. |
*/ |
MOV_L ( CONST(0x1), EAX ) |
CPUID |
MOV_L ( EDX, EAX ) |
/* Mask out highest bit, which is used by AMD for 3dnow |
* Newer Intel have this bit set, but do not support 3dnow |
*/ |
AND_L ( CONST(0X7FFFFFFF), EAX) |
JMP ( LLBL(cpuid_done) ) |
LLBL(cpuid_amd): |
/* Test for AMD processors. We must look for the |
* "AuthenticAMD" string in EBX, ECX and EDX. |
*/ |
CMP_L ( CONST(AUTH), EBX ) |
JNE ( LLBL(cpuid_other) ) |
CMP_L ( CONST(ENTI), EDX ) |
JNE ( LLBL(cpuid_other) ) |
CMP_L ( CONST(CAMD), ECX ) |
JNE ( LLBL(cpuid_other) ) |
/* We have an AMD processor, so we can get the feature |
* information after we verify that the extended functions are |
* supported. |
*/ |
/* The features we need are almost all in the extended set. The |
* exception is SSE enable, which is in the standard set (0x1). |
*/ |
MOV_L ( CONST(0x1), EAX ) |
CPUID |
TEST_L ( EAX, EAX ) |
JZ ( LLBL (cpuid_failed) ) |
MOV_L ( EDX, ESI ) |
MOV_L ( CONST(0x80000000), EAX ) |
CPUID |
TEST_L ( EAX, EAX ) |
JZ ( LLBL (cpuid_failed) ) |
MOV_L ( CONST(0x80000001), EAX ) |
CPUID |
MOV_L ( EDX, EAX ) |
AND_L ( CONST(0x02000000), ESI ) /* OR in the SSE bit */ |
OR_L ( ESI, EAX ) |
JMP ( LLBL (cpuid_done) ) |
LLBL(cpuid_other): |
/* Test for other processors here when required. |
*/ |
LLBL(cpuid_failed): |
/* If we can't determine the feature information, we must |
* return zero to indicate that no platform-specific |
* optimizations can be used. |
*/ |
MOV_L ( CONST(0), EAX ) |
LLBL (cpuid_done): |
POP_L ( ESI ) |
POP_L ( EBX ) |
RET |
#ifdef USE_SSE_ASM |
/* Execute an SSE instruction to see if the operating system correctly |
* supports SSE. A signal handler for SIGILL should have been set |
* before calling this function, otherwise this could kill the client |
* application. |
*/ |
ALIGNTEXT4 |
GLOBL GLNAME( _mesa_test_os_sse_support ) |
GLNAME( _mesa_test_os_sse_support ): |
XORPS ( XMM0, XMM0 ) |
RET |
/* Perform an SSE divide-by-zero to see if the operating system |
* correctly supports unmasked SIMD FPU exceptions. Signal handlers for |
* SIGILL and SIGFPE should have been set before calling this function, |
* otherwise this could kill the client application. |
*/ |
ALIGNTEXT4 |
GLOBL GLNAME( _mesa_test_os_sse_exception_support ) |
GLNAME( _mesa_test_os_sse_exception_support ): |
PUSH_L ( EBP ) |
MOV_L ( ESP, EBP ) |
SUB_L ( CONST( 8 ), ESP ) |
/* Save the original MXCSR register value. |
*/ |
STMXCSR ( REGOFF( -4, EBP ) ) |
/* Unmask the divide-by-zero exception and perform one. |
*/ |
STMXCSR ( REGOFF( -8, EBP ) ) |
AND_L ( CONST( 0xfffffdff ), REGOFF( -8, EBP ) ) |
LDMXCSR ( REGOFF( -8, EBP ) ) |
XORPS ( XMM0, XMM0 ) |
PUSH_L ( CONST( 0x3f800000 ) ) |
PUSH_L ( CONST( 0x3f800000 ) ) |
PUSH_L ( CONST( 0x3f800000 ) ) |
PUSH_L ( CONST( 0x3f800000 ) ) |
MOVUPS ( REGIND( ESP ), XMM1 ) |
ADD_L ( CONST( 32 ), ESP ) |
DIVPS ( XMM0, XMM1 ) |
/* Restore the original MXCSR register value. |
*/ |
LDMXCSR ( REGOFF( -4, EBP ) ) |
LEAVE |
RET |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/glapi_x86.s |
---|
0,0 → 1,4861 |
/* DO NOT EDIT - This file generated automatically with glx86asm.py script */ |
#include "assyntax.h" |
#include "../glapioffsets.h" |
#ifndef __WIN32__ |
#if defined(USE_MGL_NAMESPACE) |
#define GL_PREFIX(n) GLNAME(CONCAT(mgl,n)) |
#else |
#define GL_PREFIX(n) GLNAME(CONCAT(gl,n)) |
#endif |
#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX)) |
#if defined(GNU_ASSEMBLER) && !defined(DJGPP) |
#define GLOBL_FN(x) GLOBL x ; .type x,@function |
#else |
#define GLOBL_FN(x) GLOBL x |
#endif |
EXTERN GLNAME(_glapi_Dispatch) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(NewList)) |
GL_PREFIX(NewList): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_NewList)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EndList)) |
GL_PREFIX(EndList): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EndList)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CallList)) |
GL_PREFIX(CallList): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CallList)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CallLists)) |
GL_PREFIX(CallLists): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CallLists)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DeleteLists)) |
GL_PREFIX(DeleteLists): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DeleteLists)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GenLists)) |
GL_PREFIX(GenLists): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GenLists)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ListBase)) |
GL_PREFIX(ListBase): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ListBase)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Begin)) |
GL_PREFIX(Begin): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Begin)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Bitmap)) |
GL_PREFIX(Bitmap): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Bitmap)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3b)) |
GL_PREFIX(Color3b): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3b)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3bv)) |
GL_PREFIX(Color3bv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3bv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3d)) |
GL_PREFIX(Color3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3dv)) |
GL_PREFIX(Color3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3f)) |
GL_PREFIX(Color3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3fv)) |
GL_PREFIX(Color3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3i)) |
GL_PREFIX(Color3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3iv)) |
GL_PREFIX(Color3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3s)) |
GL_PREFIX(Color3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3sv)) |
GL_PREFIX(Color3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3ub)) |
GL_PREFIX(Color3ub): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3ub)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3ubv)) |
GL_PREFIX(Color3ubv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3ubv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3ui)) |
GL_PREFIX(Color3ui): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3ui)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3uiv)) |
GL_PREFIX(Color3uiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3uiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3us)) |
GL_PREFIX(Color3us): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3us)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color3usv)) |
GL_PREFIX(Color3usv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color3usv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4b)) |
GL_PREFIX(Color4b): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4b)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4bv)) |
GL_PREFIX(Color4bv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4bv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4d)) |
GL_PREFIX(Color4d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4dv)) |
GL_PREFIX(Color4dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4f)) |
GL_PREFIX(Color4f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4fv)) |
GL_PREFIX(Color4fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4i)) |
GL_PREFIX(Color4i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4iv)) |
GL_PREFIX(Color4iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4s)) |
GL_PREFIX(Color4s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4sv)) |
GL_PREFIX(Color4sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4ub)) |
GL_PREFIX(Color4ub): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4ub)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4ubv)) |
GL_PREFIX(Color4ubv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4ubv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4ui)) |
GL_PREFIX(Color4ui): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4ui)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4uiv)) |
GL_PREFIX(Color4uiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4uiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4us)) |
GL_PREFIX(Color4us): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4us)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Color4usv)) |
GL_PREFIX(Color4usv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Color4usv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EdgeFlag)) |
GL_PREFIX(EdgeFlag): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EdgeFlag)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EdgeFlagv)) |
GL_PREFIX(EdgeFlagv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EdgeFlagv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(End)) |
GL_PREFIX(End): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_End)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexd)) |
GL_PREFIX(Indexd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexd)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexdv)) |
GL_PREFIX(Indexdv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexdv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexf)) |
GL_PREFIX(Indexf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexfv)) |
GL_PREFIX(Indexfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexi)) |
GL_PREFIX(Indexi): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexi)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexiv)) |
GL_PREFIX(Indexiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexs)) |
GL_PREFIX(Indexs): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexs)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexsv)) |
GL_PREFIX(Indexsv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexsv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3b)) |
GL_PREFIX(Normal3b): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3b)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3bv)) |
GL_PREFIX(Normal3bv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3bv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3d)) |
GL_PREFIX(Normal3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3dv)) |
GL_PREFIX(Normal3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3f)) |
GL_PREFIX(Normal3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3fv)) |
GL_PREFIX(Normal3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3i)) |
GL_PREFIX(Normal3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3iv)) |
GL_PREFIX(Normal3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3s)) |
GL_PREFIX(Normal3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Normal3sv)) |
GL_PREFIX(Normal3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Normal3sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2d)) |
GL_PREFIX(RasterPos2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2dv)) |
GL_PREFIX(RasterPos2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2f)) |
GL_PREFIX(RasterPos2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2fv)) |
GL_PREFIX(RasterPos2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2i)) |
GL_PREFIX(RasterPos2i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2iv)) |
GL_PREFIX(RasterPos2iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2s)) |
GL_PREFIX(RasterPos2s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos2sv)) |
GL_PREFIX(RasterPos2sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos2sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3d)) |
GL_PREFIX(RasterPos3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3dv)) |
GL_PREFIX(RasterPos3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3f)) |
GL_PREFIX(RasterPos3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3fv)) |
GL_PREFIX(RasterPos3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3i)) |
GL_PREFIX(RasterPos3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3iv)) |
GL_PREFIX(RasterPos3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3s)) |
GL_PREFIX(RasterPos3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos3sv)) |
GL_PREFIX(RasterPos3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos3sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4d)) |
GL_PREFIX(RasterPos4d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4dv)) |
GL_PREFIX(RasterPos4dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4f)) |
GL_PREFIX(RasterPos4f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4fv)) |
GL_PREFIX(RasterPos4fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4i)) |
GL_PREFIX(RasterPos4i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4iv)) |
GL_PREFIX(RasterPos4iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4s)) |
GL_PREFIX(RasterPos4s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RasterPos4sv)) |
GL_PREFIX(RasterPos4sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RasterPos4sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectd)) |
GL_PREFIX(Rectd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectd)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectdv)) |
GL_PREFIX(Rectdv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectdv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectf)) |
GL_PREFIX(Rectf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectfv)) |
GL_PREFIX(Rectfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Recti)) |
GL_PREFIX(Recti): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Recti)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectiv)) |
GL_PREFIX(Rectiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rects)) |
GL_PREFIX(Rects): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rects)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rectsv)) |
GL_PREFIX(Rectsv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rectsv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1d)) |
GL_PREFIX(TexCoord1d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1dv)) |
GL_PREFIX(TexCoord1dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1f)) |
GL_PREFIX(TexCoord1f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1fv)) |
GL_PREFIX(TexCoord1fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1i)) |
GL_PREFIX(TexCoord1i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1iv)) |
GL_PREFIX(TexCoord1iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1s)) |
GL_PREFIX(TexCoord1s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord1sv)) |
GL_PREFIX(TexCoord1sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord1sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2d)) |
GL_PREFIX(TexCoord2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2dv)) |
GL_PREFIX(TexCoord2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2f)) |
GL_PREFIX(TexCoord2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2fv)) |
GL_PREFIX(TexCoord2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2i)) |
GL_PREFIX(TexCoord2i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2iv)) |
GL_PREFIX(TexCoord2iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2s)) |
GL_PREFIX(TexCoord2s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord2sv)) |
GL_PREFIX(TexCoord2sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord2sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3d)) |
GL_PREFIX(TexCoord3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3dv)) |
GL_PREFIX(TexCoord3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3f)) |
GL_PREFIX(TexCoord3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3fv)) |
GL_PREFIX(TexCoord3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3i)) |
GL_PREFIX(TexCoord3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3iv)) |
GL_PREFIX(TexCoord3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3s)) |
GL_PREFIX(TexCoord3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord3sv)) |
GL_PREFIX(TexCoord3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord3sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4d)) |
GL_PREFIX(TexCoord4d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4dv)) |
GL_PREFIX(TexCoord4dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4f)) |
GL_PREFIX(TexCoord4f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4fv)) |
GL_PREFIX(TexCoord4fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4i)) |
GL_PREFIX(TexCoord4i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4iv)) |
GL_PREFIX(TexCoord4iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4s)) |
GL_PREFIX(TexCoord4s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoord4sv)) |
GL_PREFIX(TexCoord4sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoord4sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2d)) |
GL_PREFIX(Vertex2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2dv)) |
GL_PREFIX(Vertex2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2f)) |
GL_PREFIX(Vertex2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2fv)) |
GL_PREFIX(Vertex2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2i)) |
GL_PREFIX(Vertex2i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2iv)) |
GL_PREFIX(Vertex2iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2s)) |
GL_PREFIX(Vertex2s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex2sv)) |
GL_PREFIX(Vertex2sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex2sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3d)) |
GL_PREFIX(Vertex3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3dv)) |
GL_PREFIX(Vertex3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3f)) |
GL_PREFIX(Vertex3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3fv)) |
GL_PREFIX(Vertex3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3i)) |
GL_PREFIX(Vertex3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3iv)) |
GL_PREFIX(Vertex3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3s)) |
GL_PREFIX(Vertex3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex3sv)) |
GL_PREFIX(Vertex3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex3sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4d)) |
GL_PREFIX(Vertex4d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4dv)) |
GL_PREFIX(Vertex4dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4f)) |
GL_PREFIX(Vertex4f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4fv)) |
GL_PREFIX(Vertex4fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4i)) |
GL_PREFIX(Vertex4i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4i)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4iv)) |
GL_PREFIX(Vertex4iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4iv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4s)) |
GL_PREFIX(Vertex4s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4s)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Vertex4sv)) |
GL_PREFIX(Vertex4sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Vertex4sv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClipPlane)) |
GL_PREFIX(ClipPlane): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClipPlane)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorMaterial)) |
GL_PREFIX(ColorMaterial): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorMaterial)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CullFace)) |
GL_PREFIX(CullFace): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CullFace)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Fogf)) |
GL_PREFIX(Fogf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Fogf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Fogfv)) |
GL_PREFIX(Fogfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Fogfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Fogi)) |
GL_PREFIX(Fogi): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Fogi)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Fogiv)) |
GL_PREFIX(Fogiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Fogiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FrontFace)) |
GL_PREFIX(FrontFace): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FrontFace)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Hint)) |
GL_PREFIX(Hint): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Hint)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Lightf)) |
GL_PREFIX(Lightf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Lightf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Lightfv)) |
GL_PREFIX(Lightfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Lightfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Lighti)) |
GL_PREFIX(Lighti): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Lighti)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Lightiv)) |
GL_PREFIX(Lightiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Lightiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LightModelf)) |
GL_PREFIX(LightModelf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LightModelf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LightModelfv)) |
GL_PREFIX(LightModelfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LightModelfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LightModeli)) |
GL_PREFIX(LightModeli): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LightModeli)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LightModeliv)) |
GL_PREFIX(LightModeliv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LightModeliv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LineStipple)) |
GL_PREFIX(LineStipple): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LineStipple)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LineWidth)) |
GL_PREFIX(LineWidth): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LineWidth)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Materialf)) |
GL_PREFIX(Materialf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Materialf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Materialfv)) |
GL_PREFIX(Materialfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Materialfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Materiali)) |
GL_PREFIX(Materiali): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Materiali)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Materialiv)) |
GL_PREFIX(Materialiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Materialiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointSize)) |
GL_PREFIX(PointSize): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointSize)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PolygonMode)) |
GL_PREFIX(PolygonMode): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PolygonMode)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PolygonStipple)) |
GL_PREFIX(PolygonStipple): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PolygonStipple)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Scissor)) |
GL_PREFIX(Scissor): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Scissor)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ShadeModel)) |
GL_PREFIX(ShadeModel): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ShadeModel)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexParameterf)) |
GL_PREFIX(TexParameterf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexParameterf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexParameterfv)) |
GL_PREFIX(TexParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexParameteri)) |
GL_PREFIX(TexParameteri): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexParameteri)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexParameteriv)) |
GL_PREFIX(TexParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexImage1D)) |
GL_PREFIX(TexImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexImage2D)) |
GL_PREFIX(TexImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexEnvf)) |
GL_PREFIX(TexEnvf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexEnvf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexEnvfv)) |
GL_PREFIX(TexEnvfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexEnvfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexEnvi)) |
GL_PREFIX(TexEnvi): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexEnvi)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexEnviv)) |
GL_PREFIX(TexEnviv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexEnviv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGend)) |
GL_PREFIX(TexGend): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGend)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGendv)) |
GL_PREFIX(TexGendv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGendv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGenf)) |
GL_PREFIX(TexGenf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGenf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGenfv)) |
GL_PREFIX(TexGenfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGenfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGeni)) |
GL_PREFIX(TexGeni): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGeni)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexGeniv)) |
GL_PREFIX(TexGeniv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexGeniv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FeedbackBuffer)) |
GL_PREFIX(FeedbackBuffer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SelectBuffer)) |
GL_PREFIX(SelectBuffer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SelectBuffer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RenderMode)) |
GL_PREFIX(RenderMode): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RenderMode)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(InitNames)) |
GL_PREFIX(InitNames): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_InitNames)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadName)) |
GL_PREFIX(LoadName): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadName)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PassThrough)) |
GL_PREFIX(PassThrough): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PassThrough)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PopName)) |
GL_PREFIX(PopName): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PopName)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PushName)) |
GL_PREFIX(PushName): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PushName)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawBuffer)) |
GL_PREFIX(DrawBuffer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawBuffer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Clear)) |
GL_PREFIX(Clear): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Clear)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClearAccum)) |
GL_PREFIX(ClearAccum): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClearAccum)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClearIndex)) |
GL_PREFIX(ClearIndex): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClearIndex)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClearColor)) |
GL_PREFIX(ClearColor): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClearColor)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClearStencil)) |
GL_PREFIX(ClearStencil): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClearStencil)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClearDepth)) |
GL_PREFIX(ClearDepth): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClearDepth)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(StencilMask)) |
GL_PREFIX(StencilMask): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_StencilMask)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorMask)) |
GL_PREFIX(ColorMask): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorMask)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DepthMask)) |
GL_PREFIX(DepthMask): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DepthMask)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IndexMask)) |
GL_PREFIX(IndexMask): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IndexMask)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Accum)) |
GL_PREFIX(Accum): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Accum)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Disable)) |
GL_PREFIX(Disable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Disable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Enable)) |
GL_PREFIX(Enable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Enable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Finish)) |
GL_PREFIX(Finish): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Finish)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Flush)) |
GL_PREFIX(Flush): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Flush)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PopAttrib)) |
GL_PREFIX(PopAttrib): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PopAttrib)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PushAttrib)) |
GL_PREFIX(PushAttrib): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PushAttrib)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Map1d)) |
GL_PREFIX(Map1d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Map1d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Map1f)) |
GL_PREFIX(Map1f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Map1f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Map2d)) |
GL_PREFIX(Map2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Map2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Map2f)) |
GL_PREFIX(Map2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Map2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MapGrid1d)) |
GL_PREFIX(MapGrid1d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MapGrid1d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MapGrid1f)) |
GL_PREFIX(MapGrid1f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MapGrid1f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MapGrid2d)) |
GL_PREFIX(MapGrid2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MapGrid2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MapGrid2f)) |
GL_PREFIX(MapGrid2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MapGrid2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord1d)) |
GL_PREFIX(EvalCoord1d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord1d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord1dv)) |
GL_PREFIX(EvalCoord1dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord1f)) |
GL_PREFIX(EvalCoord1f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord1f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord1fv)) |
GL_PREFIX(EvalCoord1fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord2d)) |
GL_PREFIX(EvalCoord2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord2d)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord2dv)) |
GL_PREFIX(EvalCoord2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord2f)) |
GL_PREFIX(EvalCoord2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord2f)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalCoord2fv)) |
GL_PREFIX(EvalCoord2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalMesh1)) |
GL_PREFIX(EvalMesh1): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalMesh1)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalPoint1)) |
GL_PREFIX(EvalPoint1): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalPoint1)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalMesh2)) |
GL_PREFIX(EvalMesh2): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalMesh2)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EvalPoint2)) |
GL_PREFIX(EvalPoint2): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EvalPoint2)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(AlphaFunc)) |
GL_PREFIX(AlphaFunc): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_AlphaFunc)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendFunc)) |
GL_PREFIX(BlendFunc): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendFunc)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LogicOp)) |
GL_PREFIX(LogicOp): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LogicOp)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(StencilFunc)) |
GL_PREFIX(StencilFunc): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_StencilFunc)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(StencilOp)) |
GL_PREFIX(StencilOp): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_StencilOp)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DepthFunc)) |
GL_PREFIX(DepthFunc): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DepthFunc)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelZoom)) |
GL_PREFIX(PixelZoom): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelZoom)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTransferf)) |
GL_PREFIX(PixelTransferf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTransferf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTransferi)) |
GL_PREFIX(PixelTransferi): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTransferi)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelStoref)) |
GL_PREFIX(PixelStoref): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelStoref)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelStorei)) |
GL_PREFIX(PixelStorei): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelStorei)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelMapfv)) |
GL_PREFIX(PixelMapfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelMapfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelMapuiv)) |
GL_PREFIX(PixelMapuiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelMapuiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelMapusv)) |
GL_PREFIX(PixelMapusv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelMapusv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ReadBuffer)) |
GL_PREFIX(ReadBuffer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ReadBuffer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyPixels)) |
GL_PREFIX(CopyPixels): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyPixels)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ReadPixels)) |
GL_PREFIX(ReadPixels): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ReadPixels)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawPixels)) |
GL_PREFIX(DrawPixels): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawPixels)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetBooleanv)) |
GL_PREFIX(GetBooleanv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetBooleanv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetClipPlane)) |
GL_PREFIX(GetClipPlane): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetClipPlane)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetDoublev)) |
GL_PREFIX(GetDoublev): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetDoublev)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetError)) |
GL_PREFIX(GetError): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetError)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFloatv)) |
GL_PREFIX(GetFloatv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFloatv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetIntegerv)) |
GL_PREFIX(GetIntegerv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetIntegerv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetLightfv)) |
GL_PREFIX(GetLightfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetLightfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetLightiv)) |
GL_PREFIX(GetLightiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetLightiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMapdv)) |
GL_PREFIX(GetMapdv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMapdv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMapfv)) |
GL_PREFIX(GetMapfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMapfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMapiv)) |
GL_PREFIX(GetMapiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMapiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMaterialfv)) |
GL_PREFIX(GetMaterialfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMaterialfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMaterialiv)) |
GL_PREFIX(GetMaterialiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMaterialiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPixelMapfv)) |
GL_PREFIX(GetPixelMapfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) |
GL_PREFIX(GetPixelMapuiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPixelMapusv)) |
GL_PREFIX(GetPixelMapusv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPolygonStipple)) |
GL_PREFIX(GetPolygonStipple): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetString)) |
GL_PREFIX(GetString): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetString)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexEnvfv)) |
GL_PREFIX(GetTexEnvfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexEnviv)) |
GL_PREFIX(GetTexEnviv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexEnviv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexGendv)) |
GL_PREFIX(GetTexGendv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexGendv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexGenfv)) |
GL_PREFIX(GetTexGenfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexGenfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexGeniv)) |
GL_PREFIX(GetTexGeniv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexGeniv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexImage)) |
GL_PREFIX(GetTexImage): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexImage)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexParameterfv)) |
GL_PREFIX(GetTexParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexParameteriv)) |
GL_PREFIX(GetTexParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) |
GL_PREFIX(GetTexLevelParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) |
GL_PREFIX(GetTexLevelParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsEnabled)) |
GL_PREFIX(IsEnabled): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsEnabled)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsList)) |
GL_PREFIX(IsList): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsList)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DepthRange)) |
GL_PREFIX(DepthRange): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DepthRange)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Frustum)) |
GL_PREFIX(Frustum): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Frustum)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadIdentity)) |
GL_PREFIX(LoadIdentity): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadIdentity)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadMatrixf)) |
GL_PREFIX(LoadMatrixf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadMatrixf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadMatrixd)) |
GL_PREFIX(LoadMatrixd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadMatrixd)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MatrixMode)) |
GL_PREFIX(MatrixMode): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MatrixMode)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultMatrixf)) |
GL_PREFIX(MultMatrixf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultMatrixf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultMatrixd)) |
GL_PREFIX(MultMatrixd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultMatrixd)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Ortho)) |
GL_PREFIX(Ortho): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Ortho)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PopMatrix)) |
GL_PREFIX(PopMatrix): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PopMatrix)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PushMatrix)) |
GL_PREFIX(PushMatrix): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PushMatrix)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rotated)) |
GL_PREFIX(Rotated): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rotated)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Rotatef)) |
GL_PREFIX(Rotatef): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Rotatef)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Scaled)) |
GL_PREFIX(Scaled): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Scaled)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Scalef)) |
GL_PREFIX(Scalef): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Scalef)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Translated)) |
GL_PREFIX(Translated): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Translated)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Translatef)) |
GL_PREFIX(Translatef): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Translatef)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Viewport)) |
GL_PREFIX(Viewport): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Viewport)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ArrayElement)) |
GL_PREFIX(ArrayElement): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ArrayElement)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorPointer)) |
GL_PREFIX(ColorPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DisableClientState)) |
GL_PREFIX(DisableClientState): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DisableClientState)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawArrays)) |
GL_PREFIX(DrawArrays): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawArrays)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawElements)) |
GL_PREFIX(DrawElements): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawElements)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) |
GL_PREFIX(EdgeFlagPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EnableClientState)) |
GL_PREFIX(EnableClientState): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EnableClientState)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPointerv)) |
GL_PREFIX(GetPointerv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPointerv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IndexPointer)) |
GL_PREFIX(IndexPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IndexPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(InterleavedArrays)) |
GL_PREFIX(InterleavedArrays): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_InterleavedArrays)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(NormalPointer)) |
GL_PREFIX(NormalPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_NormalPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoordPointer)) |
GL_PREFIX(TexCoordPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoordPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexPointer)) |
GL_PREFIX(VertexPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexPointer)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PolygonOffset)) |
GL_PREFIX(PolygonOffset): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PolygonOffset)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexImage1D)) |
GL_PREFIX(CopyTexImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexImage2D)) |
GL_PREFIX(CopyTexImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage1D)) |
GL_PREFIX(CopyTexSubImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage2D)) |
GL_PREFIX(CopyTexSubImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage1D)) |
GL_PREFIX(TexSubImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage2D)) |
GL_PREFIX(TexSubImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(AreTexturesResident)) |
GL_PREFIX(AreTexturesResident): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_AreTexturesResident)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BindTexture)) |
GL_PREFIX(BindTexture): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BindTexture)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DeleteTextures)) |
GL_PREFIX(DeleteTextures): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DeleteTextures)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GenTextures)) |
GL_PREFIX(GenTextures): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GenTextures)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsTexture)) |
GL_PREFIX(IsTexture): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsTexture)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PrioritizeTextures)) |
GL_PREFIX(PrioritizeTextures): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexub)) |
GL_PREFIX(Indexub): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexub)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Indexubv)) |
GL_PREFIX(Indexubv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Indexubv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PopClientAttrib)) |
GL_PREFIX(PopClientAttrib): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PopClientAttrib)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PushClientAttrib)) |
GL_PREFIX(PushClientAttrib): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PushClientAttrib)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendColor)) |
GL_PREFIX(BlendColor): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendColor)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendEquation)) |
GL_PREFIX(BlendEquation): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendEquation)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawRangeElements)) |
GL_PREFIX(DrawRangeElements): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawRangeElements)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTable)) |
GL_PREFIX(ColorTable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) |
GL_PREFIX(ColorTableParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) |
GL_PREFIX(ColorTableParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyColorTable)) |
GL_PREFIX(CopyColorTable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTable)) |
GL_PREFIX(GetColorTable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) |
GL_PREFIX(GetColorTableParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) |
GL_PREFIX(GetColorTableParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorSubTable)) |
GL_PREFIX(ColorSubTable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorSubTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyColorSubTable)) |
GL_PREFIX(CopyColorSubTable): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) |
GL_PREFIX(ConvolutionFilter1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionFilter2D)) |
GL_PREFIX(ConvolutionFilter2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameterf)) |
GL_PREFIX(ConvolutionParameterf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameterfv)) |
GL_PREFIX(ConvolutionParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameteri)) |
GL_PREFIX(ConvolutionParameteri): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameteriv)) |
GL_PREFIX(ConvolutionParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) |
GL_PREFIX(CopyConvolutionFilter1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2D)) |
GL_PREFIX(CopyConvolutionFilter2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) |
GL_PREFIX(GetConvolutionFilter): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionFilter)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionParameterfv)) |
GL_PREFIX(GetConvolutionParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionParameteriv)) |
GL_PREFIX(GetConvolutionParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetSeparableFilter)) |
GL_PREFIX(GetSeparableFilter): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SeparableFilter2D)) |
GL_PREFIX(SeparableFilter2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogram)) |
GL_PREFIX(GetHistogram): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogram)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogramParameterfv)) |
GL_PREFIX(GetHistogramParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogramParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogramParameteriv)) |
GL_PREFIX(GetHistogramParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogramParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmax)) |
GL_PREFIX(GetMinmax): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmax)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmaxParameterfv)) |
GL_PREFIX(GetMinmaxParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmaxParameteriv)) |
GL_PREFIX(GetMinmaxParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Histogram)) |
GL_PREFIX(Histogram): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Histogram)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(Minmax)) |
GL_PREFIX(Minmax): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Minmax)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ResetHistogram)) |
GL_PREFIX(ResetHistogram): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ResetHistogram)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ResetMinmax)) |
GL_PREFIX(ResetMinmax): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ResetMinmax)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexImage3D)) |
GL_PREFIX(TexImage3D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage3D)) |
GL_PREFIX(TexSubImage3D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) |
GL_PREFIX(CopyTexSubImage3D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ActiveTextureARB)) |
GL_PREFIX(ActiveTextureARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClientActiveTextureARB)) |
GL_PREFIX(ClientActiveTextureARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1dARB)) |
GL_PREFIX(MultiTexCoord1dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1dvARB)) |
GL_PREFIX(MultiTexCoord1dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1fARB)) |
GL_PREFIX(MultiTexCoord1fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1fvARB)) |
GL_PREFIX(MultiTexCoord1fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1iARB)) |
GL_PREFIX(MultiTexCoord1iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1ivARB)) |
GL_PREFIX(MultiTexCoord1ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1sARB)) |
GL_PREFIX(MultiTexCoord1sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1svARB)) |
GL_PREFIX(MultiTexCoord1svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2dARB)) |
GL_PREFIX(MultiTexCoord2dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2dvARB)) |
GL_PREFIX(MultiTexCoord2dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2fARB)) |
GL_PREFIX(MultiTexCoord2fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2fvARB)) |
GL_PREFIX(MultiTexCoord2fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2iARB)) |
GL_PREFIX(MultiTexCoord2iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2ivARB)) |
GL_PREFIX(MultiTexCoord2ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2sARB)) |
GL_PREFIX(MultiTexCoord2sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2svARB)) |
GL_PREFIX(MultiTexCoord2svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3dARB)) |
GL_PREFIX(MultiTexCoord3dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3dvARB)) |
GL_PREFIX(MultiTexCoord3dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3fARB)) |
GL_PREFIX(MultiTexCoord3fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3fvARB)) |
GL_PREFIX(MultiTexCoord3fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3iARB)) |
GL_PREFIX(MultiTexCoord3iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3ivARB)) |
GL_PREFIX(MultiTexCoord3ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3sARB)) |
GL_PREFIX(MultiTexCoord3sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3svARB)) |
GL_PREFIX(MultiTexCoord3svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4dARB)) |
GL_PREFIX(MultiTexCoord4dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4dvARB)) |
GL_PREFIX(MultiTexCoord4dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4fARB)) |
GL_PREFIX(MultiTexCoord4fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4fvARB)) |
GL_PREFIX(MultiTexCoord4fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4iARB)) |
GL_PREFIX(MultiTexCoord4iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4ivARB)) |
GL_PREFIX(MultiTexCoord4ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4sARB)) |
GL_PREFIX(MultiTexCoord4sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4svARB)) |
GL_PREFIX(MultiTexCoord4svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) |
GL_PREFIX(LoadTransposeMatrixfARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) |
GL_PREFIX(LoadTransposeMatrixdARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) |
GL_PREFIX(MultTransposeMatrixfARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) |
GL_PREFIX(MultTransposeMatrixdARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SampleCoverageARB)) |
GL_PREFIX(SampleCoverageARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(__unused413)) |
GL_PREFIX(__unused413): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset___unused413)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) |
GL_PREFIX(CompressedTexImage3DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) |
GL_PREFIX(CompressedTexImage2DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) |
GL_PREFIX(CompressedTexImage1DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) |
GL_PREFIX(CompressedTexSubImage3DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) |
GL_PREFIX(CompressedTexSubImage2DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) |
GL_PREFIX(CompressedTexSubImage1DARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) |
GL_PREFIX(GetCompressedTexImageARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ActiveTexture)) |
GL_PREFIX(ActiveTexture): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ClientActiveTexture)) |
GL_PREFIX(ClientActiveTexture): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1d)) |
GL_PREFIX(MultiTexCoord1d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1dv)) |
GL_PREFIX(MultiTexCoord1dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1f)) |
GL_PREFIX(MultiTexCoord1f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1fv)) |
GL_PREFIX(MultiTexCoord1fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1i)) |
GL_PREFIX(MultiTexCoord1i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1iv)) |
GL_PREFIX(MultiTexCoord1iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1s)) |
GL_PREFIX(MultiTexCoord1s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord1sv)) |
GL_PREFIX(MultiTexCoord1sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2d)) |
GL_PREFIX(MultiTexCoord2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2dv)) |
GL_PREFIX(MultiTexCoord2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2f)) |
GL_PREFIX(MultiTexCoord2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2fv)) |
GL_PREFIX(MultiTexCoord2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2i)) |
GL_PREFIX(MultiTexCoord2i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2iv)) |
GL_PREFIX(MultiTexCoord2iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2s)) |
GL_PREFIX(MultiTexCoord2s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord2sv)) |
GL_PREFIX(MultiTexCoord2sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3d)) |
GL_PREFIX(MultiTexCoord3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3dv)) |
GL_PREFIX(MultiTexCoord3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3f)) |
GL_PREFIX(MultiTexCoord3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3fv)) |
GL_PREFIX(MultiTexCoord3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3i)) |
GL_PREFIX(MultiTexCoord3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3iv)) |
GL_PREFIX(MultiTexCoord3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3s)) |
GL_PREFIX(MultiTexCoord3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord3sv)) |
GL_PREFIX(MultiTexCoord3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4d)) |
GL_PREFIX(MultiTexCoord4d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4dv)) |
GL_PREFIX(MultiTexCoord4dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4f)) |
GL_PREFIX(MultiTexCoord4f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4fv)) |
GL_PREFIX(MultiTexCoord4fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4i)) |
GL_PREFIX(MultiTexCoord4i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4iv)) |
GL_PREFIX(MultiTexCoord4iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4s)) |
GL_PREFIX(MultiTexCoord4s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiTexCoord4sv)) |
GL_PREFIX(MultiTexCoord4sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadTransposeMatrixf)) |
GL_PREFIX(LoadTransposeMatrixf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadTransposeMatrixd)) |
GL_PREFIX(LoadTransposeMatrixd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultTransposeMatrixf)) |
GL_PREFIX(MultTransposeMatrixf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultTransposeMatrixd)) |
GL_PREFIX(MultTransposeMatrixd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SampleCoverage)) |
GL_PREFIX(SampleCoverage): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage3D)) |
GL_PREFIX(CompressedTexImage3D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage2D)) |
GL_PREFIX(CompressedTexImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexImage1D)) |
GL_PREFIX(CompressedTexImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage3D)) |
GL_PREFIX(CompressedTexSubImage3D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage2D)) |
GL_PREFIX(CompressedTexSubImage2D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CompressedTexSubImage1D)) |
GL_PREFIX(CompressedTexSubImage1D): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCompressedTexImage)) |
GL_PREFIX(GetCompressedTexImage): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendColorEXT)) |
GL_PREFIX(BlendColorEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendColor)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PolygonOffsetEXT)) |
GL_PREFIX(PolygonOffsetEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PolygonOffsetEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexImage3DEXT)) |
GL_PREFIX(TexImage3DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) |
GL_PREFIX(TexSubImage3DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) |
GL_PREFIX(GetTexFilterFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTexFilterFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexFilterFuncSGIS)) |
GL_PREFIX(TexFilterFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) |
GL_PREFIX(TexSubImage1DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) |
GL_PREFIX(TexSubImage2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) |
GL_PREFIX(CopyTexImage1DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) |
GL_PREFIX(CopyTexImage2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) |
GL_PREFIX(CopyTexSubImage1DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) |
GL_PREFIX(CopyTexSubImage2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) |
GL_PREFIX(CopyTexSubImage3DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogramEXT)) |
GL_PREFIX(GetHistogramEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogramEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogramParameterfvEXT)) |
GL_PREFIX(GetHistogramParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogramParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetHistogramParameterivEXT)) |
GL_PREFIX(GetHistogramParameterivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetHistogramParameterivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmaxEXT)) |
GL_PREFIX(GetMinmaxEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmaxEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmaxParameterfvEXT)) |
GL_PREFIX(GetMinmaxParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetMinmaxParameterivEXT)) |
GL_PREFIX(GetMinmaxParameterivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetMinmaxParameterivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(HistogramEXT)) |
GL_PREFIX(HistogramEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Histogram)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MinmaxEXT)) |
GL_PREFIX(MinmaxEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_Minmax)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) |
GL_PREFIX(ResetHistogramEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ResetHistogram)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) |
GL_PREFIX(ResetMinmaxEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ResetMinmax)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) |
GL_PREFIX(ConvolutionFilter1DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) |
GL_PREFIX(ConvolutionFilter2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) |
GL_PREFIX(ConvolutionParameterfEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) |
GL_PREFIX(ConvolutionParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) |
GL_PREFIX(ConvolutionParameteriEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) |
GL_PREFIX(ConvolutionParameterivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) |
GL_PREFIX(CopyConvolutionFilter1DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) |
GL_PREFIX(CopyConvolutionFilter2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionFilterEXT)) |
GL_PREFIX(GetConvolutionFilterEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionFilterEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionParameterfvEXT)) |
GL_PREFIX(GetConvolutionParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetConvolutionParameterivEXT)) |
GL_PREFIX(GetConvolutionParameterivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetConvolutionParameterivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetSeparableFilterEXT)) |
GL_PREFIX(GetSeparableFilterEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetSeparableFilterEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) |
GL_PREFIX(SeparableFilter2DEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableSGI)) |
GL_PREFIX(ColorTableSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) |
GL_PREFIX(ColorTableParameterfvSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) |
GL_PREFIX(ColorTableParameterivSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) |
GL_PREFIX(CopyColorTableSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableSGI)) |
GL_PREFIX(GetColorTableSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableSGI)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameterfvSGI)) |
GL_PREFIX(GetColorTableParameterfvSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvSGI)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameterivSGI)) |
GL_PREFIX(GetColorTableParameterivSGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) |
GL_PREFIX(PixelTexGenSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) |
GL_PREFIX(PixelTexGenParameteriSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) |
GL_PREFIX(PixelTexGenParameterivSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) |
GL_PREFIX(PixelTexGenParameterfSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) |
GL_PREFIX(PixelTexGenParameterfvSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) |
GL_PREFIX(GetPixelTexGenParameterivSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) |
GL_PREFIX(GetPixelTexGenParameterfvSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) |
GL_PREFIX(TexImage4DSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) |
GL_PREFIX(TexSubImage4DSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) |
GL_PREFIX(AreTexturesResidentEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BindTextureEXT)) |
GL_PREFIX(BindTextureEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BindTexture)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) |
GL_PREFIX(DeleteTexturesEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DeleteTextures)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GenTexturesEXT)) |
GL_PREFIX(GenTexturesEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsTextureEXT)) |
GL_PREFIX(IsTextureEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsTextureEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) |
GL_PREFIX(PrioritizeTexturesEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) |
GL_PREFIX(DetailTexFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) |
GL_PREFIX(GetDetailTexFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) |
GL_PREFIX(SharpenTexFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) |
GL_PREFIX(GetSharpenTexFuncSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) |
GL_PREFIX(SampleMaskSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) |
GL_PREFIX(SamplePatternSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ArrayElementEXT)) |
GL_PREFIX(ArrayElementEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ArrayElement)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorPointerEXT)) |
GL_PREFIX(ColorPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawArraysEXT)) |
GL_PREFIX(DrawArraysEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawArrays)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) |
GL_PREFIX(EdgeFlagPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetPointervEXT)) |
GL_PREFIX(GetPointervEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetPointerv)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IndexPointerEXT)) |
GL_PREFIX(IndexPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(NormalPointerEXT)) |
GL_PREFIX(NormalPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) |
GL_PREFIX(TexCoordPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexPointerEXT)) |
GL_PREFIX(VertexPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendEquationEXT)) |
GL_PREFIX(BlendEquationEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendEquation)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) |
GL_PREFIX(SpriteParameterfSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) |
GL_PREFIX(SpriteParameterfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) |
GL_PREFIX(SpriteParameteriSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) |
GL_PREFIX(SpriteParameterivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfEXT)) |
GL_PREFIX(PointParameterfEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) |
GL_PREFIX(PointParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfARB)) |
GL_PREFIX(PointParameterfARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfvARB)) |
GL_PREFIX(PointParameterfvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) |
GL_PREFIX(PointParameterfSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) |
GL_PREFIX(PointParameterfvSGIS): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) |
GL_PREFIX(GetInstrumentsSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) |
GL_PREFIX(InstrumentsBufferSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) |
GL_PREFIX(PollInstrumentsSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) |
GL_PREFIX(ReadInstrumentsSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) |
GL_PREFIX(StartInstrumentsSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) |
GL_PREFIX(StopInstrumentsSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) |
GL_PREFIX(FrameZoomSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) |
GL_PREFIX(TagSampleBufferSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) |
GL_PREFIX(ReferencePlaneSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ReferencePlaneSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FlushRasterSGIX)) |
GL_PREFIX(FlushRasterSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) |
GL_PREFIX(ColorSubTableEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorSubTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) |
GL_PREFIX(CopyColorSubTableEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(HintPGI)) |
GL_PREFIX(HintPGI): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_HintPGI)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ColorTableEXT)) |
GL_PREFIX(ColorTableEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ColorTable)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableEXT)) |
GL_PREFIX(GetColorTableEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) |
GL_PREFIX(GetColorTableParameterivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) |
GL_PREFIX(GetColorTableParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) |
GL_PREFIX(GetListParameterfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetListParameterfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetListParameterivSGIX)) |
GL_PREFIX(GetListParameterivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetListParameterivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ListParameterfSGIX)) |
GL_PREFIX(ListParameterfSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ListParameterfSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ListParameterfvSGIX)) |
GL_PREFIX(ListParameterfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ListParameterfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ListParameteriSGIX)) |
GL_PREFIX(ListParameteriSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ListParameteriSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ListParameterivSGIX)) |
GL_PREFIX(ListParameterivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ListParameterivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IndexMaterialEXT)) |
GL_PREFIX(IndexMaterialEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IndexMaterialEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IndexFuncEXT)) |
GL_PREFIX(IndexFuncEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LockArraysEXT)) |
GL_PREFIX(LockArraysEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LockArraysEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) |
GL_PREFIX(UnlockArraysEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) |
GL_PREFIX(CullParameterdvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) |
GL_PREFIX(CullParameterfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) |
GL_PREFIX(FragmentColorMaterialSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentColorMaterialSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightfSGIX)) |
GL_PREFIX(FragmentLightfSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightfSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightfvSGIX)) |
GL_PREFIX(FragmentLightfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightiSGIX)) |
GL_PREFIX(FragmentLightiSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightiSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightivSGIX)) |
GL_PREFIX(FragmentLightivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightModelfSGIX)) |
GL_PREFIX(FragmentLightModelfSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightModelfSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightModelfvSGIX)) |
GL_PREFIX(FragmentLightModelfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightModelfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightModeliSGIX)) |
GL_PREFIX(FragmentLightModeliSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightModeliSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentLightModelivSGIX)) |
GL_PREFIX(FragmentLightModelivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentLightModelivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentMaterialfSGIX)) |
GL_PREFIX(FragmentMaterialfSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentMaterialfSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentMaterialfvSGIX)) |
GL_PREFIX(FragmentMaterialfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentMaterialfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentMaterialiSGIX)) |
GL_PREFIX(FragmentMaterialiSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentMaterialiSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FragmentMaterialivSGIX)) |
GL_PREFIX(FragmentMaterialivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FragmentMaterialivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFragmentLightfvSGIX)) |
GL_PREFIX(GetFragmentLightfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFragmentLightfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFragmentLightivSGIX)) |
GL_PREFIX(GetFragmentLightivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFragmentLightivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFragmentMaterialfvSGIX)) |
GL_PREFIX(GetFragmentMaterialfvSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFragmentMaterialfvSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFragmentMaterialivSGIX)) |
GL_PREFIX(GetFragmentMaterialivSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFragmentMaterialivSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LightEnviSGIX)) |
GL_PREFIX(LightEnviSGIX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) |
GL_PREFIX(DrawRangeElementsEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DrawRangeElements)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3bEXT)) |
GL_PREFIX(SecondaryColor3bEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3bvEXT)) |
GL_PREFIX(SecondaryColor3bvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3dEXT)) |
GL_PREFIX(SecondaryColor3dEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3dvEXT)) |
GL_PREFIX(SecondaryColor3dvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3fEXT)) |
GL_PREFIX(SecondaryColor3fEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3fvEXT)) |
GL_PREFIX(SecondaryColor3fvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3iEXT)) |
GL_PREFIX(SecondaryColor3iEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ivEXT)) |
GL_PREFIX(SecondaryColor3ivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3sEXT)) |
GL_PREFIX(SecondaryColor3sEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3svEXT)) |
GL_PREFIX(SecondaryColor3svEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ubEXT)) |
GL_PREFIX(SecondaryColor3ubEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ubvEXT)) |
GL_PREFIX(SecondaryColor3ubvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3uiEXT)) |
GL_PREFIX(SecondaryColor3uiEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3uivEXT)) |
GL_PREFIX(SecondaryColor3uivEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3usEXT)) |
GL_PREFIX(SecondaryColor3usEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3usvEXT)) |
GL_PREFIX(SecondaryColor3usvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColorPointerEXT)) |
GL_PREFIX(SecondaryColorPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiDrawArraysEXT)) |
GL_PREFIX(MultiDrawArraysEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiDrawElementsEXT)) |
GL_PREFIX(MultiDrawElementsEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordfEXT)) |
GL_PREFIX(FogCoordfEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordfvEXT)) |
GL_PREFIX(FogCoordfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoorddEXT)) |
GL_PREFIX(FogCoorddEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoorddvEXT)) |
GL_PREFIX(FogCoorddvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordPointerEXT)) |
GL_PREFIX(FogCoordPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendFuncSeparateEXT)) |
GL_PREFIX(BlendFuncSeparateEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR)) |
GL_PREFIX(BlendFuncSeparateINGR): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexWeightfEXT)) |
GL_PREFIX(VertexWeightfEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexWeightfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexWeightfvEXT)) |
GL_PREFIX(VertexWeightfvEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexWeightfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexWeightPointerEXT)) |
GL_PREFIX(VertexWeightPointerEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) |
GL_PREFIX(FlushVertexArrayRangeNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) |
GL_PREFIX(VertexArrayRangeNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) |
GL_PREFIX(CombinerParameterfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerParameterfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerParameterfNV)) |
GL_PREFIX(CombinerParameterfNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerParameterfNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerParameterivNV)) |
GL_PREFIX(CombinerParameterivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerParameteriNV)) |
GL_PREFIX(CombinerParameteriNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerParameteriNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerInputNV)) |
GL_PREFIX(CombinerInputNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerInputNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(CombinerOutputNV)) |
GL_PREFIX(CombinerOutputNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_CombinerOutputNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FinalCombinerInputNV)) |
GL_PREFIX(FinalCombinerInputNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FinalCombinerInputNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCombinerInputParameterfvNV)) |
GL_PREFIX(GetCombinerInputParameterfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCombinerInputParameterivNV)) |
GL_PREFIX(GetCombinerInputParameterivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterfvNV)) |
GL_PREFIX(GetCombinerOutputParameterfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterivNV)) |
GL_PREFIX(GetCombinerOutputParameterivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterfvNV)) |
GL_PREFIX(GetFinalCombinerInputParameterfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterivNV)) |
GL_PREFIX(GetFinalCombinerInputParameterivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) |
GL_PREFIX(ResizeBuffersMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) |
GL_PREFIX(WindowPos2dMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) |
GL_PREFIX(WindowPos2dvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) |
GL_PREFIX(WindowPos2fMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) |
GL_PREFIX(WindowPos2fvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) |
GL_PREFIX(WindowPos2iMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) |
GL_PREFIX(WindowPos2ivMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) |
GL_PREFIX(WindowPos2sMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) |
GL_PREFIX(WindowPos2svMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) |
GL_PREFIX(WindowPos3dMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) |
GL_PREFIX(WindowPos3dvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) |
GL_PREFIX(WindowPos3fMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) |
GL_PREFIX(WindowPos3fvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) |
GL_PREFIX(WindowPos3iMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) |
GL_PREFIX(WindowPos3ivMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) |
GL_PREFIX(WindowPos3sMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) |
GL_PREFIX(WindowPos3svMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) |
GL_PREFIX(WindowPos4dMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) |
GL_PREFIX(WindowPos4dvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) |
GL_PREFIX(WindowPos4fMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) |
GL_PREFIX(WindowPos4fvMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) |
GL_PREFIX(WindowPos4iMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) |
GL_PREFIX(WindowPos4ivMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) |
GL_PREFIX(WindowPos4sMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) |
GL_PREFIX(WindowPos4svMESA): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) |
GL_PREFIX(TbufferMask3DFX): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SampleMaskEXT)) |
GL_PREFIX(SampleMaskEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SamplePatternEXT)) |
GL_PREFIX(SamplePatternEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DeleteFencesNV)) |
GL_PREFIX(DeleteFencesNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DeleteFencesNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GenFencesNV)) |
GL_PREFIX(GenFencesNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GenFencesNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsFenceNV)) |
GL_PREFIX(IsFenceNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsFenceNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TestFenceNV)) |
GL_PREFIX(TestFenceNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TestFenceNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetFenceivNV)) |
GL_PREFIX(GetFenceivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetFenceivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FinishFenceNV)) |
GL_PREFIX(FinishFenceNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FinishFenceNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SetFenceNV)) |
GL_PREFIX(SetFenceNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SetFenceNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2dARB)) |
GL_PREFIX(WindowPos2dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2fARB)) |
GL_PREFIX(WindowPos2fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2iARB)) |
GL_PREFIX(WindowPos2iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2sARB)) |
GL_PREFIX(WindowPos2sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2dvARB)) |
GL_PREFIX(WindowPos2dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2fvARB)) |
GL_PREFIX(WindowPos2fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2ivARB)) |
GL_PREFIX(WindowPos2ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2svARB)) |
GL_PREFIX(WindowPos2svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3dARB)) |
GL_PREFIX(WindowPos3dARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3fARB)) |
GL_PREFIX(WindowPos3fARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3iARB)) |
GL_PREFIX(WindowPos3iARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3sARB)) |
GL_PREFIX(WindowPos3sARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3dvARB)) |
GL_PREFIX(WindowPos3dvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3fvARB)) |
GL_PREFIX(WindowPos3fvARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3ivARB)) |
GL_PREFIX(WindowPos3ivARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3svARB)) |
GL_PREFIX(WindowPos3svARB): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(AreProgramsResidentNV)) |
GL_PREFIX(AreProgramsResidentNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_AreProgramsResidentNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BindProgramNV)) |
GL_PREFIX(BindProgramNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BindProgramNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(DeleteProgramsNV)) |
GL_PREFIX(DeleteProgramsNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_DeleteProgramsNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ExecuteProgramNV)) |
GL_PREFIX(ExecuteProgramNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ExecuteProgramNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GenProgramsNV)) |
GL_PREFIX(GenProgramsNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GenProgramsNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetProgramParameterdvNV)) |
GL_PREFIX(GetProgramParameterdvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetProgramParameterdvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetProgramParameterfvNV)) |
GL_PREFIX(GetProgramParameterfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetProgramParameterfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetProgramivNV)) |
GL_PREFIX(GetProgramivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetProgramivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetProgramStringNV)) |
GL_PREFIX(GetProgramStringNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetProgramStringNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetTrackMatrixivNV)) |
GL_PREFIX(GetTrackMatrixivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetTrackMatrixivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetVertexAttribdvNV)) |
GL_PREFIX(GetVertexAttribdvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetVertexAttribdvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetVertexAttribfvNV)) |
GL_PREFIX(GetVertexAttribfvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetVertexAttribfvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetVertexAttribivNV)) |
GL_PREFIX(GetVertexAttribivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetVertexAttribivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(GetVertexAttribPointervNV)) |
GL_PREFIX(GetVertexAttribPointervNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_GetVertexAttribPointervNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(IsProgramNV)) |
GL_PREFIX(IsProgramNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_IsProgramNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(LoadProgramNV)) |
GL_PREFIX(LoadProgramNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_LoadProgramNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameter4dNV)) |
GL_PREFIX(ProgramParameter4dNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameter4dNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameter4dvNV)) |
GL_PREFIX(ProgramParameter4dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameter4dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameter4fNV)) |
GL_PREFIX(ProgramParameter4fNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameter4fNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameter4fvNV)) |
GL_PREFIX(ProgramParameter4fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameter4fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameters4dvNV)) |
GL_PREFIX(ProgramParameters4dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameters4dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ProgramParameters4fvNV)) |
GL_PREFIX(ProgramParameters4fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ProgramParameters4fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(RequestResidentProgramsNV)) |
GL_PREFIX(RequestResidentProgramsNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_RequestResidentProgramsNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(TrackMatrixNV)) |
GL_PREFIX(TrackMatrixNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_TrackMatrixNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribPointerNV)) |
GL_PREFIX(VertexAttribPointerNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribPointerNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1dNV)) |
GL_PREFIX(VertexAttrib1dNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1dNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1dvNV)) |
GL_PREFIX(VertexAttrib1dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1fNV)) |
GL_PREFIX(VertexAttrib1fNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1fNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1fvNV)) |
GL_PREFIX(VertexAttrib1fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1sNV)) |
GL_PREFIX(VertexAttrib1sNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1sNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib1svNV)) |
GL_PREFIX(VertexAttrib1svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib1svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2dNV)) |
GL_PREFIX(VertexAttrib2dNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2dNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2dvNV)) |
GL_PREFIX(VertexAttrib2dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2fNV)) |
GL_PREFIX(VertexAttrib2fNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2fNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2fvNV)) |
GL_PREFIX(VertexAttrib2fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2sNV)) |
GL_PREFIX(VertexAttrib2sNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2sNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib2svNV)) |
GL_PREFIX(VertexAttrib2svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib2svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3dNV)) |
GL_PREFIX(VertexAttrib3dNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3dNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3dvNV)) |
GL_PREFIX(VertexAttrib3dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3fNV)) |
GL_PREFIX(VertexAttrib3fNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3fNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3fvNV)) |
GL_PREFIX(VertexAttrib3fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3sNV)) |
GL_PREFIX(VertexAttrib3sNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3sNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib3svNV)) |
GL_PREFIX(VertexAttrib3svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib3svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4dNV)) |
GL_PREFIX(VertexAttrib4dNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4dNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4dvNV)) |
GL_PREFIX(VertexAttrib4dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4fNV)) |
GL_PREFIX(VertexAttrib4fNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4fNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4fvNV)) |
GL_PREFIX(VertexAttrib4fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4sNV)) |
GL_PREFIX(VertexAttrib4sNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4sNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4svNV)) |
GL_PREFIX(VertexAttrib4svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4ubNV)) |
GL_PREFIX(VertexAttrib4ubNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4ubNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttrib4ubvNV)) |
GL_PREFIX(VertexAttrib4ubvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttrib4ubvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs1dvNV)) |
GL_PREFIX(VertexAttribs1dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs1dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs1fvNV)) |
GL_PREFIX(VertexAttribs1fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs1fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs1svNV)) |
GL_PREFIX(VertexAttribs1svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs1svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs2dvNV)) |
GL_PREFIX(VertexAttribs2dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs2dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs2fvNV)) |
GL_PREFIX(VertexAttribs2fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs2fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs2svNV)) |
GL_PREFIX(VertexAttribs2svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs2svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs3dvNV)) |
GL_PREFIX(VertexAttribs3dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs3dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs3fvNV)) |
GL_PREFIX(VertexAttribs3fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs3fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs3svNV)) |
GL_PREFIX(VertexAttribs3svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs3svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs4dvNV)) |
GL_PREFIX(VertexAttribs4dvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs4dvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs4fvNV)) |
GL_PREFIX(VertexAttribs4fvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs4fvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs4svNV)) |
GL_PREFIX(VertexAttribs4svNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs4svNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(VertexAttribs4ubvNV)) |
GL_PREFIX(VertexAttribs4ubvNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_VertexAttribs4ubvNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameteriNV)) |
GL_PREFIX(PointParameteriNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameteriNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterivNV)) |
GL_PREFIX(PointParameterivNV): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(BlendFuncSeparate)) |
GL_PREFIX(BlendFuncSeparate): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordf)) |
GL_PREFIX(FogCoordf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordfv)) |
GL_PREFIX(FogCoordfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordd)) |
GL_PREFIX(FogCoordd): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoorddv)) |
GL_PREFIX(FogCoorddv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(FogCoordPointer)) |
GL_PREFIX(FogCoordPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiDrawArrays)) |
GL_PREFIX(MultiDrawArrays): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(MultiDrawElements)) |
GL_PREFIX(MultiDrawElements): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterf)) |
GL_PREFIX(PointParameterf): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameterfv)) |
GL_PREFIX(PointParameterfv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameteri)) |
GL_PREFIX(PointParameteri): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameteriNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(PointParameteriv)) |
GL_PREFIX(PointParameteriv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_PointParameterivNV)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3b)) |
GL_PREFIX(SecondaryColor3b): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3bv)) |
GL_PREFIX(SecondaryColor3bv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3d)) |
GL_PREFIX(SecondaryColor3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3dv)) |
GL_PREFIX(SecondaryColor3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3f)) |
GL_PREFIX(SecondaryColor3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3fv)) |
GL_PREFIX(SecondaryColor3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3i)) |
GL_PREFIX(SecondaryColor3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3iv)) |
GL_PREFIX(SecondaryColor3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3s)) |
GL_PREFIX(SecondaryColor3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3sv)) |
GL_PREFIX(SecondaryColor3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ub)) |
GL_PREFIX(SecondaryColor3ub): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ubv)) |
GL_PREFIX(SecondaryColor3ubv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3ui)) |
GL_PREFIX(SecondaryColor3ui): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3uiv)) |
GL_PREFIX(SecondaryColor3uiv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3us)) |
GL_PREFIX(SecondaryColor3us): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColor3usv)) |
GL_PREFIX(SecondaryColor3usv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(SecondaryColorPointer)) |
GL_PREFIX(SecondaryColorPointer): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2d)) |
GL_PREFIX(WindowPos2d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2dv)) |
GL_PREFIX(WindowPos2dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2f)) |
GL_PREFIX(WindowPos2f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2fv)) |
GL_PREFIX(WindowPos2fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2i)) |
GL_PREFIX(WindowPos2i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2iv)) |
GL_PREFIX(WindowPos2iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2s)) |
GL_PREFIX(WindowPos2s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos2sv)) |
GL_PREFIX(WindowPos2sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3d)) |
GL_PREFIX(WindowPos3d): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3dv)) |
GL_PREFIX(WindowPos3dv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3f)) |
GL_PREFIX(WindowPos3f): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3fv)) |
GL_PREFIX(WindowPos3fv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3i)) |
GL_PREFIX(WindowPos3i): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3iv)) |
GL_PREFIX(WindowPos3iv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3s)) |
GL_PREFIX(WindowPos3s): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(WindowPos3sv)) |
GL_PREFIX(WindowPos3sv): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) |
ALIGNTEXT16 |
GLOBL_FN(GL_PREFIX(ActiveStencilFaceEXT)) |
GL_PREFIX(ActiveStencilFaceEXT): |
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) |
JMP(GL_OFFSET(_gloffset_ActiveStencilFaceEXT)) |
#endif /* __WIN32__ */ |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow_normal.s |
---|
0,0 → 1,836 |
/* $Id: 3dnow_normal.s,v 1.1 2003-03-13 12:11:47 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* 3Dnow assembly code by Holger Waechtler |
*/ |
#include "matypes.h" |
#include "norm_args.h" |
SEG_TEXT |
#define M(i) REGOFF(i * 4, ECX) |
#define STRIDE REGOFF(12, ESI) |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals) |
GLNAME(_mesa_3dnow_transform_normalize_normals): |
#define FRAME_OFFSET 12 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
PUSH_L ( EBP ) |
MOV_L ( ARG_LENGTHS, EDI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */ |
MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ |
JE ( LLBL (G3TN_end) ) |
MOV_L ( REGOFF (V3F_COUNT, ESI), EBP ) |
FEMMS |
PUSH_L ( EBP ) |
PUSH_L ( EAX ) |
PUSH_L ( EDX ) /* save counter & pointer for */ |
/* the normalize pass */ |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 24 |
MOVQ ( M(0), MM3 ) /* m1 | m0 */ |
MOVQ ( M(4), MM4 ) /* m5 | m4 */ |
MOVD ( M(2), MM5 ) /* | m2 */ |
PUNPCKLDQ ( M(6), MM5 ) /* m6 | m2 */ |
MOVQ ( M(8), MM6 ) /* m9 | m8 */ |
MOVQ ( M(10), MM7 ) /* | m10 */ |
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ |
JNE ( LLBL (G3TN_scale_end ) ) |
MOVD ( ARG_SCALE, MM0 ) /* | scale */ |
PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ |
PFMUL ( MM0, MM3 ) /* scale * m1 | scale * m0 */ |
PFMUL ( MM0, MM4 ) /* scale * m5 | scale * m4 */ |
PFMUL ( MM0, MM5 ) /* scale * m6 | scale * m2 */ |
PFMUL ( MM0, MM6 ) /* scale * m9 | scale * m8 */ |
PFMUL ( MM0, MM7 ) /* | scale * m10 */ |
ALIGNTEXT32 |
LLBL (G3TN_scale_end): |
LLBL (G3TN_transform): |
MOVQ ( REGIND (EDX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ |
MOVQ ( MM0, MM1 ) /* x1 | x0 */ |
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ |
PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PREFETCHW ( REGIND(EAX) ) |
PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ |
PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ |
PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ |
PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ |
MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ |
MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ |
PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ |
MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ |
PFMUL ( MM7, MM2 ) /* | x2*m10 */ |
PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ |
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m*/ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ |
DEC_L ( EBP ) /* decrement normal counter */ |
JA ( LLBL (G3TN_transform) ) |
POP_L ( EDX ) /* end of transform --- */ |
POP_L ( EAX ) /* now normalizing ... */ |
POP_L ( EBP ) |
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ |
JE ( LLBL (G3TN_norm ) ) /* calculate lengths */ |
ALIGNTEXT32 |
LLBL (G3TN_norm_w_lengths): |
PREFETCHW ( REGOFF(12,EAX) ) |
MOVQ ( REGIND(EAX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ |
MOVD ( REGIND (EDI), MM3 ) /* | length (x) */ |
PFMUL ( MM3, MM1 ) /* | x2 (normalize*/ |
PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ |
PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalize*/ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
ADD_L ( CONST(4), EDI ) /* next length */ |
PREFETCH ( REGIND(EDI) ) |
MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ |
MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
DEC_L ( EBP ) /* decrement normal counter */ |
JA ( LLBL (G3TN_norm_w_lengths) ) |
JMP ( LLBL (G3TN_exit_3dnow) ) |
ALIGNTEXT32 |
LLBL (G3TN_norm): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( MM0, MM3 ) /* x1 | x0 */ |
MOVQ ( MM1, MM4 ) /* | x2 */ |
PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM1, MM4 ) /* | x2*x2 */ |
PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ |
PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1+x2**/ |
PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ |
MOVQ ( MM5, MM4 ) |
PUNPCKLDQ ( MM3, MM3 ) |
DEC_L ( EBP ) /* decrement normal counter */ |
PFMUL ( MM5, MM5 ) |
PFRSQIT1 ( MM3, MM5 ) |
PFRCPIT2 ( MM4, MM5 ) |
PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ |
MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ |
PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ |
MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ |
MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ |
JA ( LLBL (G3TN_norm) ) |
LLBL (G3TN_exit_3dnow): |
FEMMS |
LLBL (G3TN_end): |
POP_L ( EBP ) |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot) |
GLNAME(_mesa_3dnow_transform_normalize_normals_no_rot): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 12 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
PUSH_L ( EBP ) |
MOV_L ( ARG_LENGTHS, EDI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */ |
MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ |
JE ( LLBL (G3TNNR_end) ) |
FEMMS |
MOVD ( M(0), MM0 ) /* | m0 */ |
PUNPCKLDQ ( M(5), MM0 ) /* m5 | m0 */ |
MOVD ( M(10), MM2 ) /* | m10 */ |
PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ |
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ |
JNE ( LLBL (G3TNNR_scale_end ) ) |
MOVD ( ARG_SCALE, MM7 ) /* | scale */ |
PUNPCKLDQ ( MM7, MM7 ) /* scale | scale */ |
PFMUL ( MM7, MM0 ) /* scale * m5 | scale * m0 */ |
PFMUL ( MM7, MM2 ) /* scale * m10 | scale * m10 */ |
ALIGNTEXT32 |
LLBL (G3TNNR_scale_end): |
CMP_L ( CONST(0), EDI ) /* lengths == 0 ? */ |
JE ( LLBL (G3TNNR_norm) ) /* need to calculate lengths */ |
MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ |
ALIGNTEXT32 |
LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ |
PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
PFMUL ( MM2, MM7 ) /* | x2*m10 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ |
PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ |
ADD_L ( CONST(4), EDI ) /* next length */ |
PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ |
DEC_L ( EBP ) /* decrement normal counter */ |
MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ |
MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ |
MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ |
JA ( LLBL (G3TNNR_norm_w_lengths) ) |
JMP ( LLBL (G3TNNR_exit_3dnow) ) |
ALIGNTEXT32 |
LLBL (G3TNNR_norm): /* need to calculate lengths */ |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM6 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ |
PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM2, MM7 ) /* | x2*m10 */ |
MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ |
MOVQ ( MM7, MM4 ) /* | x2 (transformed) */ |
PFMUL ( MM6, MM3 ) /* x1*x1 | x0*x0 */ |
PFMUL ( MM7, MM4 ) /* | x2*x2 */ |
PFACC ( MM3, MM3 ) /* **not used** | x0*x0+x1*x1 */ |
PFADD ( MM4, MM3 ) /* | x0*x0+x1*x1+x2*x2*/ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ |
MOVQ ( MM5, MM4 ) |
PUNPCKLDQ ( MM3, MM3 ) |
PFMUL ( MM5, MM5 ) |
PFRSQIT1 ( MM3, MM5 ) |
DEC_L ( EBP ) /* decrement normal counter */ |
PFRCPIT2 ( MM4, MM5 ) |
PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ |
MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ |
PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ |
MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ |
JA ( LLBL (G3TNNR_norm) ) |
LLBL (G3TNNR_exit_3dnow): |
FEMMS |
LLBL (G3TNNR_end): |
POP_L ( EBP ) |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot) |
GLNAME(_mesa_3dnow_transform_rescale_normals_no_rot): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 12 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
PUSH_L ( EBP ) |
MOV_L ( ARG_IN, EAX ) |
MOV_L ( ARG_DEST, EDX ) |
MOV_L ( REGOFF(V3F_COUNT, EAX), EBP ) /* dest->count = in->count */ |
MOV_L ( EBP, REGOFF(V3F_COUNT, EDX) ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
MOV_L ( REGOFF(V3F_START, EDX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
CMP_L ( CONST(0), EBP ) |
JE ( LLBL (G3TRNR_end) ) |
FEMMS |
MOVD ( ARG_SCALE, MM6 ) /* | scale */ |
PUNPCKLDQ ( MM6, MM6 ) /* scale | scale */ |
MOVD ( REGIND(ECX), MM0 ) /* | m0 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ |
PFMUL ( MM6, MM0 ) /* scale*m5 | scale*m0 */ |
MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ |
PFMUL ( MM6, MM2 ) /* | scale*m10 */ |
ALIGNTEXT32 |
LLBL (G3TRNR_rescale): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ |
PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
PFMUL ( MM2, MM5 ) /* | x2*m10 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
DEC_L ( EBP ) /* decrement normal counter */ |
MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ |
MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ |
JA ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ |
FEMMS |
LLBL (G3TRNR_end): |
POP_L ( EBP ) |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_rescale_normals) |
GLNAME(_mesa_3dnow_transform_rescale_normals): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 8 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */ |
MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
CMP_L ( CONST(0), EDI ) |
JE ( LLBL (G3TR_end) ) |
FEMMS |
MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ |
MOVQ ( REGOFF(16,ECX), MM4 ) /* m5 | m4 */ |
MOVD ( ARG_SCALE, MM0 ) /* scale */ |
MOVD ( REGOFF(8,ECX), MM5 ) /* | m2 */ |
PUNPCKLDQ ( MM0, MM0 ) /* scale | scale */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) |
PFMUL ( MM0, MM3 ) /* scale*m1 | scale*m0 */ |
MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8*/ |
PFMUL ( MM0, MM4 ) /* scale*m5 | scale*m4 */ |
MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ |
PFMUL ( MM0, MM5 ) /* scale*m6 | scale*m2 */ |
PFMUL ( MM0, MM6 ) /* scale*m9 | scale*m8 */ |
PFMUL ( MM0, MM7 ) /* | scale*m10 */ |
ALIGNTEXT32 |
LLBL (G3TR_rescale): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ |
MOVQ ( MM0, MM1 ) /* x1 | x0 */ |
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ |
PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ |
PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ |
MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ |
PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ |
PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ |
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ |
PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ |
PFMUL ( MM7, MM2 ) /* | x2*m10 */ |
PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ |
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ |
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ |
DEC_L ( EDI ) /* decrement normal counter */ |
JA ( LLBL (G3TR_rescale) ) |
FEMMS |
LLBL (G3TR_end): |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_normals_no_rot) |
GLNAME(_mesa_3dnow_transform_normals_no_rot): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 8 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */ |
MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
CMP_L ( CONST(0), EDI ) |
JE ( LLBL (G3TNR_end) ) |
FEMMS |
MOVD ( REGIND(ECX), MM0 ) /* | m0 */ |
PUNPCKLDQ ( REGOFF(20, ECX), MM0 ) /* m5 | m0 */ |
MOVD ( REGOFF(40, ECX), MM2 ) /* | m10 */ |
PUNPCKLDQ ( MM2, MM2 ) /* m10 | m10 */ |
ALIGNTEXT32 |
LLBL (G3TNR_transform): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM4 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM5 ) /* | x2 */ |
PFMUL ( MM0, MM4 ) /* x1*m5 | x0*m0 */ |
ADD_L ( STRIDE, EDX) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
PFMUL ( MM2, MM5 ) /* | x2*m10 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
DEC_L ( EDI ) /* decrement normal counter */ |
MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ |
MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ |
JA ( LLBL (G3TNR_transform) ) |
FEMMS |
LLBL (G3TNR_end): |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_transform_normals) |
GLNAME(_mesa_3dnow_transform_normals): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 8 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( ARG_MAT, ECX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EDI ) /* dest->count = in->count */ |
MOV_L ( EDI, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), EDX ) /* in->start */ |
MOV_L ( REGOFF(MATRIX_INV, ECX), ECX ) /* mat->inv */ |
CMP_L ( CONST(0), EDI ) /* count > 0 ?? */ |
JE ( LLBL (G3T_end) ) |
FEMMS |
MOVQ ( REGIND(ECX), MM3 ) /* m1 | m0 */ |
MOVQ ( REGOFF(16, ECX), MM4 ) /* m5 | m4 */ |
MOVD ( REGOFF(8, ECX), MM5 ) /* | m2 */ |
PUNPCKLDQ ( REGOFF(24, ECX), MM5 ) /* m6 | m2 */ |
MOVQ ( REGOFF(32, ECX), MM6 ) /* m9 | m8 */ |
MOVD ( REGOFF(40, ECX), MM7 ) /* | m10 */ |
ALIGNTEXT32 |
LLBL (G3T_transform): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ |
MOVQ ( MM0, MM1 ) /* x1 | x0 */ |
PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ |
PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ |
PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ |
PFMUL ( MM5, MM2 ) /* x2*m6 | x2*m2 */ |
PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ |
MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ |
MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ |
PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ |
MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ |
PFMUL ( MM7, MM2 ) /* | x2*m10 */ |
ADD_L ( STRIDE, EDX ) /* next normal */ |
PREFETCH ( REGIND(EDX) ) |
PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ |
PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ |
MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ |
DEC_L ( EDI ) /* decrement normal counter */ |
JA ( LLBL (G3T_transform) ) |
FEMMS |
LLBL (G3T_end): |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_normalize_normals) |
GLNAME(_mesa_3dnow_normalize_normals): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 12 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
PUSH_L ( EBP ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EBP ) /* dest->count = in->count */ |
MOV_L ( EBP, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), ECX ) /* in->start */ |
MOV_L ( ARG_LENGTHS, EDX ) |
CMP_L ( CONST(0), EBP ) /* count > 0 ?? */ |
JE ( LLBL (G3N_end) ) |
FEMMS |
CMP_L ( CONST(0), EDX ) /* lengths == 0 ? */ |
JE ( LLBL (G3N_norm2) ) /* calculate lengths */ |
ALIGNTEXT32 |
LLBL (G3N_norm1): /* use precalculated lengths */ |
PREFETCH ( REGIND(EAX) ) |
MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ |
MOVD ( REGIND(EDX), MM3 ) /* | length (x) */ |
PFMUL ( MM3, MM1 ) /* | x2 (normalized) */ |
PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ |
ADD_L ( STRIDE, ECX ) /* next normal */ |
PREFETCH ( REGIND(ECX) ) |
PFMUL ( MM3, MM0 ) /* x1 (normalized) | x0 (normalized) */ |
MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ |
MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
ADD_L ( CONST(4), EDX ) /* next length */ |
DEC_L ( EBP ) /* decrement normal counter */ |
JA ( LLBL (G3N_norm1) ) |
JMP ( LLBL (G3N_end1) ) |
ALIGNTEXT32 |
LLBL (G3N_norm2): /* need to calculate lengths */ |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( MM0, MM3 ) /* x1 | x0 */ |
ADD_L ( STRIDE, ECX ) /* next normal */ |
PREFETCH ( REGIND(ECX) ) |
MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ |
PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ |
MOVQ ( MM1, MM4 ) /* | x2 */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
PFMUL ( MM1, MM4 ) /* | x2*x2 */ |
PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ |
PFACC ( MM3, MM3 ) /* x0*x0+...+x2*x2 | x0*x0+x1*x1+x2*x2*/ |
PFRSQRT ( MM3, MM5 ) /* 1/sqrt (x0*x0+x1*x1+x2*x2) */ |
MOVQ ( MM5, MM4 ) |
PUNPCKLDQ ( MM3, MM3 ) |
PFMUL ( MM5, MM5 ) |
PFRSQIT1 ( MM3, MM5 ) |
DEC_L ( EBP ) /* decrement normal counter */ |
PFRCPIT2 ( MM4, MM5 ) |
PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ |
MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ |
PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ |
MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ |
JA ( LLBL (G3N_norm2) ) |
LLBL (G3N_end1): |
FEMMS |
LLBL (G3N_end): |
POP_L ( EBP ) |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_3dnow_rescale_normals) |
GLNAME(_mesa_3dnow_rescale_normals): |
#undef FRAME_OFFSET |
#define FRAME_OFFSET 8 |
PUSH_L ( EDI ) |
PUSH_L ( ESI ) |
MOV_L ( ARG_IN, ESI ) |
MOV_L ( ARG_DEST, EAX ) |
MOV_L ( REGOFF(V3F_COUNT, ESI), EDX ) /* dest->count = in->count */ |
MOV_L ( EDX, REGOFF(V3F_COUNT, EAX) ) |
MOV_L ( REGOFF(V3F_START, EAX), EAX ) /* dest->start */ |
MOV_L ( REGOFF(V3F_START, ESI), ECX ) /* in->start */ |
CMP_L ( CONST(0), EDX ) |
JE ( LLBL (G3R_end) ) |
FEMMS |
MOVD ( ARG_SCALE, MM0 ) /* scale */ |
PUNPCKLDQ ( MM0, MM0 ) |
ALIGNTEXT32 |
LLBL (G3R_rescale): |
PREFETCHW ( REGIND(EAX) ) |
MOVQ ( REGIND(ECX), MM1 ) /* x1 | x0 */ |
MOVD ( REGOFF(8, ECX), MM2 ) /* | x2 */ |
PFMUL ( MM0, MM1 ) /* x1*scale | x0*scale */ |
ADD_L ( STRIDE, ECX ) /* next normal */ |
PREFETCH ( REGIND(ECX) ) |
PFMUL ( MM0, MM2 ) /* | x2*scale */ |
ADD_L ( CONST(16), EAX ) /* next r */ |
MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ |
MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ |
DEC_L ( EDX ) /* decrement normal counter */ |
JA ( LLBL (G3R_rescale) ) |
FEMMS |
LLBL (G3R_end): |
POP_L ( ESI ) |
POP_L ( EDI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/mmx_blend.s |
---|
0,0 → 1,358 |
/* |
* Written by José Fonseca <j_r_fonseca@yahoo.co.uk> |
*/ |
#include "matypes.h" |
/* integer multiplication - alpha plus one |
* |
* makes the following approximation to the division (Sree) |
* |
* rgb*a/255 ~= (rgb*(a+1)) >> 256 |
* |
* which is the fastest method that satisfies the following OpenGL criteria |
* |
* 0*0 = 0 and 255*255 = 255 |
* |
* note that MX1 is a register with 0xffffffffffffffff constant which can be easily obtained making |
* |
* PCMPEQW ( MX1, MX1 ) |
*/ |
#define GMB_MULT_AP1( MP1, MA1, MP2, MA2, MX1 ) \ |
PSUBW ( MX1, MA1 ) /* a1 + 1 | a1 + 1 | a1 + 1 | a1 + 1 */ ;\ |
PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ |
;\ |
TWO(PSUBW ( MX1, MA2 )) /* a2 + 1 | a2 + 1 | a2 + 1 | a2 + 1 */ ;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ |
;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 ~= t1/255 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 ~= t2/255 */ |
/* integer multiplication - geometric series |
* |
* takes the geometric series approximation to the division |
* |
* t/255 = (t >> 8) + (t >> 16) + (t >> 24) .. |
* |
* in this case just the first two terms to fit in 16bit arithmetic |
* |
* t/255 ~= (t + (t >> 8)) >> 8 |
* |
* note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254, |
* so the special case a = 255 must be accounted or roundoff must be used |
*/ |
#define GMB_MULT_GS( MP1, MA1, MP2, MA2 ) \ |
PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ |
;\ |
MOVQ ( MA1, MP1 ) ;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ |
;\ |
TWO(MOVQ ( MA2, MP2 )) ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ |
;\ |
PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ |
PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ |
;\ |
TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ |
/* integer multiplication - geometric series plus rounding |
* |
* when using a geometric series division instead of truncating the result |
* use roundoff in the approximation (Jim Blinn) |
* |
* t = rgb*a + 0x80 |
* |
* achieving the exact results |
* |
* note that M80 is register with the 0x0080008000800080 constant |
*/ |
#define GMB_MULT_GSR( MP1, MA1, MP2, MA2, M80 ) \ |
PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ |
PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ |
;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ |
TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ |
;\ |
MOVQ ( MA1, MP1 ) ;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ |
;\ |
TWO(MOVQ ( MA2, MP2 )) ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ |
;\ |
PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ |
PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ |
;\ |
TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ |
/* linear interpolation - geometric series |
*/ |
#define GMB_LERP_GS( MP1, MQ1, MA1, MP2, MQ2, MA2) \ |
PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ |
PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ |
PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ |
;\ |
TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ |
TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ |
;\ |
MOVQ ( MA1, MP1 ) ;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ |
;\ |
TWO(MOVQ ( MA2, MP2 )) ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ |
;\ |
PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ |
TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ |
;\ |
PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ |
TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ |
;\ |
PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ |
/* linear interpolation - geometric series with roundoff |
* |
* this is a generalization of Blinn's formula to signed arithmetic |
* |
* note that M80 is a register with the 0x0080008000800080 constant |
*/ |
#define GMB_LERP_GSR( MP1, MQ1, MA1, MP2, MQ2, MA2, M80) \ |
PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ |
PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ |
PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ |
;\ |
TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ |
TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ |
;\ |
PSRLW ( CONST(15), MP1 ) /* q1 > p1 ? 1 : 0 */ ;\ |
TWO(PSRLW ( CONST(15), MP2 )) /* q2 > q2 ? 1 : 0 */ ;\ |
;\ |
PSLLW ( CONST(8), MP1 ) /* q1 > p1 ? 0x100 : 0 */ ;\ |
TWO(PSLLW ( CONST(8), MP2 )) /* q2 > q2 ? 0x100 : 0 */ ;\ |
;\ |
PSUBW ( MP1, MA1 ) /* t1 -=? 0x100 */ ;\ |
TWO(PSUBW ( MP2, MA2 )) /* t2 -=? 0x100 */ ;\ |
;\ |
PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ |
TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ |
;\ |
MOVQ ( MA1, MP1 ) ;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ |
;\ |
TWO(MOVQ ( MA2, MP2 )) ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ |
;\ |
PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ |
TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ |
;\ |
PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ |
TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ |
;\ |
PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ |
/* linear interpolation - geometric series with correction |
* |
* instead of the roundoff this adds a small correction to satisfy the OpenGL criteria |
* |
* t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 |
* |
* note that although is faster than rounding off it doesn't give always the exact results |
*/ |
#define GMB_LERP_GSC( MP1, MQ1, MA1, MP2, MQ2, MA2) \ |
PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ |
PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ |
PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ |
;\ |
TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ |
TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ |
TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ |
;\ |
MOVQ ( MA1, MP1 ) ;\ |
PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ |
;\ |
TWO(MOVQ ( MA2, MP2 )) ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ |
;\ |
PADDW ( MA1, MP1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ |
PSRLW ( CONST(7), MA1 ) /* t1 >> 15 */ ;\ |
;\ |
TWO(PADDW ( MA2, MP2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ |
TWO(PSRLW ( CONST(7), MA2 )) /* t2 >> 15 */ ;\ |
;\ |
PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ ;\ |
TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ ;\ |
;\ |
PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ |
TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ |
;\ |
PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ |
TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ |
/* common blending setup code |
* |
* note that M00 is a register with 0x0000000000000000 constant which can be easily obtained making |
* |
* PXOR ( M00, M00 ) |
*/ |
#define GMB_LOAD(rgba, dest, MPP, MQQ) \ |
ONE(MOVD ( REGIND(rgba), MPP )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ |
ONE(MOVD ( REGIND(dest), MQQ )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ |
;\ |
TWO(MOVQ ( REGIND(rgba), MPP )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ |
TWO(MOVQ ( REGIND(dest), MQQ )) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ |
#define GMB_UNPACK(MP1, MQ1, MP2, MQ2, M00) \ |
TWO(MOVQ ( MP1, MP2 )) ;\ |
TWO(MOVQ ( MQ1, MQ2 )) ;\ |
;\ |
PUNPCKLBW ( M00, MQ1 ) /* qa1 | qb1 | qg1 | qr1 */ ;\ |
TWO(PUNPCKHBW ( M00, MQ2 )) /* qa2 | qb2 | qg2 | qr2 */ ;\ |
PUNPCKLBW ( M00, MP1 ) /* pa1 | pb1 | pg1 | pr1 */ ;\ |
TWO(PUNPCKHBW ( M00, MP2 )) /* pa2 | pb2 | pg2 | pr2 */ |
#define GMB_ALPHA(MP1, MA1, MP2, MA2) \ |
MOVQ ( MP1, MA1 ) ;\ |
TWO(MOVQ ( MP2, MA2 )) ;\ |
;\ |
PUNPCKHWD ( MA1, MA1 ) /* pa1 | pa1 | | */ ;\ |
TWO(PUNPCKHWD ( MA2, MA2 )) /* pa2 | pa2 | | */ ;\ |
PUNPCKHDQ ( MA1, MA1 ) /* pa1 | pa1 | pa1 | pa1 */ ;\ |
TWO(PUNPCKHDQ ( MA2, MA2 )) /* pa2 | pa2 | pa2 | pa2 */ |
#define GMB_PACK( MS1, MS2 ) \ |
PACKUSWB ( MS2, MS1 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ |
#define GMB_STORE(rgba, MSS ) \ |
ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ |
TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ |
SEG_DATA |
ALIGNDATA8 |
const_0080: |
D_LONG 0x00800080, 0x00800080 |
const_80: |
D_LONG 0x80808080, 0x80808080 |
SEG_TEXT |
/* Blend transparency function |
*/ |
#define TAG(x) x##_transparency |
#define INIT \ |
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ |
#define MAIN( rgba, dest ) \ |
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ |
GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ |
GMB_ALPHA( MM1, MM3, MM4, MM6 ) ;\ |
GMB_LERP_GSC( MM1, MM2, MM3, MM4, MM5, MM6 ) ;\ |
GMB_PACK( MM3, MM6 ) ;\ |
GMB_STORE( rgba, MM3 ) |
#include "mmx_blendtmp.h" |
/* Blend add function |
* |
* FIXME: Add some loop unrolling here... |
*/ |
#define TAG(x) x##_add |
#define INIT |
#define MAIN( rgba, dest ) \ |
ONE(MOVD ( REGIND(rgba), MM1 )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ |
ONE(MOVD ( REGIND(dest), MM2 )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ |
ONE(PADDUSB ( MM2, MM1 )) ;\ |
ONE(MOVD ( MM1, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ |
;\ |
TWO(MOVQ ( REGIND(rgba), MM1 )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ |
TWO(PADDUSB ( REGIND(dest), MM1 )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ |
TWO(MOVQ ( MM1, REGIND(rgba) )) |
#include "mmx_blendtmp.h" |
/* Blend min function |
*/ |
#define TAG(x) x##_min |
#define INIT \ |
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ |
#define MAIN( rgba, dest ) \ |
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ |
MOVQ ( MM1, MM3 ) ;\ |
MOVQ ( MM2, MM4 ) ;\ |
PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ |
PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ |
PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ |
PAND ( MM4, MM1 ) /* q > p ? p : 0 */ ;\ |
PANDN ( MM2, MM4 ) /* q > p ? 0 : q */ ;\ |
POR ( MM1, MM4 ) /* q > p ? p : q */ ;\ |
GMB_STORE( rgba, MM4 ) |
#include "mmx_blendtmp.h" |
/* Blend max function |
*/ |
#define TAG(x) x##_max |
#define INIT \ |
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ |
#define MAIN( rgba, dest ) \ |
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ |
MOVQ ( MM1, MM3 ) ;\ |
MOVQ ( MM2, MM4 ) ;\ |
PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ |
PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ |
PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ |
PAND ( MM4, MM2 ) /* q > p ? q : 0 */ ;\ |
PANDN ( MM1, MM4 ) /* q > p ? 0 : p */ ;\ |
POR ( MM2, MM4 ) /* q > p ? p : q */ ;\ |
GMB_STORE( rgba, MM4 ) |
#include "mmx_blendtmp.h" |
/* Blend modulate function |
*/ |
#define TAG(x) x##_modulate |
#define INIT \ |
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ |
MOVQ ( CONTENT(const_0080), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ |
#define MAIN( rgba, dest ) \ |
GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ |
GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ |
GMB_MULT_GSR( MM1, MM2, MM4, MM5, MM7 ) ;\ |
GMB_PACK( MM2, MM5 ) ;\ |
GMB_STORE( rgba, MM2 ) |
#include "mmx_blendtmp.h" |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow.c |
---|
0,0 → 1,89 |
/* $Id: 3dnow.c,v 1.1 2003-03-13 12:11:47 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* 3DNow! optimizations contributed by |
* Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "math/m_xform.h" |
#include "tnl/t_context.h" |
#include "3dnow.h" |
#include "common_x86_macros.h" |
#ifdef DEBUG |
#include "math/m_debug.h" |
#endif |
#ifdef USE_3DNOW_ASM |
DECLARE_XFORM_GROUP( 3dnow, 2 ) |
DECLARE_XFORM_GROUP( 3dnow, 3 ) |
DECLARE_XFORM_GROUP( 3dnow, 4 ) |
DECLARE_NORM_GROUP( 3dnow ) |
extern void _ASMAPI |
_mesa_v16_3dnow_general_xform( GLfloat *first_vert, |
const GLfloat *m, |
const GLfloat *src, |
GLuint src_stride, |
GLuint count ); |
extern void _ASMAPI |
_mesa_3dnow_project_vertices( GLfloat *first, |
GLfloat *last, |
const GLfloat *m, |
GLuint stride ); |
extern void _ASMAPI |
_mesa_3dnow_project_clipped_vertices( GLfloat *first, |
GLfloat *last, |
const GLfloat *m, |
GLuint stride, |
const GLubyte *clipmask ); |
#endif |
void _mesa_init_3dnow_transform_asm( void ) |
{ |
#ifdef USE_3DNOW_ASM |
ASSIGN_XFORM_GROUP( 3dnow, 2 ); |
ASSIGN_XFORM_GROUP( 3dnow, 3 ); |
ASSIGN_XFORM_GROUP( 3dnow, 4 ); |
ASSIGN_NORM_GROUP( 3dnow ); |
#ifdef DEBUG |
_math_test_all_transform_functions( "3DNow!" ); |
_math_test_all_normal_transform_functions( "3DNow!" ); |
#endif |
#endif |
} |
/shark/tags/rel_0_4/ports/mesa/src/x86/norm_args.h |
---|
0,0 → 1,58 |
/* $Id: norm_args.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Normal transform function interface for assembly code. Simply define |
* FRAME_OFFSET to the number of bytes pushed onto the stack before |
* using the ARG_* argument macros. |
* |
* Gareth Hughes |
*/ |
#ifndef __NORM_ARGS_H__ |
#define __NORM_ARGS_H__ |
/* Offsets for normal_func arguments |
* |
* typedef void (*normal_func)( CONST GLmatrix *mat, |
* GLfloat scale, |
* CONST GLvector3f *in, |
* CONST GLfloat lengths[], |
* GLvector3f *dest ); |
*/ |
#define OFFSET_MAT 4 |
#define OFFSET_SCALE 8 |
#define OFFSET_IN 12 |
#define OFFSET_LENGTHS 16 |
#define OFFSET_DEST 20 |
#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) |
#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) |
#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) |
#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) |
#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/common_x86.c |
---|
0,0 → 1,65 |
/* $Id: common_x86.c,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Check CPU capabilities & initialize optimized funtions for this particular |
* processor. |
* |
* Written by Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> |
* Changed by Andre Werthmann <wertmann@cs.uni-potsdam.de> for using the |
* new Katmai functions. |
*/ |
#include <stdlib.h> |
#include <stdio.h> |
#if defined(USE_SSE_ASM) && defined(__linux__) |
#include <signal.h> |
#endif |
#if defined(USE_SSE_ASM) && defined(__FreeBSD__) |
#include <sys/types.h> |
#include <sys/sysctl.h> |
#endif |
#include "context.h" |
#include "common_x86_asm.h" |
#include "imports.h" |
int _mesa_x86_cpu_features = 1; |
void _mesa_init_all_x86_transform_asm( void ) |
{ |
_mesa_x86_cpu_features = 1; |
if ( _mesa_x86_cpu_features ) { |
_mesa_init_x86_transform_asm(); |
} |
_mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); |
} |
/shark/tags/rel_0_4/ports/mesa/src/x86/3dnow.h |
---|
0,0 → 1,39 |
/* $Id: 3dnow.h,v 1.1 2003-03-13 12:11:47 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* 3DNow! optimizations contributed by |
* Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> |
*/ |
#ifndef __3DNOW_H__ |
#define __3DNOW_H__ |
#include "math/m_xform.h" |
void _mesa_init_3dnow_transform_asm( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/common_x86_macros.h |
---|
0,0 → 1,107 |
/* $Id: common_x86_macros.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#ifndef __COMMON_X86_MACROS_H__ |
#define __COMMON_X86_MACROS_H__ |
/* ============================================================= |
* Transformation function declarations: |
*/ |
#define XFORM_ARGS GLvector4f *to_vec, \ |
const GLfloat m[16], \ |
const GLvector4f *from_vec |
#define DECLARE_XFORM_GROUP( pfx, sz ) \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); |
#define ASSIGN_XFORM_GROUP( pfx, sz ) \ |
_mesa_transform_tab[sz][MATRIX_GENERAL] = \ |
_mesa_##pfx##_transform_points##sz##_general; \ |
_mesa_transform_tab[sz][MATRIX_IDENTITY] = \ |
_mesa_##pfx##_transform_points##sz##_identity; \ |
_mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ |
_mesa_##pfx##_transform_points##sz##_3d_no_rot; \ |
_mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ |
_mesa_##pfx##_transform_points##sz##_perspective; \ |
_mesa_transform_tab[sz][MATRIX_2D] = \ |
_mesa_##pfx##_transform_points##sz##_2d; \ |
_mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ |
_mesa_##pfx##_transform_points##sz##_2d_no_rot; \ |
_mesa_transform_tab[sz][MATRIX_3D] = \ |
_mesa_##pfx##_transform_points##sz##_3d; |
/* ============================================================= |
* Normal transformation function declarations: |
*/ |
#define NORM_ARGS const GLmatrix *mat, \ |
GLfloat scale, \ |
const GLvector4f *in, \ |
const GLfloat *lengths, \ |
GLvector4f *dest |
#define DECLARE_NORM_GROUP( pfx ) \ |
extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ |
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); |
#define ASSIGN_NORM_GROUP( pfx ) \ |
_mesa_normal_tab[NORM_RESCALE] = \ |
_mesa_##pfx##_rescale_normals; \ |
_mesa_normal_tab[NORM_NORMALIZE] = \ |
_mesa_##pfx##_normalize_normals; \ |
_mesa_normal_tab[NORM_TRANSFORM] = \ |
_mesa_##pfx##_transform_normals; \ |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = \ |
_mesa_##pfx##_transform_normals_no_rot; \ |
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = \ |
_mesa_##pfx##_transform_rescale_normals; \ |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = \ |
_mesa_##pfx##_transform_rescale_normals_no_rot; \ |
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = \ |
_mesa_##pfx##_transform_normalize_normals; \ |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = \ |
_mesa_##pfx##_transform_normalize_normals_no_rot; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse_xform1.s |
---|
0,0 → 1,433 |
/* $Id: sse_xform1.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** TODO: |
* - insert PREFETCH instructions to avoid cache-misses ! |
* - some more optimizations are possible... |
* - for 40-50% more performance in the SSE-functions, the |
* data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define S(i) REGOFF(i * 4, ESI) |
#define D(i) REGOFF(i * 4, EDI) |
#define M(i) REGOFF(i * 4, EDX) |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_general) |
GLNAME( _mesa_sse_transform_points1_general ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
CMP_L( CONST(0), ECX ) /* count == 0 ? */ |
JE( LLBL(K_GTP1GR_finish) ) /* yes -> nothing to do. */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ |
MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP1GR_top): |
MOVSS( S(0), XMM2 ) /* ox */ |
SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ |
MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ |
ADDPS( XMM1, XMM2 ) /* + | + | + | + */ |
MOVUPS( XMM2, D(0) ) |
LLBL(K_GTP1GR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP1GR_top) ) |
LLBL(K_GTP1GR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_identity) |
GLNAME( _mesa_sse_transform_points1_identity ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP1IR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_1), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(1), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
CMP_L( ESI, EDI ) |
JE( LLBL(K_GTP1IR_finish) ) |
ALIGNTEXT32 |
LLBL(K_GTP1IR_top): |
MOV_L( S(0), EDX ) |
MOV_L( EDX, D(0) ) |
LLBL(K_GTP1IR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP1IR_top) ) |
LLBL(K_GTP1IR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot) |
GLNAME(_mesa_sse_transform_points1_3d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP13DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS( M(0), XMM0 ) /* m0 */ |
MOVSS( M(12), XMM1 ) /* m12 */ |
MOVSS( M(13), XMM2 ) /* m13 */ |
MOVSS( M(14), XMM3 ) /* m14 */ |
ALIGNTEXT32 |
LLBL(K_GTP13DNRR_top): |
MOVSS( S(0), XMM4 ) /* ox */ |
MULSS( XMM0, XMM4 ) /* ox*m0 */ |
ADDSS( XMM1, XMM4 ) /* ox*m0+m12 */ |
MOVSS( XMM4, D(0) ) |
MOVSS( XMM2, D(1) ) |
MOVSS( XMM3, D(2) ) |
LLBL(K_GTP13DNRR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP13DNRR_top) ) |
LLBL(K_GTP13DNRR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_perspective) |
GLNAME(_mesa_sse_transform_points1_perspective): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP13PR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
XORPS( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ |
MOVSS( M(0), XMM1 ) /* m0 */ |
MOVSS( M(14), XMM2 ) /* m14 */ |
ALIGNTEXT32 |
LLBL(K_GTP13PR_top): |
MOVSS( S(0), XMM3 ) /* ox */ |
MULSS( XMM1, XMM3 ) /* ox*m0 */ |
MOVSS( XMM3, D(0) ) /* ox*m0->D(0) */ |
MOVSS( XMM2, D(2) ) /* m14->D(2) */ |
MOVSS( XMM0, D(1) ) |
MOVSS( XMM0, D(3) ) |
LLBL(K_GTP13PR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP13PR_top) ) |
LLBL(K_GTP13PR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_2d) |
GLNAME(_mesa_sse_transform_points1_2d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP13P2DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVLPS( M(0), XMM0 ) /* m1 | m0 */ |
MOVLPS( M(12), XMM1 ) /* m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP13P2DR_top): |
MOVSS( S(0), XMM2 ) /* ox */ |
SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ |
MULPS( XMM0, XMM2 ) /* - | - | ox*m1 | ox*m0 */ |
ADDPS( XMM1, XMM2 ) /* - | - | ox*m1+m13 | ox*m0+m12 */ |
MOVLPS( XMM2, D(0) ) |
LLBL(K_GTP13P2DR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP13P2DR_top) ) |
LLBL(K_GTP13P2DR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_2d_no_rot) |
GLNAME(_mesa_sse_transform_points1_2d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP13P2DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS( M(0), XMM0 ) /* m0 */ |
MOVSS( M(12), XMM1 ) /* m12 */ |
MOVSS( M(13), XMM2 ) /* m13 */ |
ALIGNTEXT32 |
LLBL(K_GTP13P2DNRR_top): |
MOVSS( S(0), XMM3 ) /* ox */ |
MULSS( XMM0, XMM3 ) /* ox*m0 */ |
ADDSS( XMM1, XMM3 ) /* ox*m0+m12 */ |
MOVSS( XMM3, D(0) ) |
MOVSS( XMM2, D(1) ) |
LLBL(K_GTP13P2DNRR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP13P2DNRR_top) ) |
LLBL(K_GTP13P2DNRR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points1_3d) |
GLNAME(_mesa_sse_transform_points1_3d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP13P3DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ |
MOVAPS( M(12), XMM1 ) /* m15 | m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP13P3DR_top): |
MOVSS( S(0), XMM2 ) /* ox */ |
SHUFPS( CONST(0x0), XMM2, XMM2 ) /* ox | ox | ox | ox */ |
MULPS( XMM0, XMM2 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ |
ADDPS( XMM1, XMM2 ) /* +m15 | +m14 | +m13 | +m12 */ |
MOVLPS( XMM2, D(0) ) /* - | - | ->D(1)| ->D(0)*/ |
UNPCKHPS( XMM2, XMM2 ) /* ox*m3+m15 | ox*m3+m15 | ox*m2+m14 | ox*m2+m14 */ |
MOVSS( XMM2, D(2) ) |
LLBL(K_GTP13P3DR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP13P3DR_top) ) |
LLBL(K_GTP13P3DR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse_xform2.s |
---|
0,0 → 1,452 |
/* $Id: sse_xform2.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** TODO: |
* - insert PREFETCH instructions to avoid cache-misses ! |
* - some more optimizations are possible... |
* - for 40-50% more performance in the SSE-functions, the |
* data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define S(i) REGOFF(i * 4, ESI) |
#define D(i) REGOFF(i * 4, EDI) |
#define M(i) REGOFF(i * 4, EDX) |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_general) |
GLNAME( _mesa_sse_transform_points2_general ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX ) |
JZ( LLBL(K_GTP2GR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS( M(0), XMM0 ) /* m3 | m2 | m1 | m0 */ |
MOVAPS( M(4), XMM1 ) /* m7 | m6 | m5 | m4 */ |
MOVAPS( M(12), XMM2 ) /* m15 | m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP2GR_top): |
MOVSS( S(0), XMM3 ) /* ox */ |
SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox | ox */ |
MULPS( XMM0, XMM3 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ |
MOVSS( S(1), XMM4 ) /* oy */ |
SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy | oy */ |
MULPS( XMM1, XMM4 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ |
ADDPS( XMM4, XMM3 ) |
ADDPS( XMM2, XMM3 ) |
MOVAPS( XMM3, D(0) ) |
LLBL(K_GTP2GR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP2GR_top) ) |
LLBL(K_GTP2GR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_identity) |
GLNAME( _mesa_sse_transform_points2_identity ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP2IR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
CMP_L( ESI, EDI ) |
JE( LLBL(K_GTP2IR_finish) ) |
ALIGNTEXT32 |
LLBL(K_GTP2IR_top): |
MOV_L ( S(0), EDX ) |
MOV_L ( EDX, D(0) ) |
MOV_L ( S(1), EDX ) |
MOV_L ( EDX, D(1) ) |
LLBL(K_GTP2IR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP2IR_top) ) |
LLBL(K_GTP2IR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_3d_no_rot) |
GLNAME(_mesa_sse_transform_points2_3d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP23DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |
MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ |
MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ |
MOVSS ( M(14), XMM3 ) /* - | - | - | m14 */ |
ALIGNTEXT32 |
LLBL(K_GTP23DNRR_top): |
MOVLPS ( S(0), XMM0 ) /* - | - | oy | ox */ |
MULPS ( XMM1, XMM0 ) /* - | - | oy*m5 | ox*m0 */ |
ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ |
MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ |
MOVSS ( XMM3, D(2) ) /* -> D(2) */ |
LLBL(K_GTP23DNRR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP23DNRR_top) ) |
LLBL(K_GTP23DNRR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_perspective) |
GLNAME(_mesa_sse_transform_points2_perspective): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP23PR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |
MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ |
MOVSS ( M(14), XMM3 ) /* m14 */ |
XORPS ( XMM0, XMM0 ) /* 0 | 0 | 0 | 0 */ |
ALIGNTEXT32 |
LLBL(K_GTP23PR_top): |
MOVLPS( S(0), XMM4 ) /* oy | ox */ |
MULPS( XMM1, XMM4 ) /* oy*m5 | ox*m0 */ |
MOVLPS( XMM4, D(0) ) /* ->D(1) | ->D(0) */ |
MOVSS( XMM3, D(2) ) /* ->D(2) */ |
MOVSS( XMM0, D(3) ) /* ->D(3) */ |
LLBL(K_GTP23PR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP23PR_top) ) |
LLBL(K_GTP23PR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_2d) |
GLNAME(_mesa_sse_transform_points2_2d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP23P2DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVLPS( M(0), XMM0 ) /* m1 | m0 */ |
MOVLPS( M(4), XMM1 ) /* m5 | m4 */ |
MOVLPS( M(12), XMM2 ) /* m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP23P2DR_top): |
MOVSS( S(0), XMM3 ) /* ox */ |
SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ |
MULPS( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ |
MOVSS( S(1), XMM4 ) /* oy */ |
SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ |
MULPS( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ |
ADDPS( XMM4, XMM3 ) |
ADDPS( XMM2, XMM3 ) |
MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ |
LLBL(K_GTP23P2DR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP23P2DR_top) ) |
LLBL(K_GTP23P2DR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_2d_no_rot) |
GLNAME(_mesa_sse_transform_points2_2d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP23P2DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_2), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(2), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* m0 */ |
MOVSS ( M(5), XMM2 ) /* m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ |
MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP23P2DNRR_top): |
MOVLPS( S(0), XMM0 ) /* oy | ox */ |
MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ |
ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ |
MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ |
LLBL(K_GTP23P2DNRR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP23P2DNRR_top) ) |
LLBL(K_GTP23P2DNRR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points2_3d) |
GLNAME(_mesa_sse_transform_points2_3d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP23P3DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ |
MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ |
MOVAPS( M(12), XMM2 ) /* m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP23P3DR_top): |
MOVSS( S(0), XMM3 ) /* ox */ |
SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ox | ox | ox */ |
MULPS( XMM0, XMM3 ) /* ox*m2 | ox*m1 | ox*m0 */ |
MOVSS( S(1), XMM4 ) /* oy */ |
SHUFPS( CONST(0x0), XMM4, XMM4 ) /* oy | oy | oy */ |
MULPS( XMM1, XMM4 ) /* oy*m6 | oy*m5 | oy*m4 */ |
ADDPS( XMM4, XMM3 ) |
ADDPS( XMM2, XMM3 ) |
MOVLPS( XMM3, D(0) ) /* ->D(1) | ->D(0) */ |
UNPCKHPS( XMM3, XMM3 ) |
MOVSS( XMM3, D(2) ) /* ->D(2) */ |
LLBL(K_GTP23P3DR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP23P3DR_top) ) |
LLBL(K_GTP23P3DR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse_xform3.s |
---|
0,0 → 1,498 |
/* $Id: sse_xform3.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** TODO: |
* - insert PREFETCH instructions to avoid cache-misses ! |
* - some more optimizations are possible... |
* - for 40-50% more performance in the SSE-functions, the |
* data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define S(i) REGOFF(i * 4, ESI) |
#define D(i) REGOFF(i * 4, EDI) |
#define M(i) REGOFF(i * 4, EDX) |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_general) |
GLNAME( _mesa_sse_transform_points3_general ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
CMP_L ( CONST(0), ECX ) /* count == 0 ? */ |
JE ( LLBL(K_GTPGR_finish) ) /* yes -> nothing to do. */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS ( REGOFF(0, EDX), XMM0 ) /* m0 | m1 | m2 | m3 */ |
MOVAPS ( REGOFF(16, EDX), XMM1 ) /* m4 | m5 | m6 | m7 */ |
MOVAPS ( REGOFF(32, EDX), XMM2 ) /* m8 | m9 | m10 | m11 */ |
MOVAPS ( REGOFF(48, EDX), XMM3 ) /* m12 | m13 | m14 | m15 */ |
ALIGNTEXT32 |
LLBL(K_GTPGR_top): |
MOVSS ( REGOFF(0, ESI), XMM4 ) /* | | | ox */ |
SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ |
MOVSS ( REGOFF(4, ESI), XMM5 ) /* | | | oy */ |
SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ |
MOVSS ( REGOFF(8, ESI), XMM6 ) /* | | | oz */ |
SHUFPS ( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ |
MULPS ( XMM0, XMM4 ) /* m3*ox | m2*ox | m1*ox | m0*ox */ |
MULPS ( XMM1, XMM5 ) /* m7*oy | m6*oy | m5*oy | m4*oy */ |
MULPS ( XMM2, XMM6 ) /* m11*oz | m10*oz | m9*oz | m8*oz */ |
ADDPS ( XMM5, XMM4 ) |
ADDPS ( XMM6, XMM4 ) |
ADDPS ( XMM3, XMM4 ) |
MOVAPS ( XMM4, REGOFF(0, EDI) ) |
LLBL(K_GTPGR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTPGR_top) ) |
LLBL(K_GTPGR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_identity) |
GLNAME( _mesa_sse_transform_points3_identity ): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTPIR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
CMP_L( ESI, EDI ) |
JE( LLBL(K_GTPIR_finish) ) |
ALIGNTEXT32 |
LLBL(K_GTPIR_top): |
MOVLPS ( S(0), XMM0 ) |
MOVLPS ( XMM0, D(0) ) |
MOVSS ( S(2), XMM0 ) |
MOVSS ( XMM0, D(2) ) |
LLBL(K_GTPIR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTPIR_top) ) |
LLBL(K_GTPIR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_3d_no_rot) |
GLNAME(_mesa_sse_transform_points3_3d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP3DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |
MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ |
MOVLPS ( M(12), XMM2 ) /* - | - | m13 | m12 */ |
MOVSS ( M(10), XMM3 ) /* - | - | - | m10 */ |
MOVSS ( M(14), XMM4 ) /* - | - | - | m14 */ |
ALIGNTEXT32 |
LLBL(K_GTP3DNRR_top): |
MOVLPS ( S(0), XMM0 ) /* - | - | s1 | s0 */ |
MULPS ( XMM1, XMM0 ) /* - | - | s1*m5 | s0*m0 */ |
ADDPS ( XMM2, XMM0 ) /* - | - | +m13 | +m12 */ |
MOVLPS ( XMM0, D(0) ) /* -> D(1) | -> D(0) */ |
MOVSS ( S(2), XMM0 ) /* sz */ |
MULSS ( XMM3, XMM0 ) /* sz*m10 */ |
ADDSS ( XMM4, XMM0 ) /* +m14 */ |
MOVSS ( XMM0, D(2) ) /* -> D(2) */ |
LLBL(K_GTP3DNRR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP3DNRR_top) ) |
LLBL(K_GTP3DNRR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_perspective) |
GLNAME(_mesa_sse_transform_points3_perspective): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP3PR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* - | - | - | m0 */ |
MOVSS ( M(5), XMM2 ) /* - | - | - | m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* - | - | m5 | m0 */ |
MOVLPS ( M(8), XMM2 ) /* - | - | m9 | m8 */ |
MOVSS ( M(10), XMM3 ) /* m10 */ |
MOVSS ( M(14), XMM4 ) /* m14 */ |
XORPS ( XMM6, XMM6 ) /* 0 */ |
ALIGNTEXT32 |
LLBL(K_GTP3PR_top): |
MOVLPS ( S(0), XMM0 ) /* oy | ox */ |
MULPS ( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ |
MOVSS ( S(2), XMM5 ) /* oz */ |
SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* oz | oz */ |
MULPS ( XMM2, XMM5 ) /* oz*m9 | oz*m8 */ |
ADDPS ( XMM5, XMM0 ) /* +oy*m5 | +ox*m0 */ |
MOVLPS ( XMM0, D(0) ) /* ->D(1) | ->D(0) */ |
MOVSS ( S(2), XMM0 ) /* oz */ |
MULSS ( XMM3, XMM0 ) /* oz*m10 */ |
ADDSS ( XMM4, XMM0 ) /* +m14 */ |
MOVSS ( XMM0, D(2) ) /* ->D(2) */ |
MOVSS ( S(2), XMM0 ) /* oz */ |
MOVSS ( XMM6, XMM5 ) /* 0 */ |
SUBPS ( XMM0, XMM5 ) /* -oz */ |
MOVSS ( XMM5, D(3) ) /* ->D(3) */ |
LLBL(K_GTP3PR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP3PR_top) ) |
LLBL(K_GTP3PR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_2d) |
GLNAME(_mesa_sse_transform_points3_2d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP3P2DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVLPS( M(0), XMM0 ) /* m1 | m0 */ |
MOVLPS( M(4), XMM1 ) /* m5 | m4 */ |
MOVLPS( M(12), XMM2 ) /* m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP3P2DR_top): |
MOVSS ( S(0), XMM3 ) /* ox */ |
SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ox | ox */ |
MULPS ( XMM0, XMM3 ) /* ox*m1 | ox*m0 */ |
MOVSS ( S(1), XMM4 ) /* oy */ |
SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* oy | oy */ |
MULPS ( XMM1, XMM4 ) /* oy*m5 | oy*m4 */ |
ADDPS ( XMM4, XMM3 ) |
ADDPS ( XMM2, XMM3 ) |
MOVLPS ( XMM3, D(0) ) |
MOVSS ( S(2), XMM3 ) |
MOVSS ( XMM3, D(2) ) |
LLBL(K_GTP3P2DR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_GTP3P2DR_top) ) |
LLBL(K_GTP3P2DR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_2d_no_rot) |
GLNAME(_mesa_sse_transform_points3_2d_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP3P2DNRR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* m0 */ |
MOVSS ( M(5), XMM2 ) /* m5 */ |
UNPCKLPS ( XMM2, XMM1 ) /* m5 | m0 */ |
MOVLPS ( M(12), XMM2 ) /* m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP3P2DNRR_top): |
MOVLPS( S(0), XMM0 ) /* oy | ox */ |
MULPS( XMM1, XMM0 ) /* oy*m5 | ox*m0 */ |
ADDPS( XMM2, XMM0 ) /* +m13 | +m12 */ |
MOVLPS( XMM0, D(0) ) /* ->D(1) | ->D(0) */ |
MOVSS( S(2), XMM0 ) |
MOVSS( XMM0, D(2) ) |
LLBL(K_GTP3P2DNRR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP3P2DNRR_top) ) |
LLBL(K_GTP3P2DNRR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT4 |
GLOBL GLNAME(_mesa_sse_transform_points3_3d) |
GLNAME(_mesa_sse_transform_points3_3d): |
#define FRAME_OFFSET 8 |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( REGOFF(OFFSET_SOURCE+8, ESP), ESI ) /* ptr to source GLvector4f */ |
MOV_L( REGOFF(OFFSET_DEST+8, ESP), EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP3P3DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) /* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVAPS( M(0), XMM0 ) /* m2 | m1 | m0 */ |
MOVAPS( M(4), XMM1 ) /* m6 | m5 | m4 */ |
MOVAPS( M(8), XMM2 ) /* m10 | m9 | m8 */ |
MOVAPS( M(12), XMM3 ) /* m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL(K_GTP3P3DR_top): |
MOVSS( S(0), XMM4 ) |
SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox */ |
MULPS( XMM0, XMM4 ) /* ox*m2 | ox*m1 | ox*m0 */ |
MOVSS( S(1), XMM5 ) |
SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy */ |
MULPS( XMM1, XMM5 ) /* oy*m6 | oy*m5 | oy*m4 */ |
MOVSS( S(2), XMM6 ) |
SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz */ |
MULPS( XMM2, XMM6 ) /* oz*m10 | oz*m9 | oz*m8 */ |
ADDPS( XMM5, XMM4 ) /* + | + | + */ |
ADDPS( XMM6, XMM4 ) /* + | + | + */ |
ADDPS( XMM3, XMM4 ) /* + | + | + */ |
MOVLPS( XMM4, D(0) ) /* => D(1) | => D(0) */ |
UNPCKHPS( XMM4, XMM4 ) |
MOVSS( XMM4, D(2) ) |
LLBL(K_GTP3P3DR_skip): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP3P3DR_top) ) |
LLBL(K_GTP3P3DR_finish): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
#undef FRAME_OFFSET |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse_xform4.s |
---|
0,0 → 1,226 |
/* $Id: sse_xform4.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "matypes.h" |
#include "xform_args.h" |
SEG_TEXT |
#define FRAME_OFFSET 8 |
#define SRC(i) REGOFF(i * 4, ESI) |
#define DST(i) REGOFF(i * 4, EDI) |
#define MAT(i) REGOFF(i * 4, EDX) |
#define SELECT(r0, r1, r2, r3) CONST( r0 * 64 + r1 * 16 + r2 * 4 + r3 ) |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_sse_transform_points4_general ) |
GLNAME( _mesa_sse_transform_points4_general ): |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) /* verify non-zero count */ |
JE( LLBL( sse_general_done ) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
PREFETCHT0( REGIND(ESI) ) |
MOVAPS( MAT(0), XMM4 ) /* m3 | m2 | m1 | m0 */ |
MOVAPS( MAT(4), XMM5 ) /* m7 | m6 | m5 | m4 */ |
MOVAPS( MAT(8), XMM6 ) /* m11 | m10 | m9 | m8 */ |
MOVAPS( MAT(12), XMM7 ) /* m15 | m14 | m13 | m12 */ |
ALIGNTEXT16 |
LLBL( sse_general_loop ): |
MOVSS( SRC(0), XMM0 ) /* ox */ |
SHUFPS( CONST(0x0), XMM0, XMM0 ) /* ox | ox | ox | ox */ |
MULPS( XMM4, XMM0 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ |
MOVSS( SRC(1), XMM1 ) /* oy */ |
SHUFPS( CONST(0x0), XMM1, XMM1 ) /* oy | oy | oy | oy */ |
MULPS( XMM5, XMM1 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ |
MOVSS( SRC(2), XMM2 ) /* oz */ |
SHUFPS( CONST(0x0), XMM2, XMM2 ) /* oz | oz | oz | oz */ |
MULPS( XMM6, XMM2 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ |
MOVSS( SRC(3), XMM3 ) /* ow */ |
SHUFPS( CONST(0x0), XMM3, XMM3 ) /* ow | ow | ow | ow */ |
MULPS( XMM7, XMM3 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ |
ADDPS( XMM1, XMM0 ) /* ox*m3+oy*m7 | ... */ |
ADDPS( XMM2, XMM0 ) /* ox*m3+oy*m7+oz*m11 | ... */ |
ADDPS( XMM3, XMM0 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ |
MOVAPS( XMM0, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
DEC_L( ECX ) |
JNZ( LLBL( sse_general_loop ) ) |
LLBL( sse_general_done ): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
ALIGNTEXT4 |
GLOBL GLNAME( _mesa_sse_transform_points4_3d ) |
GLNAME( _mesa_sse_transform_points4_3d ): |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) /* ptr to source GLvector4f */ |
MOV_L( ARG_DEST, EDI ) /* ptr to dest GLvector4f */ |
MOV_L( ARG_MATRIX, EDX ) /* ptr to matrix */ |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) /* source count */ |
TEST_L( ECX, ECX) |
JZ( LLBL(K_GTP43P3DR_finish) ) /* count was zero; go to finish */ |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_3), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) )/* set dest size */ |
SHL_L( CONST(4), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
MOVAPS( MAT(0), XMM0 ) /* m3 | m2 | m1 | m0 */ |
MOVAPS( MAT(4), XMM1 ) /* m7 | m6 | m5 | m4 */ |
MOVAPS( MAT(8), XMM2 ) /* m11 | m10 | m9 | m8 */ |
MOVAPS( MAT(12), XMM3 ) /* m15 | m14 | m13 | m12 */ |
ALIGNTEXT32 |
LLBL( K_GTP43P3DR_top ): |
MOVSS( SRC(0), XMM4 ) /* ox */ |
SHUFPS( CONST(0x0), XMM4, XMM4 ) /* ox | ox | ox | ox */ |
MULPS( XMM0, XMM4 ) /* ox*m3 | ox*m2 | ox*m1 | ox*m0 */ |
MOVSS( SRC(1), XMM5 ) /* oy */ |
SHUFPS( CONST(0x0), XMM5, XMM5 ) /* oy | oy | oy | oy */ |
MULPS( XMM1, XMM5 ) /* oy*m7 | oy*m6 | oy*m5 | oy*m4 */ |
MOVSS( SRC(2), XMM6 ) /* oz */ |
SHUFPS( CONST(0x0), XMM6, XMM6 ) /* oz | oz | oz | oz */ |
MULPS( XMM2, XMM6 ) /* oz*m11 | oz*m10 | oz*m9 | oz*m8 */ |
MOVSS( SRC(3), XMM7 ) /* ow */ |
SHUFPS( CONST(0x0), XMM7, XMM7 ) /* ow | ow | ow | ow */ |
MULPS( XMM3, XMM7 ) /* ow*m15 | ow*m14 | ow*m13 | ow*m12 */ |
ADDPS( XMM5, XMM4 ) /* ox*m3+oy*m7 | ... */ |
ADDPS( XMM6, XMM4 ) /* ox*m3+oy*m7+oz*m11 | ... */ |
ADDPS( XMM7, XMM4 ) /* ox*m3+oy*m7+oz*m11+ow*m15 | ... */ |
MOVAPS( XMM4, DST(0) ) /* ->D(3) | ->D(2) | ->D(1) | ->D(0) */ |
MOVSS( SRC(3), XMM4 ) /* ow */ |
MOVSS( XMM4, DST(3) ) /* ->D(3) */ |
LLBL( K_GTP43P3DR_skip ): |
ADD_L( CONST(16), EDI ) |
ADD_L( EAX, ESI ) |
CMP_L( ECX, EDI ) |
JNE( LLBL(K_GTP43P3DR_top) ) |
LLBL( K_GTP43P3DR_finish ): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_sse_transform_points4_identity ) |
GLNAME( _mesa_sse_transform_points4_identity ): |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_MATRIX, EDX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
TEST_L( ECX, ECX ) /* verify non-zero count */ |
JE( LLBL( sse_identity_done ) ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) /* stride */ |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) /* set dest flags */ |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) /* set dest count */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) )/* set dest size */ |
MOV_L( REGOFF(V4F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V4F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ALIGNTEXT16 |
LLBL( sse_identity_loop ): |
PREFETCHNTA( REGOFF(32, ESI) ) |
MOVAPS( REGIND(ESI), XMM0 ) |
ADD_L( EAX, ESI ) |
MOVAPS( XMM0, REGIND(EDI) ) |
ADD_L( CONST(16), EDI ) |
DEC_L( ECX ) |
JNZ( LLBL( sse_identity_loop ) ) |
LLBL( sse_identity_done ): |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86_cliptest.s |
---|
0,0 → 1,401 |
/* $Id: x86_cliptest.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* NOTE: Avoid using spaces in between '(' ')' and arguments, especially |
* with macros like CONST, LLBL that expand to CONCAT(...). Putting spaces |
* in there will break the build on some platforms. |
*/ |
#include "matypes.h" |
#include "clip_args.h" |
#define SRC0 REGOFF(0, ESI) |
#define SRC1 REGOFF(4, ESI) |
#define SRC2 REGOFF(8, ESI) |
#define SRC3 REGOFF(12, ESI) |
#define DST0 REGOFF(0, EDI) |
#define DST1 REGOFF(4, EDI) |
#define DST2 REGOFF(8, EDI) |
#define DST3 REGOFF(12, EDI) |
#define MAT0 REGOFF(0, EDX) |
#define MAT1 REGOFF(4, EDX) |
#define MAT2 REGOFF(8, EDX) |
#define MAT3 REGOFF(12, EDX) |
/* |
* Table for clip test. |
* |
* bit6 = SRC3 < 0 |
* bit5 = SRC2 < 0 |
* bit4 = abs(S(2)) > abs(S(3)) |
* bit3 = SRC1 < 0 |
* bit2 = abs(S(1)) > abs(S(3)) |
* bit1 = SRC0 < 0 |
* bit0 = abs(S(0)) > abs(S(3)) |
*/ |
SEG_DATA |
clip_table: |
D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 |
D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a |
D_BYTE 0x20, 0x21, 0x20, 0x22, 0x24, 0x25, 0x24, 0x26 |
D_BYTE 0x20, 0x21, 0x20, 0x22, 0x28, 0x29, 0x28, 0x2a |
D_BYTE 0x00, 0x01, 0x00, 0x02, 0x04, 0x05, 0x04, 0x06 |
D_BYTE 0x00, 0x01, 0x00, 0x02, 0x08, 0x09, 0x08, 0x0a |
D_BYTE 0x10, 0x11, 0x10, 0x12, 0x14, 0x15, 0x14, 0x16 |
D_BYTE 0x10, 0x11, 0x10, 0x12, 0x18, 0x19, 0x18, 0x1a |
D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 |
D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a |
D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x27, 0x25, 0x27, 0x26 |
D_BYTE 0x2f, 0x2d, 0x2f, 0x2e, 0x2b, 0x29, 0x2b, 0x2a |
D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x37, 0x35, 0x37, 0x36 |
D_BYTE 0x3f, 0x3d, 0x3f, 0x3e, 0x3b, 0x39, 0x3b, 0x3a |
D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x17, 0x15, 0x17, 0x16 |
D_BYTE 0x1f, 0x1d, 0x1f, 0x1e, 0x1b, 0x19, 0x1b, 0x1a |
SEG_TEXT |
/* |
* _mesa_x86_cliptest_points4 |
* |
* AL: ormask |
* AH: andmask |
* EBX: temp0 |
* ECX: temp1 |
* EDX: clipmask[] |
* ESI: clip[] |
* EDI: proj[] |
* EBP: temp2 |
*/ |
#if defined(__ELF__) && defined(__PIC__) && defined(GNU_ASSEMBLER) && !defined(ELFPIC) |
#define ELFPIC |
#endif |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_cliptest_points4 ) |
GLNAME( _mesa_x86_cliptest_points4 ): |
#ifdef ELFPIC |
#define FRAME_OFFSET 20 |
#else |
#define FRAME_OFFSET 16 |
#endif |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBP ) |
PUSH_L( EBX ) |
#ifdef ELFPIC |
/* store pointer to clip_table on stack */ |
CALL( LLBL(ctp4_get_eip) ) |
ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) |
MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) |
PUSH_L( EBX ) |
JMP( LLBL(ctp4_clip_table_ready) ) |
LLBL(ctp4_get_eip): |
/* store eip in ebx */ |
MOV_L( REGIND(ESP), EBX ) |
RET |
LLBL(ctp4_clip_table_ready): |
#endif |
MOV_L( ARG_SOURCE, ESI ) |
MOV_L( ARG_DEST, EDI ) |
MOV_L( ARG_CLIP, EDX ) |
MOV_L( ARG_OR, EBX ) |
MOV_L( ARG_AND, EBP ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) |
MOV_L( EAX, ARG_SOURCE ) /* put stride in ARG_SOURCE */ |
MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) |
MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) |
MOV_L( REGOFF(V4F_START, EDI), EDI ) |
ADD_L( EDX, ECX ) |
MOV_L( ECX, ARG_CLIP ) /* put clipmask + count in ARG_CLIP */ |
CMP_L( ECX, EDX ) |
MOV_B( REGIND(EBX), AL ) |
MOV_B( REGIND(EBP), AH ) |
JZ( LLBL(ctp4_finish) ) |
ALIGNTEXT16 |
LLBL(ctp4_top): |
FLD1 /* F3 */ |
FDIV_S( SRC3 ) /* GH: don't care about div-by-zero */ |
MOV_L( SRC3, EBP ) |
MOV_L( SRC2, EBX ) |
XOR_L( ECX, ECX ) |
ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ |
ADC_L( ECX, ECX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
MOV_L( SRC1, EBX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
MOV_L( SRC0, EBX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
#ifdef ELFPIC |
MOV_L( REGIND(ESP), EBP ) /* clip_table */ |
MOV_B( REGBI(EBP, ECX), CL ) |
#else |
MOV_B( REGOFF(clip_table,ECX), CL ) |
#endif |
OR_B( CL, AL ) |
AND_B( CL, AH ) |
TEST_B( CL, CL ) |
MOV_B( CL, REGIND(EDX) ) |
JZ( LLBL(ctp4_proj) ) |
LLBL(ctp4_noproj): |
FSTP( ST(0) ) /* */ |
MOV_L( CONST(0), DST0 ) |
MOV_L( CONST(0), DST1 ) |
MOV_L( CONST(0), DST2 ) |
MOV_L( CONST(0x3f800000), DST3 ) |
JMP( LLBL(ctp4_next) ) |
LLBL(ctp4_proj): |
FLD_S( SRC0 ) /* F0 F3 */ |
FMUL2( ST(1), ST0 ) |
FLD_S( SRC1 ) /* F1 F0 F3 */ |
FMUL2( ST(2), ST0 ) |
FLD_S( SRC2 ) /* F2 F1 F0 F3 */ |
FMUL2( ST(3), ST0 ) |
FXCH( ST(2) ) /* F0 F1 F2 F3 */ |
FSTP_S( DST0 ) /* F1 F2 F3 */ |
FSTP_S( DST1 ) /* F2 F3 */ |
FSTP_S( DST2 ) /* F3 */ |
FSTP_S( DST3 ) /* */ |
LLBL(ctp4_next): |
INC_L( EDX ) |
ADD_L( CONST(16), EDI ) |
ADD_L( ARG_SOURCE, ESI ) |
CMP_L( EDX, ARG_CLIP ) |
JNZ( LLBL(ctp4_top) ) |
MOV_L( ARG_OR, ECX ) |
MOV_L( ARG_AND, EDX ) |
MOV_B( AL, REGIND(ECX) ) |
MOV_B( AH, REGIND(EDX) ) |
LLBL(ctp4_finish): |
MOV_L( ARG_DEST, EAX ) |
#ifdef ELFPIC |
POP_L( ESI ) /* discard ptr to clip_table */ |
#endif |
POP_L( EBX ) |
POP_L( EBP ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
ALIGNTEXT16 |
GLOBL GLNAME( _mesa_x86_cliptest_points4_np ) |
GLNAME( _mesa_x86_cliptest_points4_np ): |
#ifdef ELFPIC |
#define FRAME_OFFSET 20 |
#else |
#define FRAME_OFFSET 16 |
#endif |
PUSH_L( ESI ) |
PUSH_L( EDI ) |
PUSH_L( EBP ) |
PUSH_L( EBX ) |
#ifdef ELFPIC |
/* store pointer to clip_table on stack */ |
CALL( LLBL(ctp4_np_get_eip) ) |
ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) |
MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) |
PUSH_L( EBX ) |
JMP( LLBL(ctp4_np_clip_table_ready) ) |
LLBL(ctp4_np_get_eip): |
/* store eip in ebx */ |
MOV_L( REGIND(ESP), EBX ) |
RET |
LLBL(ctp4_np_clip_table_ready): |
#endif |
MOV_L( ARG_SOURCE, ESI ) |
/* slot */ |
MOV_L( ARG_CLIP, EDX ) |
MOV_L( ARG_OR, EBX ) |
MOV_L( ARG_AND, EBP ) |
MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) |
MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) |
MOV_L( REGOFF(V4F_START, ESI), ESI ) |
MOV_L( EAX, ARG_DEST ) /* put stride in ARG_DEST */ |
ADD_L( EDX, ECX ) |
MOV_L( ECX, EDI ) /* put clipmask + count in EDI */ |
CMP_L( ECX, EDX ) |
MOV_B( REGIND(EBX), AL ) |
MOV_B( REGIND(EBP), AH ) |
JZ( LLBL(ctp4_np_finish) ) |
ALIGNTEXT16 |
LLBL(ctp4_np_top): |
MOV_L( SRC3, EBP ) |
MOV_L( SRC2, EBX ) |
XOR_L( ECX, ECX ) |
ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ |
ADC_L( ECX, ECX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
MOV_L( SRC1, EBX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
MOV_L( SRC0, EBX ) |
ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ |
ADC_L( ECX, ECX ) |
CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ |
ADC_L( ECX, ECX ) |
#ifdef ELFPIC |
MOV_L( REGIND(ESP), EBP ) /* clip_table */ |
MOV_B( REGBI(EBP, ECX), CL ) |
#else |
MOV_B( REGOFF(clip_table,ECX), CL ) |
#endif |
OR_B( CL, AL ) |
AND_B( CL, AH ) |
TEST_B( CL, CL ) |
MOV_B( CL, REGIND(EDX) ) |
INC_L( EDX ) |
/* slot */ |
ADD_L( ARG_DEST, ESI ) |
CMP_L( EDX, EDI ) |
JNZ( LLBL(ctp4_np_top) ) |
MOV_L( ARG_OR, ECX ) |
MOV_L( ARG_AND, EDX ) |
MOV_B( AL, REGIND(ECX) ) |
MOV_B( AH, REGIND(EDX) ) |
LLBL(ctp4_np_finish): |
MOV_L( ARG_SOURCE, EAX ) |
#ifdef ELFPIC |
POP_L( ESI ) /* discard ptr to clip_table */ |
#endif |
POP_L( EBX ) |
POP_L( EBP ) |
POP_L( EDI ) |
POP_L( ESI ) |
RET |
/shark/tags/rel_0_4/ports/mesa/src/x86/assyntax.h |
---|
0,0 → 1,1697 |
/* $Id: assyntax.h,v 1.1 2003-03-13 12:11:48 giacomo Exp $ */ |
#ifndef __ASSYNTAX_H__ |
#define __ASSYNTAX_H__ |
/* |
* Copyright 1992 Vrije Universiteit, The Netherlands |
* |
* Permission to use, copy, modify, and distribute this software and its |
* documentation for any purpose and without fee is hereby granted, provided |
* that the above copyright notice appear in all copies and that both that |
* copyright notice and this permission notice appear in supporting |
* documentation, and that the name of the Vrije Universiteit not be used in |
* advertising or publicity pertaining to distribution of the software without |
* specific, written prior permission. The Vrije Universiteit makes no |
* representations about the suitability of this software for any purpose. |
* It is provided "as is" without express or implied warranty. |
* |
* The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, |
* IN NO EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, |
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE |
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
* PERFORMANCE OF THIS SOFTWARE. |
*/ |
/* |
* assyntax.h |
* |
* Select the syntax appropriate to the 386 assembler being used |
* To add support for more assemblers add more columns to the CHOICE |
* macro. Note that register names must also have uppercase names |
* to avoid macro recursion. e.g., #define ah %ah recurses! |
* |
* NB 1. Some of the macros for certain assemblers imply that the code is to |
* run in protected mode!! Caveat emptor. |
* |
* NB 2. 486 specific instructions are not included. This is to discourage |
* their accidental use in code that is intended to run on 386 and 486 |
* systems. |
* |
* Supported assemblers: |
* |
* (a) AT&T SysVr4 as(1): define ATT_ASSEMBLER |
* (b) GNU Assembler gas: define GNU_ASSEMBLER (default) |
* (c) Amsterdam Compiler kit: define ACK_ASSEMBLER |
* (d) The Netwide Assembler: define NASM_ASSEMBLER |
* (e) Microsoft Assembler: define MASM_ASSEMBLER (UNTESTED!) |
* |
* The following naming conventions have been used to identify the various |
* data types: |
* _SR = segment register version |
* Integer: |
* _Q = quadword = 64 bits |
* _L = long = 32 bits |
* _W = short = 16 bits |
* _B = byte = 8 bits |
* Floating-point: |
* _X = m80real = 80 bits |
* _D = double = 64 bits |
* _S = single = 32 bits |
* |
* Author: Gregory J. Sharp, Sept 1992 |
* Vrije Universiteit, Amsterdam, The Netherlands |
* |
* [support for Intel syntax added by Josh Vanderhoof, 1999] |
*/ |
#if !(defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER)) |
/* Default to ATT_ASSEMBLER when SVR4 or SYSV are defined */ |
#if (defined(SVR4) || defined(SYSV)) && !defined(GNU_ASSEMBLER) |
#define ATT_ASSEMBLER |
#endif |
#if !defined(ATT_ASSEMBLER) && !defined(GNU_ASSEMBLER) && !defined(ACK_ASSEMBLER) |
#define GNU_ASSEMBLER |
#endif |
#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) |
#define CONCAT(x, y) x ## y |
#else |
#define CONCAT(x, y) x/**/y |
#endif |
#ifdef ACK_ASSEMBLER |
/* Assume we write code for 32-bit protected mode! */ |
/* Redefine register names for GAS & AT&T assemblers */ |
#define AL al |
#define AH ah |
#define AX ax |
#define EAX ax |
#define BL bl |
#define BH bh |
#define BX bx |
#define EBX bx |
#define CL cl |
#define CH ch |
#define CX cx |
#define ECX cx |
#define DL dl |
#define DH dh |
#define DX dx |
#define EDX dx |
#define BP bp |
#define EBP bp |
#define SI si |
#define ESI si |
#define DI di |
#define EDI di |
#define SP sp |
#define ESP sp |
#define CS cs |
#define SS ss |
#define DS ds |
#define ES es |
#define FS fs |
#define GS gs |
/* Control Registers */ |
#define CR0 cr0 |
#define CR1 cr1 |
#define CR2 cr2 |
#define CR3 cr3 |
/* Debug Registers */ |
#define DR0 dr0 |
#define DR1 dr1 |
#define DR2 dr2 |
#define DR3 dr3 |
#define DR4 dr4 |
#define DR5 dr5 |
#define DR6 dr6 |
#define DR7 dr7 |
/* Floating-point Stack */ |
#define ST st |
#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text |
#define _WTOG o16 /* word toggle for _W instructions */ |
#define _LTOG /* long toggle for _L instructions */ |
#define ADDR_TOGGLE a16 |
#define OPSZ_TOGGLE o16 |
#define USE16 .use16 |
#define USE32 .use32 |
#define CHOICE(a,b,c) c |
#else /* AT&T or GAS */ |
/* Redefine register names for GAS & AT&T assemblers */ |
#define AL %al |
#define AH %ah |
#define AX %ax |
#define EAX %eax |
#define BL %bl |
#define BH %bh |
#define BX %bx |
#define EBX %ebx |
#define CL %cl |
#define CH %ch |
#define CX %cx |
#define ECX %ecx |
#define DL %dl |
#define DH %dh |
#define DX %dx |
#define EDX %edx |
#define BP %bp |
#define EBP %ebp |
#define SI %si |
#define ESI %esi |
#define DI %di |
#define EDI %edi |
#define SP %sp |
#define ESP %esp |
#define CS %cs |
#define SS %ss |
#define DS %ds |
#define ES %es |
#define FS %fs |
#define GS %gs |
/* Control Registers */ |
#define CR0 %cr0 |
#define CR1 %cr1 |
#define CR2 %cr2 |
#define CR3 %cr3 |
/* Debug Registers */ |
#define DR0 %db0 |
#define DR1 %db1 |
#define DR2 %db2 |
#define DR3 %db3 |
#define DR4 %db4 |
#define DR5 %db5 |
#define DR6 %db6 |
#define DR7 %db7 |
/* Floating-point Stack */ |
#define _STX0 %st(0) |
#define _STX1 %st(1) |
#define _STX2 %st(2) |
#define _STX3 %st(3) |
#define _STX4 %st(4) |
#define _STX5 %st(5) |
#define _STX6 %st(6) |
#define _STX7 %st(7) |
#define ST(x) CONCAT(_STX,x) |
#ifdef GNU_ASSEMBLER |
#define ST0 %st(0) |
#else |
#define ST0 %st |
#endif |
/* MMX Registers */ |
#define MM0 %mm0 |
#define MM1 %mm1 |
#define MM2 %mm2 |
#define MM3 %mm3 |
#define MM4 %mm4 |
#define MM5 %mm5 |
#define MM6 %mm6 |
#define MM7 %mm7 |
/* SSE Registers */ |
#define XMM0 %xmm0 |
#define XMM1 %xmm1 |
#define XMM2 %xmm2 |
#define XMM3 %xmm3 |
#define XMM4 %xmm4 |
#define XMM5 %xmm5 |
#define XMM6 %xmm6 |
#define XMM7 %xmm7 |
#define AS_BEGIN |
#define USE16 |
#define USE32 |
#ifdef GNU_ASSEMBLER |
#define ADDR_TOGGLE aword |
#define OPSZ_TOGGLE word |
#define CHOICE(a,b,c) b |
#else |
/* |
* AT&T ASSEMBLER SYNTAX |
* ********************* |
*/ |
#define CHOICE(a,b,c) a |
#define ADDR_TOGGLE addr16 |
#define OPSZ_TOGGLE data16 |
#endif /* GNU_ASSEMBLER */ |
#endif /* ACK_ASSEMBLER */ |
#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(DJGPP) |
#define GLNAME(a) a |
#else |
#define GLNAME(a) CONCAT(_,a) |
#endif |
/****************************************/ |
/* */ |
/* Select the various choices */ |
/* */ |
/****************************************/ |
/* Redefine assembler directives */ |
/*********************************/ |
#define GLOBL CHOICE(.globl, .globl, .extern) |
#define GLOBAL GLOBL |
#define EXTERN GLOBL |
/* |
#define ALIGNTEXT32 CHOICE(.align 32, .align ARG2(5,0x90), .align 32) |
*/ |
#define ALIGNTEXT32 CHOICE(.align 32, .balign 32, .align 32) |
#define ALIGNTEXT16 CHOICE(.align 16, .balign 16, .align 16) |
#define ALIGNTEXT8 CHOICE(.align 8, .balign 8, .align 8) |
#define ALIGNTEXT4 CHOICE(.align 4, .balign 4, .align 4) |
#define ALIGNTEXT2 CHOICE(.align 2, .balign 2, .align 2) |
/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is |
* guaranteed to be filled with NOPs. Otherwise it does nothing. |
*/ |
#define ALIGNTEXT32ifNOP CHOICE(.align 32, .balign ARG2(32,0x90), /*can't do it*/) |
#define ALIGNTEXT16ifNOP CHOICE(.align 16, .balign ARG2(16,0x90), /*can't do it*/) |
#define ALIGNTEXT8ifNOP CHOICE(.align 8, .balign ARG2(8,0x90), /*can't do it*/) |
#define ALIGNTEXT4ifNOP CHOICE(.align 4, .balign ARG2(4,0x90), /*can't do it*/) |
#define ALIGNDATA32 CHOICE(.align 32, .balign ARG2(32,0x0), .align 32) |
#define ALIGNDATA16 CHOICE(.align 16, .balign ARG2(16,0x0), .align 16) |
#define ALIGNDATA8 CHOICE(.align 8, .balign ARG2(8,0x0), .align 8) |
#define ALIGNDATA4 CHOICE(.align 4, .balign ARG2(4,0x0), .align 4) |
#define ALIGNDATA2 CHOICE(.align 2, .balign ARG2(2,0x0), .align 2) |
#define FILE(s) CHOICE(.file s, .file s, .file s) |
#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) |
#define D_LONG CHOICE(.long, .long, .data4) |
#define D_WORD CHOICE(.value, .short, .data2) |
#define D_BYTE CHOICE(.byte, .byte, .data1) |
#define SPACE CHOICE(.comm, .space, .space) |
#define COMM CHOICE(.comm, .comm, .comm) |
#define SEG_DATA CHOICE(.data, .data, .sect .data) |
#define SEG_TEXT CHOICE(.text, .text, .sect .text) |
#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) |
#ifdef GNU_ASSEMBLER |
#define D_SPACE(n) . = . + n |
#else |
#define D_SPACE(n) .space n |
#endif |
/* Addressing Modes */ |
/* Immediate Mode */ |
#define ADDR(a) CHOICE(CONCAT($,a), CONCAT($,a), a) |
#define CONST(a) CHOICE(CONCAT($,a), CONCAT($,a), a) |
/* Indirect Mode */ |
#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ |
#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ |
/* Register b indirect plus displacement a */ |
#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) |
/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode |
* which has no scaling |
*/ |
#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) |
/* Reg indirect Base + (Index * Scale) */ |
#define REGBIS(b,i,s) CHOICE((b,i,s), (b,i,s), (b)(i*s)) |
/* Reg indirect Base + (Index * Scale) + Displacement */ |
#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) |
/* Displaced Scaled Index: */ |
#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) |
/* Indexed Base: */ |
#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) |
/* Displaced Base: */ |
#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) |
/* Variable indirect: */ |
#define VARINDIRECT(var) CHOICE(*var, *var, (var)) |
/* Use register contents as jump/call target: */ |
#define CODEPTR(reg) CHOICE(*reg, *reg, reg) |
/* For expressions requiring bracketing |
* eg. (CRT0_PM | CRT_EM) |
*/ |
#define EXPR(a) CHOICE([a], (a), [a]) |
#define ENOT(a) CHOICE(0!a, ~a, ~a) |
#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) |
#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) |
/* |
* We have to beat the problem of commas within arguments to choice. |
* eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI |
* and other known cpp definitions evaluate arguments before substitution |
* so the following works. |
*/ |
#define ARG2(a, b) a,b |
#define ARG3(a,b,c) a,b,c |
/* Redefine assembler commands */ |
#define AAA CHOICE(aaa, aaa, aaa) |
#define AAD CHOICE(aad, aad, aad) |
#define AAM CHOICE(aam, aam, aam) |
#define AAS CHOICE(aas, aas, aas) |
#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) |
#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) |
#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) |
#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) |
#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) |
#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) |
#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) |
#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) |
#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) |
#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) |
#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) |
#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) |
#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) |
#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) |
#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) |
#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) |
#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) |
#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) |
#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) |
#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) |
#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) |
#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) |
#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) |
#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) |
#define CALL(a) CHOICE(call a, call a, call a) |
#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) |
#define CBW CHOICE(cbtw, cbw, cbw) |
#define CWDE CHOICE(cwtd, cwde, cwde) |
#define CLC CHOICE(clc, clc, clc) |
#define CLD CHOICE(cld, cld, cld) |
#define CLI CHOICE(cli, cli, cli) |
#define CLTS CHOICE(clts, clts, clts) |
#define CMC CHOICE(cmc, cmc, cmc) |
#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) |
#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) |
#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) |
#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) |
#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) |
#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) |
#define CWD CHOICE(cwtl, cwd, cwd) |
#define CDQ CHOICE(cltd, cdq, cdq) |
#define DAA CHOICE(daa, daa, daa) |
#define DAS CHOICE(das, das, das) |
#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) |
#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) |
#define DEC_B(a) CHOICE(decb a, decb a, decb a) |
#define DIV_L(a) CHOICE(divl a, divl a, div a) |
#define DIV_W(a) CHOICE(divw a, divw a, div a) |
#define DIV_B(a) CHOICE(divb a, divb a, divb a) |
#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) |
#define HLT CHOICE(hlt, hlt, hlt) |
#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) |
#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) |
#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) |
/* More forms than this for imul!! */ |
#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) |
#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) |
#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) |
#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) |
#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) |
#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) |
/* Please AS code writer: use the following ONLY, if you refer to ports<256 |
* directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer |
*/ |
#if defined (sun) |
#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) |
#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) |
#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) |
#else |
#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) |
#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) |
#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) |
#endif |
#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) |
#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) |
#define INC_B(a) CHOICE(incb a, incb a, incb a) |
#define INS_L CHOICE(insl, insl, _LTOG ins) |
#define INS_W CHOICE(insw, insw, _WTOG ins) |
#define INS_B CHOICE(insb, insb, insb) |
#define INT(a) CHOICE(int a, int a, int a) |
#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) |
#define INTO CHOICE(into, into, into) |
#define IRET CHOICE(iret, iret, iret) |
#define IRETD CHOICE(iret, iret, iretd) |
#define JA(a) CHOICE(ja a, ja a, ja a) |
#define JAE(a) CHOICE(jae a, jae a, jae a) |
#define JB(a) CHOICE(jb a, jb a, jb a) |
#define JBE(a) CHOICE(jbe a, jbe a, jbe a) |
#define JC(a) CHOICE(jc a, jc a, jc a) |
#define JE(a) CHOICE(je a, je a, je a) |
#define JG(a) CHOICE(jg a, jg a, jg a) |
#define JGE(a) CHOICE(jge a, jge a, jge a) |
#define JL(a) CHOICE(jl a, jl a, jl a) |
#define JLE(a) CHOICE(jle a, jle a, jle a) |
#define JNA(a) CHOICE(jna a, jna a, jna a) |
#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) |
#define JNB(a) CHOICE(jnb a, jnb a, jnb a) |
#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) |
#define JNC(a) CHOICE(jnc a, jnc a, jnc a) |
#define JNE(a) CHOICE(jne a, jne a, jne a) |
#define JNG(a) CHOICE(jng a, jng a, jng a) |
#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) |
#define JNL(a) CHOICE(jnl a, jnl a, jnl a) |
#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) |
#define JNO(a) CHOICE(jno a, jno a, jno a) |
#define JNP(a) CHOICE(jnp a, jnp a, jnp a) |
#define JNS(a) CHOICE(jns a, jns a, jns a) |
#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) |
#define JO(a) CHOICE(jo a, jo a, jo a) |
#define JP(a) CHOICE(jp a, jp a, jp a) |
#define JPE(a) CHOICE(jpe a, jpe a, jpe a) |
#define JPO(a) CHOICE(jpo a, jpo a, jpo a) |
#define JS(a) CHOICE(js a, js a, js a) |
#define JZ(a) CHOICE(jz a, jz a, jz a) |
#define JMP(a) CHOICE(jmp a, jmp a, jmp a) |
#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) |
#define LAHF CHOICE(lahf, lahf, lahf) |
#if !defined(_REAL_MODE) && !defined(_V86_MODE) |
#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) |
#endif |
#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) |
#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) |
#define LEAVE CHOICE(leave, leave, leave) |
#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) |
#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) |
#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) |
#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) |
#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) |
#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) |
#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) |
#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) |
#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) |
#define LOCK CHOICE(lock, lock, lock) |
#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) |
#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) |
#define LODS_B CHOICE(lodsb, lodsb, lodsb) |
#define LOOP(a) CHOICE(loop a, loop a, loop a) |
#define LOOPE(a) CHOICE(loope a, loope a, loope a) |
#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) |
#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) |
#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) |
#if !defined(_REAL_MODE) && !defined(_V86_MODE) |
#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) |
#endif |
#define LTR(a) CHOICE(ltr a, ltr a, ltr a) |
#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) |
#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) |
#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) |
#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) |
#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) |
#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) |
#define MOVS_B CHOICE(movsb, movsb, movsb) |
#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) |
#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) |
#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) |
#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) |
#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) |
#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) |
#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) |
#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) |
#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) |
#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) |
#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) |
#define NEG_B(a) CHOICE(negb a, negb a, negb a) |
#define NOP CHOICE(nop, nop, nop) |
#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) |
#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) |
#define NOT_B(a) CHOICE(notb a, notb a, notb a) |
#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) |
#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) |
#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) |
#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) |
#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) |
#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) |
/* Please AS code writer: use the following ONLY, if you refer to ports<256 |
* directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer |
*/ |
#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) |
#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) |
#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) |
#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) |
#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) |
#define OUTS_B CHOICE(outsb, outsb, outsb) |
#define POP_SR(a) CHOICE(pop a, pop a, pop a) |
#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) |
#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) |
#define POPA_L CHOICE(popal, popal, _LTOG popa) |
#define POPA_W CHOICE(popaw, popaw, _WTOG popa) |
#define POPF_L CHOICE(popfl, popfl, _LTOG popf) |
#define POPF_W CHOICE(popfw, popfw, _WTOG popf) |
#define PUSH_SR(a) CHOICE(push a, push a, push a) |
#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) |
#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) |
#define PUSH_B(a) CHOICE(push a, pushb a, push a) |
#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) |
#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) |
#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) |
#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) |
#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) |
#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) |
#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) |
#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) |
#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) |
#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) |
#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) |
#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) |
#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) |
#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) |
#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) |
#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) |
#define REP CHOICE(rep ;, rep ;, repe) |
#define REPE CHOICE(repz ;, repe ;, repe) |
#define REPNE CHOICE(repnz ;, repne ;, repne) |
#define REPNZ REPNE |
#define REPZ REPE |
#define RET CHOICE(ret, ret, ret) |
#define SAHF CHOICE(sahf, sahf, sahf) |
#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) |
#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) |
#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) |
#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) |
#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) |
#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) |
#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) |
#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) |
#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) |
#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) |
#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) |
#define SCAS_B CHOICE(scasb, scasb, scasb) |
#define SETA(a) CHOICE(seta a, seta a, seta a) |
#define SETAE(a) CHOICE(setae a, setae a, setae a) |
#define SETB(a) CHOICE(setb a, setb a, setb a) |
#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) |
#define SETC(a) CHOICE(setc a, setb a, setb a) |
#define SETE(a) CHOICE(sete a, sete a, sete a) |
#define SETG(a) CHOICE(setg a, setg a, setg a) |
#define SETGE(a) CHOICE(setge a, setge a, setge a) |
#define SETL(a) CHOICE(setl a, setl a, setl a) |
#define SETLE(a) CHOICE(setle a, setle a, setle a) |
#define SETNA(a) CHOICE(setna a, setna a, setna a) |
#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) |
#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) |
#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) |
#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) |
#define SETNE(a) CHOICE(setne a, setne a, setne a) |
#define SETNG(a) CHOICE(setng a, setng a, setng a) |
#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) |
#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) |
#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) |
#define SETNO(a) CHOICE(setno a, setno a, setno a) |
#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) |
#define SETNS(a) CHOICE(setns a, setns a, setna a) |
#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) |
#define SETO(a) CHOICE(seto a, seto a, seto a) |
#define SETP(a) CHOICE(setp a, setp a, setp a) |
#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) |
#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) |
#define SETS(a) CHOICE(sets a, sets a, seta a) |
#define SETZ(a) CHOICE(setz a, setz a, setz a) |
#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) |
#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) |
#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) |
#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) |
#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) |
#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) |
#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) |
#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) |
#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) |
#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) |
#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) |
#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) |
#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) |
#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) |
#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) |
#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) |
#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) |
#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) |
#define STC CHOICE(stc, stc, stc) |
#define STD CHOICE(std, std, std) |
#define STI CHOICE(sti, sti, sti) |
#define STOS_L CHOICE(stosl, stosl, _LTOG stos) |
#define STOS_W CHOICE(stosw, stosw, _WTOG stos) |
#define STOS_B CHOICE(stosb, stosb, stosb) |
#define STR(a) CHOICE(str a, str a, str a) |
#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) |
#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) |
#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) |
#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) |
#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) |
#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) |
#define VERR(a) CHOICE(verr a, verr a, verr a) |
#define VERW(a) CHOICE(verw a, verw a, verw a) |
#define WAIT CHOICE(wait, wait, wait) |
#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) |
#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) |
#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) |
#define XLAT CHOICE(xlat, xlat, xlat) |
#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) |
#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) |
#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) |
/* Floating Point Instructions */ |
#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) |
#define FABS CHOICE(fabs, fabs, fabs) |
#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) |
#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) |
#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) |
#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) |
#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) |
#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) |
#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) |
#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) |
#define FCHS CHOICE(fchs, fchs, fchs) |
#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) |
#define FNCLEX CHOICE(fnclex, fnclex, fclex) |
#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) |
#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) |
#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) |
#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) |
#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) |
#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) |
#define FCOMPP CHOICE(fcompp, fcompp, fcompp) |
#define FCOS CHOICE(fcos, fcos, fcos) |
#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) |
#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) |
#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) |
#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) |
#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) |
#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) |
#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) |
#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) |
#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) |
#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) |
#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) |
#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) |
#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) |
#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) |
#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) |
#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) |
#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) |
#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) |
#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) |
#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) |
#define FILD_W(a) CHOICE(fild a, filds a, filds a) |
#define FINCSTP CHOICE(fincstp, fincstp, fincstp) |
#define FINIT CHOICE(finit, wait; fninit, wait; finit) |
#define FNINIT CHOICE(fninit, fninit, finit) |
#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) |
#define FIST_W(a) CHOICE(fist a, fists a, fists a) |
#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) |
#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) |
#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) |
#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ |
#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) |
#define FLD_S(a) CHOICE(flds a, flds a, flds a) |
#define FLD1 CHOICE(fld1, fld1, fld1) |
#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) |
#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) |
#define FLDPI CHOICE(fldpi, fldpi, fldpi) |
#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) |
#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) |
#define FLDZ CHOICE(fldz, fldz, fldz) |
#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) |
#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) |
#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) |
#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) |
#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) |
#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) |
#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) |
#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) |
#define FNOP CHOICE(fnop, fnop, fnop) |
#define FPATAN CHOICE(fpatan, fpatan, fpatan) |
#define FPREM CHOICE(fprem, fprem, fprem) |
#define FPREM1 CHOICE(fprem1, fprem1, fprem1) |
#define FPTAN CHOICE(fptan, fptan, fptan) |
#define FRNDINT CHOICE(frndint, frndint, frndint) |
#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) |
#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) |
#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) |
#define FSCALE CHOICE(fscale, fscale, fscale) |
#define FSIN CHOICE(fsin, fsin, fsin) |
#define FSINCOS CHOICE(fsincos, fsincos, fsincos) |
#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) |
#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) |
#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) |
#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) |
#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) |
#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) |
#define FSTP(a) CHOICE(fstp a, fstp a, fstp a) |
#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) |
#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) |
#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) |
#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) |
#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) |
#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) |
#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) |
#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) |
#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) |
#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) |
#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) |
#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) |
#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) |
#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) |
#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) |
#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) |
#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) |
#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) |
#define FTST CHOICE(ftst, ftst, ftst) |
#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) |
#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) |
#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) |
#define FWAIT CHOICE(wait, wait, wait) |
#define FXAM CHOICE(fxam, fxam, fxam) |
#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) |
#define FXTRACT CHOICE(fxtract, fxtract, fxtract) |
#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) |
#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) |
/* New instructions */ |
#define CPUID CHOICE(D_BYTE ARG2(15, 162), cpuid, D_BYTE ARG2(15, 162)) |
#define RDTSC CHOICE(D_BYTE ARG2(15, 49), rdtsc, D_BYTE ARG2(15, 49)) |
#else /* NASM_ASSEMBLER || MASM_ASSEMBLER is defined */ |
/****************************************/ |
/* */ |
/* Intel style assemblers. */ |
/* (NASM and MASM) */ |
/* */ |
/****************************************/ |
#define P_EAX EAX |
#define L_EAX EAX |
#define W_AX AX |
#define B_AH AH |
#define B_AL AL |
#define P_EBX EBX |
#define L_EBX EBX |
#define W_BX BX |
#define B_BH BH |
#define B_BL BL |
#define P_ECX ECX |
#define L_ECX ECX |
#define W_CX CX |
#define B_CH CH |
#define B_CL CL |
#define P_EDX EDX |
#define L_EDX EDX |
#define W_DX DX |
#define B_DH DH |
#define B_DL DL |
#define P_EBP EBP |
#define L_EBP EBP |
#define W_BP BP |
#define P_ESI ESI |
#define L_ESI ESI |
#define W_SI SI |
#define P_EDI EDI |
#define L_EDI EDI |
#define W_DI DI |
#define P_ESP ESP |
#define L_ESP ESP |
#define W_SP SP |
#define W_CS CS |
#define W_SS SS |
#define W_DS DS |
#define W_ES ES |
#define W_FS FS |
#define W_GS GS |
#define X_ST ST |
#define D_ST ST |
#define L_ST ST |
#define P_MM0 mm0 |
#define P_MM1 mm1 |
#define P_MM2 mm2 |
#define P_MM3 mm3 |
#define P_MM4 mm4 |
#define P_MM5 mm5 |
#define P_MM6 mm6 |
#define P_MM7 mm7 |
#define P_XMM0 xmm0 |
#define P_XMM1 xmm1 |
#define P_XMM2 xmm2 |
#define P_XMM3 xmm3 |
#define P_XMM4 xmm4 |
#define P_XMM5 xmm5 |
#define P_XMM6 xmm6 |
#define P_XMM7 xmm7 |
#define CONCAT(x, y) x ## y |
#if defined(NASM_ASSEMBLER) |
#define ST(n) st ## n |
#define ST0 st0 |
#define TBYTE_PTR tword |
#define QWORD_PTR qword |
#define DWORD_PTR dword |
#define WORD_PTR word |
#define BYTE_PTR byte |
#define OFFSET |
#define GLOBL GLOBAL |
#define ALIGNTEXT32 ALIGN 32 |
#define ALIGNTEXT16 ALIGN 16 |
#define ALIGNTEXT8 ALIGN 8 |
#define ALIGNTEXT4 ALIGN 4 |
#define ALIGNTEXT2 ALIGN 2 |
#define ALIGNTEXT32ifNOP ALIGN 32 |
#define ALIGNTEXT16ifNOP ALIGN 16 |
#define ALIGNTEXT8ifNOP ALIGN 8 |
#define ALIGNTEXT4ifNOP ALIGN 4 |
#define ALIGNDATA32 ALIGN 32 |
#define ALIGNDATA16 ALIGN 16 |
#define ALIGNDATA8 ALIGN 8 |
#define ALIGNDATA4 ALIGN 4 |
#define ALIGNDATA2 ALIGN 2 |
#define FILE(s) |
#define STRING(s) db s |
#define D_LONG dd |
#define D_WORD dw |
#define D_BYTE db |
/* #define SPACE */ |
/* #define COMM */ |
#if defined(__WATCOMC__) |
SECTION _TEXT public align=16 class=CODE use32 flat |
SECTION _DATA public align=16 class=DATA use32 flat |
#define SEG_TEXT SECTION _TEXT |
#define SEG_DATA SECTION _DATA |
#define SEG_BSS SECTION .bss |
#else |
#define SEG_DATA SECTION .data |
#define SEG_TEXT SECTION .text |
#define SEG_BSS SECTION .bss |
#endif |
#define D_SPACE(n) db n REP 0 |
#define AS_BEGIN |
/* Jcc's should be handled better than this... */ |
#define NEAR near |
#else /* MASM */ |
#define TBYTE_PTR tbyte ptr |
#define QWORD_PTR qword ptr |
#define DWORD_PTR dword ptr |
#define WORD_PTR word ptr |
#define BYTE_PTR byte ptr |
#define OFFSET offset |
#define GLOBL GLOBAL |
#define ALIGNTEXT32 ALIGN 32 |
#define ALIGNTEXT16 ALIGN 16 |
#define ALIGNTEXT8 ALIGN 8 |
#define ALIGNTEXT4 ALIGN 4 |
#define ALIGNTEXT2 ALIGN 2 |
#define ALIGNTEXT32ifNOP ALIGN 32 |
#define ALIGNTEXT16ifNOP ALIGN 16 |
#define ALIGNTEXT8ifNOP ALIGN 8 |
#define ALIGNTEXT4ifNOP ALIGN 4 |
#define ALIGNDATA32 ALIGN 32 |
#define ALIGNDATA16 ALIGN 16 |
#define ALIGNDATA8 ALIGN 8 |
#define ALIGNDATA4 ALIGN 4 |
#define ALIGNDATA2 ALIGN 2 |
#define FILE(s) |
#define STRING(s) db s |
#define D_LONG dd |
#define D_WORD dw |
#define D_BYTE db |
/* #define SPACE */ |
/* #define COMM */ |
#define SEG_DATA .DATA |
#define SEG_TEXT .CODE |
#define SEG_BSS .DATA |
#define D_SPACE(n) db n REP 0 |
#define AS_BEGIN |
#define NEAR |
#endif |
#if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ |
|| (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ |
|| defined(__FreeBSD__) && __FreeBSD__ >= 3 |
#define GLNAME(a) a |
#else |
#define GLNAME(a) CONCAT(_, a) |
#endif |
/* |
* Addressing Modes |
*/ |
/* Immediate Mode */ |
#define P_ADDR(a) OFFSET a |
#define X_ADDR(a) OFFSET a |
#define D_ADDR(a) OFFSET a |
#define L_ADDR(a) OFFSET a |
#define W_ADDR(a) OFFSET a |
#define B_ADDR(a) OFFSET a |
#define P_CONST(a) a |
#define X_CONST(a) a |
#define D_CONST(a) a |
#define L_CONST(a) a |
#define W_CONST(a) a |
#define B_CONST(a) a |
/* Indirect Mode */ |
#ifdef NASM_ASSEMBLER |
#define P_CONTENT(a) [a] |
#define X_CONTENT(a) TBYTE_PTR [a] |
#define D_CONTENT(a) QWORD_PTR [a] |
#define L_CONTENT(a) DWORD_PTR [a] |
#define W_CONTENT(a) WORD_PTR [a] |
#define B_CONTENT(a) BYTE_PTR [a] |
#else |
#define P_CONTENT(a) a |
#define X_CONTENT(a) TBYTE_PTR a |
#define D_CONTENT(a) QWORD_PTR a |
#define L_CONTENT(a) DWORD_PTR a |
#define W_CONTENT(a) WORD_PTR a |
#define B_CONTENT(a) BYTE_PTR a |
#endif |
/* Register a indirect */ |
#define P_REGIND(a) [a] |
#define X_REGIND(a) TBYTE_PTR [a] |
#define D_REGIND(a) QWORD_PTR [a] |
#define L_REGIND(a) DWORD_PTR [a] |
#define W_REGIND(a) WORD_PTR [a] |
#define B_REGIND(a) BYTE_PTR [a] |
/* Register b indirect plus displacement a */ |
#define P_REGOFF(a, b) [b + a] |
#define X_REGOFF(a, b) TBYTE_PTR [b + a] |
#define D_REGOFF(a, b) QWORD_PTR [b + a] |
#define L_REGOFF(a, b) DWORD_PTR [b + a] |
#define W_REGOFF(a, b) WORD_PTR [b + a] |
#define B_REGOFF(a, b) BYTE_PTR [b + a] |
/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode |
* which has no scaling |
*/ |
#define P_REGBID(b, i, d) [b + i + d] |
#define X_REGBID(b, i, d) TBYTE_PTR [b + i + d] |
#define D_REGBID(b, i, d) QWORD_PTR [b + i + d] |
#define L_REGBID(b, i, d) DWORD_PTR [b + i + d] |
#define W_REGBID(b, i, d) WORD_PTR [b + i + d] |
#define B_REGBID(b, i, d) BYTE_PTR [b + i + d] |
/* Reg indirect Base + (Index * Scale) */ |
#define P_REGBIS(b, i, s) [b + i * s] |
#define X_REGBIS(b, i, s) TBYTE_PTR [b + i * s] |
#define D_REGBIS(b, i, s) QWORD_PTR [b + i * s] |
#define L_REGBIS(b, i, s) DWORD_PTR [b + i * s] |
#define W_REGBIS(b, i, s) WORD_PTR [b + i * s] |
#define B_REGBIS(b, i, s) BYTE_PTR [b + i * s] |
/* Reg indirect Base + (Index * Scale) + Displacement */ |
#define P_REGBISD(b, i, s, d) [b + i * s + d] |
#define X_REGBISD(b, i, s, d) TBYTE_PTR [b + i * s + d] |
#define D_REGBISD(b, i, s, d) QWORD_PTR [b + i * s + d] |
#define L_REGBISD(b, i, s, d) DWORD_PTR [b + i * s + d] |
#define W_REGBISD(b, i, s, d) WORD_PTR [b + i * s + d] |
#define B_REGBISD(b, i, s, d) BYTE_PTR [b + i * s + d] |
/* Displaced Scaled Index: */ |
#define P_REGDIS(d, i, s) [i * s + d] |
#define X_REGDIS(d, i, s) TBYTE_PTR [i * s + d] |
#define D_REGDIS(d, i, s) QWORD_PTR [i * s + d] |
#define L_REGDIS(d, i, s) DWORD_PTR [i * s + d] |
#define W_REGDIS(d, i, s) WORD_PTR [i * s + d] |
#define B_REGDIS(d, i, s) BYTE_PTR [i * s + d] |
/* Indexed Base: */ |
#define P_REGBI(b, i) [b + i] |
#define X_REGBI(b, i) TBYTE_PTR [b + i] |
#define D_REGBI(b, i) QWORD_PTR [b + i] |
#define L_REGBI(b, i) DWORD_PTR [b + i] |
#define W_REGBI(b, i) WORD_PTR [b + i] |
#define B_REGBI(b, i) BYTE_PTR [b + i] |
/* Displaced Base: */ |
#define P_REGDB(d, b) [b + d] |
#define X_REGDB(d, b) TBYTE_PTR [b + d] |
#define D_REGDB(d, b) QWORD_PTR [b + d] |
#define L_REGDB(d, b) DWORD_PTR [b + d] |
#define W_REGDB(d, b) WORD_PTR [b + d] |
#define B_REGDB(d, b) BYTE_PTR [b + d] |
/* Variable indirect: */ |
#define VARINDIRECT(var) var |
/* Use register contents as jump/call target: */ |
#define CODEPTR(reg) P_(reg) |
/* |
* Redefine assembler commands |
*/ |
#define P_(a) P_ ## a |
#define X_(a) X_ ## a |
#define D_(a) D_ ## a |
#define S_(a) L_ ## a |
#define L_(a) L_ ## a |
#define W_(a) W_ ## a |
#define B_(a) B_ ## a |
#define AAA aaa |
#define AAD aad |
#define AAM aam |
#define AAS aas |
#define ADC_L(a, b) adc L_(b), L_(a) |
#define ADC_W(a, b) adc W_(b), W_(a) |
#define ADC_B(a, b) adc B_(b), B_(a) |
#define ADD_L(a, b) add L_(b), L_(a) |
#define ADD_W(a, b) add W_(b), W_(a) |
#define ADD_B(a, b) add B_(b), B_(a) |
#define AND_L(a, b) and L_(b), L_(a) |
#define AND_W(a, b) and W_(b), W_(a) |
#define AND_B(a, b) and B_(b), B_(a) |
#define ARPL(a,b) arpl W_(b), a |
#define BOUND_L(a, b) bound L_(b), L_(a) |
#define BOUND_W(a, b) bound W_(b), W_(a) |
#define BSF_L(a, b) bsf L_(b), L_(a) |
#define BSF_W(a, b) bsf W_(b), W_(a) |
#define BSR_L(a, b) bsr L_(b), L_(a) |
#define BSR_W(a, b) bsr W_(b), W_(a) |
#define BT_L(a, b) bt L_(b), L_(a) |
#define BT_W(a, b) bt W_(b), W_(a) |
#define BTC_L(a, b) btc L_(b), L_(a) |
#define BTC_W(a, b) btc W_(b), W_(a) |
#define BTR_L(a, b) btr L_(b), L_(a) |
#define BTR_W(a, b) btr W_(b), W_(a) |
#define BTS_L(a, b) bts L_(b), L_(a) |
#define BTS_W(a, b) bts W_(b), W_(a) |
#define CALL(a) call a |
#define CALLF(s,a) call far s:a |
#define CBW cbw |
#define CWDE cwde |
#define CLC clc |
#define CLD cld |
#define CLI cli |
#define CLTS clts |
#define CMC cmc |
#define CMP_L(a, b) cmp L_(b), L_(a) |
#define CMP_W(a, b) cmp W_(b), W_(a) |
#define CMP_B(a, b) cmp B_(b), B_(a) |
#define CMPS_L cmpsd |
#define CMPS_W cmpsw |
#define CMPS_B cmpsb |
#define CPUID cpuid |
#define CWD cwd |
#define CDQ cdq |
#define DAA daa |
#define DAS das |
#define DEC_L(a) dec L_(a) |
#define DEC_W(a) dec W_(a) |
#define DEC_B(a) dec B_(a) |
#define DIV_L(a) div L_(a) |
#define DIV_W(a) div W_(a) |
#define DIV_B(a) div B_(a) |
#define ENTER(a,b) enter b, a |
#define HLT hlt |
#define IDIV_L(a) idiv L_(a) |
#define IDIV_W(a) idiv W_(a) |
#define IDIV_B(a) idiv B_(a) |
#define IMUL_L(a, b) imul L_(b), L_(a) |
#define IMUL_W(a, b) imul W_(b), W_(a) |
#define IMUL_B(a) imul B_(a) |
#define IN_L in EAX, DX |
#define IN_W in AX, DX |
#define IN_B in AL, DX |
#define IN1_L(a) in1 L_(a) |
#define IN1_W(a) in1 W_(a) |
#define IN1_B(a) in1 B_(a) |
#define INC_L(a) inc L_(a) |
#define INC_W(a) inc W_(a) |
#define INC_B(a) inc B_(a) |
#define INS_L ins |
#define INS_W ins |
#define INS_B ins |
#define INT(a) int B_(a) |
#define INT3 int3 |
#define INTO into |
#define IRET iret |
#define IRETD iretd |
#define JA(a) ja NEAR a |
#define JAE(a) jae NEAR a |
#define JB(a) jb NEAR a |
#define JBE(a) jbe NEAR a |
#define JC(a) jc NEAR a |
#define JE(a) je NEAR a |
#define JG(a) jg NEAR a |
#define JGE(a) jge NEAR a |
#define JL(a) jl NEAR a |
#define JLE(a) jle NEAR a |
#define JNA(a) jna NEAR a |
#define JNAE(a) jnae NEAR a |
#define JNB(a) jnb NEAR a |
#define JNBE(a) jnbe NEAR a |
#define JNC(a) jnc NEAR a |
#define JNE(a) jne NEAR a |
#define JNG(a) jng NEAR a |
#define JNGE(a) jnge NEAR a |
#define JNL(a) jnl NEAR a |
#define JNLE(a) jnle NEAR a |
#define JNO(a) jno NEAR a |
#define JNP(a) jnp NEAR a |
#define JNS(a) jns NEAR a |
#define JNZ(a) jnz NEAR a |
#define JO(a) jo NEAR a |
#define JP(a) jp NEAR a |
#define JPE(a) jpe NEAR a |
#define JPO(a) jpo NEAR a |
#define JS(a) js NEAR a |
#define JZ(a) jz NEAR a |
#define JMP(a) jmp a |
#define JMPF(s,a) jmp far s:a |
#define LAHF lahf |
#define LAR(a, b) lar b, a |
#define LEA_L(a, b) lea P_(b), P_(a) |
#define LEA_W(a, b) lea P_(b), P_(a) |
#define LEAVE leave |
#define LGDT(a) lgdt a |
#define LIDT(a) lidt a |
#define LDS(a, b) lds b, a |
#define LES(a, b) les b, a |
#define LFS(a, b) lfs b, a |
#define LGS(a, b) lgs b, a |
#define LSS(a, b) lss b, a |
#define LLDT(a) lldt a |
#define LMSW(a) lmsw a |
#define LOCK lock |
#define LODS_L lodsd |
#define LODS_W lodsw |
#define LODS_B lodsb |
#define LOOP(a) loop a |
#define LOOPE(a) loope a |
#define LOOPZ(a) loopz a |
#define LOOPNE(a) loopne a |
#define LOOPNZ(a) loopnz a |
#define LSL(a, b) lsl b, a |
#define LTR(a) ltr a |
#define MOV_SR(a, b) mov S_(b), S_(a) |
#define MOV_L(a, b) mov L_(b), L_(a) |
#define MOV_W(a, b) mov W_(b), W_(a) |
#define MOV_B(a, b) mov B_(b), B_(a) |
#define MOVS_L movsd |
#define MOVS_W movsw |
#define MOVS_B movsb |
#define MOVSX_BL(a, b) movsx B_(b), B_(a) |
#define MOVSX_BW(a, b) movsx B_(b), B_(a) |
#define MOVSX_WL(a, b) movsx W_(b), W_(a) |
#define MOVZX_BL(a, b) movzx B_(b), B_(a) |
#define MOVZX_BW(a, b) movzx B_(b), B_(a) |
#define MOVZX_WL(a, b) movzx W_(b), W_(a) |
#define MUL_L(a) mul L_(a) |
#define MUL_W(a) mul W_(a) |
#define MUL_B(a) mul B_(a) |
#define NEG_L(a) neg L_(a) |
#define NEG_W(a) neg W_(a) |
#define NEG_B(a) neg B_(a) |
#define NOP nop |
#define NOT_L(a) not L_(a) |
#define NOT_W(a) not W_(a) |
#define NOT_B(a) not B_(a) |
#define OR_L(a,b) or L_(b), L_(a) |
#define OR_W(a,b) or W_(b), W_(a) |
#define OR_B(a,b) or B_(b), B_(a) |
#define OUT_L out DX, EAX |
#define OUT_W out DX, AX |
#define OUT_B out DX, AL |
#define OUT1_L(a) out1 L_(a) |
#define OUT1_W(a) out1 W_(a) |
#define OUT1_B(a) out1 B_(a) |
#define OUTS_L outsd |
#define OUTS_W outsw |
#define OUTS_B outsb |
#define POP_SR(a) pop S_(a) |
#define POP_L(a) pop L_(a) |
#define POP_W(a) pop W_(a) |
#define POPA_L popad |
#define POPA_W popa |
#define POPF_L popfd |
#define POPF_W popf |
#define PUSH_SR(a) push S_(a) |
#define PUSH_L(a) push L_(a) |
#define PUSH_W(a) push W_(a) |
#define PUSH_B(a) push B_(a) |
#define PUSHA_L pushad |
#define PUSHA_W pusha |
#define PUSHF_L pushfd |
#define PUSHF_W pushf |
#define RCL_L(a, b) rcl L_(b), L_(a) |
#define RCL_W(a, b) rcl W_(b), W_(a) |
#define RCL_B(a, b) rcl B_(b), B_(a) |
#define RCR_L(a, b) rcr L_(b), L_(a) |
#define RCR_W(a, b) rcr W_(b), W_(a) |
#define RCR_B(a, b) rcr B_(b), B_(a) |
#define RDTSC rdtsc |
#define ROL_L(a, b) rol L_(b), L_(a) |
#define ROL_W(a, b) rol W_(b), W_(a) |
#define ROL_B(a, b) rol B_(b), B_(a) |
#define ROR_L(a, b) ror L_(b), L_(a) |
#define ROR_W(a, b) ror W_(b), W_(a) |
#define ROR_B(a, b) ror B_(b), B_(a) |
#define REP rep |
#define REPE repe |
#define REPNE repne |
#define REPNZ REPNE |
#define REPZ REPE |
#define RET ret |
#define SAHF sahf |
#define SAL_L(a, b) sal L_(b), L_(a) |
#define SAL_W(a, b) sal W_(b), W_(a) |
#define SAL_B(a, b) sal B_(b), B_(a) |
#define SAR_L(a, b) sar L_(b), L_(a) |
#define SAR_W(a, b) sar W_(b), W_(a) |
#define SAR_B(a, b) sar B_(b), B_(a) |
#define SBB_L(a, b) sbb L_(b), L_(a) |
#define SBB_W(a, b) sbb W_(b), W_(a) |
#define SBB_B(a, b) sbb B_(b), B_(a) |
#define SCAS_L scas |
#define SCAS_W scas |
#define SCAS_B scas |
#define SETA(a) seta a |
#define SETAE(a) setae a |
#define SETB(a) setb a |
#define SETBE(a) setbe a |
#define SETC(a) setc a |
#define SETE(a) sete a |
#define SETG(a) setg a |
#define SETGE(a) setge a |
#define SETL(a) setl a |
#define SETLE(a) setle a |
#define SETNA(a) setna a |
#define SETNAE(a) setnae a |
#define SETNB(a) setnb a |
#define SETNBE(a) setnbe a |
#define SETNC(a) setnc a |
#define SETNE(a) setne a |
#define SETNG(a) setng a |
#define SETNGE(a) setnge a |
#define SETNL(a) setnl a |
#define SETNLE(a) setnle a |
#define SETNO(a) setno a |
#define SETNP(a) setnp a |
#define SETNS(a) setns a |
#define SETNZ(a) setnz a |
#define SETO(a) seto a |
#define SETP(a) setp a |
#define SETPE(a) setpe a |
#define SETPO(a) setpo a |
#define SETS(a) sets a |
#define SETZ(a) setz a |
#define SGDT(a) sgdt a |
#define SIDT(a) sidt a |
#define SHL_L(a, b) shl L_(b), L_(a) |
#define SHL_W(a, b) shl W_(b), W_(a) |
#define SHL_B(a, b) shl B_(b), B_(a) |
#define SHLD_L(a,b,c) shld |
#define SHLD2_L(a,b) shld L_(b), L_(a) |
#define SHLD_W(a,b,c) shld |
#define SHLD2_W(a,b) shld W_(b), W_(a) |
#define SHR_L(a, b) shr L_(b), L_(a) |
#define SHR_W(a, b) shr W_(b), W_(a) |
#define SHR_B(a, b) shr B_(b), B_(a) |
#define SHRD_L(a,b,c) shrd |
#define SHRD2_L(a,b) shrd L_(b), L_(a) |
#define SHRD_W(a,b,c) shrd |
#define SHRD2_W(a,b) shrd W_(b), W_(a) |
#define SLDT(a) sldt a |
#define SMSW(a) smsw a |
#define STC stc |
#define STD std |
#define STI sti |
#define STOS_L stos |
#define STOS_W stos |
#define STOS_B stos |
#define STR(a) str a |
#define SUB_L(a, b) sub L_(b), L_(a) |
#define SUB_W(a, b) sub W_(b), W_(a) |
#define SUB_B(a, b) sub B_(b), B_(a) |
#define TEST_L(a, b) test L_(b), L_(a) |
#define TEST_W(a, b) test W_(b), W_(a) |
#define TEST_B(a, b) test B_(b), B_(a) |
#define VERR(a) verr a |
#define VERW(a) verw a |
#define WAIT wait |
#define XCHG_L(a, b) xchg L_(b), L_(a) |
#define XCHG_W(a, b) xchg W_(b), W_(a) |
#define XCHG_B(a, b) xchg B_(b), B_(a) |
#define XLAT xlat |
#define XOR_L(a, b) xor L_(b), L_(a) |
#define XOR_W(a, b) xor W_(b), W_(a) |
#define XOR_B(a, b) xor B_(b), B_(a) |
/* Floating Point Instructions */ |
#define F2XM1 f2xm1 |
#define FABS fabs |
#define FADD_D(a) fadd D_(a) |
#define FADD_S(a) fadd S_(a) |
#define FADD2(a, b) fadd b, a |
#define FADDP(a, b) faddp b, a |
#define FIADD_L(a) fiadd L_(a) |
#define FIADD_W(a) fiadd W_(a) |
#define FBLD(a) fbld a |
#define FBSTP(a) fbstp a |
#define FCHS fchs |
#define FCLEX fclex |
#define FNCLEX fnclex |
#define FCOM(a) fcom a |
#define FCOM_D(a) fcom D_(a) |
#define FCOM_S(a) fcom S_(a) |
#define FCOMP(a) fcomp a |
#define FCOMP_D(a) fcomp D_(a) |
#define FCOMP_S(a) fcomp S_(a) |
#define FCOMPP fcompp |
#define FCOS fcos |
#define FDECSTP fdecstp |
#define FDIV_D(a) fdiv D_(a) |
#define FDIV_S(a) fdiv S_(a) |
#define FDIV2(a, b) fdiv b, a |
#define FDIVP(a, b) fdivp b, a |
#define FIDIV_L(a) fidiv L_(a) |
#define FIDIV_W(a) fidiv W_(a) |
#define FDIVR_D(a) fdivr D_(a) |
#define FDIVR_S(a) fdivr S_(a) |
#define FDIVR2(a, b) fdivr b, a |
#define FDIVRP(a, b) fdivrp b, a |
#define FIDIVR_L(a) fidivr L_(a) |
#define FIDIVR_W(a) fidivr W_(a) |
#define FFREE(a) ffree a |
#define FICOM_L(a) ficom L_(a) |
#define FICOM_W(a) ficom W_(a) |
#define FICOMP_L(a) ficomp L_(a) |
#define FICOMP_W(a) ficomp W_(a) |
#define FILD_Q(a) fild D_(a) |
#define FILD_L(a) fild L_(a) |
#define FILD_W(a) fild W_(a) |
#define FINCSTP fincstp |
#define FINIT finit |
#define FNINIT fninit |
#define FIST_L(a) fist L_(a) |
#define FIST_W(a) fist W_(a) |
#define FISTP_Q(a) fistp D_(a) |
#define FISTP_L(a) fistp L_(a) |
#define FISTP_W(a) fistp W_(a) |
#define FLD_X(a) fld X_(a) |
#define FLD_D(a) fld D_(a) |
#define FLD_S(a) fld S_(a) |
#define FLD1 fld1 |
#define FLDL2T fldl2t |
#define FLDL2E fldl2e |
#define FLDPI fldpi |
#define FLDLG2 fldlg2 |
#define FLDLN2 fldln2 |
#define FLDZ fldz |
#define FLDCW(a) fldcw a |
#define FLDENV(a) fldenv a |
#define FMUL_S(a) fmul S_(a) |
#define FMUL_D(a) fmul D_(a) |
#define FMUL2(a, b) fmul b, a |
#define FMULP(a, b) fmulp b, a |
#define FIMUL_L(a) fimul L_(a) |
#define FIMUL_W(a) fimul W_(a) |
#define FNOP fnop |
#define FPATAN fpatan |
#define FPREM fprem |
#define FPREM1 fprem1 |
#define FPTAN fptan |
#define FRNDINT frndint |
#define FRSTOR(a) frstor a |
#define FSAVE(a) fsave a |
#define FNSAVE(a) fnsave a |
#define FSCALE fscale |
#define FSIN fsin |
#define FSINCOS fsincos |
#define FSQRT fsqrt |
#define FST_D(a) fst D_(a) |
#define FST_S(a) fst S_(a) |
#define FSTP_X(a) fstp X_(a) |
#define FSTP_D(a) fstp D_(a) |
#define FSTP_S(a) fstp S_(a) |
#define FSTP(a) fstp a |
#define FSTCW(a) fstcw a |
#define FNSTCW(a) fnstcw a |
#define FSTENV(a) fstenv a |
#define FNSTENV(a) fnstenv a |
#define FSTSW(a) fstsw a |
#define FNSTSW(a) fnstsw a |
#define FSUB_S(a) fsub S_(a) |
#define FSUB_D(a) fsub D_(a) |
#define FSUB2(a, b) fsub b, a |
#define FSUBP(a, b) fsubp b, a |
#define FISUB_L(a) fisub L_(a) |
#define FISUB_W(a) fisub W_(a) |
#define FSUBR_S(a) fsubr S_(a) |
#define FSUBR_D(a) fsubr D_(a) |
#define FSUBR2(a, b) fsubr b, a |
#define FSUBRP(a, b) fsubrp b, a |
#define FISUBR_L(a) fisubr L_(a) |
#define FISUBR_W(a) fisubr W_(a) |
#define FTST ftst |
#define FUCOM(a) fucom a |
#define FUCOMP(a) fucomp a |
#define FUCOMPP fucompp |
#define FWAIT fwait |
#define FXAM fxam |
#define FXCH(a) fxch a |
#define FXTRACT fxtract |
#define FYL2X fyl2x |
#define FYL2XP1 fyl2xp1 |
#endif /* NASM_ASSEMBLER, MASM_ASSEMBLER */ |
/****************************************/ |
/* */ |
/* Extensions to x86 insn set - */ |
/* MMX, 3DNow! */ |
/* */ |
/****************************************/ |
#if defined(NASM_ASSEMBLER) || defined(MASM_ASSEMBLER) |
#define P_ARG1(a) P_ ## a |
#define P_ARG2(a, b) P_ ## b, P_ ## a |
#define P_ARG3(a, b, c) P_ ## c, P_ ## b, P_ ## a |
#else |
#define P_ARG1(a) a |
#define P_ARG2(a, b) a, b |
#define P_ARG3(a, b, c) a, b, c |
#endif |
/* MMX */ |
#define MOVD(a, b) movd P_ARG2(a, b) |
#define MOVQ(a, b) movq P_ARG2(a, b) |
#define PADDB(a, b) paddb P_ARG2(a, b) |
#define PADDW(a, b) paddw P_ARG2(a, b) |
#define PADDD(a, b) paddd P_ARG2(a, b) |
#define PADDSB(a, b) paddsb P_ARG2(a, b) |
#define PADDSW(a, b) paddsw P_ARG2(a, b) |
#define PADDUSB(a, b) paddusb P_ARG2(a, b) |
#define PADDUSW(a, b) paddusw P_ARG2(a, b) |
#define PSUBB(a, b) psubb P_ARG2(a, b) |
#define PSUBW(a, b) psubw P_ARG2(a, b) |
#define PSUBD(a, b) psubd P_ARG2(a, b) |
#define PSUBSB(a, b) psubsb P_ARG2(a, b) |
#define PSUBSW(a, b) psubsw P_ARG2(a, b) |
#define PSUBUSB(a, b) psubusb P_ARG2(a, b) |
#define PSUBUSW(a, b) psubusw P_ARG2(a, b) |
#define PCMPEQB(a, b) pcmpeqb P_ARG2(a, b) |
#define PCMPEQW(a, b) pcmpeqw P_ARG2(a, b) |
#define PCMPEQD(a, b) pcmpeqd P_ARG2(a, b) |
#define PCMPGTB(a, b) pcmpgtb P_ARG2(a, b) |
#define PCMPGTW(a, b) pcmpgtw P_ARG2(a, b) |
#define PCMPGTD(a, b) pcmpgtd P_ARG2(a, b) |
#define PMULHW(a, b) pmulhw P_ARG2(a, b) |
#define PMULLW(a, b) pmullw P_ARG2(a, b) |
#define PMADDWD(a, b) pmaddwd P_ARG2(a, b) |
#define PAND(a, b) pand P_ARG2(a, b) |
#define PANDN(a, b) pandn P_ARG2(a, b) |
#define POR(a, b) por P_ARG2(a, b) |
#define PXOR(a, b) pxor P_ARG2(a, b) |
#define PSRAW(a, b) psraw P_ARG2(a, b) |
#define PSRAD(a, b) psrad P_ARG2(a, b) |
#define PSRLW(a, b) psrlw P_ARG2(a, b) |
#define PSRLD(a, b) psrld P_ARG2(a, b) |
#define PSRLQ(a, b) psrlq P_ARG2(a, b) |
#define PSLLW(a, b) psllw P_ARG2(a, b) |
#define PSLLD(a, b) pslld P_ARG2(a, b) |
#define PSLLQ(a, b) psllq P_ARG2(a, b) |
#define PACKSSWB(a, b) packsswb P_ARG2(a, b) |
#define PACKSSDW(a, b) packssdw P_ARG2(a, b) |
#define PACKUSWB(a, b) packuswb P_ARG2(a, b) |
#define PUNPCKHBW(a, b) punpckhbw P_ARG2(a, b) |
#define PUNPCKHWD(a, b) punpckhwd P_ARG2(a, b) |
#define PUNPCKHDQ(a, b) punpckhdq P_ARG2(a, b) |
#define PUNPCKLBW(a, b) punpcklbw P_ARG2(a, b) |
#define PUNPCKLWD(a, b) punpcklwd P_ARG2(a, b) |
#define PUNPCKLDQ(a, b) punpckldq P_ARG2(a, b) |
#define EMMS emms |
/* AMD 3DNow! */ |
#define PAVGUSB(a, b) pavgusb P_ARG2(a, b) |
#define PFADD(a, b) pfadd P_ARG2(a, b) |
#define PFSUB(a, b) pfsub P_ARG2(a, b) |
#define PFSUBR(a, b) pfsubr P_ARG2(a, b) |
#define PFACC(a, b) pfacc P_ARG2(a, b) |
#define PFCMPGE(a, b) pfcmpge P_ARG2(a, b) |
#define PFCMPGT(a, b) pfcmpgt P_ARG2(a, b) |
#define PFCMPEQ(a, b) pfcmpeq P_ARG2(a, b) |
#define PFMIN(a, b) pfmin P_ARG2(a, b) |
#define PFMAX(a, b) pfmax P_ARG2(a, b) |
#define PI2FD(a, b) pi2fd P_ARG2(a, b) |
#define PF2ID(a, b) pf2id P_ARG2(a, b) |
#define PFRCP(a, b) pfrcp P_ARG2(a, b) |
#define PFRSQRT(a, b) pfrsqrt P_ARG2(a, b) |
#define PFMUL(a, b) pfmul P_ARG2(a, b) |
#define PFRCPIT1(a, b) pfrcpit1 P_ARG2(a, b) |
#define PFRSQIT1(a, b) pfrsqit1 P_ARG2(a, b) |
#define PFRCPIT2(a, b) pfrcpit2 P_ARG2(a, b) |
#define PMULHRW(a, b) pmulhrw P_ARG2(a, b) |
#define FEMMS femms |
#define PREFETCH(a) prefetch P_ARG1(a) |
#define PREFETCHW(a) prefetchw P_ARG1(a) |
/* Intel SSE */ |
#define ADDPS(a, b) addps P_ARG2(a, b) |
#define ADDSS(a, b) addss P_ARG2(a, b) |
#define ANDNPS(a, b) andnps P_ARG2(a, b) |
#define ANDPS(a, b) andps P_ARG2(a, b) |
/* NASM only knows the pseudo ops for these. |
#define CMPPS(a, b, c) cmpps P_ARG3(a, b, c) |
#define CMPSS(a, b, c) cmpss P_ARG3(a, b, c) |
*/ |
#define CMPEQPS(a, b) cmpeqps P_ARG2(a, b) |
#define CMPLTPS(a, b) cmpltps P_ARG2(a, b) |
#define CMPLEPS(a, b) cmpleps P_ARG2(a, b) |
#define CMPUNORDPS(a, b) cmpunordps P_ARG2(a, b) |
#define CMPNEQPS(a, b) cmpneqps P_ARG2(a, b) |
#define CMPNLTPS(a, b) cmpnltps P_ARG2(a, b) |
#define CMPNLEPS(a, b) cmpnleps P_ARG2(a, b) |
#define CMPORDPS(a, b) cmpordps P_ARG2(a, b) |
#define CMPEQSS(a, b) cmpeqss P_ARG2(a, b) |
#define CMPLTSS(a, b) cmpltss P_ARG2(a, b) |
#define CMPLESS(a, b) cmpless P_ARG2(a, b) |
#define CMPUNORDSS(a, b) cmpunordss P_ARG2(a, b) |
#define CMPNEQSS(a, b) cmpneqss P_ARG2(a, b) |
#define CMPNLTSS(a, b) cmpnltss P_ARG2(a, b) |
#define CMPNLESS(a, b) cmpnless P_ARG2(a, b) |
#define CMPORDSS(a, b) cmpordss P_ARG2(a, b) |
#define COMISS(a, b) comiss P_ARG2(a, b) |
#define CVTPI2PS(a, b) cvtpi2ps P_ARG2(a, b) |
#define CVTPS2PI(a, b) cvtps2pi P_ARG2(a, b) |
#define CVTSI2SS(a, b) cvtsi2ss P_ARG2(a, b) |
#define CVTSS2SI(a, b) cvtss2si P_ARG2(a, b) |
#define CVTTPS2PI(a, b) cvttps2pi P_ARG2(a, b) |
#define CVTTSS2SI(a, b) cvttss2si P_ARG2(a, b) |
#define DIVPS(a, b) divps P_ARG2(a, b) |
#define DIVSS(a, b) divss P_ARG2(a, b) |
#define FXRSTOR(a) fxrstor P_ARG1(a) |
#define FXSAVE(a) fxsave P_ARG1(a) |
#define LDMXCSR(a) ldmxcsr P_ARG1(a) |
#define MAXPS(a, b) maxps P_ARG2(a, b) |
#define MAXSS(a, b) maxss P_ARG2(a, b) |
#define MINPS(a, b) minps P_ARG2(a, b) |
#define MINSS(a, b) minss P_ARG2(a, b) |
#define MOVAPS(a, b) movaps P_ARG2(a, b) |
#define MOVHLPS(a, b) movhlps P_ARG2(a, b) |
#define MOVHPS(a, b) movhps P_ARG2(a, b) |
#define MOVLHPS(a, b) movlhps P_ARG2(a, b) |
#define MOVLPS(a, b) movlps P_ARG2(a, b) |
#define MOVMSKPS(a, b) movmskps P_ARG2(a, b) |
#define MOVNTPS(a, b) movntps P_ARG2(a, b) |
#define MOVNTQ(a, b) movntq P_ARG2(a, b) |
#define MOVSS(a, b) movss P_ARG2(a, b) |
#define MOVUPS(a, b) movups P_ARG2(a, b) |
#define MULPS(a, b) mulps P_ARG2(a, b) |
#define MULSS(a, b) mulss P_ARG2(a, b) |
#define ORPS(a, b) orps P_ARG2(a, b) |
#define RCPPS(a, b) rcpps P_ARG2(a, b) |
#define RCPSS(a, b) rcpss P_ARG2(a, b) |
#define RSQRTPS(a, b) rsqrtps P_ARG2(a, b) |
#define RSQRTSS(a, b) rsqrtss P_ARG2(a, b) |
#define SHUFPS(a, b, c) shufps P_ARG3(a, b, c) |
#define SQRTPS(a, b) sqrtps P_ARG2(a, b) |
#define SQRTSS(a, b) sqrtss P_ARG2(a, b) |
#define STMXCSR(a) stmxcsr P_ARG1(a) |
#define SUBPS(a, b) subps P_ARG2(a, b) |
#define UCOMISS(a, b) ucomiss P_ARG2(a, b) |
#define UNPCKHPS(a, b) unpckhps P_ARG2(a, b) |
#define UNPCKLPS(a, b) unpcklps P_ARG2(a, b) |
#define XORPS(a, b) xorps P_ARG2(a, b) |
#define PREFETCHNTA(a) prefetchnta P_ARG1(a) |
#define PREFETCHT0(a) prefetcht0 P_ARG1(a) |
#define PREFETCHT1(a) prefetcht1 P_ARG1(a) |
#define PREFETCHT2(a) prefetcht2 P_ARG1(a) |
#define SFENCE sfence |
/* Added by BrianP for FreeBSD (per David Dawes) */ |
#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) |
#define LLBL(a) CONCAT(.L,a) |
#else |
#define LLBL(a) a |
#endif |
#endif /* __ASSYNTAX_H__ */ |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse_normal.s |
---|
0,0 → 1,252 |
/* $Id: sse_normal.s,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/** TODO: |
* - insert PREFETCH instructions to avoid cache-misses ! |
* - some more optimizations are possible... |
* - for 40-50% more performance in the SSE-functions, the |
* data (trans-matrix, src_vert, dst_vert) needs to be 16byte aligned ! |
*/ |
#include "matypes.h" |
#include "norm_args.h" |
SEG_TEXT |
#define M(i) REGOFF(i * 4, EDX) |
#define S(i) REGOFF(i * 4, ESI) |
#define D(i) REGOFF(i * 4, EDI) |
#define STRIDE REGOFF(12, ESI) |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot) |
GLNAME(_mesa_sse_transform_rescale_normals_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ |
MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ |
MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ |
MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ |
MOV_L ( REGOFF(V3F_COUNT, ESI), ECX ) /* source count */ |
TEST_L ( ECX, ECX ) |
JZ( LLBL(K_G3TRNNRR_finish) ) /* count was zero; go to finish */ |
MOV_L ( STRIDE, EAX ) /* stride */ |
MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ |
IMUL_L( CONST(16), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM1 ) /* m0 */ |
MOVSS ( M(5), XMM2 ) /* m5 */ |
UNPCKLPS( XMM2, XMM1 ) /* m5 | m0 */ |
MOVSS ( ARG_SCALE, XMM0 ) /* scale */ |
SHUFPS ( CONST(0x0), XMM0, XMM0 ) /* scale | scale */ |
MULPS ( XMM0, XMM1 ) /* m5*scale | m0*scale */ |
MULSS ( M(10), XMM0 ) /* m10*scale */ |
ALIGNTEXT32 |
LLBL(K_G3TRNNRR_top): |
MOVLPS ( S(0), XMM2 ) /* uy | ux */ |
MULPS ( XMM1, XMM2 ) /* uy*m5*scale | ux*m0*scale */ |
MOVLPS ( XMM2, D(0) ) /* ->D(1) | D(0) */ |
MOVSS ( S(2), XMM2 ) /* uz */ |
MULSS ( XMM0, XMM2 ) /* uz*m10*scale */ |
MOVSS ( XMM2, D(2) ) /* ->D(2) */ |
LLBL(K_G3TRNNRR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_G3TRNNRR_top) ) |
LLBL(K_G3TRNNRR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_sse_transform_rescale_normals) |
GLNAME(_mesa_sse_transform_rescale_normals): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ |
MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ |
MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ |
MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ |
MOV_L ( REGOFF(V3F_COUNT, ESI), ECX ) /* source count */ |
TEST_L ( ECX, ECX ) |
JZ( LLBL(K_G3TRNR_finish) ) /* count was zero; go to finish */ |
MOV_L ( STRIDE, EAX ) /* stride */ |
MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ |
IMUL_L( CONST(16), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS ( M(0), XMM0 ) /* m0 */ |
MOVSS ( M(4), XMM1 ) /* m4 */ |
UNPCKLPS( XMM1, XMM0 ) /* m4 | m0 */ |
MOVSS ( ARG_SCALE, XMM4 ) /* scale */ |
SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* scale | scale */ |
MULPS ( XMM4, XMM0 ) /* m4*scale | m0*scale */ |
MOVSS ( M(1), XMM1 ) /* m1 */ |
MOVSS ( M(5), XMM2 ) /* m5 */ |
UNPCKLPS( XMM2, XMM1 ) /* m5 | m1 */ |
MULPS ( XMM4, XMM1 ) /* m5*scale | m1*scale */ |
MOVSS ( M(2), XMM2 ) /* m2 */ |
MOVSS ( M(6), XMM3 ) /* m6 */ |
UNPCKLPS( XMM3, XMM2 ) /* m6 | m2 */ |
MULPS ( XMM4, XMM2 ) /* m6*scale | m2*scale */ |
MOVSS ( M(8), XMM6 ) /* m8 */ |
MULSS ( ARG_SCALE, XMM6 ) /* m8*scale */ |
MOVSS ( M(9), XMM7 ) /* m9 */ |
MULSS ( ARG_SCALE, XMM7 ) /* m9*scale */ |
ALIGNTEXT32 |
LLBL(K_G3TRNR_top): |
MOVSS ( S(0), XMM3 ) /* ux */ |
SHUFPS ( CONST(0x0), XMM3, XMM3 ) /* ux | ux */ |
MULPS ( XMM0, XMM3 ) /* ux*m4 | ux*m0 */ |
MOVSS ( S(1), XMM4 ) /* uy */ |
SHUFPS ( CONST(0x0), XMM4, XMM4 ) /* uy | uy */ |
MULPS ( XMM1, XMM4 ) /* uy*m5 | uy*m1 */ |
MOVSS ( S(2), XMM5 ) /* uz */ |
SHUFPS ( CONST(0x0), XMM5, XMM5 ) /* uz | uz */ |
MULPS ( XMM2, XMM5 ) /* uz*m6 | uz*m2 */ |
ADDPS ( XMM4, XMM3 ) |
ADDPS ( XMM5, XMM3 ) |
MOVLPS ( XMM3, D(0) ) |
MOVSS ( M(10), XMM3 ) /* m10 */ |
MULSS ( ARG_SCALE, XMM3 ) /* m10*scale */ |
MULSS ( S(2), XMM3 ) /* m10*scale*uz */ |
MOVSS ( S(1), XMM4 ) /* uy */ |
MULSS ( XMM7, XMM4 ) /* uy*m9*scale */ |
MOVSS ( S(0), XMM5 ) /* ux */ |
MULSS ( XMM6, XMM5 ) /* ux*m8*scale */ |
ADDSS ( XMM4, XMM3 ) |
ADDSS ( XMM5, XMM3 ) |
MOVSS ( XMM3, D(2) ) |
LLBL(K_G3TRNR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_G3TRNR_top) ) |
LLBL(K_G3TRNR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
ALIGNTEXT16 |
GLOBL GLNAME(_mesa_sse_transform_normals_no_rot) |
GLNAME(_mesa_sse_transform_normals_no_rot): |
#define FRAME_OFFSET 8 |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
MOV_L ( ARG_IN, ESI ) /* ptr to source GLvector3f */ |
MOV_L ( ARG_DEST, EDI ) /* ptr to dest GLvector3f */ |
MOV_L ( ARG_MAT, EDX ) /* ptr to matrix */ |
MOV_L ( REGOFF(MATRIX_INV, EDX), EDX) /* matrix->inv */ |
MOV_L ( REGOFF(V3F_COUNT, ESI), ECX ) /* source count */ |
TEST_L ( ECX, ECX ) |
JZ( LLBL(K_G3TNNRR_finish) ) /* count was zero; go to finish */ |
MOV_L ( STRIDE, EAX ) /* stride */ |
MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ |
IMUL_L( CONST(16), ECX ) /* count *= 16 */ |
MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ |
MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ |
ADD_L( EDI, ECX ) /* count += dest ptr */ |
ALIGNTEXT32 |
MOVSS( M(0), XMM0 ) /* m0 */ |
MOVSS( M(5), XMM1 ) /* m5 */ |
UNPCKLPS( XMM1, XMM0 ) /* m5 | m0 */ |
MOVSS( M(10), XMM1 ) /* m10 */ |
ALIGNTEXT32 |
LLBL(K_G3TNNRR_top): |
MOVLPS( S(0), XMM2 ) /* uy | ux */ |
MULPS( XMM0, XMM2 ) /* uy*m5 | ux*m0 */ |
MOVLPS( XMM2, D(0) ) |
MOVSS( S(2), XMM2 ) /* uz */ |
MULSS( XMM1, XMM2 ) /* uz*m10 */ |
MOVSS( XMM2, D(2) ) |
LLBL(K_G3TNNRR_skip): |
ADD_L ( CONST(16), EDI ) |
ADD_L ( EAX, ESI ) |
CMP_L ( ECX, EDI ) |
JNE ( LLBL(K_G3TNNRR_top) ) |
LLBL(K_G3TNNRR_finish): |
POP_L ( EDI ) |
POP_L ( ESI ) |
RET |
#undef FRAME_OFFSET |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86.c |
---|
0,0 → 1,96 |
/* $Id: x86.c,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Intel x86 assembly code by Josh Vanderhoof |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "math/m_xform.h" |
#include "tnl/t_context.h" |
#include "x86.h" |
#include "common_x86_macros.h" |
#ifdef DEBUG |
#include "math/m_debug.h" |
#endif |
#ifdef USE_X86_ASM |
DECLARE_XFORM_GROUP( x86, 2 ) |
DECLARE_XFORM_GROUP( x86, 3 ) |
DECLARE_XFORM_GROUP( x86, 4 ) |
extern GLvector4f * _ASMAPI |
_mesa_x86_cliptest_points4( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ); |
extern GLvector4f * _ASMAPI |
_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, |
GLvector4f *proj_vec, |
GLubyte clipMask[], |
GLubyte *orMask, |
GLubyte *andMask ); |
extern void _ASMAPI |
_mesa_v16_x86_cliptest_points4( GLfloat *first_vert, |
GLfloat *last_vert, |
GLubyte *or_mask, |
GLubyte *and_mask, |
GLubyte *clip_mask ); |
extern void _ASMAPI |
_mesa_v16_x86_general_xform( GLfloat *dest, |
const GLfloat *m, |
const GLfloat *src, |
GLuint src_stride, |
GLuint count ); |
#endif |
void _mesa_init_x86_transform_asm( void ) |
{ |
#ifdef USE_X86_ASM |
ASSIGN_XFORM_GROUP( x86, 2 ); |
ASSIGN_XFORM_GROUP( x86, 3 ); |
ASSIGN_XFORM_GROUP( x86, 4 ); |
_mesa_clip_tab[4] = _mesa_x86_cliptest_points4; |
_mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np; |
#ifdef DEBUG |
_math_test_all_transform_functions( "x86" ); |
_math_test_all_cliptest_functions( "x86" ); |
#endif |
#endif |
} |
/shark/tags/rel_0_4/ports/mesa/src/x86/matypes.h |
---|
0,0 → 1,204 |
/* |
* This file is automatically generated from the Mesa internal type |
* definitions. Do not edit directly. |
*/ |
#ifndef __ASM_TYPES_H__ |
#define __ASM_TYPES_H__ |
#include "assyntax.h" |
/* ============================================================= |
* Offsets for GLcontext |
*/ |
#define CTX_DRIVER_CTX 680 |
#define CTX_LIGHT_ENABLED 37140 |
#define CTX_LIGHT_SHADE_MODEL 37144 |
#define CTX_LIGHT_COLOR_MAT_FACE 37148 |
#define CTX_LIGHT_COLOR_MAT_MODE 37152 |
#define CTX_LIGHT_COLOR_MAT_MASK 37156 |
#define CTX_LIGHT_COLOR_MAT_ENABLED 37160 |
#define CTX_LIGHT_ENABLED_LIST 37164 |
#define CTX_LIGHT_NEED_VERTS 41520 |
#define CTX_LIGHT_FLAGS 41524 |
#define CTX_LIGHT_BASE_COLOR 41528 |
/* ============================================================= |
* Offsets for struct vertex_buffer |
*/ |
#define VB_SIZE 0 |
#define VB_COUNT 4 |
#define VB_FIRST_CLIPPED 8 |
#define VB_FIRST_PRIMITIVE 12 |
#define VB_ELTS 16 |
#define VB_OBJ_PTR 20 |
#define VB_EYE_PTR 24 |
#define VB_CLIP_PTR 28 |
#define VB_PROJ_CLIP_PTR 32 |
#define VB_CLIP_OR_MASK 36 |
#define VB_CLIP_MASK 40 |
#define VB_NORMAL_PTR 44 |
#define VB_EDGE_FLAG 52 |
#define VB_TEX0_COORD_PTR 56 |
#define VB_TEX1_COORD_PTR 60 |
#define VB_TEX2_COORD_PTR 64 |
#define VB_TEX3_COORD_PTR 68 |
#define VB_INDEX_PTR 88 |
#define VB_COLOR_PTR 96 |
#define VB_SECONDARY_COLOR_PTR 104 |
#define VB_FOG_COORD_PTR 116 |
#define VB_POINT_SIZE_PTR 112 |
#define VB_MATERIAL 120 |
#define VB_MATERIAL_MASK 124 |
#define VB_FLAG 128 |
#define VB_PRIMITIVE 132 |
#define VB_PRIMITIVE_LENGTH 136 |
#define VB_IMPORTABLE_DATA 204 |
#define VB_LAST_CLIPPED 216 |
/* |
* Flags for struct vertex_buffer |
*/ |
#define VERT_BIT_OBJ 0x1 |
#define VERT_BIT_NORM 0x4 |
#define VERT_BIT_RGBA 0x8 |
#define VERT_BIT_SPEC_RGB 0x10 |
#define VERT_BIT_FOG_COORD 0x20 |
#define VERT_BIT_INDEX 0x40 |
#define VERT_BIT_EDGE 0x80 |
#define VERT_BIT_TEX0 0x100 |
#define VERT_BIT_TEX1 0x200 |
#define VERT_BIT_TEX2 0x400 |
#define VERT_BIT_TEX3 0x800 |
#define VERT_BIT_EVAL_C1 0x10000 |
#define VERT_BIT_EVAL_C2 0x20000 |
#define VERT_BIT_EVAL_P1 0x40000 |
#define VERT_BIT_EVAL_P2 0x80000 |
#define VERT_BIT_OBJ_3 0x100000 |
#define VERT_BIT_OBJ_4 0x200000 |
#define VERT_BIT_MATERIAL 0x400000 |
#define VERT_BIT_ELT 0x800000 |
#define VERT_BIT_BEGIN 0x1000000 |
#define VERT_BIT_END 0x2000000 |
#define VERT_BIT_END_VB 0x4000000 |
#define VERT_BIT_POINT_SIZE 0x8000000 |
#define VERT_BIT_EYE 0x1000000 |
#define VERT_BIT_CLIP 0x2000000 |
#define VERT_BIT_OBJ_23 0x100000 |
#define VERT_BIT_OBJ_234 0x200000 |
/* ============================================================= |
* Offsets for GLvector3f |
*/ |
#define V3F_DATA 0 |
#define V3F_START 4 |
#define V3F_COUNT 8 |
#define V3F_STRIDE 12 |
#define V3F_FLAGS 16 |
/* ============================================================= |
* Offsets for GLvector4f |
*/ |
#define V4F_DATA 0 |
#define V4F_START 4 |
#define V4F_COUNT 8 |
#define V4F_STRIDE 12 |
#define V4F_SIZE 16 |
#define V4F_FLAGS 20 |
/* |
* Flags for GLvector4f |
*/ |
#define VEC_MALLOC 0x10 |
#define VEC_NOT_WRITEABLE 0x40 |
#define VEC_BAD_STRIDE 0x100 |
#define VEC_SIZE_1 0x1 |
#define VEC_SIZE_2 0x3 |
#define VEC_SIZE_3 0x7 |
#define VEC_SIZE_4 0xf |
/* ============================================================= |
* Offsets for GLmatrix |
*/ |
#define MATRIX_DATA 0 |
#define MATRIX_INV 4 |
#define MATRIX_FLAGS 8 |
#define MATRIX_TYPE 12 |
/* ============================================================= |
* Offsets for struct gl_light |
*/ |
#define LIGHT_NEXT 0 |
#define LIGHT_PREV 4 |
#define LIGHT_AMBIENT 8 |
#define LIGHT_DIFFUSE 24 |
#define LIGHT_SPECULAR 40 |
#define LIGHT_EYE_POSITION 56 |
#define LIGHT_EYE_DIRECTION 72 |
#define LIGHT_SPOT_EXPONENT 88 |
#define LIGHT_SPOT_CUTOFF 92 |
#define LIGHT_COS_CUTOFF 96 |
#define LIGHT_CONST_ATTEN 100 |
#define LIGHT_LINEAR_ATTEN 104 |
#define LIGHT_QUADRATIC_ATTEN 108 |
#define LIGHT_ENABLED 112 |
#define LIGHT_FLAGS 116 |
#define LIGHT_POSITION 120 |
#define LIGHT_VP_INF_NORM 136 |
#define LIGHT_H_INF_NORM 148 |
#define LIGHT_NORM_DIRECTION 160 |
#define LIGHT_VP_INF_SPOT_ATTEN 176 |
#define LIGHT_SPOT_EXP_TABLE 180 |
#define LIGHT_MAT_AMBIENT 4276 |
#define LIGHT_MAT_DIFFUSE 4300 |
#define LIGHT_MAT_SPECULAR 4324 |
#define SIZEOF_GL_LIGHT 4356 |
/* |
* Flags for struct gl_light |
*/ |
#define LIGHT_SPOT 0x1 |
#define LIGHT_LOCAL_VIEWER 0x2 |
#define LIGHT_POSITIONAL 0x4 |
#define LIGHT_NEED_VERTICES 0x6 |
/* ============================================================= |
* Offsets for struct gl_lightmodel |
*/ |
#define LIGHT_MODEL_AMBIENT 0 |
#define LIGHT_MODEL_LOCAL_VIEWER 16 |
#define LIGHT_MODEL_TWO_SIDE 17 |
#define LIGHT_MODEL_COLOR_CONTROL 20 |
#endif /* __ASM_TYPES_H__ */ |
/shark/tags/rel_0_4/ports/mesa/src/x86/sse.c |
---|
0,0 → 1,119 |
/* $Id: sse.c,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* PentiumIII-SIMD (SSE) optimizations contributed by |
* Andre Werthmann <wertmann@cs.uni-potsdam.de> |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "math/m_xform.h" |
#include "tnl/t_context.h" |
#include "sse.h" |
#include "common_x86_macros.h" |
#ifdef DEBUG |
#include "math/m_debug.h" |
#endif |
#ifdef USE_SSE_ASM |
DECLARE_XFORM_GROUP( sse, 2 ) |
DECLARE_XFORM_GROUP( sse, 3 ) |
#if 1 |
/* Some functions are not written in SSE-assembly, because the fpu ones are faster */ |
extern void _mesa_sse_transform_normals_no_rot( NORM_ARGS ); |
extern void _mesa_sse_transform_rescale_normals( NORM_ARGS ); |
extern void _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS ); |
extern void _mesa_sse_transform_points4_general( XFORM_ARGS ); |
extern void _mesa_sse_transform_points4_3d( XFORM_ARGS ); |
extern void _mesa_sse_transform_points4_identity( XFORM_ARGS ); |
#else |
DECLARE_NORM_GROUP( sse ) |
#endif |
extern void _ASMAPI |
_mesa_v16_sse_general_xform( GLfloat *first_vert, |
const GLfloat *m, |
const GLfloat *src, |
GLuint src_stride, |
GLuint count ); |
extern void _ASMAPI |
_mesa_sse_project_vertices( GLfloat *first, |
GLfloat *last, |
const GLfloat *m, |
GLuint stride ); |
extern void _ASMAPI |
_mesa_sse_project_clipped_vertices( GLfloat *first, |
GLfloat *last, |
const GLfloat *m, |
GLuint stride, |
const GLubyte *clipmask ); |
#endif |
void _mesa_init_sse_transform_asm( void ) |
{ |
#ifdef USE_SSE_ASM |
ASSIGN_XFORM_GROUP( sse, 2 ); |
ASSIGN_XFORM_GROUP( sse, 3 ); |
#if 1 |
/* TODO: Finish these off. |
*/ |
_mesa_transform_tab[4][MATRIX_GENERAL] = |
_mesa_sse_transform_points4_general; |
_mesa_transform_tab[4][MATRIX_3D] = |
_mesa_sse_transform_points4_3d; |
_mesa_transform_tab[4][MATRIX_IDENTITY] = |
_mesa_sse_transform_points4_identity; |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = |
_mesa_sse_transform_normals_no_rot; |
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = |
_mesa_sse_transform_rescale_normals; |
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = |
_mesa_sse_transform_rescale_normals_no_rot; |
#else |
ASSIGN_XFORM_GROUP( sse, 4 ); |
ASSIGN_NORM_GROUP( sse ); |
#endif |
#ifdef DEBUG |
_math_test_all_transform_functions( "SSE" ); |
_math_test_all_normal_transform_functions( "SSE" ); |
#endif |
#endif |
} |
/shark/tags/rel_0_4/ports/mesa/src/x86/x86.h |
---|
0,0 → 1,36 |
/* $Id: x86.h,v 1.1 2003-03-13 12:11:49 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Intel x86 assembly code by Josh Vanderhoof |
*/ |
#ifndef __X86_H__ |
#define __X86_H__ |
extern void _mesa_init_x86_transform_asm( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/x86/mmx_blendtmp.h |
---|
0,0 → 1,113 |
/* |
* Written by José Fonseca <j_r_fonseca@yahoo.co.uk> |
*/ |
/* |
* void _mesa_mmx_blend( GLcontext *ctx, |
* GLuint n, |
* const GLubyte mask[], |
* GLchan rgba[][4], |
* CONST GLchan dest[][4] ) |
* |
*/ |
ALIGNTEXT16 |
GLOBL GLNAME( TAG(_mesa_mmx_blend) ) |
GLNAME( TAG(_mesa_mmx_blend) ): |
PUSH_L ( EBP ) |
MOV_L ( ESP, EBP ) |
PUSH_L ( ESI ) |
PUSH_L ( EDI ) |
PUSH_L ( EBX ) |
MOV_L ( REGOFF(12, EBP), ECX ) /* n */ |
CMP_L ( CONST(0), ECX) |
JE ( LLBL ( TAG(GMB_return) ) ) |
MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ |
MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ |
MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ |
INIT |
TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ |
JZ ( LLBL ( TAG(GMB_align_end) ) ) |
CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ |
JE ( LLBL ( TAG(GMB_align_continue) ) ) |
/* runin */ |
#define ONE(x) x |
#define TWO(x) |
MAIN ( EDI, ESI ) |
#undef ONE |
#undef TWO |
LLBL ( TAG(GMB_align_continue) ): |
DEC_L ( ECX ) /* n -= 1 */ |
INC_L ( EBX ) /* mask += 1 */ |
ADD_L ( CONST(4), EDI ) /* rgba += 1 */ |
ADD_L ( CONST(4), ESI ) /* dest += 1 */ |
LLBL ( TAG(GMB_align_end) ): |
CMP_L ( CONST(2), ECX) |
JB ( LLBL ( TAG(GMB_loop_end) ) ) |
ALIGNTEXT16 |
LLBL ( TAG(GMB_loop_begin) ): |
CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ |
JE ( LLBL ( TAG(GMB_loop_continue) ) ) |
/* main loop */ |
#define ONE(x) |
#define TWO(x) x |
MAIN ( EDI, ESI ) |
#undef ONE |
#undef TWO |
LLBL ( TAG(GMB_loop_continue) ): |
DEC_L ( ECX ) |
DEC_L ( ECX ) /* n -= 2 */ |
ADD_L ( CONST(2), EBX ) /* mask += 2 */ |
ADD_L ( CONST(8), EDI ) /* rgba += 2 */ |
ADD_L ( CONST(8), ESI ) /* dest += 2 */ |
CMP_L ( CONST(2), ECX ) |
JAE ( LLBL ( TAG(GMB_loop_begin) ) ) |
LLBL ( TAG(GMB_loop_end) ): |
CMP_L ( CONST(1), ECX ) |
JB ( LLBL ( TAG(GMB_done) ) ) |
CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ |
JE ( LLBL ( TAG(GMB_done) ) ) |
/* runout */ |
#define ONE(x) x |
#define TWO(x) |
MAIN ( EDI, ESI ) |
#undef ONE |
#undef TWO |
LLBL ( TAG(GMB_done) ): |
EMMS |
LLBL ( TAG(GMB_return) ): |
POP_L ( EBX ) |
POP_L ( EDI ) |
POP_L ( ESI ) |
MOV_L ( EBP, ESP ) |
POP_L ( EBP ) |
RET |
#undef TAG |
#undef INIT |
#undef MAIN |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_context.h |
---|
0,0 → 1,51 |
/* $Id: ss_context.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef SS_CONTEXT_H |
#define SS_CONTEXT_H |
#include "mtypes.h" |
#include "swrast/swrast.h" |
#include "swrast_setup.h" |
typedef struct { |
GLuint NewState; |
SWvertex *verts; |
GLenum render_prim; |
GLuint SetupIndex; |
/* Temporaries for translating away float colors: |
*/ |
struct gl_client_array ChanColor; |
struct gl_client_array ChanSecondaryColor; |
} SScontext; |
#define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_triangle.h |
---|
0,0 → 1,40 |
/* $Id: ss_triangle.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef SS_TRIANGLE_H |
#define SS_TRIANGLE_H |
#include "mtypes.h" |
#include "ss_context.h" |
void _swsetup_trifuncs_init( GLcontext *ctx ); |
void _swsetup_choose_trifuncs( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_vb.h |
---|
0,0 → 1,39 |
/* $Id: ss_vb.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef SS_VB_H |
#define SS_VB_H |
#include "mtypes.h" |
#include "swrast_setup.h" |
void _swsetup_vb_init( GLcontext *ctx ); |
void _swsetup_choose_rastersetup_func( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_vbtmp.h |
---|
0,0 → 1,254 |
/* $Id: ss_vbtmp.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, |
GLuint newinputs ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
struct vertex_buffer *VB = &tnl->vb; |
SWvertex *v; |
GLfloat *proj; /* projected clip coordinates */ |
GLfloat *tc[MAX_TEXTURE_UNITS]; |
GLchan *color; |
GLchan *spec; |
GLuint *index; |
GLfloat *fog; |
GLfloat *pointSize; |
GLuint tsz[MAX_TEXTURE_UNITS]; |
GLuint tstride[MAX_TEXTURE_UNITS]; |
GLuint proj_stride, color_stride, spec_stride, index_stride; |
GLuint fog_stride, pointSize_stride; |
GLuint i; |
GLfloat *m = ctx->Viewport._WindowMap.m; |
const GLfloat sx = m[0]; |
const GLfloat sy = m[5]; |
const GLfloat sz = m[10]; |
const GLfloat tx = m[12]; |
const GLfloat ty = m[13]; |
const GLfloat tz = m[14]; |
GLuint maxtex = 0; |
if (IND & TEX0) { |
tc[0] = (GLfloat *)VB->TexCoordPtr[0]->data; |
tsz[0] = VB->TexCoordPtr[0]->size; |
tstride[0] = VB->TexCoordPtr[0]->stride; |
} |
if (IND & MULTITEX) { |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { |
if (VB->TexCoordPtr[i]) { |
maxtex = i+1; |
tc[i] = (GLfloat *)VB->TexCoordPtr[i]->data; |
tsz[i] = VB->TexCoordPtr[i]->size; |
tstride[i] = VB->TexCoordPtr[i]->stride; |
} |
else tc[i] = 0; |
} |
} |
proj = VB->NdcPtr->data[0]; |
proj_stride = VB->NdcPtr->stride; |
if (IND & FOG) { |
fog = (GLfloat *) VB->FogCoordPtr->data; |
fog_stride = VB->FogCoordPtr->stride; |
} |
if (IND & COLOR) { |
if (VB->ColorPtr[0]->Type != CHAN_TYPE) |
import_float_colors( ctx ); |
color = (GLchan *) VB->ColorPtr[0]->Ptr; |
color_stride = VB->ColorPtr[0]->StrideB; |
} |
if (IND & SPEC) { |
if (VB->SecondaryColorPtr[0]->Type != CHAN_TYPE) |
import_float_spec_colors( ctx ); |
spec = (GLchan *) VB->SecondaryColorPtr[0]->Ptr; |
spec_stride = VB->SecondaryColorPtr[0]->StrideB; |
} |
if (IND & INDEX) { |
index = VB->IndexPtr[0]->data; |
index_stride = VB->IndexPtr[0]->stride; |
} |
if (IND & POINT) { |
pointSize = (GLfloat *) VB->PointSizePtr->data; |
pointSize_stride = VB->PointSizePtr->stride; |
} |
v = &(SWSETUP_CONTEXT(ctx)->verts[start]); |
for (i=start; i < end; i++, v++) { |
if (VB->ClipMask[i] == 0) { |
v->win[0] = sx * proj[0] + tx; |
v->win[1] = sy * proj[1] + ty; |
v->win[2] = sz * proj[2] + tz; |
v->win[3] = proj[3]; |
} |
STRIDE_F(proj, proj_stride); |
if (IND & TEX0) { |
COPY_CLEAN_4V( v->texcoord[0], tsz[0], tc[0] ); |
STRIDE_F(tc[0], tstride[0]); |
} |
if (IND & MULTITEX) { |
GLuint u; |
for (u = 0 ; u < maxtex ; u++) |
if (tc[u]) { |
COPY_CLEAN_4V( v->texcoord[u], tsz[u], tc[u] ); |
STRIDE_F(tc[u], tstride[u]); |
} |
} |
if (IND & COLOR) { |
COPY_CHAN4(v->color, color); |
STRIDE_CHAN(color, color_stride); |
} |
if (IND & SPEC) { |
COPY_CHAN4(v->specular, spec); |
STRIDE_CHAN(spec, spec_stride); |
} |
if (IND & FOG) { |
v->fog = fog[0]; |
STRIDE_F(fog, fog_stride); |
} |
if (IND & INDEX) { |
v->index = index[0]; |
STRIDE_UI(index, index_stride); |
} |
if (IND & POINT) { |
v->pointSize = pointSize[0]; |
STRIDE_F(pointSize, pointSize_stride); |
} |
} |
} |
static void TAG(interp)( GLcontext *ctx, |
GLfloat t, |
GLuint edst, GLuint eout, GLuint ein, |
GLboolean force_boundary ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLfloat *m = ctx->Viewport._WindowMap.m; |
GLfloat *clip = VB->ClipPtr->data[edst]; |
SWvertex *dst = &swsetup->verts[edst]; |
SWvertex *in = &swsetup->verts[ein]; |
SWvertex *out = &swsetup->verts[eout]; |
/* Avoid division by zero by rearranging order of clip planes? |
*/ |
if (clip[3] != 0.0) { |
GLfloat oow = 1.0F / clip[3]; |
dst->win[0] = m[0] * clip[0] * oow + m[12]; |
dst->win[1] = m[5] * clip[1] * oow + m[13]; |
dst->win[2] = m[10] * clip[2] * oow + m[14]; |
dst->win[3] = oow; |
} |
if (IND & TEX0) { |
INTERP_4F( t, dst->texcoord[0], out->texcoord[0], in->texcoord[0] ); |
} |
if (IND & MULTITEX) { |
GLuint u; |
GLuint maxtex = ctx->Const.MaxTextureUnits; |
for (u = 0 ; u < maxtex ; u++) |
if (VB->TexCoordPtr[u]) { |
INTERP_4F( t, dst->texcoord[u], out->texcoord[u], in->texcoord[u] ); |
} |
} |
if (IND & COLOR) { |
INTERP_CHAN( t, dst->color[0], out->color[0], in->color[0] ); |
INTERP_CHAN( t, dst->color[1], out->color[1], in->color[1] ); |
INTERP_CHAN( t, dst->color[2], out->color[2], in->color[2] ); |
INTERP_CHAN( t, dst->color[3], out->color[3], in->color[3] ); |
} |
if (IND & SPEC) { |
INTERP_CHAN( t, dst->specular[0], out->specular[0], in->specular[0] ); |
INTERP_CHAN( t, dst->specular[1], out->specular[1], in->specular[1] ); |
INTERP_CHAN( t, dst->specular[2], out->specular[2], in->specular[2] ); |
} |
if (IND & FOG) { |
INTERP_F( t, dst->fog, out->fog, in->fog ); |
} |
if (IND & INDEX) { |
INTERP_UI( t, dst->index, out->index, in->index ); |
} |
/* XXX Point size interpolation??? */ |
if (IND & POINT) { |
INTERP_F( t, dst->pointSize, out->pointSize, in->pointSize ); |
} |
} |
static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
SWvertex *dst = &swsetup->verts[edst]; |
SWvertex *src = &swsetup->verts[esrc]; |
if (IND & COLOR) { |
COPY_CHAN4( dst->color, src->color ); |
} |
if (IND & SPEC) { |
COPY_3V( dst->specular, src->specular ); |
} |
if (IND & INDEX) { |
dst->index = src->index; |
} |
} |
static void TAG(init)( void ) |
{ |
setup_tab[IND] = TAG(emit); |
interp_tab[IND] = TAG(interp); |
copy_pv_tab[IND] = TAG(copy_pv); |
} |
#undef TAG |
#undef IND |
#undef SETUP_FLAGS |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/swrast_setup.h |
---|
0,0 → 1,54 |
/* $Id: swrast_setup.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
/* Public interface to the swrast_setup module. This module provides |
* an implementation of the driver interface to t_vb_render.c, and uses |
* the software rasterizer (swrast) to perform actual rasterization. |
* |
* The internals of the implementation are private, but can be hooked |
* into tnl at any time (except between RenderStart/RenderEnd) by |
* calling _swsetup_Wakeup(). |
*/ |
#ifndef SWRAST_SETUP_H |
#define SWRAST_SETUP_H |
extern GLboolean |
_swsetup_CreateContext( GLcontext *ctx ); |
extern void |
_swsetup_DestroyContext( GLcontext *ctx ); |
extern void |
_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); |
extern void |
_swsetup_Wakeup( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_context.c |
---|
0,0 → 1,167 |
/* $Id: ss_context.c,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "ss_context.h" |
#include "ss_triangle.h" |
#include "ss_vb.h" |
#include "swrast_setup.h" |
#include "tnl/tnl.h" |
#include "tnl/t_context.h" |
#include "tnl/t_pipeline.h" |
#define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \ |
_NEW_POLYGON| \ |
_NEW_LIGHT| \ |
_NEW_TEXTURE| \ |
_NEW_COLOR| \ |
_NEW_FOG| \ |
_NEW_POINT) |
#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT) |
GLboolean |
_swsetup_CreateContext( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext)); |
if (!swsetup) |
return GL_FALSE; |
swsetup->verts = (SWvertex *) ALIGN_CALLOC( sizeof(SWvertex) * tnl->vb.Size, |
32); |
if (!swsetup->verts) { |
FREE(swsetup); |
return GL_FALSE; |
} |
ctx->swsetup_context = swsetup; |
swsetup->NewState = ~0; |
_swsetup_vb_init( ctx ); |
_swsetup_trifuncs_init( ctx ); |
return GL_TRUE; |
} |
void |
_swsetup_DestroyContext( GLcontext *ctx ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
if (swsetup) { |
if (swsetup->verts) |
ALIGN_FREE(swsetup->verts); |
if (swsetup->ChanSecondaryColor.Ptr) |
ALIGN_FREE(swsetup->ChanSecondaryColor.Ptr); |
if (swsetup->ChanColor.Ptr) |
ALIGN_FREE(swsetup->ChanColor.Ptr); |
FREE(swsetup); |
ctx->swsetup_context = 0; |
} |
} |
static void |
_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) |
{ |
SWSETUP_CONTEXT(ctx)->render_prim = mode; |
_swrast_render_primitive( ctx, mode ); |
} |
/* |
* We patch this function into tnl->Driver.Render.Start. |
* It's called when we start rendering a vertex buffer. |
*/ |
static void |
_swsetup_RenderStart( GLcontext *ctx ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
GLuint new_state = swsetup->NewState; |
if (new_state & _SWSETUP_NEW_RENDERINDEX) { |
_swsetup_choose_trifuncs( ctx ); |
} |
if (new_state & _SWSETUP_NEW_VERTS) { |
_swsetup_choose_rastersetup_func( ctx ); |
} |
swsetup->NewState = 0; |
_swrast_render_start( ctx ); |
} |
/* |
* We patch this function into tnl->Driver.Render.Finish. |
* It's called when we finish rendering a vertex buffer. |
*/ |
static void |
_swsetup_RenderFinish( GLcontext *ctx ) |
{ |
_swrast_render_finish( ctx ); |
} |
void |
_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
swsetup->NewState |= new_state; |
} |
void |
_swsetup_Wakeup( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
tnl->Driver.Render.Start = _swsetup_RenderStart; |
tnl->Driver.Render.Finish = _swsetup_RenderFinish; |
tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive; |
/* interp */ |
/* copypv */ |
tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; /* new */ |
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; /* new */ |
/* points */ |
/* line */ |
/* triangle */ |
/* quad */ |
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; |
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; |
tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple; |
/* buildvertices */ |
tnl->Driver.Render.Multipass = 0; |
_tnl_need_projected_coords( ctx, GL_TRUE ); |
_swsetup_InvalidateState( ctx, ~0 ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_tritmp.h |
---|
0,0 → 1,195 |
/* $Id: ss_tritmp.h,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; |
SWvertex *v[3]; |
GLfloat z[3]; |
GLfloat offset; |
GLenum mode = GL_FILL; |
GLuint facing = 0; |
v[0] = &verts[e0]; |
v[1] = &verts[e1]; |
v[2] = &verts[e2]; |
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) |
{ |
GLfloat ex = v[0]->win[0] - v[2]->win[0]; |
GLfloat ey = v[0]->win[1] - v[2]->win[1]; |
GLfloat fx = v[1]->win[0] - v[2]->win[0]; |
GLfloat fy = v[1]->win[1] - v[2]->win[1]; |
GLfloat cc = ex*fy - ey*fx; |
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) |
{ |
facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; |
if (ctx->Stencil.TestTwoSide) |
ctx->_Facing = facing; /* for 2-sided stencil test */ |
if (IND & SS_UNFILLED_BIT) |
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; |
if (facing == 1) { |
if (IND & SS_TWOSIDE_BIT) { |
if (IND & SS_RGBA_BIT) { |
GLchan (*vbcolor)[4] = (GLchan (*)[4])VB->ColorPtr[1]->Ptr; |
SS_COLOR(v[0]->color, vbcolor[e0]); |
SS_COLOR(v[1]->color, vbcolor[e1]); |
SS_COLOR(v[2]->color, vbcolor[e2]); |
if (VB->SecondaryColorPtr[1]) { |
GLchan (*vbspec)[4] = (GLchan (*)[4])VB->SecondaryColorPtr[1]->Ptr; |
SS_SPEC(v[0]->specular, vbspec[e0]); |
SS_SPEC(v[1]->specular, vbspec[e1]); |
SS_SPEC(v[2]->specular, vbspec[e2]); |
} |
} else { |
GLuint *vbindex = VB->IndexPtr[1]->data; |
SS_IND(v[0]->index, vbindex[e0]); |
SS_IND(v[1]->index, vbindex[e1]); |
SS_IND(v[2]->index, vbindex[e2]); |
} |
} |
} |
} |
if (IND & SS_OFFSET_BIT) |
{ |
offset = ctx->Polygon.OffsetUnits; |
z[0] = v[0]->win[2]; |
z[1] = v[1]->win[2]; |
z[2] = v[2]->win[2]; |
if (cc * cc > 1e-16) { |
GLfloat ez = z[0] - z[2]; |
GLfloat fz = z[1] - z[2]; |
GLfloat a = ey*fz - ez*fy; |
GLfloat b = ez*fx - ex*fz; |
GLfloat ic = 1.0F / cc; |
GLfloat ac = a * ic; |
GLfloat bc = b * ic; |
if (ac < 0.0F) ac = -ac; |
if (bc < 0.0F) bc = -bc; |
offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; |
} |
offset *= ctx->MRD; |
/*printf("offset %g\n", offset);*/ |
} |
} |
if (mode == GL_POINT) { |
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { |
v[0]->win[2] += offset; |
v[1]->win[2] += offset; |
v[2]->win[2] += offset; |
} |
_swsetup_render_point_tri( ctx, e0, e1, e2, facing ); |
} else if (mode == GL_LINE) { |
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { |
v[0]->win[2] += offset; |
v[1]->win[2] += offset; |
v[2]->win[2] += offset; |
} |
_swsetup_render_line_tri( ctx, e0, e1, e2, facing ); |
} else { |
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { |
v[0]->win[2] += offset; |
v[1]->win[2] += offset; |
v[2]->win[2] += offset; |
} |
_swrast_Triangle( ctx, v[0], v[1], v[2] ); |
} |
if (IND & SS_OFFSET_BIT) { |
v[0]->win[2] = z[0]; |
v[1]->win[2] = z[1]; |
v[2]->win[2] = z[2]; |
} |
if (IND & SS_TWOSIDE_BIT) { |
if (facing == 1) { |
if (IND & SS_RGBA_BIT) { |
GLchan (*vbcolor)[4] = (GLchan (*)[4])VB->ColorPtr[0]->Ptr; |
SS_COLOR(v[0]->color, vbcolor[e0]); |
SS_COLOR(v[1]->color, vbcolor[e1]); |
SS_COLOR(v[2]->color, vbcolor[e2]); |
if (VB->SecondaryColorPtr[0]) { |
GLchan (*vbspec)[4] = (GLchan (*)[4])VB->SecondaryColorPtr[0]->Ptr; |
SS_SPEC(v[0]->specular, vbspec[e0]); |
SS_SPEC(v[1]->specular, vbspec[e1]); |
SS_SPEC(v[2]->specular, vbspec[e2]); |
} |
} else { |
GLuint *vbindex = VB->IndexPtr[0]->data; |
SS_IND(v[0]->index, vbindex[e0]); |
SS_IND(v[1]->index, vbindex[e1]); |
SS_IND(v[2]->index, vbindex[e2]); |
} |
} |
} |
} |
/* Need to fixup edgeflags when decomposing to triangles: |
*/ |
static void TAG(quadfunc)( GLcontext *ctx, GLuint v0, |
GLuint v1, GLuint v2, GLuint v3 ) |
{ |
if (IND & SS_UNFILLED_BIT) { |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLubyte ef1 = VB->EdgeFlag[v1]; |
GLubyte ef3 = VB->EdgeFlag[v3]; |
VB->EdgeFlag[v1] = 0; |
TAG(triangle)( ctx, v0, v1, v3 ); |
VB->EdgeFlag[v1] = ef1; |
VB->EdgeFlag[v3] = 0; |
TAG(triangle)( ctx, v1, v2, v3 ); |
VB->EdgeFlag[v3] = ef3; |
} else { |
TAG(triangle)( ctx, v0, v1, v3 ); |
TAG(triangle)( ctx, v1, v2, v3 ); |
} |
} |
static void TAG(init)( void ) |
{ |
tri_tab[IND] = TAG(triangle); |
quad_tab[IND] = TAG(quadfunc); |
} |
#undef IND |
#undef TAG |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_triangle.c |
---|
0,0 → 1,311 |
/* $Id: ss_triangle.c,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "tnl/t_context.h" |
#include "ss_triangle.h" |
#include "ss_context.h" |
#define SS_RGBA_BIT 0x1 |
#define SS_OFFSET_BIT 0x2 |
#define SS_TWOSIDE_BIT 0x4 |
#define SS_UNFILLED_BIT 0x8 |
#define SS_MAX_TRIFUNC 0x10 |
static triangle_func tri_tab[SS_MAX_TRIFUNC]; |
static quad_func quad_tab[SS_MAX_TRIFUNC]; |
static void _swsetup_render_line_tri( GLcontext *ctx, |
GLuint e0, GLuint e1, GLuint e2, |
GLuint facing ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLubyte *ef = VB->EdgeFlag; |
SWvertex *verts = swsetup->verts; |
SWvertex *v0 = &verts[e0]; |
SWvertex *v1 = &verts[e1]; |
SWvertex *v2 = &verts[e2]; |
GLchan c[2][4]; |
GLchan s[2][4]; |
GLuint i[2]; |
/* cull testing */ |
if (ctx->Polygon.CullFlag) { |
if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) |
return; |
if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) |
return; |
} |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
COPY_CHAN4(c[0], v0->color); |
COPY_CHAN4(c[1], v1->color); |
COPY_CHAN4(s[0], v0->specular); |
COPY_CHAN4(s[1], v1->specular); |
i[0] = v0->index; |
i[1] = v1->index; |
COPY_CHAN4(v0->color, v2->color); |
COPY_CHAN4(v1->color, v2->color); |
COPY_CHAN4(v0->specular, v2->specular); |
COPY_CHAN4(v1->specular, v2->specular); |
v0->index = v2->index; |
v1->index = v2->index; |
} |
if (swsetup->render_prim == GL_POLYGON) { |
if (ef[e2]) _swrast_Line( ctx, v2, v0 ); |
if (ef[e0]) _swrast_Line( ctx, v0, v1 ); |
if (ef[e1]) _swrast_Line( ctx, v1, v2 ); |
} else { |
if (ef[e0]) _swrast_Line( ctx, v0, v1 ); |
if (ef[e1]) _swrast_Line( ctx, v1, v2 ); |
if (ef[e2]) _swrast_Line( ctx, v2, v0 ); |
} |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
COPY_CHAN4(v0->color, c[0]); |
COPY_CHAN4(v1->color, c[1]); |
COPY_CHAN4(v0->specular, s[0]); |
COPY_CHAN4(v1->specular, s[1]); |
v0->index = i[0]; |
v1->index = i[1]; |
} |
} |
static void _swsetup_render_point_tri( GLcontext *ctx, |
GLuint e0, GLuint e1, GLuint e2, |
GLuint facing ) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
GLubyte *ef = VB->EdgeFlag; |
SWvertex *verts = swsetup->verts; |
SWvertex *v0 = &verts[e0]; |
SWvertex *v1 = &verts[e1]; |
SWvertex *v2 = &verts[e2]; |
GLchan c[2][4]; |
GLchan s[2][4]; |
GLuint i[2]; |
/* cull testing */ |
if (ctx->Polygon.CullFlag) { |
if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) |
return; |
if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) |
return; |
} |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
COPY_CHAN4(c[0], v0->color); |
COPY_CHAN4(c[1], v1->color); |
COPY_CHAN4(s[0], v0->specular); |
COPY_CHAN4(s[1], v1->specular); |
i[0] = v0->index; |
i[1] = v1->index; |
COPY_CHAN4(v0->color, v2->color); |
COPY_CHAN4(v1->color, v2->color); |
COPY_CHAN4(v0->specular, v2->specular); |
COPY_CHAN4(v1->specular, v2->specular); |
v0->index = v2->index; |
v1->index = v2->index; |
} |
if (ef[e0]) _swrast_Point( ctx, v0 ); |
if (ef[e1]) _swrast_Point( ctx, v1 ); |
if (ef[e2]) _swrast_Point( ctx, v2 ); |
if (ctx->_TriangleCaps & DD_FLATSHADE) { |
COPY_CHAN4(v0->color, c[0]); |
COPY_CHAN4(v1->color, c[1]); |
COPY_CHAN4(v0->specular, s[0]); |
COPY_CHAN4(v1->specular, s[1]); |
v0->index = i[0]; |
v1->index = i[1]; |
} |
_swrast_flush(ctx); |
} |
#define SS_COLOR(a,b) COPY_CHAN4(a,b) |
#define SS_SPEC(a,b) COPY_3V(a,b) |
#define SS_IND(a,b) (a = b) |
#define IND (0) |
#define TAG(x) x |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT) |
#define TAG(x) x##_offset |
#include "ss_tritmp.h" |
#define IND (SS_TWOSIDE_BIT) |
#define TAG(x) x##_twoside |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT) |
#define TAG(x) x##_offset_twoside |
#include "ss_tritmp.h" |
#define IND (SS_UNFILLED_BIT) |
#define TAG(x) x##_unfilled |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT) |
#define TAG(x) x##_offset_unfilled |
#include "ss_tritmp.h" |
#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT) |
#define TAG(x) x##_twoside_unfilled |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT) |
#define TAG(x) x##_offset_twoside_unfilled |
#include "ss_tritmp.h" |
#define IND (0|SS_RGBA_BIT) |
#define TAG(x) x##_rgba |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_offset_rgba |
#include "ss_tritmp.h" |
#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_twoside_rgba |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_offset_twoside_rgba |
#include "ss_tritmp.h" |
#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_unfilled_rgba |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_offset_unfilled_rgba |
#include "ss_tritmp.h" |
#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_twoside_unfilled_rgba |
#include "ss_tritmp.h" |
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) |
#define TAG(x) x##_offset_twoside_unfilled_rgba |
#include "ss_tritmp.h" |
void _swsetup_trifuncs_init( GLcontext *ctx ) |
{ |
(void) ctx; |
init(); |
init_offset(); |
init_twoside(); |
init_offset_twoside(); |
init_unfilled(); |
init_offset_unfilled(); |
init_twoside_unfilled(); |
init_offset_twoside_unfilled(); |
init_rgba(); |
init_offset_rgba(); |
init_twoside_rgba(); |
init_offset_twoside_rgba(); |
init_unfilled_rgba(); |
init_offset_unfilled_rgba(); |
init_twoside_unfilled_rgba(); |
init_offset_twoside_unfilled_rgba(); |
} |
static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; |
GLuint i; |
if (VB->Elts) { |
for (i = first; i < last; i++) |
if (VB->ClipMask[VB->Elts[i]] == 0) |
_swrast_Point( ctx, &verts[VB->Elts[i]] ); |
} |
else { |
for (i = first; i < last; i++) |
if (VB->ClipMask[i] == 0) |
_swrast_Point( ctx, &verts[i] ); |
} |
} |
static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 ) |
{ |
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; |
_swrast_Line( ctx, &verts[v0], &verts[v1] ); |
} |
void _swsetup_choose_trifuncs( GLcontext *ctx ) |
{ |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
GLuint ind = 0; |
if (ctx->Polygon.OffsetPoint || |
ctx->Polygon.OffsetLine || |
ctx->Polygon.OffsetFill) |
ind |= SS_OFFSET_BIT; |
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) |
ind |= SS_TWOSIDE_BIT; |
/* We piggyback the two-sided stencil front/back determination on the |
* unfilled triangle path. |
*/ |
if ((ctx->_TriangleCaps & DD_TRI_UNFILLED) || |
(ctx->Stencil.Enabled && ctx->Stencil.TestTwoSide)) |
ind |= SS_UNFILLED_BIT; |
if (ctx->Visual.rgbMode) |
ind |= SS_RGBA_BIT; |
tnl->Driver.Render.Triangle = tri_tab[ind]; |
tnl->Driver.Render.Quad = quad_tab[ind]; |
tnl->Driver.Render.Line = swsetup_line; |
tnl->Driver.Render.Points = swsetup_points; |
ctx->_Facing = 0; |
} |
/shark/tags/rel_0_4/ports/mesa/src/swrast_setup/ss_vb.c |
---|
0,0 → 1,446 |
/* $Id: ss_vb.c,v 1.1 2003-02-28 11:54:35 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "imports.h" |
#include "swrast/swrast.h" |
#include "tnl/t_context.h" |
#include "math/m_vector.h" |
#include "math/m_translate.h" |
#include "ss_context.h" |
#include "ss_vb.h" |
static void do_import( struct vertex_buffer *VB, |
struct gl_client_array *to, |
struct gl_client_array *from ) |
{ |
GLuint count = VB->Count; |
if (!to->Ptr) { |
to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLchan), 32 ); |
to->Type = CHAN_TYPE; |
} |
/* No need to transform the same value 3000 times. |
*/ |
if (!from->StrideB) { |
to->StrideB = 0; |
count = 1; |
} |
else |
to->StrideB = 4 * sizeof(GLchan); |
_math_trans_4chan( (GLchan (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
count); |
} |
static void import_float_colors( GLcontext *ctx ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct gl_client_array *to = &SWSETUP_CONTEXT(ctx)->ChanColor; |
do_import( VB, to, VB->ColorPtr[0] ); |
VB->ColorPtr[0] = to; |
} |
static void import_float_spec_colors( GLcontext *ctx ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
struct gl_client_array *to = &SWSETUP_CONTEXT(ctx)->ChanSecondaryColor; |
do_import( VB, to, VB->SecondaryColorPtr[0] ); |
VB->SecondaryColorPtr[0] = to; |
} |
/* Provides a RasterSetup function which prebuilds vertices for the |
* software rasterizer. This is required for the triangle functions |
* in this module, but not the rest of the swrast module. |
*/ |
#define COLOR 0x1 |
#define INDEX 0x2 |
#define TEX0 0x4 |
#define MULTITEX 0x8 |
#define SPEC 0x10 |
#define FOG 0x20 |
#define POINT 0x40 |
#define MAX_SETUPFUNC 0x80 |
static setup_func setup_tab[MAX_SETUPFUNC]; |
static interp_func interp_tab[MAX_SETUPFUNC]; |
static copy_pv_func copy_pv_tab[MAX_SETUPFUNC]; |
#define IND (0) |
#define TAG(x) x##_none |
#include "ss_vbtmp.h" |
#define IND (COLOR) |
#define TAG(x) x##_color |
#include "ss_vbtmp.h" |
#define IND (COLOR|SPEC) |
#define TAG(x) x##_color_spec |
#include "ss_vbtmp.h" |
#define IND (COLOR|FOG) |
#define TAG(x) x##_color_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|SPEC|FOG) |
#define TAG(x) x##_color_spec_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0) |
#define TAG(x) x##_color_tex0 |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|SPEC) |
#define TAG(x) x##_color_tex0_spec |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|FOG) |
#define TAG(x) x##_color_tex0_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|SPEC|FOG) |
#define TAG(x) x##_color_tex0_spec_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX) |
#define TAG(x) x##_color_multitex |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|SPEC) |
#define TAG(x) x##_color_multitex_spec |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|FOG) |
#define TAG(x) x##_color_multitex_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|SPEC|FOG) |
#define TAG(x) x##_color_multitex_spec_fog |
#include "ss_vbtmp.h" |
#define IND (COLOR|POINT) |
#define TAG(x) x##_color_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|SPEC|POINT) |
#define TAG(x) x##_color_spec_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|FOG|POINT) |
#define TAG(x) x##_color_fog_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|SPEC|FOG|POINT) |
#define TAG(x) x##_color_spec_fog_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|POINT) |
#define TAG(x) x##_color_tex0_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|SPEC|POINT) |
#define TAG(x) x##_color_tex0_spec_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|FOG|POINT) |
#define TAG(x) x##_color_tex0_fog_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|TEX0|SPEC|FOG|POINT) |
#define TAG(x) x##_color_tex0_spec_fog_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|POINT) |
#define TAG(x) x##_color_multitex_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|SPEC|POINT) |
#define TAG(x) x##_color_multitex_spec_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|FOG|POINT) |
#define TAG(x) x##_color_multitex_fog_point |
#include "ss_vbtmp.h" |
#define IND (COLOR|MULTITEX|SPEC|FOG|POINT) |
#define TAG(x) x##_color_multitex_spec_fog_point |
#include "ss_vbtmp.h" |
#define IND (INDEX) |
#define TAG(x) x##_index |
#include "ss_vbtmp.h" |
#define IND (INDEX|FOG) |
#define TAG(x) x##_index_fog |
#include "ss_vbtmp.h" |
#define IND (INDEX|POINT) |
#define TAG(x) x##_index_point |
#include "ss_vbtmp.h" |
#define IND (INDEX|FOG|POINT) |
#define TAG(x) x##_index_fog_point |
#include "ss_vbtmp.h" |
/*********************************************************************** |
* Additional setup and interp for back color and edgeflag. |
***********************************************************************/ |
#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx]) |
static void interp_extras( GLcontext *ctx, |
GLfloat t, |
GLuint dst, GLuint out, GLuint in, |
GLboolean force_boundary ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
if (VB->ColorPtr[1]) { |
INTERP_4CHAN( t, |
GET_COLOR(VB->ColorPtr[1], dst), |
GET_COLOR(VB->ColorPtr[1], out), |
GET_COLOR(VB->ColorPtr[1], in) ); |
if (VB->SecondaryColorPtr[1]) { |
INTERP_3CHAN( t, |
GET_COLOR(VB->SecondaryColorPtr[1], dst), |
GET_COLOR(VB->SecondaryColorPtr[1], out), |
GET_COLOR(VB->SecondaryColorPtr[1], in) ); |
} |
} |
else if (VB->IndexPtr[1]) { |
VB->IndexPtr[1]->data[dst] = (GLuint) (GLint) |
LINTERP( t, |
(GLfloat) VB->IndexPtr[1]->data[out], |
(GLfloat) VB->IndexPtr[1]->data[in] ); |
} |
if (VB->EdgeFlag) { |
VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary; |
} |
interp_tab[SWSETUP_CONTEXT(ctx)->SetupIndex](ctx, t, dst, out, in, |
force_boundary); |
} |
static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) |
{ |
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; |
if (VB->ColorPtr[1]) { |
COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst), |
GET_COLOR(VB->ColorPtr[1], src) ); |
if (VB->SecondaryColorPtr[1]) { |
COPY_3V( GET_COLOR(VB->SecondaryColorPtr[1], dst), |
GET_COLOR(VB->SecondaryColorPtr[1], src) ); |
} |
} |
else if (VB->IndexPtr[1]) { |
VB->IndexPtr[1]->data[dst] = VB->IndexPtr[1]->data[src]; |
} |
copy_pv_tab[SWSETUP_CONTEXT(ctx)->SetupIndex](ctx, dst, src); |
} |
/*********************************************************************** |
* Initialization |
***********************************************************************/ |
static void |
emit_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) |
{ |
_mesa_debug(ctx, "swrast_setup: invalid setup function\n"); |
(void) (ctx && start && end && newinputs); |
} |
static void |
interp_invalid( GLcontext *ctx, GLfloat t, |
GLuint edst, GLuint eout, GLuint ein, |
GLboolean force_boundary ) |
{ |
_mesa_debug(ctx, "swrast_setup: invalid interp function\n"); |
(void) (ctx && t && edst && eout && ein && force_boundary); |
} |
static void |
copy_pv_invalid( GLcontext *ctx, GLuint edst, GLuint esrc ) |
{ |
_mesa_debug(ctx, "swrast_setup: invalid copy_pv function\n"); |
(void) (ctx && edst && esrc ); |
} |
static void init_standard( void ) |
{ |
GLuint i; |
for (i = 0 ; i < Elements(setup_tab) ; i++) { |
setup_tab[i] = emit_invalid; |
interp_tab[i] = interp_invalid; |
copy_pv_tab[i] = copy_pv_invalid; |
} |
init_none(); |
init_color(); |
init_color_spec(); |
init_color_fog(); |
init_color_spec_fog(); |
init_color_tex0(); |
init_color_tex0_spec(); |
init_color_tex0_fog(); |
init_color_tex0_spec_fog(); |
init_color_multitex(); |
init_color_multitex_spec(); |
init_color_multitex_fog(); |
init_color_multitex_spec_fog(); |
init_color_point(); |
init_color_spec_point(); |
init_color_fog_point(); |
init_color_spec_fog_point(); |
init_color_tex0_point(); |
init_color_tex0_spec_point(); |
init_color_tex0_fog_point(); |
init_color_tex0_spec_fog_point(); |
init_color_multitex_point(); |
init_color_multitex_spec_point(); |
init_color_multitex_fog_point(); |
init_color_multitex_spec_fog_point(); |
init_index(); |
init_index_fog(); |
init_index_point(); |
init_index_fog_point(); |
} |
/* debug only */ |
#if 0 |
static void |
printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags ) |
{ |
_mesa_debug(ctx, "%s(%x): %s%s%s%s%s%s%s\n", |
msg, |
(int) flags, |
(flags & COLOR) ? "color, " : "", |
(flags & INDEX) ? "index, " : "", |
(flags & TEX0) ? "tex0, " : "", |
(flags & MULTITEX) ? "multitex, " : "", |
(flags & SPEC) ? "spec, " : "", |
(flags & FOG) ? "fog, " : "", |
(flags & POINT) ? "point, " : ""); |
} |
#endif |
void |
_swsetup_choose_rastersetup_func(GLcontext *ctx) |
{ |
SScontext *swsetup = SWSETUP_CONTEXT(ctx); |
TNLcontext *tnl = TNL_CONTEXT(ctx); |
int funcindex = 0; |
if (ctx->RenderMode == GL_RENDER) { |
if (ctx->Visual.rgbMode) { |
funcindex = COLOR; |
if (ctx->Texture._EnabledUnits > 1) |
funcindex |= MULTITEX; /* a unit above unit[0] is enabled */ |
else if (ctx->Texture._EnabledUnits == 1) |
funcindex |= TEX0; /* only unit 0 is enabled */ |
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) |
funcindex |= SPEC; |
} |
else { |
funcindex = INDEX; |
} |
if (ctx->Point._Attenuated || |
(ctx->VertexProgram.Enabled && ctx->VertexProgram.PointSizeEnabled)) |
funcindex |= POINT; |
if (ctx->Fog.Enabled) |
funcindex |= FOG; |
} |
else if (ctx->RenderMode == GL_FEEDBACK) { |
if (ctx->Visual.rgbMode) |
funcindex = (COLOR | TEX0); /* is feedback color subject to fogging? */ |
else |
funcindex = INDEX; |
} |
else |
funcindex = 0; |
swsetup->SetupIndex = funcindex; |
tnl->Driver.Render.BuildVertices = setup_tab[funcindex]; |
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { |
tnl->Driver.Render.Interp = interp_extras; |
tnl->Driver.Render.CopyPV = copy_pv_extras; |
} |
else { |
tnl->Driver.Render.Interp = interp_tab[funcindex]; |
tnl->Driver.Render.CopyPV = copy_pv_tab[funcindex]; |
} |
ASSERT(tnl->Driver.Render.BuildVertices); |
ASSERT(tnl->Driver.Render.BuildVertices != emit_invalid); |
} |
void |
_swsetup_vb_init( GLcontext *ctx ) |
{ |
(void) ctx; |
init_standard(); |
/* |
printSetupFlags(ctx); |
*/ |
} |
/shark/tags/rel_0_4/ports/mesa/src/array_cache/ac_context.c |
---|
0,0 → 1,315 |
/* $Id: ac_context.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "array_cache/ac_context.h" |
/* |
* Initialize the array fallbacks. That is, by default the fallback arrays |
* point into the current vertex attribute values in ctx->Current.Attrib[] |
*/ |
static void _ac_fallbacks_init( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *cl; |
GLuint i; |
cl = &ac->Fallback.Normal; |
cl->Size = 3; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
cl = &ac->Fallback.Color; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
cl = &ac->Fallback.SecondaryColor; |
cl->Size = 3; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
cl = &ac->Fallback.FogCoord; |
cl->Size = 1; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) &ctx->Current.Attrib[VERT_ATTRIB_FOG]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
cl = &ac->Fallback.Index; |
cl->Size = 1; |
cl->Type = GL_UNSIGNED_INT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) &ctx->Current.Index; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) { |
cl = &ac->Fallback.TexCoord[i]; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
} |
cl = &ac->Fallback.EdgeFlag; |
cl->Size = 1; |
cl->Type = GL_UNSIGNED_BYTE; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) &ctx->Current.EdgeFlag; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
for (i = 0; i < VERT_ATTRIB_MAX; i++) { |
cl = &ac->Fallback.Attrib[i]; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 0; |
cl->Ptr = (void *) ctx->Current.Attrib[i]; |
cl->Enabled = 1; |
cl->Flags = CA_CLIENT_DATA; /* hack */ |
} |
} |
/* |
* Initialize the array cache pointers, types, strides, etc. |
*/ |
static void _ac_cache_init( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *cl; |
GLuint size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; |
GLuint i; |
cl = &ac->Cache.Vertex; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 4 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
cl = &ac->Cache.Normal; |
cl->Size = 3; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 3 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
cl = &ac->Cache.Color; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 4 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
cl = &ac->Cache.SecondaryColor; |
cl->Size = 3; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 4 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
cl = &ac->Cache.FogCoord; |
cl->Size = 1; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
cl = &ac->Cache.Index; |
cl->Size = 1; |
cl->Type = GL_UNSIGNED_INT; |
cl->Stride = 0; |
cl->StrideB = sizeof(GLuint); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) { |
cl = &ac->Cache.TexCoord[i]; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 4 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
} |
cl = &ac->Cache.EdgeFlag; |
cl->Size = 1; |
cl->Type = GL_UNSIGNED_BYTE; |
cl->Stride = 0; |
cl->StrideB = sizeof(GLubyte); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { |
cl = &ac->Cache.Attrib[i]; |
cl->Size = 4; |
cl->Type = GL_FLOAT; |
cl->Stride = 0; |
cl->StrideB = 4 * sizeof(GLfloat); |
cl->Ptr = MALLOC( cl->StrideB * size ); |
cl->Enabled = 1; |
cl->Flags = 0; |
} |
} |
/* This storage used to hold translated client data if type or stride |
* need to be fixed. |
*/ |
static void _ac_elts_init( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
GLuint size = 1000; |
ac->Elts = (GLuint *)MALLOC( sizeof(GLuint) * size ); |
ac->elt_size = size; |
} |
static void _ac_raw_init( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
GLuint i; |
ac->Raw.Color = ac->Fallback.Color; |
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; |
ac->Raw.FogCoord = ac->Fallback.FogCoord; |
ac->Raw.Index = ac->Fallback.Index; |
ac->Raw.Normal = ac->Fallback.Normal; |
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; |
ac->Raw.Vertex = ctx->Array.Vertex; |
ac->IsCached.Color = GL_FALSE; |
ac->IsCached.EdgeFlag = GL_FALSE; |
ac->IsCached.FogCoord = GL_FALSE; |
ac->IsCached.Index = GL_FALSE; |
ac->IsCached.Normal = GL_FALSE; |
ac->IsCached.SecondaryColor = GL_FALSE; |
ac->IsCached.Vertex = GL_FALSE; |
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) { |
ac->Raw.TexCoord[i] = ac->Fallback.TexCoord[i]; |
ac->IsCached.TexCoord[i] = GL_FALSE; |
} |
for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) { |
ac->Raw.Attrib[i] = ac->Fallback.Attrib[i]; |
ac->IsCached.Attrib[i] = GL_FALSE; |
} |
} |
GLboolean _ac_CreateContext( GLcontext *ctx ) |
{ |
ctx->acache_context = CALLOC(sizeof(ACcontext)); |
if (ctx->acache_context) { |
_ac_cache_init( ctx ); |
_ac_fallbacks_init( ctx ); |
_ac_raw_init( ctx ); |
_ac_elts_init( ctx ); |
return GL_TRUE; |
} |
return GL_FALSE; |
} |
void _ac_DestroyContext( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
GLint i; |
if (ac->Cache.Vertex.Ptr) FREE( ac->Cache.Vertex.Ptr ); |
if (ac->Cache.Normal.Ptr) FREE( ac->Cache.Normal.Ptr ); |
if (ac->Cache.Color.Ptr) FREE( ac->Cache.Color.Ptr ); |
if (ac->Cache.SecondaryColor.Ptr) FREE( ac->Cache.SecondaryColor.Ptr ); |
if (ac->Cache.EdgeFlag.Ptr) FREE( ac->Cache.EdgeFlag.Ptr ); |
if (ac->Cache.Index.Ptr) FREE( ac->Cache.Index.Ptr ); |
if (ac->Cache.FogCoord.Ptr) FREE( ac->Cache.FogCoord.Ptr ); |
for (i = 0; i < MAX_TEXTURE_UNITS; i++) { |
if (ac->Cache.TexCoord[i].Ptr) |
FREE( ac->Cache.TexCoord[i].Ptr ); |
} |
for (i = 0; i < VERT_ATTRIB_MAX; i++) { |
if (ac->Cache.Attrib[i].Ptr) |
FREE( ac->Cache.Attrib[i].Ptr ); |
} |
if (ac->Elts) FREE( ac->Elts ); |
/* Free the context structure itself */ |
FREE(ac); |
ctx->acache_context = NULL; |
} |
void _ac_InvalidateState( GLcontext *ctx, GLuint new_state ) |
{ |
AC_CONTEXT(ctx)->NewState |= new_state; |
AC_CONTEXT(ctx)->NewArrayState |= ctx->Array.NewState; |
} |
/shark/tags/rel_0_4/ports/mesa/src/array_cache/acache.h |
---|
0,0 → 1,133 |
/* $Id: acache.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _ARRAYCACHE_H |
#define _ARRAYCACHE_H |
#include "mtypes.h" |
extern GLboolean |
_ac_CreateContext( GLcontext *ctx ); |
extern void |
_ac_DestroyContext( GLcontext *ctx ); |
extern void |
_ac_InvalidateState( GLcontext *ctx, GLuint new_state ); |
extern struct gl_client_array * |
_ac_import_vertex( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_normal( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_color( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_index( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_secondarycolor( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_fogcoord( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_edgeflag( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_texcoord( GLcontext *ctx, |
GLuint unit, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwritable, |
GLboolean *writable ); |
extern struct gl_client_array * |
_ac_import_attrib( GLcontext *ctx, |
GLuint index, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwritable, |
GLboolean *writable ); |
/* Clients must call this function to validate state and set bounds |
* before importing any data: |
*/ |
extern void |
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count ); |
/* Additional convenience function: |
*/ |
extern CONST void * |
_ac_import_elements( GLcontext *ctx, |
GLenum new_type, |
GLuint count, |
GLenum old_type, |
CONST void *indices ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/array_cache/ac_context.h |
---|
0,0 → 1,100 |
/* $Id: ac_context.h,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#ifndef _AC_CONTEXT_H |
#define _AC_CONTEXT_H |
#include "glheader.h" |
#include "mtypes.h" |
#include "array_cache/acache.h" |
/* These are used to make the ctx->Current values look like |
* arrays (with zero StrideB). |
*/ |
struct ac_arrays { |
struct gl_client_array Vertex; |
struct gl_client_array Normal; |
struct gl_client_array Color; |
struct gl_client_array SecondaryColor; |
struct gl_client_array FogCoord; |
struct gl_client_array Index; |
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; |
struct gl_client_array EdgeFlag; |
struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ |
}; |
struct ac_array_pointers { |
struct gl_client_array *Vertex; |
struct gl_client_array *Normal; |
struct gl_client_array *Color; |
struct gl_client_array *SecondaryColor; |
struct gl_client_array *FogCoord; |
struct gl_client_array *Index; |
struct gl_client_array *TexCoord[MAX_TEXTURE_UNITS]; |
struct gl_client_array *EdgeFlag; |
struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ |
}; |
struct ac_array_flags { |
GLboolean Vertex; |
GLboolean Normal; |
GLboolean Color; |
GLboolean SecondaryColor; |
GLboolean FogCoord; |
GLboolean Index; |
GLboolean TexCoord[MAX_TEXTURE_UNITS]; |
GLboolean EdgeFlag; |
GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ |
}; |
typedef struct { |
GLuint NewState; /* not needed? */ |
GLuint NewArrayState; |
/* Facility for importing and caching array data: |
*/ |
struct ac_arrays Fallback; |
struct ac_arrays Cache; |
struct ac_arrays Raw; |
struct ac_array_flags IsCached; |
GLuint start; |
GLuint count; |
/* Facility for importing element lists: |
*/ |
GLuint *Elts; |
GLuint elt_size; |
} ACcontext; |
#define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/array_cache/ac_import.c |
---|
0,0 → 1,929 |
/* $Id: ac_import.c,v 1.1 2003-02-28 11:49:40 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "macros.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_translate.h" |
#include "array_cache/ac_context.h" |
#include "math/m_translate.h" |
#define STRIDE_ARRAY( array, offset ) \ |
do { \ |
char *tmp = (char *) (array).Ptr; \ |
tmp += (offset) * (array).StrideB; \ |
(array).Ptr = tmp; \ |
} while (0) |
/* Set the array pointer back to its source when the cached data is |
* invalidated: |
*/ |
static void reset_texcoord( GLcontext *ctx, GLuint unit ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_TEXCOORD(unit)) { |
ac->Raw.TexCoord[unit] = ctx->Array.TexCoord[unit]; |
STRIDE_ARRAY(ac->Raw.TexCoord[unit], ac->start); |
} |
else { |
ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit]; |
if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0) |
ac->Raw.TexCoord[unit].Size = 4; |
else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0) |
ac->Raw.TexCoord[unit].Size = 3; |
else |
ac->Raw.TexCoord[unit].Size = 2; |
} |
ac->IsCached.TexCoord[unit] = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_TEXCOORD(unit); |
} |
static void reset_vertex( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
ASSERT(ctx->Array.Vertex.Enabled |
|| (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)); |
ac->Raw.Vertex = ctx->Array.Vertex; |
STRIDE_ARRAY(ac->Raw.Vertex, ac->start); |
ac->IsCached.Vertex = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_VERTEX; |
} |
static void reset_normal( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_NORMAL) { |
ac->Raw.Normal = ctx->Array.Normal; |
STRIDE_ARRAY(ac->Raw.Normal, ac->start); |
} |
else { |
ac->Raw.Normal = ac->Fallback.Normal; |
} |
ac->IsCached.Normal = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_NORMAL; |
} |
static void reset_color( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_COLOR0) { |
ac->Raw.Color = ctx->Array.Color; |
STRIDE_ARRAY(ac->Raw.Color, ac->start); |
} |
else |
ac->Raw.Color = ac->Fallback.Color; |
ac->IsCached.Color = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_COLOR0; |
} |
static void reset_secondarycolor( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_COLOR1) { |
ac->Raw.SecondaryColor = ctx->Array.SecondaryColor; |
STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start); |
} |
else |
ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; |
ac->IsCached.SecondaryColor = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_COLOR1; |
} |
static void reset_index( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_INDEX) { |
ac->Raw.Index = ctx->Array.Index; |
STRIDE_ARRAY(ac->Raw.Index, ac->start); |
} |
else |
ac->Raw.Index = ac->Fallback.Index; |
ac->IsCached.Index = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_INDEX; |
} |
static void reset_fogcoord( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_FOGCOORD) { |
ac->Raw.FogCoord = ctx->Array.FogCoord; |
STRIDE_ARRAY(ac->Raw.FogCoord, ac->start); |
} |
else |
ac->Raw.FogCoord = ac->Fallback.FogCoord; |
ac->IsCached.FogCoord = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD; |
} |
static void reset_edgeflag( GLcontext *ctx ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (ctx->Array._Enabled & _NEW_ARRAY_EDGEFLAG) { |
ac->Raw.EdgeFlag = ctx->Array.EdgeFlag; |
STRIDE_ARRAY(ac->Raw.EdgeFlag, ac->start); |
} |
else |
ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; |
ac->IsCached.EdgeFlag = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_EDGEFLAG; |
} |
static void reset_attrib( GLcontext *ctx, GLuint index ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
GLboolean fallback = GL_FALSE; |
/* |
* The 16 NV vertex attribute arrays have top priority. If one of those |
* is not enabled, look if a corresponding conventional array is enabled. |
* If nothing else, use the fallback (ctx->Current.Attrib) values. |
*/ |
if (ctx->Array._Enabled & _NEW_ARRAY_ATTRIB(index)) { |
ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index]; |
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); |
} |
else if (ctx->Array._Enabled & (1 << index)) { |
/* use conventional vertex array if possible */ |
if (index == VERT_ATTRIB_POS) { |
ac->Raw.Attrib[index] = ctx->Array.Vertex; |
} |
else if (index == VERT_ATTRIB_NORMAL) { |
ac->Raw.Attrib[index] = ctx->Array.Normal; |
} |
else if (index == VERT_ATTRIB_COLOR0) { |
ac->Raw.Attrib[index] = ctx->Array.Color; |
} |
else if (index == VERT_ATTRIB_COLOR1) { |
ac->Raw.Attrib[index] = ctx->Array.SecondaryColor; |
} |
else if (index == VERT_ATTRIB_FOG) { |
ac->Raw.Attrib[index] = ctx->Array.FogCoord; |
} |
else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { |
GLuint unit = index - VERT_ATTRIB_TEX0; |
ASSERT(unit < MAX_TEXTURE_UNITS); |
ac->Raw.Attrib[index] = ctx->Array.TexCoord[unit]; |
} |
else { |
/* missing conventional array (vertex weight, for example) */ |
fallback = GL_TRUE; |
} |
if (!fallback) |
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); |
} |
else { |
fallback = GL_TRUE; |
} |
if (fallback) { |
/* fallback to ctx->Current.Attrib values */ |
ac->Raw.Attrib[index] = ac->Fallback.Attrib[index]; |
if (ctx->Current.Attrib[index][3] != 1.0) |
ac->Raw.Attrib[index].Size = 4; |
else if (ctx->Current.Attrib[index][2] != 0.0) |
ac->Raw.Attrib[index].Size = 3; |
else |
ac->Raw.Attrib[index].Size = 2; |
} |
ac->IsCached.Attrib[index] = GL_FALSE; |
ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index); |
} |
/* |
* Generic import function for color data |
*/ |
static void import( GLcontext *ctx, |
GLenum type, |
struct gl_client_array *to, |
struct gl_client_array *from ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (type == 0) |
type = from->Type; |
switch (type) { |
case GL_FLOAT: |
_math_trans_4f( (GLfloat (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->StrideB = 4 * sizeof(GLfloat); |
to->Type = GL_FLOAT; |
break; |
case GL_UNSIGNED_BYTE: |
_math_trans_4ub( (GLubyte (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->StrideB = 4 * sizeof(GLubyte); |
to->Type = GL_UNSIGNED_BYTE; |
break; |
case GL_UNSIGNED_SHORT: |
_math_trans_4us( (GLushort (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->StrideB = 4 * sizeof(GLushort); |
to->Type = GL_UNSIGNED_SHORT; |
break; |
default: |
ASSERT(0); |
break; |
} |
} |
/* |
* Functions to import array ranges with specified types and strides. |
* For example, if the vertex data is GLshort[2] and we want GLfloat[3] |
* we'll use an import function to do the data conversion. |
*/ |
static void import_texcoord( GLcontext *ctx, GLuint unit, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.TexCoord[unit]; |
struct gl_client_array *to = &ac->Cache.TexCoord[unit]; |
ASSERT(unit < ctx->Const.MaxTextureUnits); |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_FLOAT); |
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); |
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); |
_math_trans_4f( (GLfloat (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->Size = from->Size; |
to->StrideB = 4 * sizeof(GLfloat); |
to->Type = GL_FLOAT; |
ac->IsCached.TexCoord[unit] = GL_TRUE; |
} |
static void import_vertex( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.Vertex; |
struct gl_client_array *to = &ac->Cache.Vertex; |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_FLOAT); |
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); |
_math_trans_4f( (GLfloat (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->Size = from->Size; |
to->StrideB = 4 * sizeof(GLfloat); |
to->Type = GL_FLOAT; |
ac->IsCached.Vertex = GL_TRUE; |
} |
static void import_normal( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.Normal; |
struct gl_client_array *to = &ac->Cache.Normal; |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_FLOAT); |
ASSERT(stride == 3*sizeof(GLfloat) || stride == 0); |
_math_trans_3f( (GLfloat (*)[3]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
0, |
ac->count - ac->start); |
to->StrideB = 3 * sizeof(GLfloat); |
to->Type = GL_FLOAT; |
ac->IsCached.Normal = GL_TRUE; |
} |
static void import_color( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.Color; |
struct gl_client_array *to = &ac->Cache.Color; |
import( ctx, type, to, from ); |
ac->IsCached.Color = GL_TRUE; |
} |
static void import_index( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.Index; |
struct gl_client_array *to = &ac->Cache.Index; |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_UNSIGNED_INT); |
ASSERT(stride == sizeof(GLuint) || stride == 0); |
_math_trans_1ui( (GLuint *) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
0, |
ac->count - ac->start); |
to->StrideB = sizeof(GLuint); |
to->Type = GL_UNSIGNED_INT; |
ac->IsCached.Index = GL_TRUE; |
} |
static void import_secondarycolor( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.SecondaryColor; |
struct gl_client_array *to = &ac->Cache.SecondaryColor; |
import( ctx, type, to, from ); |
ac->IsCached.SecondaryColor = GL_TRUE; |
} |
static void import_fogcoord( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.FogCoord; |
struct gl_client_array *to = &ac->Cache.FogCoord; |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_FLOAT); |
ASSERT(stride == sizeof(GLfloat) || stride == 0); |
_math_trans_1f( (GLfloat *) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
0, |
ac->count - ac->start); |
to->StrideB = sizeof(GLfloat); |
to->Type = GL_FLOAT; |
ac->IsCached.FogCoord = GL_TRUE; |
} |
static void import_edgeflag( GLcontext *ctx, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.EdgeFlag; |
struct gl_client_array *to = &ac->Cache.EdgeFlag; |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_UNSIGNED_BYTE); |
ASSERT(stride == sizeof(GLubyte) || stride == 0); |
_math_trans_1ub( (GLubyte *) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
0, |
ac->count - ac->start); |
to->StrideB = sizeof(GLubyte); |
to->Type = GL_UNSIGNED_BYTE; |
ac->IsCached.EdgeFlag = GL_TRUE; |
} |
static void import_attrib( GLcontext *ctx, GLuint index, |
GLenum type, GLuint stride ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
struct gl_client_array *from = &ac->Raw.Attrib[index]; |
struct gl_client_array *to = &ac->Cache.Attrib[index]; |
ASSERT(index < VERT_ATTRIB_MAX); |
/* Limited choices at this stage: |
*/ |
ASSERT(type == GL_FLOAT); |
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); |
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); |
_math_trans_4f( (GLfloat (*)[4]) to->Ptr, |
from->Ptr, |
from->StrideB, |
from->Type, |
from->Size, |
0, |
ac->count - ac->start); |
to->Size = from->Size; |
to->StrideB = 4 * sizeof(GLfloat); |
to->Type = GL_FLOAT; |
ac->IsCached.Attrib[index] = GL_TRUE; |
} |
/* |
* Externals to request arrays with specific properties: |
*/ |
struct gl_client_array *_ac_import_texcoord( GLcontext *ctx, |
GLuint unit, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
ASSERT(unit < ctx->Const.MaxTextureUnits); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit)) |
reset_texcoord( ctx, unit ); |
/* Is the request impossible? |
*/ |
if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize) |
return 0; |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.TexCoord[unit].Type != type || |
(reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.TexCoord[unit]) |
import_texcoord(ctx, unit, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.TexCoord[unit]; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.TexCoord[unit]; |
} |
} |
struct gl_client_array *_ac_import_vertex( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_VERTEX) |
reset_vertex( ctx ); |
/* Is the request impossible? |
*/ |
if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize) |
return 0; |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.Vertex.Type != type || |
(reqstride != 0 && ac->Raw.Vertex.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.Vertex) |
import_vertex(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.Vertex; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.Vertex; |
} |
} |
struct gl_client_array *_ac_import_normal( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_NORMAL) |
reset_normal( ctx ); |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.Normal.Type != type || |
(reqstride != 0 && ac->Raw.Normal.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.Normal) |
import_normal(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.Normal; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.Normal; |
} |
} |
struct gl_client_array *_ac_import_color( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_COLOR0) |
reset_color( ctx ); |
/* Is the request impossible? |
*/ |
if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) { |
return 0; |
} |
/* Do we need to pull in a copy of the client data: |
*/ |
if ((type != 0 && ac->Raw.Color.Type != type) || |
(reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.Color) |
import_color(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.Color; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.Color; |
} |
} |
struct gl_client_array *_ac_import_index( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_INDEX) |
reset_index( ctx ); |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.Index.Type != type || |
(reqstride != 0 && ac->Raw.Index.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.Index) |
import_index(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.Index; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.Index; |
} |
} |
struct gl_client_array *_ac_import_secondarycolor( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_COLOR1) |
reset_secondarycolor( ctx ); |
/* Is the request impossible? |
*/ |
if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize) |
return 0; |
/* Do we need to pull in a copy of the client data: |
*/ |
if ((type != 0 && ac->Raw.SecondaryColor.Type != type) || |
(reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.SecondaryColor) |
import_secondarycolor(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.SecondaryColor; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.SecondaryColor; |
} |
} |
struct gl_client_array *_ac_import_fogcoord( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_FOGCOORD) |
reset_fogcoord( ctx ); |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.FogCoord.Type != type || |
(reqstride != 0 && ac->Raw.FogCoord.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.FogCoord) |
import_fogcoord(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.FogCoord; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.FogCoord; |
} |
} |
struct gl_client_array *_ac_import_edgeflag( GLcontext *ctx, |
GLenum type, |
GLuint reqstride, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_EDGEFLAG) |
reset_edgeflag( ctx ); |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.EdgeFlag.Type != type || |
(reqstride != 0 && ac->Raw.EdgeFlag.StrideB != (GLint) reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.EdgeFlag) |
import_edgeflag(ctx, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.EdgeFlag; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.EdgeFlag; |
} |
} |
/* GL_NV_vertex_program */ |
struct gl_client_array *_ac_import_attrib( GLcontext *ctx, |
GLuint index, |
GLenum type, |
GLuint reqstride, |
GLuint reqsize, |
GLboolean reqwriteable, |
GLboolean *writeable ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
ASSERT(index < VERT_ATTRIB_MAX); |
/* Can we keep the existing version? |
*/ |
if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index)) { |
reset_attrib( ctx, index ); |
} |
else if (ac->NewArrayState & (1 << index)) { |
/* Also need to check conventional attributes */ |
reset_attrib( ctx, index ); |
} |
/* Is the request impossible? |
*/ |
if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize) |
return NULL; |
/* Do we need to pull in a copy of the client data: |
*/ |
if (ac->Raw.Attrib[index].Type != type || |
(reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) || |
reqwriteable) |
{ |
if (!ac->IsCached.Attrib[index]) |
import_attrib(ctx, index, type, reqstride ); |
*writeable = GL_TRUE; |
return &ac->Cache.Attrib[index]; |
} |
else { |
*writeable = GL_FALSE; |
return &ac->Raw.Attrib[index]; |
} |
} |
/* Clients must call this function to validate state and set bounds |
* before importing any data: |
*/ |
void _ac_import_range( GLcontext *ctx, GLuint start, GLuint count ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (!ctx->Array.LockCount) { |
/* Not locked, discard cached data. Changes to lock |
* status are caught via. _ac_invalidate_state(). |
*/ |
ac->NewArrayState = _NEW_ARRAY_ALL; |
ac->start = start; |
ac->count = count; |
} |
else { |
/* Locked, discard data for any disabled arrays. Require that |
* the whole locked range always be dealt with, otherwise hard to |
* maintain cached data in the face of clipping. |
*/ |
ac->NewArrayState |= ~ctx->Array._Enabled; |
ac->start = ctx->Array.LockFirst; |
ac->count = ctx->Array.LockCount; |
ASSERT(ac->start == start); /* hmm? */ |
ASSERT(ac->count == count); |
} |
} |
/* Additional convienence function for importing the element list |
* for glDrawElements() and glDrawRangeElements(). |
*/ |
CONST void * |
_ac_import_elements( GLcontext *ctx, |
GLenum new_type, |
GLuint count, |
GLenum old_type, |
CONST void *indices ) |
{ |
ACcontext *ac = AC_CONTEXT(ctx); |
if (old_type == new_type) |
return indices; |
if (ac->elt_size < count * sizeof(GLuint)) { |
if (ac->Elts) FREE(ac->Elts); |
while (ac->elt_size < count * sizeof(GLuint)) |
ac->elt_size *= 2; |
ac->Elts = (GLuint *) MALLOC(ac->elt_size); |
} |
switch (new_type) { |
case GL_UNSIGNED_BYTE: |
ASSERT(0); |
return 0; |
case GL_UNSIGNED_SHORT: |
ASSERT(0); |
return 0; |
case GL_UNSIGNED_INT: { |
GLuint *out = (GLuint *)ac->Elts; |
GLuint i; |
switch (old_type) { |
case GL_UNSIGNED_BYTE: { |
CONST GLubyte *in = (CONST GLubyte *)indices; |
for (i = 0 ; i < count ; i++) |
out[i] = in[i]; |
break; |
} |
case GL_UNSIGNED_SHORT: { |
CONST GLushort *in = (CONST GLushort *)indices; |
for (i = 0 ; i < count ; i++) |
out[i] = in[i]; |
break; |
} |
default: |
ASSERT(0); |
} |
return (CONST void *)out; |
} |
default: |
ASSERT(0); |
break; |
} |
return 0; |
} |
/shark/tags/rel_0_4/ports/mesa/src/dispatch.c |
---|
0,0 → 1,91 |
/* $Id: dispatch.c,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* This file generates all the gl* function entyrpoints. |
* But if we're using X86-optimized dispatch (X86/glapi_x86.S) then |
* we don't use this code. |
* |
* NOTE: This file should _not_ be used when compiling Mesa for a DRI- |
* based device driver. |
* |
*/ |
#include "glheader.h" |
#include "glapi.h" |
#include "glapitable.h" |
#include "glthread.h" |
#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM)) |
#if defined(WIN32) |
#define KEYWORD1 GLAPI |
#else |
#define KEYWORD1 |
#endif |
#define KEYWORD2 GLAPIENTRY |
#if defined(USE_MGL_NAMESPACE) |
#define NAME(func) mgl##func |
#else |
#define NAME(func) gl##func |
#endif |
#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ |
#define F stdout |
#define DISPATCH(FUNC, ARGS, MESSAGE) \ |
fprintf MESSAGE; \ |
(_glapi_Dispatch->FUNC) ARGS; |
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ |
fprintf MESSAGE; \ |
return (_glapi_Dispatch->FUNC) ARGS |
#else |
#define DISPATCH(FUNC, ARGS, MESSAGE) \ |
(_glapi_Dispatch->FUNC) ARGS; |
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ |
return (_glapi_Dispatch->FUNC) ARGS |
#endif /* logging */ |
#ifndef GLAPIENTRY |
#define GLAPIENTRY |
#endif |
#include "glapitemp.h" |
#endif /* USE_X86_ASM */ |
/shark/tags/rel_0_4/ports/mesa/src/histogram.h |
---|
0,0 → 1,62 |
/* $Id: histogram.h,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef HISTOGRAM_H |
#define HISTOGRAM_H |
#include "glheader.h" |
#include "mtypes.h" |
extern void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); |
extern void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
extern void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); |
extern void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); |
extern void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); |
extern void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); |
extern void _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); |
extern void _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); |
extern void _mesa_ResetHistogram(GLenum target); |
extern void _mesa_ResetMinmax(GLenum target); |
extern void |
_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); |
extern void |
_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/depth.c |
---|
0,0 → 1,118 |
/* $Id: depth.c,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "context.h" |
#include "enums.h" |
#include "depth.h" |
#include "macros.h" |
#include "mtypes.h" |
/**********************************************************************/ |
/***** API Functions *****/ |
/**********************************************************************/ |
void |
_mesa_ClearDepth( GLclampd depth ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat tmp = (GLfloat) CLAMP( depth, 0.0, 1.0 ); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Depth.Clear == tmp) |
return; |
FLUSH_VERTICES(ctx, _NEW_DEPTH); |
ctx->Depth.Clear = tmp; |
if (ctx->Driver.ClearDepth) |
(*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); |
} |
void |
_mesa_DepthFunc( GLenum func ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); |
switch (func) { |
case GL_LESS: /* (default) pass if incoming z < stored z */ |
case GL_GEQUAL: |
case GL_LEQUAL: |
case GL_GREATER: |
case GL_NOTEQUAL: |
case GL_EQUAL: |
case GL_ALWAYS: |
case GL_NEVER: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); |
return; |
} |
if (ctx->Depth.Func == func) |
return; |
FLUSH_VERTICES(ctx, _NEW_DEPTH); |
ctx->Depth.Func = func; |
if (ctx->Driver.DepthFunc) |
ctx->Driver.DepthFunc( ctx, func ); |
} |
void |
_mesa_DepthMask( GLboolean flag ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glDepthMask %d\n", flag); |
/* |
* GL_TRUE indicates depth buffer writing is enabled (default) |
* GL_FALSE indicates depth buffer writing is disabled |
*/ |
if (ctx->Depth.Mask == flag) |
return; |
FLUSH_VERTICES(ctx, _NEW_DEPTH); |
ctx->Depth.Mask = flag; |
if (ctx->Driver.DepthMask) |
ctx->Driver.DepthMask( ctx, flag ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/light.c |
---|
0,0 → 1,1294 |
/* $Id: light.c,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "math/m_matrix.h" |
/* XXX this is a bit of a hack needed for compilation within XFree86 */ |
#ifndef FLT_MIN |
#define FLT_MIN 1e-37 |
#endif |
void |
_mesa_ShadeModel( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); |
if (mode != GL_FLAT && mode != GL_SMOOTH) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); |
return; |
} |
if (ctx->Light.ShadeModel == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.ShadeModel = mode; |
ctx->_TriangleCaps ^= DD_FLATSHADE; |
if (ctx->Driver.ShadeModel) |
(*ctx->Driver.ShadeModel)( ctx, mode ); |
} |
void |
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param ) |
{ |
_mesa_Lightfv( light, pname, ¶m ); |
} |
void |
_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i = (GLint) (light - GL_LIGHT0); |
struct gl_light *l = &ctx->Light.Light[i]; |
if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); |
return; |
} |
switch (pname) { |
case GL_AMBIENT: |
if (TEST_EQ_4V(l->Ambient, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_4V( l->Ambient, params ); |
break; |
case GL_DIFFUSE: |
if (TEST_EQ_4V(l->Diffuse, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_4V( l->Diffuse, params ); |
break; |
case GL_SPECULAR: |
if (TEST_EQ_4V(l->Specular, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_4V( l->Specular, params ); |
break; |
case GL_POSITION: { |
GLfloat tmp[4]; |
/* transform position by ModelView matrix */ |
TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, params ); |
if (TEST_EQ_4V(l->EyePosition, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_4V(l->EyePosition, tmp); |
if (l->EyePosition[3] != 0.0F) |
l->_Flags |= LIGHT_POSITIONAL; |
else |
l->_Flags &= ~LIGHT_POSITIONAL; |
break; |
} |
case GL_SPOT_DIRECTION: { |
GLfloat tmp[4]; |
/* transform direction by inverse modelview */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
} |
TRANSFORM_NORMAL( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_3V(l->EyeDirection, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_3V(l->EyeDirection, tmp); |
break; |
} |
case GL_SPOT_EXPONENT: |
if (params[0]<0.0 || params[0]>128.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); |
return; |
} |
if (l->SpotExponent == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
l->SpotExponent = params[0]; |
_mesa_invalidate_spot_exp_table( l ); |
break; |
case GL_SPOT_CUTOFF: |
if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); |
return; |
} |
if (l->SpotCutoff == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
l->SpotCutoff = params[0]; |
l->_CosCutoff = (GLfloat) _mesa_cos(params[0]*DEG2RAD); |
if (l->_CosCutoff < 0) |
l->_CosCutoff = 0; |
if (l->SpotCutoff != 180.0F) |
l->_Flags |= LIGHT_SPOT; |
else |
l->_Flags &= ~LIGHT_SPOT; |
break; |
case GL_CONSTANT_ATTENUATION: |
if (params[0]<0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); |
return; |
} |
if (l->ConstantAttenuation == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
l->ConstantAttenuation = params[0]; |
break; |
case GL_LINEAR_ATTENUATION: |
if (params[0]<0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); |
return; |
} |
if (l->LinearAttenuation == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
l->LinearAttenuation = params[0]; |
break; |
case GL_QUADRATIC_ATTENUATION: |
if (params[0]<0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); |
return; |
} |
if (l->QuadraticAttenuation == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
l->QuadraticAttenuation = params[0]; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glLight(pname=0x%x)", pname ); |
return; |
} |
if (ctx->Driver.Lightfv) |
ctx->Driver.Lightfv( ctx, light, pname, params ); |
} |
void |
_mesa_Lighti( GLenum light, GLenum pname, GLint param ) |
{ |
_mesa_Lightiv( light, pname, ¶m ); |
} |
void |
_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
switch (pname) { |
case GL_AMBIENT: |
case GL_DIFFUSE: |
case GL_SPECULAR: |
fparam[0] = INT_TO_FLOAT( params[0] ); |
fparam[1] = INT_TO_FLOAT( params[1] ); |
fparam[2] = INT_TO_FLOAT( params[2] ); |
fparam[3] = INT_TO_FLOAT( params[3] ); |
break; |
case GL_POSITION: |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = (GLfloat) params[1]; |
fparam[2] = (GLfloat) params[2]; |
fparam[3] = (GLfloat) params[3]; |
break; |
case GL_SPOT_DIRECTION: |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = (GLfloat) params[1]; |
fparam[2] = (GLfloat) params[2]; |
break; |
case GL_SPOT_EXPONENT: |
case GL_SPOT_CUTOFF: |
case GL_CONSTANT_ATTENUATION: |
case GL_LINEAR_ATTENUATION: |
case GL_QUADRATIC_ATTENUATION: |
fparam[0] = (GLfloat) params[0]; |
break; |
default: |
/* error will be caught later in gl_Lightfv */ |
; |
} |
_mesa_Lightfv( light, pname, fparam ); |
} |
void |
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint l = (GLint) (light - GL_LIGHT0); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); |
return; |
} |
switch (pname) { |
case GL_AMBIENT: |
COPY_4V( params, ctx->Light.Light[l].Ambient ); |
break; |
case GL_DIFFUSE: |
COPY_4V( params, ctx->Light.Light[l].Diffuse ); |
break; |
case GL_SPECULAR: |
COPY_4V( params, ctx->Light.Light[l].Specular ); |
break; |
case GL_POSITION: |
COPY_4V( params, ctx->Light.Light[l].EyePosition ); |
break; |
case GL_SPOT_DIRECTION: |
COPY_3V( params, ctx->Light.Light[l].EyeDirection ); |
break; |
case GL_SPOT_EXPONENT: |
params[0] = ctx->Light.Light[l].SpotExponent; |
break; |
case GL_SPOT_CUTOFF: |
params[0] = ctx->Light.Light[l].SpotCutoff; |
break; |
case GL_CONSTANT_ATTENUATION: |
params[0] = ctx->Light.Light[l].ConstantAttenuation; |
break; |
case GL_LINEAR_ATTENUATION: |
params[0] = ctx->Light.Light[l].LinearAttenuation; |
break; |
case GL_QUADRATIC_ATTENUATION: |
params[0] = ctx->Light.Light[l].QuadraticAttenuation; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); |
break; |
} |
} |
void |
_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint l = (GLint) (light - GL_LIGHT0); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); |
return; |
} |
switch (pname) { |
case GL_AMBIENT: |
params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[0]); |
params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[1]); |
params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[2]); |
params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[3]); |
break; |
case GL_DIFFUSE: |
params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[0]); |
params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[1]); |
params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[2]); |
params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[3]); |
break; |
case GL_SPECULAR: |
params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[0]); |
params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[1]); |
params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[2]); |
params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[3]); |
break; |
case GL_POSITION: |
params[0] = (GLint) ctx->Light.Light[l].EyePosition[0]; |
params[1] = (GLint) ctx->Light.Light[l].EyePosition[1]; |
params[2] = (GLint) ctx->Light.Light[l].EyePosition[2]; |
params[3] = (GLint) ctx->Light.Light[l].EyePosition[3]; |
break; |
case GL_SPOT_DIRECTION: |
params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0]; |
params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1]; |
params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2]; |
break; |
case GL_SPOT_EXPONENT: |
params[0] = (GLint) ctx->Light.Light[l].SpotExponent; |
break; |
case GL_SPOT_CUTOFF: |
params[0] = (GLint) ctx->Light.Light[l].SpotCutoff; |
break; |
case GL_CONSTANT_ATTENUATION: |
params[0] = (GLint) ctx->Light.Light[l].ConstantAttenuation; |
break; |
case GL_LINEAR_ATTENUATION: |
params[0] = (GLint) ctx->Light.Light[l].LinearAttenuation; |
break; |
case GL_QUADRATIC_ATTENUATION: |
params[0] = (GLint) ctx->Light.Light[l].QuadraticAttenuation; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); |
break; |
} |
} |
/**********************************************************************/ |
/*** Light Model ***/ |
/**********************************************************************/ |
void |
_mesa_LightModelfv( GLenum pname, const GLfloat *params ) |
{ |
GLenum newenum; |
GLboolean newbool; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (pname) { |
case GL_LIGHT_MODEL_AMBIENT: |
if (TEST_EQ_4V( ctx->Light.Model.Ambient, params )) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
COPY_4V( ctx->Light.Model.Ambient, params ); |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
newbool = (params[0]!=0.0); |
if (ctx->Light.Model.LocalViewer == newbool) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.Model.LocalViewer = newbool; |
break; |
case GL_LIGHT_MODEL_TWO_SIDE: |
newbool = (params[0]!=0.0); |
if (ctx->Light.Model.TwoSide == newbool) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.Model.TwoSide = newbool; |
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) |
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; |
else |
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; |
break; |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
if (params[0] == (GLfloat) GL_SINGLE_COLOR) |
newenum = GL_SINGLE_COLOR; |
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) |
newenum = GL_SEPARATE_SPECULAR_COLOR; |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)", |
(GLint) params[0] ); |
return; |
} |
if (ctx->Light.Model.ColorControl == newenum) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.Model.ColorControl = newenum; |
if ((ctx->Light.Enabled && |
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) |
|| ctx->Fog.ColorSumEnabled) |
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; |
else |
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname ); |
break; |
} |
if (ctx->Driver.LightModelfv) |
ctx->Driver.LightModelfv( ctx, pname, params ); |
} |
void |
_mesa_LightModeliv( GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
switch (pname) { |
case GL_LIGHT_MODEL_AMBIENT: |
fparam[0] = INT_TO_FLOAT( params[0] ); |
fparam[1] = INT_TO_FLOAT( params[1] ); |
fparam[2] = INT_TO_FLOAT( params[2] ); |
fparam[3] = INT_TO_FLOAT( params[3] ); |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
case GL_LIGHT_MODEL_TWO_SIDE: |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
fparam[0] = (GLfloat) params[0]; |
break; |
default: |
/* Error will be caught later in gl_LightModelfv */ |
; |
} |
_mesa_LightModelfv( pname, fparam ); |
} |
void |
_mesa_LightModeli( GLenum pname, GLint param ) |
{ |
_mesa_LightModeliv( pname, ¶m ); |
} |
void |
_mesa_LightModelf( GLenum pname, GLfloat param ) |
{ |
_mesa_LightModelfv( pname, ¶m ); |
} |
/********** MATERIAL **********/ |
/* |
* Given a face and pname value (ala glColorMaterial), compute a bitmask |
* of the targeted material values. |
*/ |
GLuint |
_mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, |
GLuint legal, const char *where ) |
{ |
GLuint bitmask = 0; |
/* Make a bitmask indicating what material attribute(s) we're updating */ |
switch (pname) { |
case GL_EMISSION: |
bitmask |= FRONT_EMISSION_BIT | BACK_EMISSION_BIT; |
break; |
case GL_AMBIENT: |
bitmask |= FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT; |
break; |
case GL_DIFFUSE: |
bitmask |= FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT; |
break; |
case GL_SPECULAR: |
bitmask |= FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT; |
break; |
case GL_SHININESS: |
bitmask |= FRONT_SHININESS_BIT | BACK_SHININESS_BIT; |
break; |
case GL_AMBIENT_AND_DIFFUSE: |
bitmask |= FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT; |
bitmask |= FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT; |
break; |
case GL_COLOR_INDEXES: |
bitmask |= FRONT_INDEXES_BIT | BACK_INDEXES_BIT; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, where ); |
return 0; |
} |
if (face==GL_FRONT) { |
bitmask &= FRONT_MATERIAL_BITS; |
} |
else if (face==GL_BACK) { |
bitmask &= BACK_MATERIAL_BITS; |
} |
else if (face != GL_FRONT_AND_BACK) { |
_mesa_error( ctx, GL_INVALID_ENUM, where ); |
return 0; |
} |
if (bitmask & ~legal) { |
_mesa_error( ctx, GL_INVALID_ENUM, where ); |
return 0; |
} |
return bitmask; |
} |
/* Perform a straight copy between pairs of materials. |
*/ |
void _mesa_copy_material_pairs( struct gl_material dst[2], |
const struct gl_material src[2], |
GLuint bitmask ) |
{ |
if (bitmask & FRONT_EMISSION_BIT) { |
COPY_4FV( dst[0].Emission, src[0].Emission ); |
} |
if (bitmask & BACK_EMISSION_BIT) { |
COPY_4FV( dst[1].Emission, src[1].Emission ); |
} |
if (bitmask & FRONT_AMBIENT_BIT) { |
COPY_4FV( dst[0].Ambient, src[0].Ambient ); |
} |
if (bitmask & BACK_AMBIENT_BIT) { |
COPY_4FV( dst[1].Ambient, src[1].Ambient ); |
} |
if (bitmask & FRONT_DIFFUSE_BIT) { |
COPY_4FV( dst[0].Diffuse, src[0].Diffuse ); |
} |
if (bitmask & BACK_DIFFUSE_BIT) { |
COPY_4FV( dst[1].Diffuse, src[1].Diffuse ); |
} |
if (bitmask & FRONT_SPECULAR_BIT) { |
COPY_4FV( dst[0].Specular, src[0].Specular ); |
} |
if (bitmask & BACK_SPECULAR_BIT) { |
COPY_4FV( dst[1].Specular, src[1].Specular ); |
} |
if (bitmask & FRONT_SHININESS_BIT) { |
dst[0].Shininess = src[0].Shininess; |
} |
if (bitmask & BACK_SHININESS_BIT) { |
dst[1].Shininess = src[1].Shininess; |
} |
if (bitmask & FRONT_INDEXES_BIT) { |
dst[0].AmbientIndex = src[0].AmbientIndex; |
dst[0].DiffuseIndex = src[0].DiffuseIndex; |
dst[0].SpecularIndex = src[0].SpecularIndex; |
} |
if (bitmask & BACK_INDEXES_BIT) { |
dst[1].AmbientIndex = src[1].AmbientIndex; |
dst[1].DiffuseIndex = src[1].DiffuseIndex; |
dst[1].SpecularIndex = src[1].SpecularIndex; |
} |
} |
/* |
* Check if the global material has to be updated with info that was |
* associated with a vertex via glMaterial. |
* This function is used when any material values get changed between |
* glBegin/glEnd either by calling glMaterial() or by calling glColor() |
* when GL_COLOR_MATERIAL is enabled. |
* |
* src[0] is front material, src[1] is back material |
* |
* Additionally keeps the precomputed lighting state uptodate. |
*/ |
void _mesa_update_material( GLcontext *ctx, |
const struct gl_material src[2], |
GLuint bitmask ) |
{ |
struct gl_light *light, *list = &ctx->Light.EnabledList; |
if (ctx->Light.ColorMaterialEnabled) |
bitmask &= ~ctx->Light.ColorMaterialBitmask; |
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); |
if (!bitmask) |
return; |
/* update material emission */ |
if (bitmask & FRONT_EMISSION_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Emission, src[0].Emission ); |
} |
if (bitmask & BACK_EMISSION_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Emission, src[1].Emission ); |
} |
/* update material ambience */ |
if (bitmask & FRONT_AMBIENT_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Ambient, src[0].Ambient ); |
foreach (light, list) { |
SCALE_3V( light->_MatAmbient[0], light->Ambient, src[0].Ambient); |
} |
} |
if (bitmask & BACK_AMBIENT_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Ambient, src[1].Ambient ); |
foreach (light, list) { |
SCALE_3V( light->_MatAmbient[1], light->Ambient, src[1].Ambient); |
} |
} |
/* update BaseColor = emission + scene's ambience * material's ambience */ |
if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_3V( ctx->Light._BaseColor[0], mat->Emission ); |
ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient, |
ctx->Light.Model.Ambient ); |
} |
if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_3V( ctx->Light._BaseColor[1], mat->Emission ); |
ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient, |
ctx->Light.Model.Ambient ); |
} |
/* update material diffuse values */ |
if (bitmask & FRONT_DIFFUSE_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Diffuse, src[0].Diffuse ); |
foreach (light, list) { |
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse ); |
} |
} |
if (bitmask & BACK_DIFFUSE_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Diffuse, src[1].Diffuse ); |
foreach (light, list) { |
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse ); |
} |
} |
/* update material specular values */ |
if (bitmask & FRONT_SPECULAR_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Specular, src[0].Specular ); |
foreach (light, list) { |
SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular); |
} |
} |
if (bitmask & BACK_SPECULAR_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Specular, src[1].Specular ); |
foreach (light, list) { |
SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular); |
} |
} |
if (bitmask & FRONT_SHININESS_BIT) { |
ctx->Light.Material[0].Shininess = src[0].Shininess; |
_mesa_invalidate_shine_table( ctx, 0 ); |
} |
if (bitmask & BACK_SHININESS_BIT) { |
ctx->Light.Material[1].Shininess = src[1].Shininess; |
_mesa_invalidate_shine_table( ctx, 1 ); |
} |
if (bitmask & FRONT_INDEXES_BIT) { |
ctx->Light.Material[0].AmbientIndex = src[0].AmbientIndex; |
ctx->Light.Material[0].DiffuseIndex = src[0].DiffuseIndex; |
ctx->Light.Material[0].SpecularIndex = src[0].SpecularIndex; |
} |
if (bitmask & BACK_INDEXES_BIT) { |
ctx->Light.Material[1].AmbientIndex = src[1].AmbientIndex; |
ctx->Light.Material[1].DiffuseIndex = src[1].DiffuseIndex; |
ctx->Light.Material[1].SpecularIndex = src[1].SpecularIndex; |
} |
if (0) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
_mesa_debug(ctx, "update_mat emission : %f %f %f\n", |
mat->Emission[0], mat->Emission[1], mat->Emission[2]); |
_mesa_debug(ctx, "update_mat specular : %f %f %f\n", |
mat->Specular[0], mat->Specular[1], mat->Specular[2]); |
_mesa_debug(ctx, "update_mat diffuse : %f %f %f\n", |
mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]); |
_mesa_debug(ctx, "update_mat ambient : %f %f %f\n", |
mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]); |
} |
} |
/* |
* Update the current materials from the given rgba color |
* according to the bitmask in ColorMaterialBitmask, which is |
* set by glColorMaterial(). |
*/ |
void _mesa_update_color_material( GLcontext *ctx, |
const GLfloat color[4] ) |
{ |
struct gl_light *light, *list = &ctx->Light.EnabledList; |
GLuint bitmask = ctx->Light.ColorMaterialBitmask; |
if (MESA_VERBOSE&VERBOSE_IMMEDIATE) |
_mesa_debug(ctx, "_mesa_update_color_material, mask 0x%x\n", bitmask); |
/* update emissive colors */ |
if (bitmask & FRONT_EMISSION_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Emission, color ); |
} |
if (bitmask & BACK_EMISSION_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Emission, color ); |
} |
/* update light->_MatAmbient = light's ambient * material's ambient */ |
if (bitmask & FRONT_AMBIENT_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
foreach (light, list) { |
SCALE_3V( light->_MatAmbient[0], light->Ambient, color); |
} |
COPY_4FV( mat->Ambient, color ); |
} |
if (bitmask & BACK_AMBIENT_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
foreach (light, list) { |
SCALE_3V( light->_MatAmbient[1], light->Ambient, color); |
} |
COPY_4FV( mat->Ambient, color ); |
} |
/* update BaseColor = emission + scene's ambience * material's ambience */ |
if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_3V( ctx->Light._BaseColor[0], mat->Emission ); |
ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient ); |
} |
if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_3V( ctx->Light._BaseColor[1], mat->Emission ); |
ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient ); |
} |
/* update light->_MatDiffuse = light's diffuse * material's diffuse */ |
if (bitmask & FRONT_DIFFUSE_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Diffuse, color ); |
foreach (light, list) { |
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse ); |
} |
} |
if (bitmask & BACK_DIFFUSE_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Diffuse, color ); |
foreach (light, list) { |
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse ); |
} |
} |
/* update light->_MatSpecular = light's specular * material's specular */ |
if (bitmask & FRONT_SPECULAR_BIT) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
COPY_4FV( mat->Specular, color ); |
foreach (light, list) { |
ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular); |
} |
} |
if (bitmask & BACK_SPECULAR_BIT) { |
struct gl_material *mat = &ctx->Light.Material[1]; |
COPY_4FV( mat->Specular, color ); |
foreach (light, list) { |
ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular); |
} |
} |
if (0) { |
struct gl_material *mat = &ctx->Light.Material[0]; |
_mesa_debug(ctx, "update_color_mat emission : %f %f %f\n", |
mat->Emission[0], mat->Emission[1], mat->Emission[2]); |
_mesa_debug(ctx, "update_color_mat specular : %f %f %f\n", |
mat->Specular[0], mat->Specular[1], mat->Specular[2]); |
_mesa_debug(ctx, "update_color_mat diffuse : %f %f %f\n", |
mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]); |
_mesa_debug(ctx, "update_color_mat ambient : %f %f %f\n", |
mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]); |
} |
} |
void |
_mesa_ColorMaterial( GLenum face, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint bitmask; |
GLuint legal = (FRONT_EMISSION_BIT | BACK_EMISSION_BIT | |
FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT | |
FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT | |
FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glColorMaterial %s %s\n", |
_mesa_lookup_enum_by_nr(face), |
_mesa_lookup_enum_by_nr(mode)); |
bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial"); |
if (ctx->Light.ColorMaterialBitmask == bitmask && |
ctx->Light.ColorMaterialFace == face && |
ctx->Light.ColorMaterialMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.ColorMaterialBitmask = bitmask; |
ctx->Light.ColorMaterialFace = face; |
ctx->Light.ColorMaterialMode = mode; |
if (ctx->Light.ColorMaterialEnabled) { |
FLUSH_CURRENT( ctx, 0 ); |
_mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); |
} |
if (ctx->Driver.ColorMaterial) |
(*ctx->Driver.ColorMaterial)( ctx, face, mode ); |
} |
void |
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint f; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ |
if (face==GL_FRONT) { |
f = 0; |
} |
else if (face==GL_BACK) { |
f = 1; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(face)" ); |
return; |
} |
switch (pname) { |
case GL_AMBIENT: |
COPY_4FV( params, ctx->Light.Material[f].Ambient ); |
break; |
case GL_DIFFUSE: |
COPY_4FV( params, ctx->Light.Material[f].Diffuse ); |
break; |
case GL_SPECULAR: |
COPY_4FV( params, ctx->Light.Material[f].Specular ); |
break; |
case GL_EMISSION: |
COPY_4FV( params, ctx->Light.Material[f].Emission ); |
break; |
case GL_SHININESS: |
*params = ctx->Light.Material[f].Shininess; |
break; |
case GL_COLOR_INDEXES: |
params[0] = ctx->Light.Material[f].AmbientIndex; |
params[1] = ctx->Light.Material[f].DiffuseIndex; |
params[2] = ctx->Light.Material[f].SpecularIndex; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); |
} |
} |
void |
_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint f; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ |
if (face==GL_FRONT) { |
f = 0; |
} |
else if (face==GL_BACK) { |
f = 1; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialiv(face)" ); |
return; |
} |
switch (pname) { |
case GL_AMBIENT: |
params[0] = FLOAT_TO_INT( ctx->Light.Material[f].Ambient[0] ); |
params[1] = FLOAT_TO_INT( ctx->Light.Material[f].Ambient[1] ); |
params[2] = FLOAT_TO_INT( ctx->Light.Material[f].Ambient[2] ); |
params[3] = FLOAT_TO_INT( ctx->Light.Material[f].Ambient[3] ); |
break; |
case GL_DIFFUSE: |
params[0] = FLOAT_TO_INT( ctx->Light.Material[f].Diffuse[0] ); |
params[1] = FLOAT_TO_INT( ctx->Light.Material[f].Diffuse[1] ); |
params[2] = FLOAT_TO_INT( ctx->Light.Material[f].Diffuse[2] ); |
params[3] = FLOAT_TO_INT( ctx->Light.Material[f].Diffuse[3] ); |
break; |
case GL_SPECULAR: |
params[0] = FLOAT_TO_INT( ctx->Light.Material[f].Specular[0] ); |
params[1] = FLOAT_TO_INT( ctx->Light.Material[f].Specular[1] ); |
params[2] = FLOAT_TO_INT( ctx->Light.Material[f].Specular[2] ); |
params[3] = FLOAT_TO_INT( ctx->Light.Material[f].Specular[3] ); |
break; |
case GL_EMISSION: |
params[0] = FLOAT_TO_INT( ctx->Light.Material[f].Emission[0] ); |
params[1] = FLOAT_TO_INT( ctx->Light.Material[f].Emission[1] ); |
params[2] = FLOAT_TO_INT( ctx->Light.Material[f].Emission[2] ); |
params[3] = FLOAT_TO_INT( ctx->Light.Material[f].Emission[3] ); |
break; |
case GL_SHININESS: |
*params = ROUNDF( ctx->Light.Material[f].Shininess ); |
break; |
case GL_COLOR_INDEXES: |
params[0] = ROUNDF( ctx->Light.Material[f].AmbientIndex ); |
params[1] = ROUNDF( ctx->Light.Material[f].DiffuseIndex ); |
params[2] = ROUNDF( ctx->Light.Material[f].SpecularIndex ); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); |
} |
} |
/**********************************************************************/ |
/***** Lighting computation *****/ |
/**********************************************************************/ |
/* |
* Notes: |
* When two-sided lighting is enabled we compute the color (or index) |
* for both the front and back side of the primitive. Then, when the |
* orientation of the facet is later learned, we can determine which |
* color (or index) to use for rendering. |
* |
* KW: We now know orientation in advance and only shade for |
* the side or sides which are actually required. |
* |
* Variables: |
* n = normal vector |
* V = vertex position |
* P = light source position |
* Pe = (0,0,0,1) |
* |
* Precomputed: |
* IF P[3]==0 THEN |
* // light at infinity |
* IF local_viewer THEN |
* _VP_inf_norm = unit vector from V to P // Precompute |
* ELSE |
* // eye at infinity |
* _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute |
* ENDIF |
* ENDIF |
* |
* Functions: |
* Normalize( v ) = normalized vector v |
* Magnitude( v ) = length of vector v |
*/ |
/* |
* Whenever the spotlight exponent for a light changes we must call |
* this function to recompute the exponent lookup table. |
*/ |
void |
_mesa_invalidate_spot_exp_table( struct gl_light *l ) |
{ |
l->_SpotExpTable[0][0] = -1; |
} |
static void validate_spot_exp_table( struct gl_light *l ) |
{ |
GLint i; |
GLdouble exponent = l->SpotExponent; |
GLdouble tmp = 0; |
GLint clamp = 0; |
l->_SpotExpTable[0][0] = 0.0; |
for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { |
if (clamp == 0) { |
tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); |
if (tmp < FLT_MIN * 100.0) { |
tmp = 0.0; |
clamp = 1; |
} |
} |
l->_SpotExpTable[i][0] = (GLfloat) tmp; |
} |
for (i = 0; i < EXP_TABLE_SIZE - 1; i++) { |
l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] - |
l->_SpotExpTable[i][0]); |
} |
l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0; |
} |
/* Calculate a new shine table. Doing this here saves a branch in |
* lighting, and the cost of doing it early may be partially offset |
* by keeping a MRU cache of shine tables for various shine values. |
*/ |
void |
_mesa_invalidate_shine_table( GLcontext *ctx, GLuint i ) |
{ |
if (ctx->_ShineTable[i]) |
ctx->_ShineTable[i]->refcount--; |
ctx->_ShineTable[i] = 0; |
} |
static void validate_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) |
{ |
struct gl_shine_tab *list = ctx->_ShineTabList; |
struct gl_shine_tab *s; |
foreach(s, list) |
if ( s->shininess == shininess ) |
break; |
if (s == list) { |
GLint j; |
GLfloat *m; |
foreach(s, list) |
if (s->refcount == 0) |
break; |
m = s->tab; |
m[0] = 0.0; |
if (shininess == 0.0) { |
for (j = 1 ; j <= SHINE_TABLE_SIZE ; j++) |
m[j] = 1.0; |
} |
else { |
for (j = 1 ; j < SHINE_TABLE_SIZE ; j++) { |
GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); |
if (x < 0.005) /* underflow check */ |
x = 0.005; |
t = _mesa_pow(x, shininess); |
if (t > 1e-20) |
m[j] = (GLfloat) t; |
else |
m[j] = 0.0; |
} |
m[SHINE_TABLE_SIZE] = 1.0; |
} |
s->shininess = shininess; |
} |
if (ctx->_ShineTable[i]) |
ctx->_ShineTable[i]->refcount--; |
ctx->_ShineTable[i] = s; |
move_to_tail( list, s ); |
s->refcount++; |
} |
void |
_mesa_validate_all_lighting_tables( GLcontext *ctx ) |
{ |
GLint i; |
GLfloat shininess; |
shininess = ctx->Light.Material[0].Shininess; |
if (!ctx->_ShineTable[0] || ctx->_ShineTable[0]->shininess != shininess) |
validate_shine_table( ctx, 0, shininess ); |
shininess = ctx->Light.Material[1].Shininess; |
if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess) |
validate_shine_table( ctx, 1, shininess ); |
for (i = 0 ; i < MAX_LIGHTS ; i++) |
if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1) |
validate_spot_exp_table( &ctx->Light.Light[i] ); |
} |
/* |
* Examine current lighting parameters to determine if the optimized lighting |
* function can be used. |
* Also, precompute some lighting values such as the products of light |
* source and material ambient, diffuse and specular coefficients. |
*/ |
void |
_mesa_update_lighting( GLcontext *ctx ) |
{ |
struct gl_light *light; |
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT; |
ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT; |
ctx->Light._Flags = 0; |
if (!ctx->Light.Enabled) |
return; |
ctx->_NeedNormals |= NEED_NORMALS_LIGHT; |
foreach(light, &ctx->Light.EnabledList) { |
ctx->Light._Flags |= light->_Flags; |
} |
ctx->Light._NeedVertices = |
((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) || |
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR || |
ctx->Light.Model.LocalViewer); |
if ((ctx->Light._Flags & LIGHT_POSITIONAL) || |
ctx->Light.Model.LocalViewer) |
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT; |
/* XXX: This test is overkill & needs to be fixed both for software and |
* hardware t&l drivers. The above should be sufficient & should |
* be tested to verify this. |
*/ |
if (ctx->Light._NeedVertices) |
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT; |
/* Precompute some shading values. Although we reference |
* Light.Material here, we can get away without flushing |
* FLUSH_UPDATE_CURRENT, as when any outstanding material changes |
* are flushed, they will update the derived state at that time. |
*/ |
if (ctx->Visual.rgbMode) { |
GLuint sides = ctx->Light.Model.TwoSide ? 2 : 1; |
GLuint side; |
for (side=0; side < sides; side++) { |
struct gl_material *mat = &ctx->Light.Material[side]; |
COPY_3V(ctx->Light._BaseColor[side], mat->Emission); |
ACC_SCALE_3V(ctx->Light._BaseColor[side], |
ctx->Light.Model.Ambient, |
mat->Ambient); |
} |
foreach (light, &ctx->Light.EnabledList) { |
for (side=0; side< sides; side++) { |
const struct gl_material *mat = &ctx->Light.Material[side]; |
SCALE_3V( light->_MatDiffuse[side], light->Diffuse, mat->Diffuse ); |
SCALE_3V( light->_MatAmbient[side], light->Ambient, mat->Ambient ); |
SCALE_3V( light->_MatSpecular[side], light->Specular, |
mat->Specular); |
} |
} |
} |
else { |
static const GLfloat ci[3] = { .30F, .59F, .11F }; |
foreach(light, &ctx->Light.EnabledList) { |
light->_dli = DOT3(ci, light->Diffuse); |
light->_sli = DOT3(ci, light->Specular); |
} |
} |
} |
/* _NEW_MODELVIEW |
* _NEW_LIGHT |
* _TNL_NEW_NEED_EYE_COORDS |
* |
* Update on (_NEW_MODELVIEW | _NEW_LIGHT) when lighting is enabled. |
* Also update on lighting space changes. |
*/ |
void |
_mesa_compute_light_positions( GLcontext *ctx ) |
{ |
struct gl_light *light; |
static const GLfloat eye_z[3] = { 0, 0, 1 }; |
if (!ctx->Light.Enabled) |
return; |
if (ctx->_NeedEyeCoords) { |
COPY_3V( ctx->_EyeZDir, eye_z ); |
} |
else { |
TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m ); |
} |
foreach (light, &ctx->Light.EnabledList) { |
if (ctx->_NeedEyeCoords) { |
COPY_4FV( light->_Position, light->EyePosition ); |
} |
else { |
TRANSFORM_POINT( light->_Position, ctx->ModelviewMatrixStack.Top->inv, |
light->EyePosition ); |
} |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
/* VP (VP) = Normalize( Position ) */ |
COPY_3V( light->_VP_inf_norm, light->_Position ); |
NORMALIZE_3FV( light->_VP_inf_norm ); |
if (!ctx->Light.Model.LocalViewer) { |
/* _h_inf_norm = Normalize( V_to_P + <0,0,1> ) */ |
ADD_3V( light->_h_inf_norm, light->_VP_inf_norm, ctx->_EyeZDir); |
NORMALIZE_3FV( light->_h_inf_norm ); |
} |
light->_VP_inf_spot_attenuation = 1.0; |
} |
if (light->_Flags & LIGHT_SPOT) { |
if (ctx->_NeedEyeCoords) { |
COPY_3V( light->_NormDirection, light->EyeDirection ); |
} |
else { |
TRANSFORM_NORMAL( light->_NormDirection, |
light->EyeDirection, |
ctx->ModelviewMatrixStack.Top->m); |
} |
NORMALIZE_3FV( light->_NormDirection ); |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, |
light->_NormDirection); |
if (PV_dot_dir > light->_CosCutoff) { |
double x = PV_dot_dir * (EXP_TABLE_SIZE-1); |
int k = (int) x; |
light->_VP_inf_spot_attenuation = |
(GLfloat) (light->_SpotExpTable[k][0] + |
(x-k)*light->_SpotExpTable[k][1]); |
} |
else { |
light->_VP_inf_spot_attenuation = 0; |
} |
} |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/depth.h |
---|
0,0 → 1,53 |
/* $Id: depth.h,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef DEPTH_H |
#define DEPTH_H |
#include "mtypes.h" |
/* |
* Immediate-mode API entrpoints |
*/ |
extern void |
_mesa_ClearDepth( GLclampd depth ); |
extern void |
_mesa_DepthFunc( GLenum func ); |
extern void |
_mesa_DepthMask( GLboolean flag ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/config.h |
---|
0,0 → 1,207 |
/* $Id: config.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Tunable configuration parameters. |
*/ |
#ifndef CONFIG_H |
#define CONFIG_H |
#ifdef HAVE_CONFIG_H |
#include "conf.h" |
#endif |
/* |
* OpenGL implementation limits |
*/ |
/* Maximum modelview matrix stack depth: */ |
#define MAX_MODELVIEW_STACK_DEPTH 32 |
/* Maximum projection matrix stack depth: */ |
#define MAX_PROJECTION_STACK_DEPTH 32 |
/* Maximum texture matrix stack depth: */ |
#define MAX_TEXTURE_STACK_DEPTH 10 |
/* Maximum color matrix stack depth: */ |
#define MAX_COLOR_STACK_DEPTH 4 |
/* Vertex program matrix stacks: */ |
#define MAX_PROGRAM_MATRICES 8 |
#define MAX_PROGRAM_STACK_DEPTH 4 |
/* Maximum attribute stack depth: */ |
#define MAX_ATTRIB_STACK_DEPTH 16 |
/* Maximum client attribute stack depth: */ |
#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16 |
/* Maximum recursion depth of display list calls: */ |
#define MAX_LIST_NESTING 64 |
/* Maximum number of lights: */ |
#define MAX_LIGHTS 8 |
/* Maximum user-defined clipping planes: */ |
#define MAX_CLIP_PLANES 6 |
/* Maximum pixel map lookup table size: */ |
#define MAX_PIXEL_MAP_TABLE 256 |
/* Number of auxillary color buffers: */ |
#define NUM_AUX_BUFFERS 0 |
/* Maximum order (degree) of curves: */ |
#ifdef AMIGA |
# define MAX_EVAL_ORDER 12 |
#else |
# define MAX_EVAL_ORDER 30 |
#endif |
/* Maximum Name stack depth */ |
#define MAX_NAME_STACK_DEPTH 64 |
/* Min and Max point sizes and granularity */ |
#define MIN_POINT_SIZE 1.0 |
#define MAX_POINT_SIZE 20.0 |
#define POINT_SIZE_GRANULARITY 0.1 |
/* Min and Max line widths and granularity */ |
#define MIN_LINE_WIDTH 1.0 |
#define MAX_LINE_WIDTH 10.0 |
#define LINE_WIDTH_GRANULARITY 0.1 |
/* Max texture palette / color table size */ |
#define MAX_COLOR_TABLE_SIZE 256 |
/* Number of 1D/2D texture mipmap levels */ |
#define MAX_TEXTURE_LEVELS 12 |
/* Number of 3D texture mipmap levels */ |
#define MAX_3D_TEXTURE_LEVELS 8 |
/* Number of cube texture mipmap levels - GL_ARB_texture_cube_map */ |
#define MAX_CUBE_TEXTURE_LEVELS 12 |
/* Maximum rectangular texture size - GL_NV_texture_rectangle */ |
#define MAX_TEXTURE_RECT_SIZE 2048 |
/* Number of texture units - GL_ARB_multitexture */ |
#define MAX_TEXTURE_UNITS 8 |
/* Maximum viewport/image size: */ |
#define MAX_WIDTH 2048 |
#define MAX_HEIGHT 2048 |
/* Maxmimum size for CVA. May be overridden by the drivers. */ |
#define MAX_ARRAY_LOCK_SIZE 3000 |
/* Subpixel precision for antialiasing, window coordinate snapping */ |
#define SUB_PIXEL_BITS 4 |
/* Size of histogram tables */ |
#define HISTOGRAM_TABLE_SIZE 256 |
/* Max convolution filter sizes */ |
#define MAX_CONVOLUTION_WIDTH 9 |
#define MAX_CONVOLUTION_HEIGHT 9 |
/* GL_ARB_texture_compression */ |
#define MAX_COMPRESSED_TEXTURE_FORMATS 25 |
/* GL_EXT_texture_filter_anisotropic */ |
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0 |
/* GL_EXT_texture_lod_bias */ |
#define MAX_TEXTURE_LOD_BIAS 4.0 |
/* |
* Mesa-specific parameters |
*/ |
/* |
* Bits per accumulation buffer color component: 8, 16 or 32 |
*/ |
#define ACCUM_BITS 16 |
/* |
* Bits per depth buffer value. Any reasonable value up to 31 will |
* work. 32 doesn't work because of integer overflow problems in the |
* rasterizer code. |
*/ |
#ifndef DEFAULT_SOFTWARE_DEPTH_BITS |
#define DEFAULT_SOFTWARE_DEPTH_BITS 16 |
#endif |
#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16 |
#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort |
#else |
#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint |
#endif |
/* |
* Bits per stencil value: 8 |
*/ |
#define STENCIL_BITS 8 |
/* |
* Bits per color channel: 8, 16 or 32 |
*/ |
#ifndef CHAN_BITS |
#define CHAN_BITS 8 |
#endif |
/* |
* Color channel component order |
* (changes will almost certainly cause problems at this time) |
*/ |
#define RCOMP 0 |
#define GCOMP 1 |
#define BCOMP 2 |
#define ACOMP 3 |
/* |
* Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. |
*/ |
#define FEATURE_NV_vertex_program 1 |
#endif /* CONFIG_H */ |
/shark/tags/rel_0_4/ports/mesa/src/light.h |
---|
0,0 → 1,123 |
/* $Id: light.h,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef LIGHT_H |
#define LIGHT_H |
#include "mtypes.h" |
extern void |
_mesa_ShadeModel( GLenum mode ); |
extern void |
_mesa_ColorMaterial( GLenum face, GLenum mode ); |
extern void |
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param ); |
extern void |
_mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ); |
extern void |
_mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ); |
extern void |
_mesa_Lighti( GLenum light, GLenum pname, GLint param ); |
extern void |
_mesa_LightModelf( GLenum pname, GLfloat param ); |
extern void |
_mesa_LightModelfv( GLenum pname, const GLfloat *params ); |
extern void |
_mesa_LightModeli( GLenum pname, GLint param ); |
extern void |
_mesa_LightModeliv( GLenum pname, const GLint *params ); |
extern void |
_mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ); |
extern void |
_mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); |
/* Lerp between adjacent values in the f(x) lookup table, giving a |
* continuous function, with adequeate overall accuracy. (Though |
* still pretty good compared to a straight lookup). |
* Result should be a GLfloat. |
*/ |
#define GET_SHINE_TAB_ENTRY( table, dp, result ) \ |
do { \ |
struct gl_shine_tab *_tab = table; \ |
float f = (dp * (SHINE_TABLE_SIZE-1)); \ |
int k = (int) f; \ |
if (k > SHINE_TABLE_SIZE-2) \ |
result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ |
else \ |
result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ |
} while (0) |
extern GLuint _mesa_material_bitmask( GLcontext *ctx, |
GLenum face, GLenum pname, |
GLuint legal, |
const char * ); |
extern void _mesa_invalidate_spot_exp_table( struct gl_light *l ); |
extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i ); |
extern void _mesa_validate_all_lighting_tables( GLcontext *ctx ); |
extern void _mesa_update_lighting( GLcontext *ctx ); |
extern void _mesa_compute_light_positions( GLcontext *ctx ); |
extern void _mesa_update_material( GLcontext *ctx, |
const struct gl_material src[2], |
GLuint bitmask ); |
extern void _mesa_copy_material_pairs( struct gl_material dst[2], |
const struct gl_material src[2], |
GLuint bitmask ); |
extern void _mesa_update_color_material( GLcontext *ctx, |
const GLfloat rgba[4] ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/points.c |
---|
0,0 → 1,222 |
/* $Id: points.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "points.h" |
#include "texstate.h" |
#include "mtypes.h" |
void |
_mesa_PointSize( GLfloat size ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (size <= 0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); |
return; |
} |
if (ctx->Point.Size == size) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.Size = size; |
ctx->Point._Size = CLAMP(size, |
ctx->Const.MinPointSize, |
ctx->Const.MaxPointSize); |
if (ctx->Point._Size == 1.0F) |
ctx->_TriangleCaps &= ~DD_POINT_SIZE; |
else |
ctx->_TriangleCaps |= DD_POINT_SIZE; |
if (ctx->Driver.PointSize) |
(*ctx->Driver.PointSize)(ctx, size); |
} |
/* |
* Added by GL_NV_point_sprite |
*/ |
void |
_mesa_PointParameteriNV( GLenum pname, GLint param ) |
{ |
const GLfloat value = (GLfloat) param; |
_mesa_PointParameterfvEXT(pname, &value); |
} |
/* |
* Added by GL_NV_point_sprite |
*/ |
void |
_mesa_PointParameterivNV( GLenum pname, const GLint *params ) |
{ |
const GLfloat value = (GLfloat) params[0]; |
_mesa_PointParameterfvEXT(pname, &value); |
} |
/* |
* Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. |
*/ |
void |
_mesa_PointParameterfEXT( GLenum pname, GLfloat param) |
{ |
_mesa_PointParameterfvEXT(pname, ¶m); |
} |
/* |
* Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. |
*/ |
void |
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (pname) { |
case GL_DISTANCE_ATTENUATION_EXT: |
if (ctx->Extensions.EXT_point_parameters) { |
const GLboolean tmp = ctx->Point._Attenuated; |
if (TEST_EQ_3V(ctx->Point.Params, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
COPY_3V(ctx->Point.Params, params); |
/* Update several derived values now. This likely to be |
* more efficient than trying to catch this statechange in |
* state.c. |
*/ |
ctx->Point._Attenuated = (params[0] != 1.0 || |
params[1] != 0.0 || |
params[2] != 0.0); |
if (tmp != ctx->Point._Attenuated) { |
ctx->_TriangleCaps ^= DD_POINT_ATTEN; |
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN; |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)"); |
return; |
} |
break; |
case GL_POINT_SIZE_MIN_EXT: |
if (ctx->Extensions.EXT_point_parameters) { |
if (params[0] < 0.0F) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glPointParameterf[v]{EXT,ARB}(param)" ); |
return; |
} |
if (ctx->Point.MinSize == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.MinSize = params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)"); |
return; |
} |
break; |
case GL_POINT_SIZE_MAX_EXT: |
if (ctx->Extensions.EXT_point_parameters) { |
if (params[0] < 0.0F) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glPointParameterf[v]{EXT,ARB}(param)" ); |
return; |
} |
if (ctx->Point.MaxSize == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.MaxSize = params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)"); |
return; |
} |
break; |
case GL_POINT_FADE_THRESHOLD_SIZE_EXT: |
if (ctx->Extensions.EXT_point_parameters) { |
if (params[0] < 0.0F) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glPointParameterf[v]{EXT,ARB}(param)" ); |
return; |
} |
if (ctx->Point.Threshold == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.Threshold = params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)"); |
return; |
} |
break; |
case GL_POINT_SPRITE_R_MODE_NV: |
if (ctx->Extensions.NV_point_sprite) { |
GLenum value = (GLenum) params[0]; |
if (value != GL_ZERO && value != GL_S && value != GL_R) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glPointParameterf[v]{EXT,ARB}(param)"); |
return; |
} |
if (ctx->Point.SpriteRMode == value) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.SpriteRMode = value; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)"); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, |
"glPointParameterf[v]{EXT,ARB}(pname)" ); |
return; |
} |
if (ctx->Driver.PointParameterfv) |
(*ctx->Driver.PointParameterfv)(ctx, pname, params); |
} |
/shark/tags/rel_0_4/ports/mesa/src/vtxfmt_tmp.h |
---|
0,0 → 1,472 |
/* $Id: vtxfmt_tmp.h,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#ifndef PRE_LOOPBACK |
#define PRE_LOOPBACK( FUNC ) |
#endif |
static void TAG(ArrayElement)( GLint i ) |
{ |
PRE_LOOPBACK( ArrayElement ); |
_glapi_Dispatch->ArrayElement( i ); |
} |
static void TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) |
{ |
PRE_LOOPBACK( Color3f ); |
_glapi_Dispatch->Color3f( r, g, b ); |
} |
static void TAG(Color3fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Color3fv ); |
_glapi_Dispatch->Color3fv( v ); |
} |
static void TAG(Color3ub)( GLubyte r, GLubyte g, GLubyte b ) |
{ |
PRE_LOOPBACK( Color3ub ); |
_glapi_Dispatch->Color3ub( r, g, b ); |
} |
static void TAG(Color3ubv)( const GLubyte *v ) |
{ |
PRE_LOOPBACK( Color3ubv ); |
_glapi_Dispatch->Color3ubv( v ); |
} |
static void TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) |
{ |
PRE_LOOPBACK( Color4f ); |
_glapi_Dispatch->Color4f( r, g, b, a ); |
} |
static void TAG(Color4fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Color4fv ); |
_glapi_Dispatch->Color4fv( v ); |
} |
static void TAG(Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) |
{ |
PRE_LOOPBACK( Color4ub ); |
_glapi_Dispatch->Color4ub( r, g, b, a ); |
} |
static void TAG(Color4ubv)( const GLubyte *v ) |
{ |
PRE_LOOPBACK( Color4ubv ); |
_glapi_Dispatch->Color4ubv( v ); |
} |
static void TAG(EdgeFlag)( GLboolean e ) |
{ |
PRE_LOOPBACK( EdgeFlag ); |
_glapi_Dispatch->EdgeFlag( e ); |
} |
static void TAG(EdgeFlagv)( const GLboolean *v ) |
{ |
PRE_LOOPBACK( EdgeFlagv ); |
_glapi_Dispatch->EdgeFlagv( v ); |
} |
static void TAG(EvalCoord1f)( GLfloat s ) |
{ |
PRE_LOOPBACK( EvalCoord1f ); |
_glapi_Dispatch->EvalCoord1f( s ); |
} |
static void TAG(EvalCoord1fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( EvalCoord1fv ); |
_glapi_Dispatch->EvalCoord1fv( v ); |
} |
static void TAG(EvalCoord2f)( GLfloat s, GLfloat t ) |
{ |
PRE_LOOPBACK( EvalCoord2f ); |
_glapi_Dispatch->EvalCoord2f( s, t ); |
} |
static void TAG(EvalCoord2fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( EvalCoord2fv ); |
_glapi_Dispatch->EvalCoord2fv( v ); |
} |
static void TAG(EvalPoint1)( GLint i ) |
{ |
PRE_LOOPBACK( EvalPoint1 ); |
_glapi_Dispatch->EvalPoint1( i ); |
} |
static void TAG(EvalPoint2)( GLint i, GLint j ) |
{ |
PRE_LOOPBACK( EvalPoint2 ); |
_glapi_Dispatch->EvalPoint2( i, j ); |
} |
static void TAG(FogCoordfEXT)( GLfloat f ) |
{ |
PRE_LOOPBACK( FogCoordfEXT ); |
_glapi_Dispatch->FogCoordfEXT( f ); |
} |
static void TAG(FogCoordfvEXT)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( FogCoordfvEXT ); |
_glapi_Dispatch->FogCoordfvEXT( v ); |
} |
static void TAG(Indexi)( GLint i ) |
{ |
PRE_LOOPBACK( Indexi ); |
_glapi_Dispatch->Indexi( i ); |
} |
static void TAG(Indexiv)( const GLint *v ) |
{ |
PRE_LOOPBACK( Indexiv ); |
_glapi_Dispatch->Indexiv( v ); |
} |
static void TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) |
{ |
PRE_LOOPBACK( Materialfv ); |
_glapi_Dispatch->Materialfv( face, pname, v ); |
} |
static void TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) |
{ |
PRE_LOOPBACK( MultiTexCoord1fARB ); |
_glapi_Dispatch->MultiTexCoord1fARB( target, a ); |
} |
static void TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) |
{ |
PRE_LOOPBACK( MultiTexCoord1fvARB ); |
_glapi_Dispatch->MultiTexCoord1fvARB( target, tc ); |
} |
static void TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) |
{ |
PRE_LOOPBACK( MultiTexCoord2fARB ); |
_glapi_Dispatch->MultiTexCoord2fARB( target, s, t ); |
} |
static void TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) |
{ |
PRE_LOOPBACK( MultiTexCoord2fvARB ); |
_glapi_Dispatch->MultiTexCoord2fvARB( target, tc ); |
} |
static void TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, |
GLfloat t, GLfloat r ) |
{ |
PRE_LOOPBACK( MultiTexCoord3fARB ); |
_glapi_Dispatch->MultiTexCoord3fARB( target, s, t, r ); |
} |
static void TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) |
{ |
PRE_LOOPBACK( MultiTexCoord3fvARB ); |
_glapi_Dispatch->MultiTexCoord3fvARB( target, tc ); |
} |
static void TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, |
GLfloat t, GLfloat r, GLfloat q ) |
{ |
PRE_LOOPBACK( MultiTexCoord4fARB ); |
_glapi_Dispatch->MultiTexCoord4fARB( target, s, t, r, q ); |
} |
static void TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) |
{ |
PRE_LOOPBACK( MultiTexCoord4fvARB ); |
_glapi_Dispatch->MultiTexCoord4fvARB( target, tc ); |
} |
static void TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) |
{ |
PRE_LOOPBACK( Normal3f ); |
_glapi_Dispatch->Normal3f( x, y, z ); |
} |
static void TAG(Normal3fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Normal3fv ); |
_glapi_Dispatch->Normal3fv( v ); |
} |
static void TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) |
{ |
PRE_LOOPBACK( SecondaryColor3fEXT ); |
_glapi_Dispatch->SecondaryColor3fEXT( r, g, b ); |
} |
static void TAG(SecondaryColor3fvEXT)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( SecondaryColor3fvEXT ); |
_glapi_Dispatch->SecondaryColor3fvEXT( v ); |
} |
static void TAG(SecondaryColor3ubEXT)( GLubyte r, GLubyte g, GLubyte b ) |
{ |
PRE_LOOPBACK( SecondaryColor3ubEXT ); |
_glapi_Dispatch->SecondaryColor3ubEXT( r, g, b ); |
} |
static void TAG(SecondaryColor3ubvEXT)( const GLubyte *v ) |
{ |
PRE_LOOPBACK( SecondaryColor3ubvEXT ); |
_glapi_Dispatch->SecondaryColor3ubvEXT( v ); |
} |
static void TAG(TexCoord1f)( GLfloat s ) |
{ |
PRE_LOOPBACK( TexCoord1f ); |
_glapi_Dispatch->TexCoord1f( s ); |
} |
static void TAG(TexCoord1fv)( const GLfloat *tc ) |
{ |
PRE_LOOPBACK( TexCoord1fv ); |
_glapi_Dispatch->TexCoord1fv( tc ); |
} |
static void TAG(TexCoord2f)( GLfloat s, GLfloat t ) |
{ |
PRE_LOOPBACK( TexCoord2f ); |
_glapi_Dispatch->TexCoord2f( s, t ); |
} |
static void TAG(TexCoord2fv)( const GLfloat *tc ) |
{ |
PRE_LOOPBACK( TexCoord2fv ); |
_glapi_Dispatch->TexCoord2fv( tc ); |
} |
static void TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) |
{ |
PRE_LOOPBACK( TexCoord3f ); |
_glapi_Dispatch->TexCoord3f( s, t, r ); |
} |
static void TAG(TexCoord3fv)( const GLfloat *tc ) |
{ |
PRE_LOOPBACK( TexCoord3fv ); |
_glapi_Dispatch->TexCoord3fv( tc ); |
} |
static void TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) |
{ |
PRE_LOOPBACK( TexCoord4f ); |
_glapi_Dispatch->TexCoord4f( s, t, r, q ); |
} |
static void TAG(TexCoord4fv)( const GLfloat *tc ) |
{ |
PRE_LOOPBACK( TexCoord4fv ); |
_glapi_Dispatch->TexCoord4fv( tc ); |
} |
static void TAG(Vertex2f)( GLfloat x, GLfloat y ) |
{ |
PRE_LOOPBACK( Vertex2f ); |
_glapi_Dispatch->Vertex2f( x, y ); |
} |
static void TAG(Vertex2fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Vertex2fv ); |
_glapi_Dispatch->Vertex2fv( v ); |
} |
static void TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) |
{ |
PRE_LOOPBACK( Vertex3f ); |
_glapi_Dispatch->Vertex3f( x, y, z ); |
} |
static void TAG(Vertex3fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Vertex3fv ); |
_glapi_Dispatch->Vertex3fv( v ); |
} |
static void TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
PRE_LOOPBACK( Vertex4f ); |
_glapi_Dispatch->Vertex4f( x, y, z, w ); |
} |
static void TAG(Vertex4fv)( const GLfloat *v ) |
{ |
PRE_LOOPBACK( Vertex4fv ); |
_glapi_Dispatch->Vertex4fv( v ); |
} |
static void TAG(CallList)( GLuint i ) |
{ |
PRE_LOOPBACK( CallList ); |
_glapi_Dispatch->CallList( i ); |
} |
static void TAG(Begin)( GLenum mode ) |
{ |
PRE_LOOPBACK( Begin ); |
_glapi_Dispatch->Begin( mode ); |
} |
static void TAG(End)( void ) |
{ |
PRE_LOOPBACK( End ); |
_glapi_Dispatch->End(); |
} |
static void TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) |
{ |
PRE_LOOPBACK( Rectf ); |
_glapi_Dispatch->Rectf( x1, y1, x2, y2 ); |
} |
static void TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) |
{ |
PRE_LOOPBACK( DrawArrays ); |
_glapi_Dispatch->DrawArrays( mode, start, count ); |
} |
static void TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, |
const void *indices ) |
{ |
PRE_LOOPBACK( DrawElements ); |
_glapi_Dispatch->DrawElements( mode, count, type, indices ); |
} |
static void TAG(DrawRangeElements)( GLenum mode, GLuint start, |
GLuint end, GLsizei count, |
GLenum type, const void *indices ) |
{ |
PRE_LOOPBACK( DrawRangeElements ); |
_glapi_Dispatch->DrawRangeElements( mode, start, end, count, type, indices ); |
} |
static void TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) |
{ |
PRE_LOOPBACK( EvalMesh1 ); |
_glapi_Dispatch->EvalMesh1( mode, i1, i2 ); |
} |
static void TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, |
GLint j1, GLint j2 ) |
{ |
PRE_LOOPBACK( EvalMesh2 ); |
_glapi_Dispatch->EvalMesh2( mode, i1, i2, j1, j2 ); |
} |
static void TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
PRE_LOOPBACK( VertexAttrib4fNV ); |
_glapi_Dispatch->VertexAttrib4fNV( index, x, y, z, w ); |
} |
static void TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) |
{ |
PRE_LOOPBACK( VertexAttrib4fNV ); |
_glapi_Dispatch->VertexAttrib4fvNV( index, v ); |
} |
static GLvertexformat TAG(vtxfmt) = { |
TAG(ArrayElement), |
TAG(Color3f), |
TAG(Color3fv), |
TAG(Color3ub), |
TAG(Color3ubv), |
TAG(Color4f), |
TAG(Color4fv), |
TAG(Color4ub), |
TAG(Color4ubv), |
TAG(EdgeFlag), |
TAG(EdgeFlagv), |
TAG(EvalCoord1f), |
TAG(EvalCoord1fv), |
TAG(EvalCoord2f), |
TAG(EvalCoord2fv), |
TAG(EvalPoint1), |
TAG(EvalPoint2), |
TAG(FogCoordfEXT), |
TAG(FogCoordfvEXT), |
TAG(Indexi), |
TAG(Indexiv), |
TAG(Materialfv), |
TAG(MultiTexCoord1fARB), |
TAG(MultiTexCoord1fvARB), |
TAG(MultiTexCoord2fARB), |
TAG(MultiTexCoord2fvARB), |
TAG(MultiTexCoord3fARB), |
TAG(MultiTexCoord3fvARB), |
TAG(MultiTexCoord4fARB), |
TAG(MultiTexCoord4fvARB), |
TAG(Normal3f), |
TAG(Normal3fv), |
TAG(SecondaryColor3fEXT), |
TAG(SecondaryColor3fvEXT), |
TAG(SecondaryColor3ubEXT), |
TAG(SecondaryColor3ubvEXT), |
TAG(TexCoord1f), |
TAG(TexCoord1fv), |
TAG(TexCoord2f), |
TAG(TexCoord2fv), |
TAG(TexCoord3f), |
TAG(TexCoord3fv), |
TAG(TexCoord4f), |
TAG(TexCoord4fv), |
TAG(Vertex2f), |
TAG(Vertex2fv), |
TAG(Vertex3f), |
TAG(Vertex3fv), |
TAG(Vertex4f), |
TAG(Vertex4fv), |
TAG(CallList), |
TAG(Begin), |
TAG(End), |
TAG(VertexAttrib4fNV), |
TAG(VertexAttrib4fvNV), |
TAG(Rectf), |
TAG(DrawArrays), |
TAG(DrawElements), |
TAG(DrawRangeElements), |
TAG(EvalMesh1), |
TAG(EvalMesh2) |
}; |
#undef TAG |
#undef PRE_LOOPBACK |
/shark/tags/rel_0_4/ports/mesa/src/texstore.c |
---|
0,0 → 1,2116 |
/* $Id: texstore.c,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Authors: |
* Brian Paul |
*/ |
/* |
* The GL texture image functions in teximage.c basically just do |
* error checking and data structure allocation. They in turn call |
* device driver functions which actually copy/convert/store the user's |
* texture image data. |
* |
* However, most device drivers will be able to use the fallback functions |
* in this file. That is, most drivers will have the following bit of |
* code: |
* ctx->Driver.TexImage1D = _mesa_store_teximage1d; |
* ctx->Driver.TexImage2D = _mesa_store_teximage2d; |
* ctx->Driver.TexImage3D = _mesa_store_teximage3d; |
* etc... |
* |
* Texture image processing is actually kind of complicated. We have to do: |
* Format/type conversions |
* pixel unpacking |
* pixel transfer (scale, bais, lookup, convolution!, etc) |
* |
* These functions can handle most everything, including processing full |
* images and sub-images. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "convolve.h" |
#include "image.h" |
#include "macros.h" |
#include "imports.h" |
#include "texcompress.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "texstore.h" |
#include "texutil.h" |
/* |
* Given an internal texture format enum or 1, 2, 3, 4 return the |
* corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, |
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the |
* number of components for the format. Return -1 if invalid enum. |
*/ |
static GLint |
components_in_intformat( GLint format ) |
{ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return 1; |
case 1: |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return 1; |
case 2: |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return 2; |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
return 1; |
case 3: |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return 3; |
case 4: |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return 4; |
case GL_COLOR_INDEX: |
case GL_COLOR_INDEX1_EXT: |
case GL_COLOR_INDEX2_EXT: |
case GL_COLOR_INDEX4_EXT: |
case GL_COLOR_INDEX8_EXT: |
case GL_COLOR_INDEX12_EXT: |
case GL_COLOR_INDEX16_EXT: |
return 1; |
case GL_DEPTH_COMPONENT: |
case GL_DEPTH_COMPONENT16_SGIX: |
case GL_DEPTH_COMPONENT24_SGIX: |
case GL_DEPTH_COMPONENT32_SGIX: |
return 1; |
case GL_YCBCR_MESA: |
return 2; /* Y + (Cb or Cr) */ |
default: |
return -1; /* error */ |
} |
} |
/* |
* This function is used to transfer the user's image data into a texture |
* image buffer. We handle both full texture images and subtexture images. |
* We also take care of all image transfer operations here, including |
* convolution, scale/bias, colortables, etc. |
* |
* The destination texel type is always GLchan. |
* The destination texel format is one of the 6 basic types. |
* |
* A hardware driver may use this as a helper routine to unpack and |
* apply pixel transfer ops into a temporary image buffer. Then, |
* convert the temporary image into the special hardware format. |
* |
* Input: |
* dimensions - 1, 2, or 3 |
* texDestFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA, |
* GL_RGB or GL_RGBA (the destination format) |
* texDestAddr - destination image address |
* srcWidth, srcHeight, srcDepth - size (in pixels) of src and dest images |
* dstXoffset, dstYoffset, dstZoffset - position to store the image within |
* the destination 3D texture |
* dstRowStride, dstImageStride - dest image strides in bytes |
* srcFormat - source image format (GL_ALPHA, GL_RED, GL_RGB, etc) |
* srcType - GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_FLOAT, etc |
* srcPacking - describes packing of incoming image. |
* transferOps - mask of pixel transfer operations |
*/ |
static void |
transfer_teximage(GLcontext *ctx, GLuint dimensions, |
GLenum texDestFormat, GLvoid *texDestAddr, |
GLint srcWidth, GLint srcHeight, GLint srcDepth, |
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, |
GLint dstRowStride, GLint dstImageStride, |
GLenum srcFormat, GLenum srcType, |
const GLvoid *srcAddr, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps) |
{ |
GLint texComponents; |
ASSERT(ctx); |
ASSERT(dimensions >= 1 && dimensions <= 3); |
ASSERT(texDestFormat == GL_LUMINANCE || |
texDestFormat == GL_INTENSITY || |
texDestFormat == GL_LUMINANCE_ALPHA || |
texDestFormat == GL_ALPHA || |
texDestFormat == GL_RGB || |
texDestFormat == GL_RGBA); |
ASSERT(texDestAddr); |
ASSERT(srcWidth >= 1); |
ASSERT(srcHeight >= 1); |
ASSERT(srcDepth >= 1); |
ASSERT(dstXoffset >= 0); |
ASSERT(dstYoffset >= 0); |
ASSERT(dstZoffset >= 0); |
ASSERT(dstRowStride >= 0); |
ASSERT(dstImageStride >= 0); |
ASSERT(srcAddr); |
ASSERT(srcPacking); |
texComponents = components_in_intformat(texDestFormat); |
/* try common 2D texture cases first */ |
if (!transferOps && dimensions == 2 && srcType == CHAN_TYPE) { |
if (srcFormat == texDestFormat) { |
/* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA, |
* GL_LUMINANCE_ALPHA, etc. texture formats. Use memcpy(). |
*/ |
const GLchan *src = (const GLchan *) _mesa_image_address( |
srcPacking, srcAddr, srcWidth, srcHeight, |
srcFormat, srcType, 0, 0, 0); |
const GLint srcRowStride = _mesa_image_row_stride(srcPacking, |
srcWidth, srcFormat, srcType); |
const GLint widthInBytes = srcWidth * texComponents * sizeof(GLchan); |
GLchan *dst = (GLchan *) texDestAddr |
+ dstYoffset * (dstRowStride / sizeof(GLchan)) |
+ dstXoffset * texComponents; |
if (srcRowStride == widthInBytes && dstRowStride == widthInBytes) { |
MEMCPY(dst, src, srcHeight * widthInBytes); |
} |
else { |
GLint i; |
for (i = 0; i < srcHeight; i++) { |
MEMCPY(dst, src, widthInBytes); |
src += (srcRowStride / sizeof(GLchan)); |
dst += (dstRowStride / sizeof(GLchan)); |
} |
} |
return; /* all done */ |
} |
else if (srcFormat == GL_RGBA && texDestFormat == GL_RGB) { |
/* commonly used by Quake */ |
const GLchan *src = (const GLchan *) _mesa_image_address( |
srcPacking, srcAddr, srcWidth, srcHeight, |
srcFormat, srcType, 0, 0, 0); |
const GLint srcRowStride = _mesa_image_row_stride(srcPacking, |
srcWidth, srcFormat, srcType); |
GLchan *dst = (GLchan *) texDestAddr |
+ dstYoffset * (dstRowStride / sizeof(GLchan)) |
+ dstXoffset * texComponents; |
GLint i, j; |
for (i = 0; i < srcHeight; i++) { |
const GLchan *s = src; |
GLchan *d = dst; |
for (j = 0; j < srcWidth; j++) { |
*d++ = *s++; /*red*/ |
*d++ = *s++; /*green*/ |
*d++ = *s++; /*blue*/ |
s++; /*alpha*/ |
} |
src += (srcRowStride / sizeof(GLchan)); |
dst += (dstRowStride / sizeof(GLchan)); |
} |
return; /* all done */ |
} |
} |
/* |
* General case solutions |
*/ |
if (texDestFormat == GL_COLOR_INDEX) { |
/* color index texture */ |
const GLenum texType = CHAN_TYPE; |
GLint img, row; |
GLchan *dest = (GLchan *) texDestAddr |
+ dstZoffset * (dstImageStride / sizeof(GLchan)) |
+ dstYoffset * (dstRowStride / sizeof(GLchan)) |
+ dstXoffset * texComponents; |
for (img = 0; img < srcDepth; img++) { |
GLchan *destRow = dest; |
for (row = 0; row < srcHeight; row++) { |
const GLvoid *src = _mesa_image_address(srcPacking, |
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); |
_mesa_unpack_index_span(ctx, srcWidth, texType, destRow, |
srcType, src, srcPacking, transferOps); |
destRow += (dstRowStride / sizeof(GLchan)); |
} |
dest += dstImageStride; |
} |
} |
else if (texDestFormat == GL_YCBCR_MESA) { |
/* YCbCr texture */ |
GLint img, row; |
GLushort *dest = (GLushort *) texDestAddr |
+ dstZoffset * (dstImageStride / sizeof(GLushort)) |
+ dstYoffset * (dstRowStride / sizeof(GLushort)) |
+ dstXoffset * texComponents; |
ASSERT(ctx->Extensions.MESA_ycbcr_texture); |
for (img = 0; img < srcDepth; img++) { |
GLushort *destRow = dest; |
for (row = 0; row < srcHeight; row++) { |
const GLvoid *srcRow = _mesa_image_address(srcPacking, |
srcAddr, srcWidth, srcHeight, |
srcFormat, srcType, img, row, 0); |
MEMCPY(destRow, srcRow, srcWidth * sizeof(GLushort)); |
destRow += (dstRowStride / sizeof(GLushort)); |
} |
dest += dstImageStride / sizeof(GLushort); |
} |
} |
else if (texDestFormat == GL_DEPTH_COMPONENT) { |
/* Depth texture (shadow maps) */ |
GLint img, row; |
GLubyte *dest = (GLubyte *) texDestAddr |
+ dstZoffset * dstImageStride |
+ dstYoffset * (dstRowStride / sizeof(GLchan)) |
+ dstXoffset * texComponents; |
for (img = 0; img < srcDepth; img++) { |
GLubyte *destRow = dest; |
for (row = 0; row < srcHeight; row++) { |
const GLvoid *src = _mesa_image_address(srcPacking, |
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); |
_mesa_unpack_depth_span(ctx, srcWidth, (GLfloat *) destRow, |
srcType, src, srcPacking); |
destRow += (dstRowStride / sizeof(GLchan)); |
} |
dest += dstImageStride; |
} |
} |
else { |
/* regular, color texture */ |
if ((dimensions == 1 && ctx->Pixel.Convolution1DEnabled) || |
(dimensions >= 2 && ctx->Pixel.Convolution2DEnabled) || |
(dimensions >= 2 && ctx->Pixel.Separable2DEnabled)) { |
/* |
* Fill texture image with convolution |
*/ |
GLint img, row; |
GLint convWidth = srcWidth, convHeight = srcHeight; |
GLfloat *tmpImage, *convImage; |
tmpImage = (GLfloat *) MALLOC(srcWidth * srcHeight * 4 * sizeof(GLfloat)); |
if (!tmpImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); |
return; |
} |
convImage = (GLfloat *) MALLOC(srcWidth * srcHeight * 4 * sizeof(GLfloat)); |
if (!convImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); |
FREE(tmpImage); |
return; |
} |
for (img = 0; img < srcDepth; img++) { |
const GLfloat *srcf; |
GLfloat *dstf = tmpImage; |
GLchan *dest; |
/* unpack and do transfer ops up to convolution */ |
for (row = 0; row < srcHeight; row++) { |
const GLvoid *src = _mesa_image_address(srcPacking, |
srcAddr, srcWidth, srcHeight, |
srcFormat, srcType, img, row, 0); |
_mesa_unpack_float_color_span(ctx, srcWidth, GL_RGBA, dstf, |
srcFormat, srcType, src, srcPacking, |
transferOps & IMAGE_PRE_CONVOLUTION_BITS, |
GL_TRUE); |
dstf += srcWidth * 4; |
} |
/* convolve */ |
if (dimensions == 1) { |
ASSERT(ctx->Pixel.Convolution1DEnabled); |
_mesa_convolve_1d_image(ctx, &convWidth, tmpImage, convImage); |
} |
else { |
if (ctx->Pixel.Convolution2DEnabled) { |
_mesa_convolve_2d_image(ctx, &convWidth, &convHeight, |
tmpImage, convImage); |
} |
else { |
ASSERT(ctx->Pixel.Separable2DEnabled); |
_mesa_convolve_sep_image(ctx, &convWidth, &convHeight, |
tmpImage, convImage); |
} |
} |
/* packing and transfer ops after convolution */ |
srcf = convImage; |
dest = (GLchan *) texDestAddr |
+ (dstZoffset + img) * (dstImageStride / sizeof(GLchan)) |
+ dstYoffset * (dstRowStride / sizeof(GLchan)); |
for (row = 0; row < convHeight; row++) { |
_mesa_pack_float_rgba_span(ctx, convWidth, |
(const GLfloat (*)[4]) srcf, |
texDestFormat, CHAN_TYPE, |
dest, &_mesa_native_packing, |
transferOps |
& IMAGE_POST_CONVOLUTION_BITS); |
srcf += convWidth * 4; |
dest += (dstRowStride / sizeof(GLchan)); |
} |
} |
FREE(convImage); |
FREE(tmpImage); |
} |
else { |
/* |
* no convolution |
*/ |
GLint img, row; |
GLchan *dest = (GLchan *) texDestAddr |
+ dstZoffset * (dstImageStride / sizeof(GLchan)) |
+ dstYoffset * (dstRowStride / sizeof(GLchan)) |
+ dstXoffset * texComponents; |
for (img = 0; img < srcDepth; img++) { |
GLchan *destRow = dest; |
for (row = 0; row < srcHeight; row++) { |
const GLvoid *srcRow = _mesa_image_address(srcPacking, |
srcAddr, srcWidth, srcHeight, |
srcFormat, srcType, img, row, 0); |
_mesa_unpack_chan_color_span(ctx, srcWidth, texDestFormat, |
destRow, srcFormat, srcType, srcRow, |
srcPacking, transferOps); |
destRow += (dstRowStride / sizeof(GLchan)); |
} |
dest += dstImageStride / sizeof(GLchan); |
} |
} |
} |
} |
/* |
* Transfer a texture image from user space to <destAddr> applying all |
* needed image transfer operations and storing the result in the format |
* specified by <dstFormat>. <dstFormat> may be any format from texformat.h. |
* Input: |
* dimensions - 1, 2 or 3 |
* baseInternalFormat - base format of the internal texture format |
* specified by the user. This is very important, see below. |
* dstFormat - destination image format |
* dstAddr - destination address |
* srcWidth, srcHeight, srcDepth - size of source iamge |
* dstX/Y/Zoffset - as specified by glTexSubImage |
* dstRowStride - stride between dest rows in bytes |
* dstImageStride - stride between dest images in bytes |
* srcFormat, srcType - incoming image format and datatype |
* srcAddr - source image address |
* srcPacking - packing params of source image |
* |
* XXX this function is a bit more complicated than it should be. If |
* _mesa_convert_texsubimage[123]d could handle any dest/source formats |
* or if transfer_teximage() could store in any MESA_FORMAT_* format, we |
* could simplify things here. |
*/ |
void |
_mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, |
GLenum baseInternalFormat, |
const struct gl_texture_format *dstFormat, |
GLvoid *dstAddr, |
GLint srcWidth, GLint srcHeight, GLint srcDepth, |
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, |
GLint dstRowStride, GLint dstImageStride, |
GLenum srcFormat, GLenum srcType, |
const GLvoid *srcAddr, |
const struct gl_pixelstore_attrib *srcPacking) |
{ |
const GLint dstRowStridePixels = dstRowStride / dstFormat->TexelBytes; |
const GLint dstImageStridePixels = dstImageStride / dstFormat->TexelBytes; |
GLboolean makeTemp; |
GLuint transferOps = ctx->_ImageTransferState; |
GLboolean freeSourceData = GL_FALSE; |
GLint postConvWidth = srcWidth, postConvHeight = srcHeight; |
assert(baseInternalFormat > 0); |
ASSERT(baseInternalFormat == GL_LUMINANCE || |
baseInternalFormat == GL_INTENSITY || |
baseInternalFormat == GL_LUMINANCE_ALPHA || |
baseInternalFormat == GL_ALPHA || |
baseInternalFormat == GL_RGB || |
baseInternalFormat == GL_RGBA); |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
_mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth, |
&postConvHeight); |
} |
/* |
* Consider this scenario: The user's source image is GL_RGB and the |
* requested internal format is GL_LUMINANCE. Now suppose the device |
* driver doesn't support GL_LUMINANCE and instead uses RGB16 as the |
* texture format. In that case we still need to do an intermediate |
* conversion to luminance format so that the incoming red channel gets |
* replicated into the dest red, green and blue channels. The following |
* code takes care of that. |
*/ |
if (dstFormat->BaseFormat != baseInternalFormat) { |
/* Allocate storage for temporary image in the baseInternalFormat */ |
const GLint texelSize = _mesa_components_in_format(baseInternalFormat) |
* sizeof(GLchan); |
const GLint bytes = texelSize * postConvWidth * postConvHeight *srcDepth; |
const GLint tmpRowStride = texelSize * postConvWidth; |
const GLint tmpImgStride = texelSize * postConvWidth * postConvHeight; |
GLvoid *tmpImage = MALLOC(bytes); |
if (!tmpImage) |
return; |
transfer_teximage(ctx, dimensions, baseInternalFormat, tmpImage, |
srcWidth, srcHeight, srcDepth, |
0, 0, 0, /* x/y/zoffset */ |
tmpRowStride, tmpImgStride, |
srcFormat, srcType, srcAddr, srcPacking, transferOps); |
/* this is our new source image */ |
srcWidth = postConvWidth; |
srcHeight = postConvHeight; |
srcFormat = baseInternalFormat; |
srcType = CHAN_TYPE; |
srcAddr = tmpImage; |
srcPacking = &_mesa_native_packing; |
freeSourceData = GL_TRUE; |
transferOps = 0; /* image transfer ops were completed */ |
} |
/* Let the optimized tex conversion functions take a crack at the |
* image conversion if the dest format is a h/w format. |
*/ |
if (_mesa_is_hardware_tex_format(dstFormat)) { |
if (transferOps) { |
makeTemp = GL_TRUE; |
} |
else { |
if (dimensions == 1) { |
makeTemp = !_mesa_convert_texsubimage1d(dstFormat->MesaFormat, |
dstXoffset, |
srcWidth, |
srcFormat, srcType, |
srcPacking, srcAddr, |
dstAddr); |
} |
else if (dimensions == 2) { |
makeTemp = !_mesa_convert_texsubimage2d(dstFormat->MesaFormat, |
dstXoffset, dstYoffset, |
srcWidth, srcHeight, |
dstRowStridePixels, |
srcFormat, srcType, |
srcPacking, srcAddr, |
dstAddr); |
} |
else { |
assert(dimensions == 3); |
makeTemp = !_mesa_convert_texsubimage3d(dstFormat->MesaFormat, |
dstXoffset, dstYoffset, dstZoffset, |
srcWidth, srcHeight, srcDepth, |
dstRowStridePixels, dstImageStridePixels, |
srcFormat, srcType, |
srcPacking, srcAddr, dstAddr); |
} |
if (!makeTemp) { |
/* all done! */ |
if (freeSourceData) |
FREE((void *) srcAddr); |
return; |
} |
} |
} |
else { |
/* software texture format */ |
makeTemp = GL_FALSE; |
} |
if (makeTemp) { |
GLint postConvWidth = srcWidth, postConvHeight = srcHeight; |
GLenum tmpFormat; |
GLuint tmpComps, tmpTexelSize; |
GLint tmpRowStride, tmpImageStride; |
GLubyte *tmpImage; |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
_mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth, |
&postConvHeight); |
} |
tmpFormat = dstFormat->BaseFormat; |
tmpComps = _mesa_components_in_format(tmpFormat); |
tmpTexelSize = tmpComps * sizeof(GLchan); |
tmpRowStride = postConvWidth * tmpTexelSize; |
tmpImageStride = postConvWidth * postConvHeight * tmpTexelSize; |
tmpImage = (GLubyte *) MALLOC(postConvWidth * postConvHeight * |
srcDepth * tmpTexelSize); |
if (!tmpImage) { |
if (freeSourceData) |
FREE((void *) srcAddr); |
return; |
} |
transfer_teximage(ctx, dimensions, tmpFormat, tmpImage, |
srcWidth, srcHeight, srcDepth, |
0, 0, 0, /* x/y/zoffset */ |
tmpRowStride, tmpImageStride, |
srcFormat, srcType, srcAddr, srcPacking, transferOps); |
if (freeSourceData) |
FREE((void *) srcAddr); |
/* the temp image is our new source image */ |
srcWidth = postConvWidth; |
srcHeight = postConvHeight; |
srcFormat = tmpFormat; |
srcType = CHAN_TYPE; |
srcAddr = tmpImage; |
srcPacking = &_mesa_native_packing; |
freeSourceData = GL_TRUE; |
} |
if (_mesa_is_hardware_tex_format(dstFormat)) { |
assert(makeTemp); |
if (dimensions == 1) { |
GLboolean b; |
b = _mesa_convert_texsubimage1d(dstFormat->MesaFormat, |
dstXoffset, |
srcWidth, |
srcFormat, srcType, |
srcPacking, srcAddr, |
dstAddr); |
assert(b); |
} |
else if (dimensions == 2) { |
GLboolean b; |
b = _mesa_convert_texsubimage2d(dstFormat->MesaFormat, |
dstXoffset, dstYoffset, |
srcWidth, srcHeight, |
dstRowStridePixels, |
srcFormat, srcType, |
srcPacking, srcAddr, |
dstAddr); |
assert(b); |
} |
else { |
GLboolean b; |
b = _mesa_convert_texsubimage3d(dstFormat->MesaFormat, |
dstXoffset, dstYoffset, dstZoffset, |
srcWidth, srcHeight, srcDepth, |
dstRowStridePixels, dstImageStridePixels, |
srcFormat, srcType, |
srcPacking, srcAddr, dstAddr); |
assert(b); |
} |
} |
else { |
/* software format */ |
assert(!makeTemp); |
transfer_teximage(ctx, dimensions, dstFormat->BaseFormat, dstAddr, |
srcWidth, srcHeight, srcDepth, |
dstXoffset, dstYoffset, dstZoffset, |
dstRowStride, dstImageStride, |
srcFormat, srcType, srcAddr, srcPacking, transferOps); |
} |
if (freeSourceData) |
FREE((void *) srcAddr); /* the temp image */ |
} |
/** |
* Given a user's uncompressed texture image, this function takes care of |
* pixel unpacking, pixel transfer, format conversion and compression. |
*/ |
static void |
transfer_compressed_teximage(GLcontext *ctx, GLuint dimensions, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum srcFormat, GLenum srcType, |
const struct gl_pixelstore_attrib *unpacking, |
const GLvoid *source, |
const struct gl_texture_format *dstFormat, |
GLubyte *dest, |
GLint dstRowStride) |
{ |
GLchan *tempImage = NULL; |
GLint srcRowStride; |
GLenum baseFormat; |
ASSERT(dimensions == 2); |
/* TexelBytes is zero if and only if it's a compressed format */ |
ASSERT(dstFormat->TexelBytes == 0); |
baseFormat = dstFormat->BaseFormat; |
if (srcFormat != baseFormat || srcType != CHAN_TYPE || |
ctx->_ImageTransferState != 0 || unpacking->SwapBytes) { |
/* need to convert user's image to texImage->Format, GLchan */ |
GLint comps = components_in_intformat(baseFormat); |
GLint postConvWidth = width, postConvHeight = height; |
/* XXX convolution untested */ |
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { |
_mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth, |
&postConvHeight); |
} |
tempImage = (GLchan*) MALLOC(width * height * comps * sizeof(GLchan)); |
if (!tempImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); |
return; |
} |
transfer_teximage(ctx, dimensions, |
baseFormat, /* dest format */ |
tempImage, /* dst address */ |
width, height, depth, /* src size */ |
0, 0, 0, /* x/y/zoffset */ |
comps * width, /* dst row stride */ |
comps * width * height, /* dst image stride */ |
srcFormat, srcType, /* src format, type */ |
source, unpacking, /* src and src packing */ |
ctx->_ImageTransferState); |
source = tempImage; |
width = postConvWidth; |
height = postConvHeight; |
srcRowStride = width; |
} |
else { |
if (unpacking->RowLength) |
srcRowStride = unpacking->RowLength; |
else |
srcRowStride = width; |
} |
_mesa_compress_teximage(ctx, width, height, baseFormat, |
(const GLchan *) source, srcRowStride, |
dstFormat, dest, dstRowStride); |
if (tempImage) { |
FREE(tempImage); |
} |
} |
/* |
* This is the software fallback for Driver.TexImage1D() |
* and Driver.CopyTexImage2D(). |
* The texture image type will be GLchan. |
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, |
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. |
*/ |
void |
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
GLint postConvWidth = width; |
GLint texelBytes, sizeInBytes; |
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { |
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
} |
/* choose the texture format */ |
assert(ctx->Driver.ChooseTextureFormat); |
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, |
internalFormat, format, type); |
assert(texImage->TexFormat); |
texImage->FetchTexel = texImage->TexFormat->FetchTexel1D; |
texelBytes = texImage->TexFormat->TexelBytes; |
/* allocate memory */ |
if (texImage->IsCompressed) |
sizeInBytes = texImage->CompressedSize; |
else |
sizeInBytes = postConvWidth * texelBytes; |
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); |
if (!texImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); |
return; |
} |
if (!pixels) |
return; |
/* unpack image, apply transfer ops and store in texImage->Data */ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
width); |
transfer_compressed_teximage(ctx, 1, width, 1, 1, |
format, type, packing, |
pixels, texImage->TexFormat, |
(GLubyte *) texImage->Data, dstRowStride); |
} |
else { |
_mesa_transfer_teximage(ctx, 1, |
texImage->Format, /* base format */ |
texImage->TexFormat, texImage->Data, |
width, 1, 1, /* src size */ |
0, 0, 0, /* dstX/Y/Zoffset */ |
0, /* dstRowStride */ |
0, /* dstImageStride */ |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* This is the software fallback for Driver.TexImage2D() |
* and Driver.CopyTexImage2D(). |
* The texture image type will be GLchan. |
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, |
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. |
*/ |
void |
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint border, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
GLint postConvWidth = width, postConvHeight = height; |
GLint texelBytes, sizeInBytes; |
if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
&postConvHeight); |
} |
/* choose the texture format */ |
assert(ctx->Driver.ChooseTextureFormat); |
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, |
internalFormat, format, type); |
assert(texImage->TexFormat); |
texImage->FetchTexel = texImage->TexFormat->FetchTexel2D; |
texelBytes = texImage->TexFormat->TexelBytes; |
/* allocate memory */ |
if (texImage->IsCompressed) |
sizeInBytes = texImage->CompressedSize; |
else |
sizeInBytes = postConvWidth * postConvHeight * texelBytes; |
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); |
if (!texImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); |
return; |
} |
if (!pixels) |
return; |
/* unpack image, apply transfer ops and store in texImage->Data */ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
width); |
transfer_compressed_teximage(ctx, 2, width, height, 1, |
format, type, packing, |
pixels, texImage->TexFormat, |
(GLubyte *) texImage->Data, dstRowStride); |
} |
else { |
_mesa_transfer_teximage(ctx, 2, |
texImage->Format, |
texImage->TexFormat, texImage->Data, |
width, height, 1, /* src size */ |
0, 0, 0, /* dstX/Y/Zoffset */ |
texImage->Width * texelBytes, /* dstRowStride */ |
0, /* dstImageStride */ |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* This is the software fallback for Driver.TexImage3D() |
* and Driver.CopyTexImage3D(). |
* The texture image type will be GLchan. |
* The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, |
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. |
*/ |
void |
_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint depth, GLint border, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
GLint texelBytes, sizeInBytes; |
/* choose the texture format */ |
assert(ctx->Driver.ChooseTextureFormat); |
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, |
internalFormat, format, type); |
assert(texImage->TexFormat); |
texImage->FetchTexel = texImage->TexFormat->FetchTexel3D; |
texelBytes = texImage->TexFormat->TexelBytes; |
/* allocate memory */ |
if (texImage->IsCompressed) |
sizeInBytes = texImage->CompressedSize; |
else |
sizeInBytes = width * height * depth * texelBytes; |
texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); |
if (!texImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); |
return; |
} |
if (!pixels) |
return; |
/* unpack image, apply transfer ops and store in texImage->Data */ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
width); |
transfer_compressed_teximage(ctx, 3, width, height, depth, |
format, type, packing, |
pixels, texImage->TexFormat, |
(GLubyte *) texImage->Data, dstRowStride); |
} |
else { |
_mesa_transfer_teximage(ctx, 3, |
texImage->Format, |
texImage->TexFormat, texImage->Data, |
width, height, depth, /* src size */ |
0, 0, 0, /* dstX/Y/Zoffset */ |
texImage->Width * texelBytes, /* dstRowStride */ |
texImage->Width * texImage->Height * texelBytes, |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* This is the software fallback for Driver.TexSubImage1D() |
* and Driver.CopyTexSubImage1D(). |
*/ |
void |
_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint width, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
texImage->Width); |
GLubyte *dest = _mesa_compressed_image_address(xoffset, 0, 0, |
texImage->IntFormat, |
texImage->Width, |
texImage->Data); |
transfer_compressed_teximage(ctx, 1, /* dimensions */ |
width, 1, 1, /* size to replace */ |
format, type, /* source format/type */ |
packing, /* source packing */ |
pixels, /* source data */ |
texImage->TexFormat,/* dest format */ |
dest, dstRowStride); |
} |
else { |
_mesa_transfer_teximage(ctx, 1, |
texImage->Format, |
texImage->TexFormat, texImage->Data, |
width, 1, 1, /* src size */ |
xoffset, 0, 0, /* dest offsets */ |
0, /* dstRowStride */ |
0, /* dstImageStride */ |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* This is the software fallback for Driver.TexSubImage2D() |
* and Driver.CopyTexSubImage2D(). |
*/ |
void |
_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint width, GLint height, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
texImage->Width); |
GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, 0, |
texImage->IntFormat, |
texImage->Width, |
texImage->Data); |
transfer_compressed_teximage(ctx, 2, /* dimensions */ |
width, height, 1, /* size to replace */ |
format, type, /* source format/type */ |
packing, /* source packing */ |
pixels, /* source data */ |
texImage->TexFormat,/* dest format */ |
dest, dstRowStride); |
} |
else { |
_mesa_transfer_teximage(ctx, 2, |
texImage->Format, |
texImage->TexFormat, texImage->Data, |
width, height, 1, /* src size */ |
xoffset, yoffset, 0, /* dest offsets */ |
texImage->Width *texImage->TexFormat->TexelBytes, |
0, /* dstImageStride */ |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* This is the software fallback for Driver.TexSubImage3D(). |
* and Driver.CopyTexSubImage3D(). |
*/ |
void |
_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint width, GLint height, GLint depth, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
if (texImage->IsCompressed) { |
GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
texImage->Width); |
GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, zoffset, |
texImage->IntFormat, |
texImage->Width, |
texImage->Data); |
transfer_compressed_teximage(ctx, 3, /* dimensions */ |
width, height, depth,/* size to replace */ |
format, type, /* source format/type */ |
packing, /* source packing */ |
pixels, /* source data */ |
texImage->TexFormat,/* dest format */ |
dest, dstRowStride); |
} |
else { |
const GLint texelBytes = texImage->TexFormat->TexelBytes; |
_mesa_transfer_teximage(ctx, 3, |
texImage->Format, |
texImage->TexFormat, texImage->Data, |
width, height, depth, /* src size */ |
xoffset, yoffset, xoffset, /* dest offsets */ |
texImage->Width * texelBytes, /* dst row stride */ |
texImage->Width * texImage->Height * texelBytes, |
format, type, pixels, packing); |
} |
/* GL_SGIS_generate_mipmap */ |
if (level == texObj->BaseLevel && texObj->GenerateMipmap) { |
_mesa_generate_mipmap(ctx, target, |
&ctx->Texture.Unit[ctx->Texture.CurrentUnit], |
texObj); |
} |
} |
/* |
* Fallback for Driver.CompressedTexImage1D() |
*/ |
void |
_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
/* this space intentionally left blank */ |
} |
/* |
* Fallback for Driver.CompressedTexImage2D() |
*/ |
void |
_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
/* This is pretty simple, basically just do a memcpy without worrying |
* about the usual image unpacking or image transfer operations. |
*/ |
ASSERT(texObj); |
ASSERT(texImage); |
ASSERT(texImage->Width > 0); |
ASSERT(texImage->Height > 0); |
ASSERT(texImage->Depth == 1); |
ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */ |
/* choose the texture format */ |
assert(ctx->Driver.ChooseTextureFormat); |
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, |
internalFormat, 0, 0); |
assert(texImage->TexFormat); |
texImage->FetchTexel = texImage->TexFormat->FetchTexel2D; |
/* allocate storage */ |
texImage->Data = MESA_PBUFFER_ALLOC(imageSize); |
if (!texImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); |
return; |
} |
/* copy the data */ |
ASSERT(texImage->CompressedSize == imageSize); |
MEMCPY(texImage->Data, data, imageSize); |
} |
/* |
* Fallback for Driver.CompressedTexImage3D() |
*/ |
void |
_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint depth, |
GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
/* this space intentionally left blank */ |
} |
/** |
* Fallback for Driver.CompressedTexSubImage1D() |
*/ |
void |
_mesa_store_compressed_texsubimage1d(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) |
{ |
/* this space intentionally left blank */ |
} |
/** |
* Fallback for Driver.CompressedTexSubImage2D() |
*/ |
void |
_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, |
GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
GLint bytesPerRow, destRowStride, srcRowStride; |
GLint i, rows; |
GLubyte *dest; |
const GLubyte *src; |
/* these should have been caught sooner */ |
ASSERT((width & 3) == 0 || width == 2 || width == 1); |
ASSERT((height & 3) == 0 || height == 2 || height == 1); |
ASSERT((xoffset & 3) == 0); |
ASSERT((yoffset & 3) == 0); |
srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); |
src = (const GLubyte *) data; |
destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, |
texImage->Width); |
dest = _mesa_compressed_image_address(xoffset, yoffset, 0, |
texImage->IntFormat, |
texImage->Width, texImage->Data); |
bytesPerRow = srcRowStride; |
rows = height / 4; |
for (i = 0; i < rows; i++) { |
MEMCPY(dest, src, bytesPerRow); |
dest += destRowStride; |
src += srcRowStride; |
} |
} |
/** |
* Fallback for Driver.CompressedTexSubImage3D() |
*/ |
void |
_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, |
GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage) |
{ |
/* this space intentionally left blank */ |
} |
/* |
* This is the fallback for Driver.TestProxyTexImage(). |
*/ |
GLboolean |
_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, GLenum format, GLenum type, |
GLint width, GLint height, GLint depth, GLint border) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
(void) format; |
(void) type; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
/* We always pass. |
* The core Mesa code will have already tested the image size, etc. |
* If a driver has more stringent texture limits to enforce it will |
* have to override this function. |
*/ |
/* choose the texture format */ |
assert(ctx->Driver.ChooseTextureFormat); |
texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, |
internalFormat, format, type); |
assert(texImage->TexFormat); |
return GL_TRUE; |
} |
/* |
* Average together two rows of a source image to produce a single new |
* row in the dest image. It's legal for the two source rows to point |
* to the same data. The source width must be equal to either the |
* dest width or two times the dest width. |
*/ |
static void |
do_row(const struct gl_texture_format *format, GLint srcWidth, |
const GLvoid *srcRowA, const GLvoid *srcRowB, |
GLint dstWidth, GLvoid *dstRow) |
{ |
const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1; |
const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; |
assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); |
switch (format->MesaFormat) { |
case MESA_FORMAT_RGBA: |
{ |
GLuint i, j, k; |
const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; |
const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; |
GLchan (*dst)[4] = (GLchan (*)[4]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) / 4; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) / 4; |
dst[i][2] = (rowA[j][2] + rowA[k][2] + |
rowB[j][2] + rowB[k][2]) / 4; |
dst[i][3] = (rowA[j][3] + rowA[k][3] + |
rowB[j][3] + rowB[k][3]) / 4; |
} |
} |
return; |
case MESA_FORMAT_RGB: |
{ |
GLuint i, j, k; |
const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; |
const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; |
GLchan (*dst)[3] = (GLchan (*)[3]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) / 4; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) / 4; |
dst[i][2] = (rowA[j][2] + rowA[k][2] + |
rowB[j][2] + rowB[k][2]) / 4; |
} |
} |
return; |
case MESA_FORMAT_ALPHA: |
case MESA_FORMAT_LUMINANCE: |
case MESA_FORMAT_INTENSITY: |
case MESA_FORMAT_COLOR_INDEX: |
{ |
GLuint i, j, k; |
const GLchan *rowA = (const GLchan *) srcRowA; |
const GLchan *rowB = (const GLchan *) srcRowB; |
GLchan *dst = (GLchan *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; |
} |
} |
return; |
case MESA_FORMAT_LUMINANCE_ALPHA: |
{ |
GLuint i, j, k; |
const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; |
const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; |
GLchan (*dst)[2] = (GLchan (*)[2]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) / 4; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) / 4; |
} |
} |
return; |
case MESA_FORMAT_DEPTH_COMPONENT: |
{ |
GLuint i, j, k; |
const GLfloat *rowA = (const GLfloat *) srcRowA; |
const GLfloat *rowB = (const GLfloat *) srcRowB; |
GLfloat *dst = (GLfloat *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; |
} |
} |
return; |
/* Begin hardware formats */ |
case MESA_FORMAT_RGBA8888: |
case MESA_FORMAT_ARGB8888: |
{ |
GLuint i, j, k; |
const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; |
const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; |
GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) / 4; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) / 4; |
dst[i][2] = (rowA[j][2] + rowA[k][2] + |
rowB[j][2] + rowB[k][2]) / 4; |
dst[i][3] = (rowA[j][3] + rowA[k][3] + |
rowB[j][3] + rowB[k][3]) / 4; |
} |
} |
return; |
case MESA_FORMAT_RGB888: |
{ |
GLuint i, j, k; |
const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; |
const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; |
GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) / 4; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) / 4; |
dst[i][2] = (rowA[j][2] + rowA[k][2] + |
rowB[j][2] + rowB[k][2]) / 4; |
} |
} |
return; |
case MESA_FORMAT_RGB565: |
{ |
GLuint i, j, k; |
const GLushort *rowA = (const GLushort *) srcRowA; |
const GLushort *rowB = (const GLushort *) srcRowB; |
GLushort *dst = (GLushort *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
const GLint rowAr0 = rowA[j] & 0x1f; |
const GLint rowAr1 = rowA[k] & 0x1f; |
const GLint rowBr0 = rowB[j] & 0x1f; |
const GLint rowBr1 = rowB[k] & 0x1f; |
const GLint rowAg0 = (rowA[j] >> 5) & 0x3f; |
const GLint rowAg1 = (rowA[k] >> 5) & 0x3f; |
const GLint rowBg0 = (rowB[j] >> 5) & 0x3f; |
const GLint rowBg1 = (rowB[k] >> 5) & 0x3f; |
const GLint rowAb0 = (rowA[j] >> 11) & 0x1f; |
const GLint rowAb1 = (rowA[k] >> 11) & 0x1f; |
const GLint rowBb0 = (rowB[j] >> 11) & 0x1f; |
const GLint rowBb1 = (rowB[k] >> 11) & 0x1f; |
const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 4; |
const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 4; |
const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 4; |
dst[i] = (blue << 11) | (green << 5) | red; |
} |
} |
return; |
case MESA_FORMAT_ARGB4444: |
{ |
GLuint i, j, k; |
const GLushort *rowA = (const GLushort *) srcRowA; |
const GLushort *rowB = (const GLushort *) srcRowB; |
GLushort *dst = (GLushort *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
const GLint rowAr0 = rowA[j] & 0xf; |
const GLint rowAr1 = rowA[k] & 0xf; |
const GLint rowBr0 = rowB[j] & 0xf; |
const GLint rowBr1 = rowB[k] & 0xf; |
const GLint rowAg0 = (rowA[j] >> 4) & 0xf; |
const GLint rowAg1 = (rowA[k] >> 4) & 0xf; |
const GLint rowBg0 = (rowB[j] >> 4) & 0xf; |
const GLint rowBg1 = (rowB[k] >> 4) & 0xf; |
const GLint rowAb0 = (rowA[j] >> 8) & 0xf; |
const GLint rowAb1 = (rowA[k] >> 8) & 0xf; |
const GLint rowBb0 = (rowB[j] >> 8) & 0xf; |
const GLint rowBb1 = (rowB[k] >> 8) & 0xf; |
const GLint rowAa0 = (rowA[j] >> 12) & 0xf; |
const GLint rowAa1 = (rowA[k] >> 12) & 0xf; |
const GLint rowBa0 = (rowB[j] >> 12) & 0xf; |
const GLint rowBa1 = (rowB[k] >> 12) & 0xf; |
const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 4; |
const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 4; |
const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 4; |
const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 4; |
dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; |
} |
} |
return; |
case MESA_FORMAT_ARGB1555: |
{ |
GLuint i, j, k; |
const GLushort *rowA = (const GLushort *) srcRowA; |
const GLushort *rowB = (const GLushort *) srcRowB; |
GLushort *dst = (GLushort *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
const GLint rowAr0 = rowA[j] & 0x1f; |
const GLint rowAr1 = rowA[k] & 0x1f; |
const GLint rowBr0 = rowB[j] & 0x1f; |
const GLint rowBr1 = rowB[k] & 0xf; |
const GLint rowAg0 = (rowA[j] >> 5) & 0x1f; |
const GLint rowAg1 = (rowA[k] >> 5) & 0x1f; |
const GLint rowBg0 = (rowB[j] >> 5) & 0x1f; |
const GLint rowBg1 = (rowB[k] >> 5) & 0x1f; |
const GLint rowAb0 = (rowA[j] >> 10) & 0x1f; |
const GLint rowAb1 = (rowA[k] >> 10) & 0x1f; |
const GLint rowBb0 = (rowB[j] >> 10) & 0x1f; |
const GLint rowBb1 = (rowB[k] >> 10) & 0x1f; |
const GLint rowAa0 = (rowA[j] >> 15) & 0x1; |
const GLint rowAa1 = (rowA[k] >> 15) & 0x1; |
const GLint rowBa0 = (rowB[j] >> 15) & 0x1; |
const GLint rowBa1 = (rowB[k] >> 15) & 0x1; |
const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 4; |
const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 4; |
const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 4; |
const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 4; |
dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; |
} |
} |
return; |
case MESA_FORMAT_AL88: |
{ |
GLuint i, j, k; |
const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; |
const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; |
GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i][0] = (rowA[j][0] + rowA[k][0] + |
rowB[j][0] + rowB[k][0]) >> 2; |
dst[i][1] = (rowA[j][1] + rowA[k][1] + |
rowB[j][1] + rowB[k][1]) >> 2; |
} |
} |
return; |
case MESA_FORMAT_RGB332: |
{ |
GLuint i, j, k; |
const GLubyte *rowA = (const GLubyte *) srcRowA; |
const GLubyte *rowB = (const GLubyte *) srcRowB; |
GLubyte *dst = (GLubyte *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
const GLint rowAr0 = rowA[j] & 0x3; |
const GLint rowAr1 = rowA[k] & 0x3; |
const GLint rowBr0 = rowB[j] & 0x3; |
const GLint rowBr1 = rowB[k] & 0x3; |
const GLint rowAg0 = (rowA[j] >> 2) & 0x7; |
const GLint rowAg1 = (rowA[k] >> 2) & 0x7; |
const GLint rowBg0 = (rowB[j] >> 2) & 0x7; |
const GLint rowBg1 = (rowB[k] >> 2) & 0x7; |
const GLint rowAb0 = (rowA[j] >> 5) & 0x7; |
const GLint rowAb1 = (rowA[k] >> 5) & 0x7; |
const GLint rowBb0 = (rowB[j] >> 5) & 0x7; |
const GLint rowBb1 = (rowB[k] >> 5) & 0x7; |
const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 4; |
const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 4; |
const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 4; |
dst[i] = (blue << 5) | (green << 2) | red; |
} |
} |
return; |
case MESA_FORMAT_A8: |
case MESA_FORMAT_L8: |
case MESA_FORMAT_I8: |
case MESA_FORMAT_CI8: |
{ |
GLuint i, j, k; |
const GLubyte *rowA = (const GLubyte *) srcRowA; |
const GLubyte *rowB = (const GLubyte *) srcRowB; |
GLubyte *dst = (GLubyte *) dstRow; |
for (i = j = 0, k = k0; i < (GLuint) dstWidth; |
i++, j += colStride, k += colStride) { |
dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; |
} |
} |
return; |
default: |
_mesa_problem(NULL, "bad format in do_row()"); |
} |
} |
/* |
* These functions generate a 1/2-size mipmap image from a source image. |
* Texture borders are handled by copying or averaging the source image's |
* border texels, depending on the scale-down factor. |
*/ |
static void |
make_1d_mipmap(const struct gl_texture_format *format, GLint border, |
GLint srcWidth, const GLubyte *srcPtr, |
GLint dstWidth, GLubyte *dstPtr) |
{ |
const GLint bpt = format->TexelBytes; |
const GLubyte *src; |
GLubyte *dst; |
/* skip the border pixel, if any */ |
src = srcPtr + border * bpt; |
dst = dstPtr + border * bpt; |
/* we just duplicate the input row, kind of hack, saves code */ |
do_row(format, srcWidth - 2 * border, src, src, |
dstWidth - 2 * border, dst); |
if (border) { |
/* copy left-most pixel from source */ |
MEMCPY(dstPtr, srcPtr, bpt); |
/* copy right-most pixel from source */ |
MEMCPY(dstPtr + (dstWidth - 1) * bpt, |
srcPtr + (srcWidth - 1) * bpt, |
bpt); |
} |
} |
static void |
make_2d_mipmap(const struct gl_texture_format *format, GLint border, |
GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, |
GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) |
{ |
const GLint bpt = format->TexelBytes; |
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ |
const GLint dstWidthNB = dstWidth - 2 * border; |
const GLint dstHeightNB = dstHeight - 2 * border; |
const GLint srcRowStride = bpt * srcWidth; |
const GLint dstRowStride = bpt * dstWidth; |
const GLubyte *srcA, *srcB; |
GLubyte *dst; |
GLint row, colStride; |
colStride = (srcWidth == dstWidth) ? 1 : 2; |
/* Compute src and dst pointers, skipping any border */ |
srcA = srcPtr + border * ((srcWidth + 1) * bpt); |
if (srcHeight > 1) |
srcB = srcA + srcRowStride; |
else |
srcB = srcA; |
dst = dstPtr + border * ((dstWidth + 1) * bpt); |
for (row = 0; row < dstHeightNB; row++) { |
do_row(format, srcWidthNB, srcA, srcB, |
dstWidthNB, dst); |
srcA += 2 * srcRowStride; |
srcB += 2 * srcRowStride; |
dst += dstRowStride; |
} |
/* This is ugly but probably won't be used much */ |
if (border > 0) { |
/* fill in dest border */ |
/* lower-left border pixel */ |
MEMCPY(dstPtr, srcPtr, bpt); |
/* lower-right border pixel */ |
MEMCPY(dstPtr + (dstWidth - 1) * bpt, |
srcPtr + (srcWidth - 1) * bpt, bpt); |
/* upper-left border pixel */ |
MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt, |
srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt); |
/* upper-right border pixel */ |
MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt, |
srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt); |
/* lower border */ |
do_row(format, srcWidthNB, |
srcPtr + bpt, |
srcPtr + bpt, |
dstWidthNB, dstPtr + bpt); |
/* upper border */ |
do_row(format, srcWidthNB, |
srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, |
srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, |
dstWidthNB, |
dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt); |
/* left and right borders */ |
if (srcHeight == dstHeight) { |
/* copy border pixel from src to dst */ |
for (row = 1; row < srcHeight; row++) { |
MEMCPY(dstPtr + dstWidth * row * bpt, |
srcPtr + srcWidth * row * bpt, bpt); |
MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt, |
srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt); |
} |
} |
else { |
/* average two src pixels each dest pixel */ |
for (row = 0; row < dstHeightNB; row += 2) { |
do_row(format, 1, |
srcPtr + (srcWidth * (row * 2 + 1)) * bpt, |
srcPtr + (srcWidth * (row * 2 + 2)) * bpt, |
1, dstPtr + (dstWidth * row + 1) * bpt); |
do_row(format, 1, |
srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt, |
srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt, |
1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt); |
} |
} |
} |
} |
static void |
make_3d_mipmap(const struct gl_texture_format *format, GLint border, |
GLint srcWidth, GLint srcHeight, GLint srcDepth, |
const GLubyte *srcPtr, |
GLint dstWidth, GLint dstHeight, GLint dstDepth, |
GLubyte *dstPtr) |
{ |
const GLint bpt = format->TexelBytes; |
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ |
const GLint srcDepthNB = srcDepth - 2 * border; |
const GLint dstWidthNB = dstWidth - 2 * border; |
const GLint dstHeightNB = dstHeight - 2 * border; |
const GLint dstDepthNB = dstDepth - 2 * border; |
GLvoid *tmpRowA, *tmpRowB; |
GLint img, row; |
GLint bytesPerSrcImage, bytesPerDstImage; |
GLint bytesPerSrcRow, bytesPerDstRow; |
GLint srcImageOffset, srcRowOffset; |
(void) srcDepthNB; /* silence warnings */ |
/* Need two temporary row buffers */ |
tmpRowA = MALLOC(srcWidth * bpt); |
if (!tmpRowA) |
return; |
tmpRowB = MALLOC(srcWidth * bpt); |
if (!tmpRowB) { |
FREE(tmpRowA); |
return; |
} |
bytesPerSrcImage = srcWidth * srcHeight * bpt; |
bytesPerDstImage = dstWidth * dstHeight * bpt; |
bytesPerSrcRow = srcWidth * bpt; |
bytesPerDstRow = dstWidth * bpt; |
/* Offset between adjacent src images to be averaged together */ |
srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; |
/* Offset between adjacent src rows to be averaged together */ |
srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt; |
/* |
* Need to average together up to 8 src pixels for each dest pixel. |
* Break that down into 3 operations: |
* 1. take two rows from source image and average them together. |
* 2. take two rows from next source image and average them together. |
* 3. take the two averaged rows and average them for the final dst row. |
*/ |
/* |
_mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n", |
srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth); |
*/ |
for (img = 0; img < dstDepthNB; img++) { |
/* first source image pointer, skipping border */ |
const GLubyte *imgSrcA = srcPtr |
+ (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border |
+ img * (bytesPerSrcImage + srcImageOffset); |
/* second source image pointer, skipping border */ |
const GLubyte *imgSrcB = imgSrcA + srcImageOffset; |
/* address of the dest image, skipping border */ |
GLubyte *imgDst = dstPtr |
+ (bytesPerDstImage + bytesPerDstRow + border) * bpt * border |
+ img * bytesPerDstImage; |
/* setup the four source row pointers and the dest row pointer */ |
const GLubyte *srcImgARowA = imgSrcA; |
const GLubyte *srcImgARowB = imgSrcA + srcRowOffset; |
const GLubyte *srcImgBRowA = imgSrcB; |
const GLubyte *srcImgBRowB = imgSrcB + srcRowOffset; |
GLubyte *dstImgRow = imgDst; |
for (row = 0; row < dstHeightNB; row++) { |
/* Average together two rows from first src image */ |
do_row(format, srcWidthNB, srcImgARowA, srcImgARowB, |
srcWidthNB, tmpRowA); |
/* Average together two rows from second src image */ |
do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB, |
srcWidthNB, tmpRowB); |
/* Average together the temp rows to make the final row */ |
do_row(format, srcWidthNB, tmpRowA, tmpRowB, |
dstWidthNB, dstImgRow); |
/* advance to next rows */ |
srcImgARowA += bytesPerSrcRow + srcRowOffset; |
srcImgARowB += bytesPerSrcRow + srcRowOffset; |
srcImgBRowA += bytesPerSrcRow + srcRowOffset; |
srcImgBRowB += bytesPerSrcRow + srcRowOffset; |
dstImgRow += bytesPerDstRow; |
} |
} |
FREE(tmpRowA); |
FREE(tmpRowB); |
/* Luckily we can leverage the make_2d_mipmap() function here! */ |
if (border > 0) { |
/* do front border image */ |
make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr, |
dstWidth, dstHeight, dstPtr); |
/* do back border image */ |
make_2d_mipmap(format, 1, srcWidth, srcHeight, |
srcPtr + bytesPerSrcImage * (srcDepth - 1), |
dstWidth, dstHeight, |
dstPtr + bytesPerDstImage * (dstDepth - 1)); |
/* do four remaining border edges that span the image slices */ |
if (srcDepth == dstDepth) { |
/* just copy border pixels from src to dst */ |
for (img = 0; img < dstDepthNB; img++) { |
const GLubyte *src; |
GLubyte *dst; |
/* do border along [img][row=0][col=0] */ |
src = srcPtr + (img + 1) * bytesPerSrcImage; |
dst = dstPtr + (img + 1) * bytesPerDstImage; |
MEMCPY(dst, src, bpt); |
/* do border along [img][row=dstHeight-1][col=0] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (srcHeight - 1) * bytesPerSrcRow; |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (dstHeight - 1) * bytesPerDstRow; |
MEMCPY(dst, src, bpt); |
/* do border along [img][row=0][col=dstWidth-1] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (srcWidth - 1) * bpt; |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (dstWidth - 1) * bpt; |
MEMCPY(dst, src, bpt); |
/* do border along [img][row=dstHeight-1][col=dstWidth-1] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (bytesPerSrcImage - bpt); |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (bytesPerDstImage - bpt); |
MEMCPY(dst, src, bpt); |
} |
} |
else { |
/* average border pixels from adjacent src image pairs */ |
ASSERT(srcDepthNB == 2 * dstDepthNB); |
for (img = 0; img < dstDepthNB; img++) { |
const GLubyte *src; |
GLubyte *dst; |
/* do border along [img][row=0][col=0] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage; |
dst = dstPtr + (img + 1) * bytesPerDstImage; |
do_row(format, 1, src, src + srcImageOffset, 1, dst); |
/* do border along [img][row=dstHeight-1][col=0] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (srcHeight - 1) * bytesPerSrcRow; |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (dstHeight - 1) * bytesPerDstRow; |
do_row(format, 1, src, src + srcImageOffset, 1, dst); |
/* do border along [img][row=0][col=dstWidth-1] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (srcWidth - 1) * bpt; |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (dstWidth - 1) * bpt; |
do_row(format, 1, src, src + srcImageOffset, 1, dst); |
/* do border along [img][row=dstHeight-1][col=dstWidth-1] */ |
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage |
+ (bytesPerSrcImage - bpt); |
dst = dstPtr + (img + 1) * bytesPerDstImage |
+ (bytesPerDstImage - bpt); |
do_row(format, 1, src, src + srcImageOffset, 1, dst); |
} |
} |
} |
} |
/* |
* For GL_SGIX_generate_mipmap: |
* Generate a complete set of mipmaps from texObj's base-level image. |
* Stop at texObj's MaxLevel or when we get to the 1x1 texture. |
*/ |
void |
_mesa_generate_mipmap(GLcontext *ctx, GLenum target, |
const struct gl_texture_unit *texUnit, |
struct gl_texture_object *texObj) |
{ |
const struct gl_texture_image *srcImage; |
const struct gl_texture_format *convertFormat; |
const GLubyte *srcData; |
GLubyte *dstData; |
GLint level, maxLevels; |
ASSERT(texObj); |
srcImage = texObj->Image[texObj->BaseLevel]; |
ASSERT(srcImage); |
maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); |
ASSERT(maxLevels > 0); /* bad target */ |
/* Find convertFormat - the format that do_row() will process */ |
if (srcImage->IsCompressed) { |
/* setup for compressed textures */ |
GLuint row; |
GLint components, size; |
GLchan *dst; |
assert(texObj->Target == GL_TEXTURE_2D); |
if (srcImage->Format == GL_RGB) { |
convertFormat = &_mesa_texformat_rgb; |
components = 3; |
} |
else if (srcImage->Format == GL_RGBA) { |
convertFormat = &_mesa_texformat_rgba; |
components = 4; |
} |
else { |
_mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps"); |
return; |
} |
/* allocate storage for uncompressed GL_RGB or GL_RGBA images */ |
size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) |
* srcImage->Width * srcImage->Height * srcImage->Depth + 20; |
/* 20 extra bytes, just be safe when calling last FetchTexel */ |
srcData = MALLOC(size); |
if (!srcData) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); |
return; |
} |
dstData = MALLOC(size / 2); /* 1/4 would probably be OK */ |
if (!dstData) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); |
FREE((void *) srcData); |
return; |
} |
/* decompress base image here */ |
dst = (GLchan *) srcData; |
for (row = 0; row < srcImage->Height; row++) { |
GLuint col; |
for (col = 0; col < srcImage->Width; col++) { |
(*srcImage->FetchTexel)(srcImage, col, row, 0, (GLvoid *) dst); |
dst += components; |
} |
} |
} |
else { |
/* uncompressed */ |
convertFormat = srcImage->TexFormat; |
} |
for (level = texObj->BaseLevel; level < texObj->MaxLevel |
&& level < maxLevels - 1; level++) { |
/* generate image[level+1] from image[level] */ |
const struct gl_texture_image *srcImage; |
struct gl_texture_image *dstImage; |
GLint srcWidth, srcHeight, srcDepth; |
GLint dstWidth, dstHeight, dstDepth; |
GLint border, bytesPerTexel; |
/* get src image parameters */ |
srcImage = texObj->Image[level]; |
ASSERT(srcImage); |
srcWidth = srcImage->Width; |
srcHeight = srcImage->Height; |
srcDepth = srcImage->Depth; |
border = srcImage->Border; |
/* compute next (level+1) image size */ |
if (srcWidth - 2 * border > 1) { |
dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; |
} |
else { |
dstWidth = srcWidth; /* can't go smaller */ |
} |
if (srcHeight - 2 * border > 1) { |
dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; |
} |
else { |
dstHeight = srcHeight; /* can't go smaller */ |
} |
if (srcDepth - 2 * border > 1) { |
dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; |
} |
else { |
dstDepth = srcDepth; /* can't go smaller */ |
} |
if (dstWidth == srcWidth && |
dstHeight == srcHeight && |
dstDepth == srcDepth) { |
/* all done */ |
if (srcImage->IsCompressed) { |
FREE((void *) srcData); |
FREE(dstData); |
} |
return; |
} |
/* get dest gl_texture_image */ |
dstImage = _mesa_select_tex_image(ctx, texUnit, target, level+1); |
if (!dstImage) { |
dstImage = _mesa_alloc_texture_image(); |
if (!dstImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); |
return; |
} |
_mesa_set_tex_image(texObj, target, level + 1, dstImage); |
} |
/* Free old image data */ |
if (dstImage->Data) |
MESA_PBUFFER_FREE(dstImage->Data); |
/* initialize new image */ |
_mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, |
dstDepth, border, srcImage->IntFormat); |
dstImage->DriverData = NULL; |
dstImage->TexFormat = srcImage->TexFormat; |
dstImage->FetchTexel = srcImage->FetchTexel; |
ASSERT(dstImage->TexFormat); |
ASSERT(dstImage->FetchTexel); |
/* Alloc new teximage data buffer. |
* Setup src and dest data pointers. |
*/ |
if (dstImage->IsCompressed) { |
ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/ |
dstImage->Data = MESA_PBUFFER_ALLOC(dstImage->CompressedSize); |
if (!dstImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); |
return; |
} |
/* srcData and dstData are already set */ |
ASSERT(srcData); |
ASSERT(dstData); |
} |
else { |
bytesPerTexel = srcImage->TexFormat->TexelBytes; |
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); |
dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth |
* bytesPerTexel); |
if (!dstImage->Data) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); |
return; |
} |
srcData = (const GLubyte *) srcImage->Data; |
dstData = (GLubyte *) dstImage->Data; |
} |
/* |
* We use simple 2x2 averaging to compute the next mipmap level. |
*/ |
switch (target) { |
case GL_TEXTURE_1D: |
make_1d_mipmap(convertFormat, border, |
srcWidth, srcData, |
dstWidth, dstData); |
break; |
case GL_TEXTURE_2D: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
make_2d_mipmap(convertFormat, border, |
srcWidth, srcHeight, srcData, |
dstWidth, dstHeight, dstData); |
break; |
case GL_TEXTURE_3D: |
make_3d_mipmap(convertFormat, border, |
srcWidth, srcHeight, srcDepth, srcData, |
dstWidth, dstHeight, dstDepth, dstData); |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
/* no mipmaps, do nothing */ |
break; |
default: |
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); |
return; |
} |
if (dstImage->IsCompressed) { |
GLubyte *temp; |
/* compress image from dstData into dstImage->Data */ |
const GLenum srcFormat = convertFormat->BaseFormat; |
GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat, |
dstWidth); |
ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); |
_mesa_compress_teximage(ctx, |
dstWidth, dstHeight, /* size */ |
srcFormat, /* source format */ |
dstData, /* source buffer */ |
dstWidth, /* source row stride */ |
dstImage->TexFormat, /* dest format */ |
dstImage->Data, /* dest buffer */ |
dstRowStride ); /* dest row stride */ |
/* swap src and dest pointers */ |
temp = (GLubyte *) srcData; |
srcData = dstData; |
dstData = temp; |
} |
} /* loop over mipmap levels */ |
} |
/shark/tags/rel_0_4/ports/mesa/src/drawpix.c |
---|
0,0 → 1,284 |
/* $Id: drawpix.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "colormac.h" |
#include "context.h" |
#include "drawpix.h" |
#include "feedback.h" |
#include "macros.h" |
#include "mmath.h" |
#include "state.h" |
#include "mtypes.h" |
/* |
* Execute glDrawPixels |
*/ |
void |
_mesa_DrawPixels( GLsizei width, GLsizei height, |
GLenum format, GLenum type, const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0" ); |
return; |
} |
if (ctx->RenderMode==GL_RENDER) { |
GLint x, y; |
if (!pixels || !ctx->Current.RasterPosValid) { |
return; |
} |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */ |
x = IROUND(ctx->Current.RasterPos[0]); |
y = IROUND(ctx->Current.RasterPos[1]); |
ctx->OcclusionResult = GL_TRUE; |
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, |
&ctx->Unpack, pixels); |
} |
else if (ctx->RenderMode==GL_FEEDBACK) { |
/* Feedback the current raster pos info */ |
if (ctx->Current.RasterPosValid) { |
FLUSH_CURRENT( ctx, 0 ); |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); |
_mesa_feedback_vertex( ctx, |
ctx->Current.RasterPos, |
ctx->Current.RasterColor, |
ctx->Current.RasterIndex, |
ctx->Current.RasterTexCoords[0] ); |
} |
} |
else if (ctx->RenderMode==GL_SELECT) { |
if (ctx->Current.RasterPosValid) { |
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); |
} |
} |
} |
void |
_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, |
GLenum format, GLenum type, GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glReadPixels(width=%d height=%d)", width, height ); |
return; |
} |
if (!pixels) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(pixels)" ); |
return; |
} |
if (ctx->NewState) |
_mesa_update_state(ctx); |
ctx->Driver.ReadPixels(ctx, x, y, width, height, |
format, type, &ctx->Pack, pixels); |
} |
void |
_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, |
GLenum type ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint destx, desty; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)" ); |
return; |
} |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
if (ctx->RenderMode==GL_RENDER) { |
/* Destination of copy: */ |
if (!ctx->Current.RasterPosValid) { |
return; |
} |
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */ |
destx = IROUND(ctx->Current.RasterPos[0]); |
desty = IROUND(ctx->Current.RasterPos[1]); |
ctx->OcclusionResult = GL_TRUE; |
ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, |
type ); |
} |
else if (ctx->RenderMode == GL_FEEDBACK) { |
if (ctx->Current.RasterPosValid) { |
FLUSH_CURRENT( ctx, 0 ); |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); |
_mesa_feedback_vertex( ctx, |
ctx->Current.RasterPos, |
ctx->Current.RasterColor, |
ctx->Current.RasterIndex, |
ctx->Current.RasterTexCoords[0] ); |
} |
} |
else if (ctx->RenderMode == GL_SELECT) { |
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); |
} |
} |
void |
_mesa_Bitmap( GLsizei width, GLsizei height, |
GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, |
const GLubyte *bitmap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" ); |
return; |
} |
if (ctx->Current.RasterPosValid == GL_FALSE) { |
return; /* do nothing */ |
} |
if (ctx->RenderMode==GL_RENDER) { |
if (bitmap) { |
/* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ |
GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); |
GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
ctx->OcclusionResult = GL_TRUE; |
ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); |
} |
} |
else if (ctx->RenderMode==GL_FEEDBACK) { |
if (ctx->Current.RasterPosValid) { |
FLUSH_CURRENT(ctx, 0); |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); |
_mesa_feedback_vertex( ctx, |
ctx->Current.RasterPos, |
ctx->Current.RasterColor, |
ctx->Current.RasterIndex, |
ctx->Current.RasterTexCoords[0] ); |
} |
} |
else if (ctx->RenderMode==GL_SELECT) { |
/* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */ |
} |
/* update raster position */ |
ctx->Current.RasterPos[0] += xmove; |
ctx->Current.RasterPos[1] += ymove; |
} |
#if 0 /* experimental */ |
/* |
* Execute glDrawDepthPixelsMESA(). This function accepts both a color |
* image and depth (Z) image. Rasterization produces fragments with |
* color and Z taken from these images. This function is intended for |
* Z-compositing. Normally, this operation requires two glDrawPixels |
* calls with stencil testing. |
*/ |
void |
_mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, |
GLenum colorFormat, GLenum colorType, |
const GLvoid *colors, |
GLenum depthType, const GLvoid *depths ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glDrawDepthPixelsMESA(width or height < 0" ); |
return; |
} |
if (ctx->RenderMode==GL_RENDER) { |
GLint x, y; |
if (!colors || !depths || !ctx->Current.RasterPosValid) { |
return; |
} |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
/* Round, to satisfy conformance tests (matches SGI's OpenGL) */ |
x = IROUND(ctx->Current.RasterPos[0]); |
y = IROUND(ctx->Current.RasterPos[1]); |
ctx->OcclusionResult = GL_TRUE; |
ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height, |
colorFormat, colorType, colors, |
depthType, depths, &ctx->Unpack); |
} |
else if (ctx->RenderMode==GL_FEEDBACK) { |
/* Feedback the current raster pos info */ |
if (ctx->Current.RasterPosValid) { |
FLUSH_CURRENT( ctx, 0 ); |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); |
_mesa_feedback_vertex( ctx, |
ctx->Current.RasterPos, |
ctx->Current.RasterColor, |
ctx->Current.RasterIndex, |
ctx->Current.RasterTexCoords[0] ); |
} |
} |
else if (ctx->RenderMode==GL_SELECT) { |
if (ctx->Current.RasterPosValid) { |
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); |
} |
} |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/dlist.c |
---|
0,0 → 1,6485 |
/* $Id: dlist.c,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "api_loopback.h" |
#include "attrib.h" |
#include "blend.h" |
#include "buffers.h" |
#include "clip.h" |
#include "colormac.h" |
#include "colortab.h" |
#include "context.h" |
#include "convolve.h" |
#include "depth.h" |
#include "dlist.h" |
#include "enable.h" |
#include "enums.h" |
#include "eval.h" |
#include "extensions.h" |
#include "feedback.h" |
#include "get.h" |
#include "glapi.h" |
#include "hash.h" |
#include "histogram.h" |
#include "image.h" |
#include "light.h" |
#include "lines.h" |
#include "dlist.h" |
#include "macros.h" |
#include "matrix.h" |
#include "pixel.h" |
#include "points.h" |
#include "polygon.h" |
#include "state.h" |
#include "texobj.h" |
#include "teximage.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "varray.h" |
#if FEATURE_NV_vertex_program |
#include "vpstate.h" |
#endif |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
/* |
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. |
*/ |
#define BLOCK_SIZE 256 |
/* |
* 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, |
OPCODE_ALPHA_FUNC, |
OPCODE_BIND_TEXTURE, |
OPCODE_BITMAP, |
OPCODE_BLEND_COLOR, |
OPCODE_BLEND_EQUATION, |
OPCODE_BLEND_FUNC, |
OPCODE_BLEND_FUNC_SEPARATE, |
OPCODE_CALL_LIST, |
OPCODE_CALL_LIST_OFFSET, |
OPCODE_CLEAR, |
OPCODE_CLEAR_ACCUM, |
OPCODE_CLEAR_COLOR, |
OPCODE_CLEAR_DEPTH, |
OPCODE_CLEAR_INDEX, |
OPCODE_CLEAR_STENCIL, |
OPCODE_CLIP_PLANE, |
OPCODE_COLOR_MASK, |
OPCODE_COLOR_MATERIAL, |
OPCODE_COLOR_TABLE, |
OPCODE_COLOR_TABLE_PARAMETER_FV, |
OPCODE_COLOR_TABLE_PARAMETER_IV, |
OPCODE_COLOR_SUB_TABLE, |
OPCODE_CONVOLUTION_FILTER_1D, |
OPCODE_CONVOLUTION_FILTER_2D, |
OPCODE_CONVOLUTION_PARAMETER_I, |
OPCODE_CONVOLUTION_PARAMETER_IV, |
OPCODE_CONVOLUTION_PARAMETER_F, |
OPCODE_CONVOLUTION_PARAMETER_FV, |
OPCODE_COPY_COLOR_SUB_TABLE, |
OPCODE_COPY_COLOR_TABLE, |
OPCODE_COPY_PIXELS, |
OPCODE_COPY_TEX_IMAGE1D, |
OPCODE_COPY_TEX_IMAGE2D, |
OPCODE_COPY_TEX_SUB_IMAGE1D, |
OPCODE_COPY_TEX_SUB_IMAGE2D, |
OPCODE_COPY_TEX_SUB_IMAGE3D, |
OPCODE_CULL_FACE, |
OPCODE_DEPTH_FUNC, |
OPCODE_DEPTH_MASK, |
OPCODE_DEPTH_RANGE, |
OPCODE_DISABLE, |
OPCODE_DRAW_BUFFER, |
OPCODE_DRAW_PIXELS, |
OPCODE_ENABLE, |
OPCODE_EVALMESH1, |
OPCODE_EVALMESH2, |
OPCODE_FOG, |
OPCODE_FRONT_FACE, |
OPCODE_FRUSTUM, |
OPCODE_HINT, |
OPCODE_HISTOGRAM, |
OPCODE_INDEX_MASK, |
OPCODE_INIT_NAMES, |
OPCODE_LIGHT, |
OPCODE_LIGHT_MODEL, |
OPCODE_LINE_STIPPLE, |
OPCODE_LINE_WIDTH, |
OPCODE_LIST_BASE, |
OPCODE_LOAD_IDENTITY, |
OPCODE_LOAD_MATRIX, |
OPCODE_LOAD_NAME, |
OPCODE_LOGIC_OP, |
OPCODE_MAP1, |
OPCODE_MAP2, |
OPCODE_MAPGRID1, |
OPCODE_MAPGRID2, |
OPCODE_MATRIX_MODE, |
OPCODE_MIN_MAX, |
OPCODE_MULT_MATRIX, |
OPCODE_ORTHO, |
OPCODE_PASSTHROUGH, |
OPCODE_PIXEL_MAP, |
OPCODE_PIXEL_TRANSFER, |
OPCODE_PIXEL_ZOOM, |
OPCODE_POINT_SIZE, |
OPCODE_POINT_PARAMETERS, |
OPCODE_POLYGON_MODE, |
OPCODE_POLYGON_STIPPLE, |
OPCODE_POLYGON_OFFSET, |
OPCODE_POP_ATTRIB, |
OPCODE_POP_MATRIX, |
OPCODE_POP_NAME, |
OPCODE_PRIORITIZE_TEXTURE, |
OPCODE_PUSH_ATTRIB, |
OPCODE_PUSH_MATRIX, |
OPCODE_PUSH_NAME, |
OPCODE_RASTER_POS, |
OPCODE_READ_BUFFER, |
OPCODE_RESET_HISTOGRAM, |
OPCODE_RESET_MIN_MAX, |
OPCODE_ROTATE, |
OPCODE_SCALE, |
OPCODE_SCISSOR, |
OPCODE_SELECT_TEXTURE_SGIS, |
OPCODE_SELECT_TEXTURE_COORD_SET, |
OPCODE_SHADE_MODEL, |
OPCODE_STENCIL_FUNC, |
OPCODE_STENCIL_MASK, |
OPCODE_STENCIL_OP, |
OPCODE_TEXENV, |
OPCODE_TEXGEN, |
OPCODE_TEXPARAMETER, |
OPCODE_TEX_IMAGE1D, |
OPCODE_TEX_IMAGE2D, |
OPCODE_TEX_IMAGE3D, |
OPCODE_TEX_SUB_IMAGE1D, |
OPCODE_TEX_SUB_IMAGE2D, |
OPCODE_TEX_SUB_IMAGE3D, |
OPCODE_TRANSLATE, |
OPCODE_VIEWPORT, |
OPCODE_WINDOW_POS, |
/* GL_ARB_multitexture */ |
OPCODE_ACTIVE_TEXTURE, |
/* GL_SGIX/SGIS_pixel_texture */ |
OPCODE_PIXEL_TEXGEN_SGIX, |
OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, |
/* GL_ARB_texture_compression */ |
OPCODE_COMPRESSED_TEX_IMAGE_1D, |
OPCODE_COMPRESSED_TEX_IMAGE_2D, |
OPCODE_COMPRESSED_TEX_IMAGE_3D, |
OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, |
OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, |
OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, |
/* GL_ARB_multisample */ |
OPCODE_SAMPLE_COVERAGE, |
/* GL_ARB_window_pos */ |
OPCODE_WINDOW_POS_ARB, |
/* GL_NV_vertex_program */ |
OPCODE_BIND_PROGRAM_NV, |
OPCODE_EXECUTE_PROGRAM_NV, |
OPCODE_REQUEST_PROGRAMS_RESIDENT_NV, |
OPCODE_LOAD_PROGRAM_NV, |
OPCODE_PROGRAM_PARAMETER4F_NV, |
OPCODE_TRACK_MATRIX_NV, |
/* GL_EXT_stencil_two_side */ |
OPCODE_ACTIVE_STENCIL_FACE_EXT, |
/* The following three are meta instructions */ |
OPCODE_ERROR, /* raise compiled-in error */ |
OPCODE_CONTINUE, |
OPCODE_END_OF_LIST, |
OPCODE_DRV_0 |
} OpCode; |
/* |
* 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. |
*/ |
union node { |
OpCode opcode; |
GLboolean b; |
GLbitfield bf; |
GLubyte ub; |
GLshort s; |
GLushort us; |
GLint i; |
GLuint ui; |
GLenum e; |
GLfloat f; |
GLvoid *data; |
void *next; /* If prev node's opcode==OPCODE_CONTINUE */ |
}; |
/* 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 ]; |
void mesa_print_display_list( GLuint list ); |
/**********************************************************************/ |
/***** Private *****/ |
/**********************************************************************/ |
/* |
* Make an empty display list. This is used by glGenLists() to |
* reserver display list IDs. |
*/ |
static Node *make_empty_list( void ) |
{ |
Node *n = (Node *) MALLOC( sizeof(Node) ); |
n[0].opcode = OPCODE_END_OF_LIST; |
return n; |
} |
/* |
* Destroy all nodes in a display list. |
* Input: list - display list number |
*/ |
void _mesa_destroy_list( GLcontext *ctx, GLuint list ) |
{ |
Node *n, *block; |
GLboolean done; |
if (list==0) |
return; |
block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); |
n = block; |
done = block ? GL_FALSE : GL_TRUE; |
while (!done) { |
/* check for extension opcodes first */ |
GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0; |
if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) { |
ctx->listext.opcode[i].destroy(ctx, &n[1]); |
n += ctx->listext.opcode[i].size; |
} |
else { |
switch (n[0].opcode) { |
case OPCODE_MAP1: |
FREE(n[6].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_MAP2: |
FREE(n[10].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_DRAW_PIXELS: |
FREE( n[5].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_BITMAP: |
FREE( n[7].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COLOR_TABLE: |
FREE( n[6].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COLOR_SUB_TABLE: |
FREE( n[6].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_CONVOLUTION_FILTER_1D: |
FREE( n[6].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_CONVOLUTION_FILTER_2D: |
FREE( n[7].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_POLYGON_STIPPLE: |
FREE( n[1].data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_IMAGE1D: |
FREE(n[8].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_IMAGE2D: |
FREE( n[9]. data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_IMAGE3D: |
FREE( n[10]. data ); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_SUB_IMAGE1D: |
FREE(n[7].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_SUB_IMAGE2D: |
FREE(n[9].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_TEX_SUB_IMAGE3D: |
FREE(n[11].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_1D: |
FREE(n[7].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_2D: |
FREE(n[8].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_3D: |
FREE(n[9].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: |
FREE(n[7].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: |
FREE(n[9].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: |
FREE(n[11].data); |
n += InstSize[n[0].opcode]; |
break; |
case OPCODE_CONTINUE: |
n = (Node *) n[1].next; |
FREE( block ); |
block = n; |
break; |
case OPCODE_END_OF_LIST: |
FREE( block ); |
done = GL_TRUE; |
break; |
default: |
/* Most frequent case */ |
n += InstSize[n[0].opcode]; |
break; |
} |
} |
} |
_mesa_HashRemove(ctx->Shared->DisplayList, list); |
} |
/* |
* Translate the nth element of list from type to GLuint. |
*/ |
static GLuint translate_id( GLsizei n, GLenum type, const GLvoid *list ) |
{ |
GLbyte *bptr; |
GLubyte *ubptr; |
GLshort *sptr; |
GLushort *usptr; |
GLint *iptr; |
GLuint *uiptr; |
GLfloat *fptr; |
switch (type) { |
case GL_BYTE: |
bptr = (GLbyte *) list; |
return (GLuint) *(bptr+n); |
case GL_UNSIGNED_BYTE: |
ubptr = (GLubyte *) list; |
return (GLuint) *(ubptr+n); |
case GL_SHORT: |
sptr = (GLshort *) list; |
return (GLuint) *(sptr+n); |
case GL_UNSIGNED_SHORT: |
usptr = (GLushort *) list; |
return (GLuint) *(usptr+n); |
case GL_INT: |
iptr = (GLint *) list; |
return (GLuint) *(iptr+n); |
case GL_UNSIGNED_INT: |
uiptr = (GLuint *) list; |
return (GLuint) *(uiptr+n); |
case GL_FLOAT: |
fptr = (GLfloat *) list; |
return (GLuint) *(fptr+n); |
case GL_2_BYTES: |
ubptr = ((GLubyte *) list) + 2*n; |
return (GLuint) *ubptr * 256 + (GLuint) *(ubptr+1); |
case GL_3_BYTES: |
ubptr = ((GLubyte *) list) + 3*n; |
return (GLuint) *ubptr * 65536 |
+ (GLuint) *(ubptr+1) * 256 |
+ (GLuint) *(ubptr+2); |
case GL_4_BYTES: |
ubptr = ((GLubyte *) list) + 4*n; |
return (GLuint) *ubptr * 16777216 |
+ (GLuint) *(ubptr+1) * 65536 |
+ (GLuint) *(ubptr+2) * 256 |
+ (GLuint) *(ubptr+3); |
default: |
return 0; |
} |
} |
/**********************************************************************/ |
/***** Public *****/ |
/**********************************************************************/ |
void _mesa_init_lists( void ) |
{ |
static int init_flag = 0; |
if (init_flag==0) { |
InstSize[OPCODE_ACCUM] = 3; |
InstSize[OPCODE_ALPHA_FUNC] = 3; |
InstSize[OPCODE_BIND_TEXTURE] = 3; |
InstSize[OPCODE_BITMAP] = 8; |
InstSize[OPCODE_BLEND_COLOR] = 5; |
InstSize[OPCODE_BLEND_EQUATION] = 2; |
InstSize[OPCODE_BLEND_FUNC] = 3; |
InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; |
InstSize[OPCODE_CALL_LIST] = 2; |
InstSize[OPCODE_CALL_LIST_OFFSET] = 3; |
InstSize[OPCODE_CLEAR] = 2; |
InstSize[OPCODE_CLEAR_ACCUM] = 5; |
InstSize[OPCODE_CLEAR_COLOR] = 5; |
InstSize[OPCODE_CLEAR_DEPTH] = 2; |
InstSize[OPCODE_CLEAR_INDEX] = 2; |
InstSize[OPCODE_CLEAR_STENCIL] = 2; |
InstSize[OPCODE_CLIP_PLANE] = 6; |
InstSize[OPCODE_COLOR_MASK] = 5; |
InstSize[OPCODE_COLOR_MATERIAL] = 3; |
InstSize[OPCODE_COLOR_TABLE] = 7; |
InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7; |
InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7; |
InstSize[OPCODE_COLOR_SUB_TABLE] = 7; |
InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7; |
InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8; |
InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4; |
InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7; |
InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4; |
InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7; |
InstSize[OPCODE_COPY_PIXELS] = 6; |
InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6; |
InstSize[OPCODE_COPY_COLOR_TABLE] = 6; |
InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8; |
InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9; |
InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7; |
InstSize[OPCODE_COPY_TEX_SUB_IMAGE2D] = 9; |
InstSize[OPCODE_COPY_TEX_SUB_IMAGE3D] = 10; |
InstSize[OPCODE_CULL_FACE] = 2; |
InstSize[OPCODE_DEPTH_FUNC] = 2; |
InstSize[OPCODE_DEPTH_MASK] = 2; |
InstSize[OPCODE_DEPTH_RANGE] = 3; |
InstSize[OPCODE_DISABLE] = 2; |
InstSize[OPCODE_DRAW_BUFFER] = 2; |
InstSize[OPCODE_DRAW_PIXELS] = 6; |
InstSize[OPCODE_ENABLE] = 2; |
InstSize[OPCODE_EVALMESH1] = 4; |
InstSize[OPCODE_EVALMESH2] = 6; |
InstSize[OPCODE_FOG] = 6; |
InstSize[OPCODE_FRONT_FACE] = 2; |
InstSize[OPCODE_FRUSTUM] = 7; |
InstSize[OPCODE_HINT] = 3; |
InstSize[OPCODE_HISTOGRAM] = 5; |
InstSize[OPCODE_INDEX_MASK] = 2; |
InstSize[OPCODE_INIT_NAMES] = 1; |
InstSize[OPCODE_LIGHT] = 7; |
InstSize[OPCODE_LIGHT_MODEL] = 6; |
InstSize[OPCODE_LINE_STIPPLE] = 3; |
InstSize[OPCODE_LINE_WIDTH] = 2; |
InstSize[OPCODE_LIST_BASE] = 2; |
InstSize[OPCODE_LOAD_IDENTITY] = 1; |
InstSize[OPCODE_LOAD_MATRIX] = 17; |
InstSize[OPCODE_LOAD_NAME] = 2; |
InstSize[OPCODE_LOGIC_OP] = 2; |
InstSize[OPCODE_MAP1] = 7; |
InstSize[OPCODE_MAP2] = 11; |
InstSize[OPCODE_MAPGRID1] = 4; |
InstSize[OPCODE_MAPGRID2] = 7; |
InstSize[OPCODE_MATRIX_MODE] = 2; |
InstSize[OPCODE_MIN_MAX] = 4; |
InstSize[OPCODE_MULT_MATRIX] = 17; |
InstSize[OPCODE_ORTHO] = 7; |
InstSize[OPCODE_PASSTHROUGH] = 2; |
InstSize[OPCODE_PIXEL_MAP] = 4; |
InstSize[OPCODE_PIXEL_TRANSFER] = 3; |
InstSize[OPCODE_PIXEL_ZOOM] = 3; |
InstSize[OPCODE_POINT_SIZE] = 2; |
InstSize[OPCODE_POINT_PARAMETERS] = 5; |
InstSize[OPCODE_POLYGON_MODE] = 3; |
InstSize[OPCODE_POLYGON_STIPPLE] = 2; |
InstSize[OPCODE_POLYGON_OFFSET] = 3; |
InstSize[OPCODE_POP_ATTRIB] = 1; |
InstSize[OPCODE_POP_MATRIX] = 1; |
InstSize[OPCODE_POP_NAME] = 1; |
InstSize[OPCODE_PRIORITIZE_TEXTURE] = 3; |
InstSize[OPCODE_PUSH_ATTRIB] = 2; |
InstSize[OPCODE_PUSH_MATRIX] = 1; |
InstSize[OPCODE_PUSH_NAME] = 2; |
InstSize[OPCODE_RASTER_POS] = 5; |
InstSize[OPCODE_READ_BUFFER] = 2; |
InstSize[OPCODE_RESET_HISTOGRAM] = 2; |
InstSize[OPCODE_RESET_MIN_MAX] = 2; |
InstSize[OPCODE_ROTATE] = 5; |
InstSize[OPCODE_SCALE] = 4; |
InstSize[OPCODE_SCISSOR] = 5; |
InstSize[OPCODE_STENCIL_FUNC] = 4; |
InstSize[OPCODE_STENCIL_MASK] = 2; |
InstSize[OPCODE_STENCIL_OP] = 4; |
InstSize[OPCODE_SHADE_MODEL] = 2; |
InstSize[OPCODE_TEXENV] = 7; |
InstSize[OPCODE_TEXGEN] = 7; |
InstSize[OPCODE_TEXPARAMETER] = 7; |
InstSize[OPCODE_TEX_IMAGE1D] = 9; |
InstSize[OPCODE_TEX_IMAGE2D] = 10; |
InstSize[OPCODE_TEX_IMAGE3D] = 11; |
InstSize[OPCODE_TEX_SUB_IMAGE1D] = 8; |
InstSize[OPCODE_TEX_SUB_IMAGE2D] = 10; |
InstSize[OPCODE_TEX_SUB_IMAGE3D] = 12; |
InstSize[OPCODE_TRANSLATE] = 4; |
InstSize[OPCODE_VIEWPORT] = 5; |
InstSize[OPCODE_WINDOW_POS] = 5; |
InstSize[OPCODE_CONTINUE] = 2; |
InstSize[OPCODE_ERROR] = 3; |
InstSize[OPCODE_END_OF_LIST] = 1; |
/* GL_SGIX/SGIS_pixel_texture */ |
InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; |
InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3; |
/* GL_ARB_texture_compression */ |
InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8; |
InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9; |
InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10; |
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8; |
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10; |
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12; |
/* GL_ARB_multisample */ |
InstSize[OPCODE_SAMPLE_COVERAGE] = 3; |
/* GL_ARB_multitexture */ |
InstSize[OPCODE_ACTIVE_TEXTURE] = 2; |
/* GL_ARB_window_pos */ |
InstSize[OPCODE_WINDOW_POS_ARB] = 4; |
/* GL_NV_vertex_program */ |
InstSize[OPCODE_BIND_PROGRAM_NV] = 3; |
InstSize[OPCODE_EXECUTE_PROGRAM_NV] = 7; |
InstSize[OPCODE_REQUEST_PROGRAMS_RESIDENT_NV] = 2; |
InstSize[OPCODE_LOAD_PROGRAM_NV] = 4; |
InstSize[OPCODE_PROGRAM_PARAMETER4F_NV] = 7; |
InstSize[OPCODE_TRACK_MATRIX_NV] = 5; |
/* GL_EXT_stencil_two_side */ |
InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2; |
} |
init_flag = 1; |
} |
/* |
* Allocate space for a display list instruction. |
* Input: opcode - type of instruction |
* argcount - size in bytes of data required. |
* Return: pointer to the usable data area (not including the internal |
* opcode). |
*/ |
void * |
_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ) |
{ |
Node *n, *newblock; |
GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node); |
#ifdef DEBUG |
if (opcode < (int) OPCODE_DRV_0) { |
assert( count == InstSize[opcode] ); |
} |
#endif |
if (ctx->CurrentPos + count + 2 > BLOCK_SIZE) { |
/* This block is full. Allocate a new block and chain to it */ |
n = ctx->CurrentBlock + ctx->CurrentPos; |
n[0].opcode = OPCODE_CONTINUE; |
newblock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE ); |
if (!newblock) { |
_mesa_error( ctx, GL_OUT_OF_MEMORY, "Building display list" ); |
return NULL; |
} |
n[1].next = (Node *) newblock; |
ctx->CurrentBlock = newblock; |
ctx->CurrentPos = 0; |
} |
n = ctx->CurrentBlock + ctx->CurrentPos; |
ctx->CurrentPos += count; |
n[0].opcode = (OpCode) opcode; |
return (void *)&n[1]; |
} |
/* Allow modules and drivers to get their own opcodes. |
*/ |
int |
_mesa_alloc_opcode( GLcontext *ctx, |
GLuint sz, |
void (*execute)( GLcontext *, void * ), |
void (*destroy)( GLcontext *, void * ), |
void (*print)( GLcontext *, void * ) ) |
{ |
if (ctx->listext.nr_opcodes < GL_MAX_EXT_OPCODES) { |
GLuint i = ctx->listext.nr_opcodes++; |
ctx->listext.opcode[i].size = 1 + (sz + sizeof(Node) - 1)/sizeof(Node); |
ctx->listext.opcode[i].execute = execute; |
ctx->listext.opcode[i].destroy = destroy; |
ctx->listext.opcode[i].print = print; |
return i + OPCODE_DRV_0; |
} |
return -1; |
} |
/* Mimic the old behaviour of alloc_instruction: |
* - sz is in units of sizeof(Node) |
* - return value a pointer to sizeof(Node) before the actual |
* usable data area. |
*/ |
#define ALLOC_INSTRUCTION(ctx, opcode, sz) \ |
((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1) |
/* |
* Display List compilation functions |
*/ |
static void save_Accum( GLenum op, GLfloat value ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACCUM, 2 ); |
if (n) { |
n[1].e = op; |
n[2].f = value; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Accum)( op, value ); |
} |
} |
static void save_AlphaFunc( GLenum func, GLclampf ref ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ALPHA_FUNC, 2 ); |
if (n) { |
n[1].e = func; |
n[2].f = (GLfloat) ref; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->AlphaFunc)( func, ref ); |
} |
} |
static void save_BindTexture( GLenum target, GLuint texture ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_TEXTURE, 2 ); |
if (n) { |
n[1].e = target; |
n[2].ui = texture; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BindTexture)( target, texture ); |
} |
} |
static void save_Bitmap( GLsizei width, GLsizei height, |
GLfloat xorig, GLfloat yorig, |
GLfloat xmove, GLfloat ymove, |
const GLubyte *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack ); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BITMAP, 7 ); |
if (n) { |
n[1].i = (GLint) width; |
n[2].i = (GLint) height; |
n[3].f = xorig; |
n[4].f = yorig; |
n[5].f = xmove; |
n[6].f = ymove; |
n[7].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Bitmap)( width, height, |
xorig, yorig, xmove, ymove, pixels ); |
} |
} |
static void save_BlendEquation( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BlendEquation)( mode ); |
} |
} |
static void save_BlendFunc( GLenum sfactor, GLenum dfactor ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC, 2 ); |
if (n) { |
n[1].e = sfactor; |
n[2].e = dfactor; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BlendFunc)( sfactor, dfactor ); |
} |
} |
static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, |
GLenum sfactorA, GLenum dfactorA) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC_SEPARATE, 4 ); |
if (n) { |
n[1].e = sfactorRGB; |
n[2].e = dfactorRGB; |
n[3].e = sfactorA; |
n[4].e = dfactorA; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BlendFuncSeparateEXT)( sfactorRGB, dfactorRGB, |
sfactorA, dfactorA); |
} |
} |
static void save_BlendColor( GLfloat red, GLfloat green, |
GLfloat blue, GLfloat alpha ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_COLOR, 4 ); |
if (n) { |
n[1].f = red; |
n[2].f = green; |
n[3].f = blue; |
n[4].f = alpha; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BlendColor)( red, green, blue, alpha ); |
} |
} |
void _mesa_save_CallList( GLuint list ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 ); |
if (n) { |
n[1].ui = list; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CallList)( list ); |
} |
} |
void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
GLboolean typeErrorFlag; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
switch (type) { |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
case GL_2_BYTES: |
case GL_3_BYTES: |
case GL_4_BYTES: |
typeErrorFlag = GL_FALSE; |
break; |
default: |
typeErrorFlag = GL_TRUE; |
} |
for (i=0;i<n;i++) { |
GLuint list = translate_id( i, type, lists ); |
Node *n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST_OFFSET, 2 ); |
if (n) { |
n[1].ui = list; |
n[2].b = typeErrorFlag; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CallLists)( n, type, lists ); |
} |
} |
static void save_Clear( GLbitfield mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR, 1 ); |
if (n) { |
n[1].bf = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Clear)( mask ); |
} |
} |
static void save_ClearAccum( GLfloat red, GLfloat green, |
GLfloat blue, GLfloat alpha ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_ACCUM, 4 ); |
if (n) { |
n[1].f = red; |
n[2].f = green; |
n[3].f = blue; |
n[4].f = alpha; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClearAccum)( red, green, blue, alpha ); |
} |
} |
static void save_ClearColor( GLclampf red, GLclampf green, |
GLclampf blue, GLclampf alpha ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_COLOR, 4 ); |
if (n) { |
n[1].f = red; |
n[2].f = green; |
n[3].f = blue; |
n[4].f = alpha; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClearColor)( red, green, blue, alpha ); |
} |
} |
static void save_ClearDepth( GLclampd depth ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_DEPTH, 1 ); |
if (n) { |
n[1].f = (GLfloat) depth; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClearDepth)( depth ); |
} |
} |
static void save_ClearIndex( GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_INDEX, 1 ); |
if (n) { |
n[1].f = c; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClearIndex)( c ); |
} |
} |
static void save_ClearStencil( GLint s ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_STENCIL, 1 ); |
if (n) { |
n[1].i = s; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClearStencil)( s ); |
} |
} |
static void save_ClipPlane( GLenum plane, const GLdouble *equ ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIP_PLANE, 5 ); |
if (n) { |
n[1].e = plane; |
n[2].f = (GLfloat) equ[0]; |
n[3].f = (GLfloat) equ[1]; |
n[4].f = (GLfloat) equ[2]; |
n[5].f = (GLfloat) equ[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ClipPlane)( plane, equ ); |
} |
} |
static void save_ColorMask( GLboolean red, GLboolean green, |
GLboolean blue, GLboolean alpha ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MASK, 4 ); |
if (n) { |
n[1].b = red; |
n[2].b = green; |
n[3].b = blue; |
n[4].b = alpha; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorMask)( red, green, blue, alpha ); |
} |
} |
static void save_ColorMaterial( GLenum face, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 ); |
if (n) { |
n[1].e = face; |
n[2].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorMaterial)( face, mode ); |
} |
} |
static void save_ColorTable( GLenum target, GLenum internalFormat, |
GLsizei width, GLenum format, GLenum type, |
const GLvoid *table ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_1D || |
target == GL_PROXY_TEXTURE_2D || |
target == GL_PROXY_TEXTURE_3D || |
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { |
/* execute immediately */ |
(*ctx->Exec->ColorTable)( target, internalFormat, width, |
format, type, table ); |
} |
else { |
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, table, |
&ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = internalFormat; |
n[3].i = width; |
n[4].e = format; |
n[5].e = type; |
n[6].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorTable)( target, internalFormat, width, |
format, type, table ); |
} |
} |
} |
static void |
save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].f = params[0]; |
if (pname == GL_COLOR_TABLE_SGI || |
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || |
pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorTableParameterfv)( target, pname, params ); |
} |
} |
static void |
save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].i = params[0]; |
if (pname == GL_COLOR_TABLE_SGI || |
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || |
pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { |
n[4].i = params[1]; |
n[5].i = params[2]; |
n[6].i = params[3]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorTableParameteriv)( target, pname, params ); |
} |
} |
static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, |
GLenum format, GLenum type, |
const GLvoid *table) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLvoid *image = _mesa_unpack_image(count, 1, 1, format, type, table, |
&ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 ); |
if (n) { |
n[1].e = target; |
n[2].i = start; |
n[3].i = count; |
n[4].e = format; |
n[5].e = type; |
n[6].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ColorSubTable)(target, start, count, format, type, table); |
} |
} |
static void |
save_CopyColorSubTable(GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5 ); |
if (n) { |
n[1].e = target; |
n[2].i = start; |
n[3].i = x; |
n[4].i = y; |
n[5].i = width; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyColorSubTable)(target, start, x, y, width); |
} |
} |
static void |
save_CopyColorTable(GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_TABLE, 5 ); |
if (n) { |
n[1].e = target; |
n[2].e = internalformat; |
n[3].i = x; |
n[4].i = y; |
n[5].i = width; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyColorTable)(target, internalformat, x, y, width); |
} |
} |
static void |
save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, |
GLenum format, GLenum type, const GLvoid *filter) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter, |
&ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = internalFormat; |
n[3].i = width; |
n[4].e = format; |
n[5].e = type; |
n[6].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionFilter1D)( target, internalFormat, width, |
format, type, filter ); |
} |
} |
static void |
save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, |
GLsizei width, GLsizei height, GLenum format, |
GLenum type, const GLvoid *filter) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter, |
&ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 ); |
if (n) { |
n[1].e = target; |
n[2].e = internalFormat; |
n[3].i = width; |
n[4].i = height; |
n[5].e = format; |
n[6].e = type; |
n[7].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionFilter2D)( target, internalFormat, width, height, |
format, type, filter ); |
} |
} |
static void |
save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].i = param; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionParameteri)( target, pname, param ); |
} |
} |
static void |
save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].i = params[0]; |
if (pname == GL_CONVOLUTION_BORDER_COLOR || |
pname == GL_CONVOLUTION_FILTER_SCALE || |
pname == GL_CONVOLUTION_FILTER_BIAS) { |
n[4].i = params[1]; |
n[5].i = params[2]; |
n[6].i = params[3]; |
} |
else { |
n[4].i = n[5].i = n[6].i = 0; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionParameteriv)( target, pname, params ); |
} |
} |
static void |
save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].f = param; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionParameterf)( target, pname, param ); |
} |
} |
static void |
save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].f = params[0]; |
if (pname == GL_CONVOLUTION_BORDER_COLOR || |
pname == GL_CONVOLUTION_FILTER_SCALE || |
pname == GL_CONVOLUTION_FILTER_BIAS) { |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
else { |
n[4].f = n[5].f = n[6].f = 0.0F; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ConvolutionParameterfv)( target, pname, params ); |
} |
} |
static void |
save_CopyPixels( GLint x, GLint y, |
GLsizei width, GLsizei height, GLenum type ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_PIXELS, 5 ); |
if (n) { |
n[1].i = x; |
n[2].i = y; |
n[3].i = (GLint) width; |
n[4].i = (GLint) height; |
n[5].e = type; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyPixels)( x, y, width, height, type ); |
} |
} |
static void |
save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, |
GLint x, GLint y, GLsizei width, GLint border ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE1D, 7 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].e = internalformat; |
n[4].i = x; |
n[5].i = y; |
n[6].i = width; |
n[7].i = border; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyTexImage1D)( target, level, internalformat, |
x, y, width, border ); |
} |
} |
static void |
save_CopyTexImage2D( GLenum target, GLint level, |
GLenum internalformat, |
GLint x, GLint y, GLsizei width, |
GLsizei height, GLint border ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE2D, 8 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].e = internalformat; |
n[4].i = x; |
n[5].i = y; |
n[6].i = width; |
n[7].i = height; |
n[8].i = border; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyTexImage2D)( target, level, internalformat, |
x, y, width, height, border ); |
} |
} |
static void |
save_CopyTexSubImage1D( GLenum target, GLint level, |
GLint xoffset, GLint x, GLint y, |
GLsizei width ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = x; |
n[5].i = y; |
n[6].i = width; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyTexSubImage1D)( target, level, xoffset, x, y, width ); |
} |
} |
static void |
save_CopyTexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, |
GLsizei width, GLint height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = x; |
n[6].i = y; |
n[7].i = width; |
n[8].i = height; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyTexSubImage2D)( target, level, xoffset, yoffset, |
x, y, width, height ); |
} |
} |
static void |
save_CopyTexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint x, GLint y, |
GLsizei width, GLint height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = zoffset; |
n[6].i = x; |
n[7].i = y; |
n[8].i = width; |
n[9].i = height; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CopyTexSubImage3D)( target, level, |
xoffset, yoffset, zoffset, |
x, y, width, height ); |
} |
} |
static void save_CullFace( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_CULL_FACE, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CullFace)( mode ); |
} |
} |
static void save_DepthFunc( GLenum func ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_FUNC, 1 ); |
if (n) { |
n[1].e = func; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->DepthFunc)( func ); |
} |
} |
static void save_DepthMask( GLboolean mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_MASK, 1 ); |
if (n) { |
n[1].b = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->DepthMask)( mask ); |
} |
} |
static void save_DepthRange( GLclampd nearval, GLclampd farval ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_RANGE, 2 ); |
if (n) { |
n[1].f = (GLfloat) nearval; |
n[2].f = (GLfloat) farval; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->DepthRange)( nearval, farval ); |
} |
} |
static void save_Disable( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DISABLE, 1 ); |
if (n) { |
n[1].e = cap; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Disable)( cap ); |
} |
} |
static void save_DrawBuffer( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFER, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->DrawBuffer)( mode ); |
} |
} |
static void save_DrawPixels( GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, |
pixels, &ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 ); |
if (n) { |
n[1].i = width; |
n[2].i = height; |
n[3].e = format; |
n[4].e = type; |
n[5].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->DrawPixels)( width, height, format, type, pixels ); |
} |
} |
static void save_Enable( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ENABLE, 1 ); |
if (n) { |
n[1].e = cap; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Enable)( cap ); |
} |
} |
void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH1, 3 ); |
if (n) { |
n[1].e = mode; |
n[2].i = i1; |
n[3].i = i2; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->EvalMesh1)( mode, i1, i2 ); |
} |
} |
void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH2, 5 ); |
if (n) { |
n[1].e = mode; |
n[2].i = i1; |
n[3].i = i2; |
n[4].i = j1; |
n[5].i = j2; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->EvalMesh2)( mode, i1, i2, j1, j2 ); |
} |
} |
static void save_Fogfv( GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_FOG, 5 ); |
if (n) { |
n[1].e = pname; |
n[2].f = params[0]; |
n[3].f = params[1]; |
n[4].f = params[2]; |
n[5].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Fogfv)( pname, params ); |
} |
} |
static void save_Fogf( GLenum pname, GLfloat param ) |
{ |
save_Fogfv(pname, ¶m); |
} |
static void save_Fogiv(GLenum pname, const GLint *params ) |
{ |
GLfloat p[4]; |
switch (pname) { |
case GL_FOG_MODE: |
case GL_FOG_DENSITY: |
case GL_FOG_START: |
case GL_FOG_END: |
case GL_FOG_INDEX: |
p[0] = (GLfloat) *params; |
break; |
case GL_FOG_COLOR: |
p[0] = INT_TO_FLOAT( params[0] ); |
p[1] = INT_TO_FLOAT( params[1] ); |
p[2] = INT_TO_FLOAT( params[2] ); |
p[3] = INT_TO_FLOAT( params[3] ); |
break; |
default: |
/* Error will be caught later in gl_Fogfv */ |
; |
} |
save_Fogfv(pname, p); |
} |
static void save_Fogi(GLenum pname, GLint param ) |
{ |
save_Fogiv(pname, ¶m); |
} |
static void save_FrontFace( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_FRONT_FACE, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->FrontFace)( mode ); |
} |
} |
static void save_Frustum( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_FRUSTUM, 6 ); |
if (n) { |
n[1].f = (GLfloat) left; |
n[2].f = (GLfloat) right; |
n[3].f = (GLfloat) bottom; |
n[4].f = (GLfloat) top; |
n[5].f = (GLfloat) nearval; |
n[6].f = (GLfloat) farval; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Frustum)( left, right, bottom, top, nearval, farval ); |
} |
} |
static void save_Hint( GLenum target, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT, 2 ); |
if (n) { |
n[1].e = target; |
n[2].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Hint)( target, mode ); |
} |
} |
static void |
save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_HISTOGRAM, 4 ); |
if (n) { |
n[1].e = target; |
n[2].i = width; |
n[3].e = internalFormat; |
n[4].b = sink; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Histogram)( target, width, internalFormat, sink ); |
} |
} |
static void save_IndexMask( GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX_MASK, 1 ); |
if (n) { |
n[1].ui = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->IndexMask)( mask ); |
} |
} |
static void save_InitNames( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->InitNames)(); |
} |
} |
static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT, 6 ); |
if (OPCODE_LIGHT) { |
GLint i, nParams; |
n[1].e = light; |
n[2].e = pname; |
switch (pname) { |
case GL_AMBIENT: |
nParams = 4; |
break; |
case GL_DIFFUSE: |
nParams = 4; |
break; |
case GL_SPECULAR: |
nParams = 4; |
break; |
case GL_POSITION: |
nParams = 4; |
break; |
case GL_SPOT_DIRECTION: |
nParams = 3; |
break; |
case GL_SPOT_EXPONENT: |
nParams = 1; |
break; |
case GL_SPOT_CUTOFF: |
nParams = 1; |
break; |
case GL_CONSTANT_ATTENUATION: |
nParams = 1; |
break; |
case GL_LINEAR_ATTENUATION: |
nParams = 1; |
break; |
case GL_QUADRATIC_ATTENUATION: |
nParams = 1; |
break; |
default: |
nParams = 0; |
} |
for (i = 0; i < nParams; i++) { |
n[3+i].f = params[i]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Lightfv)( light, pname, params ); |
} |
} |
static void save_Lightf( GLenum light, GLenum pname, GLfloat params ) |
{ |
save_Lightfv(light, pname, ¶ms); |
} |
static void save_Lightiv( GLenum light, GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
switch (pname) { |
case GL_AMBIENT: |
case GL_DIFFUSE: |
case GL_SPECULAR: |
fparam[0] = INT_TO_FLOAT( params[0] ); |
fparam[1] = INT_TO_FLOAT( params[1] ); |
fparam[2] = INT_TO_FLOAT( params[2] ); |
fparam[3] = INT_TO_FLOAT( params[3] ); |
break; |
case GL_POSITION: |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = (GLfloat) params[1]; |
fparam[2] = (GLfloat) params[2]; |
fparam[3] = (GLfloat) params[3]; |
break; |
case GL_SPOT_DIRECTION: |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = (GLfloat) params[1]; |
fparam[2] = (GLfloat) params[2]; |
break; |
case GL_SPOT_EXPONENT: |
case GL_SPOT_CUTOFF: |
case GL_CONSTANT_ATTENUATION: |
case GL_LINEAR_ATTENUATION: |
case GL_QUADRATIC_ATTENUATION: |
fparam[0] = (GLfloat) params[0]; |
break; |
default: |
/* error will be caught later in gl_Lightfv */ |
; |
} |
save_Lightfv( light, pname, fparam ); |
} |
static void save_Lighti( GLenum light, GLenum pname, GLint param ) |
{ |
save_Lightiv( light, pname, ¶m ); |
} |
static void save_LightModelfv( GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT_MODEL, 5 ); |
if (n) { |
n[1].e = pname; |
n[2].f = params[0]; |
n[3].f = params[1]; |
n[4].f = params[2]; |
n[5].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LightModelfv)( pname, params ); |
} |
} |
static void save_LightModelf( GLenum pname, GLfloat param ) |
{ |
save_LightModelfv(pname, ¶m); |
} |
static void save_LightModeliv( GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
switch (pname) { |
case GL_LIGHT_MODEL_AMBIENT: |
fparam[0] = INT_TO_FLOAT( params[0] ); |
fparam[1] = INT_TO_FLOAT( params[1] ); |
fparam[2] = INT_TO_FLOAT( params[2] ); |
fparam[3] = INT_TO_FLOAT( params[3] ); |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
case GL_LIGHT_MODEL_TWO_SIDE: |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
fparam[0] = (GLfloat) params[0]; |
break; |
default: |
/* Error will be caught later in gl_LightModelfv */ |
; |
} |
save_LightModelfv(pname, fparam); |
} |
static void save_LightModeli( GLenum pname, GLint param ) |
{ |
save_LightModeliv(pname, ¶m); |
} |
static void save_LineStipple( GLint factor, GLushort pattern ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_STIPPLE, 2 ); |
if (n) { |
n[1].i = factor; |
n[2].us = pattern; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LineStipple)( factor, pattern ); |
} |
} |
static void save_LineWidth( GLfloat width ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_WIDTH, 1 ); |
if (n) { |
n[1].f = width; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LineWidth)( width ); |
} |
} |
static void save_ListBase( GLuint base ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LIST_BASE, 1 ); |
if (n) { |
n[1].ui = base; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ListBase)( base ); |
} |
} |
static void save_LoadIdentity( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LoadIdentity)(); |
} |
} |
static void save_LoadMatrixf( const GLfloat *m ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_MATRIX, 16 ); |
if (n) { |
GLuint i; |
for (i=0;i<16;i++) { |
n[1+i].f = m[i]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LoadMatrixf)( m ); |
} |
} |
static void save_LoadMatrixd( const GLdouble *m ) |
{ |
GLfloat f[16]; |
GLint i; |
for (i = 0; i < 16; i++) { |
f[i] = (GLfloat) m[i]; |
} |
save_LoadMatrixf(f); |
} |
static void save_LoadName( GLuint name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_NAME, 1 ); |
if (n) { |
n[1].ui = name; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LoadName)( name ); |
} |
} |
static void save_LogicOp( GLenum opcode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_LOGIC_OP, 1 ); |
if (n) { |
n[1].e = opcode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->LogicOp)( opcode ); |
} |
} |
static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, |
GLint order, const GLdouble *points) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); |
if (n) { |
GLfloat *pnts = _mesa_copy_map_points1d( target, stride, order, points ); |
n[1].e = target; |
n[2].f = (GLfloat) u1; |
n[3].f = (GLfloat) u2; |
n[4].i = _mesa_evaluator_components(target); /* stride */ |
n[5].i = order; |
n[6].data = (void *) pnts; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Map1d)( target, u1, u2, stride, order, points ); |
} |
} |
static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, |
GLint order, const GLfloat *points) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); |
if (n) { |
GLfloat *pnts = _mesa_copy_map_points1f( target, stride, order, points ); |
n[1].e = target; |
n[2].f = u1; |
n[3].f = u2; |
n[4].i = _mesa_evaluator_components(target); /* stride */ |
n[5].i = order; |
n[6].data = (void *) pnts; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Map1f)( target, u1, u2, stride, order, points ); |
} |
} |
static void save_Map2d( GLenum target, |
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, |
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, |
const GLdouble *points ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); |
if (n) { |
GLfloat *pnts = _mesa_copy_map_points2d( target, ustride, uorder, |
vstride, vorder, points ); |
n[1].e = target; |
n[2].f = (GLfloat) u1; |
n[3].f = (GLfloat) u2; |
n[4].f = (GLfloat) v1; |
n[5].f = (GLfloat) v2; |
/* XXX verify these strides are correct */ |
n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/ |
n[7].i = _mesa_evaluator_components(target); /*vstride*/ |
n[8].i = uorder; |
n[9].i = vorder; |
n[10].data = (void *) pnts; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Map2d)( target, |
u1, u2, ustride, uorder, |
v1, v2, vstride, vorder, points ); |
} |
} |
static void save_Map2f( GLenum target, |
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, |
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, |
const GLfloat *points ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); |
if (n) { |
GLfloat *pnts = _mesa_copy_map_points2f( target, ustride, uorder, |
vstride, vorder, points ); |
n[1].e = target; |
n[2].f = u1; |
n[3].f = u2; |
n[4].f = v1; |
n[5].f = v2; |
/* XXX verify these strides are correct */ |
n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/ |
n[7].i = _mesa_evaluator_components(target); /*vstride*/ |
n[8].i = uorder; |
n[9].i = vorder; |
n[10].data = (void *) pnts; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder, |
v1, v2, vstride, vorder, points ); |
} |
} |
static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID1, 3 ); |
if (n) { |
n[1].i = un; |
n[2].f = u1; |
n[3].f = u2; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->MapGrid1f)( un, u1, u2 ); |
} |
} |
static void save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) |
{ |
save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2); |
} |
static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, |
GLint vn, GLfloat v1, GLfloat v2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID2, 6 ); |
if (n) { |
n[1].i = un; |
n[2].f = u1; |
n[3].f = u2; |
n[4].i = vn; |
n[5].f = v1; |
n[6].f = v2; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->MapGrid2f)( un, u1, u2, vn, v1, v2 ); |
} |
} |
static void save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, |
GLint vn, GLdouble v1, GLdouble v2 ) |
{ |
save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, |
vn, (GLfloat) v1, (GLfloat) v2); |
} |
static void save_MatrixMode( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MATRIX_MODE, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->MatrixMode)( mode ); |
} |
} |
static void |
save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MIN_MAX, 3 ); |
if (n) { |
n[1].e = target; |
n[2].e = internalFormat; |
n[3].b = sink; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Minmax)( target, internalFormat, sink ); |
} |
} |
static void save_MultMatrixf( const GLfloat *m ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_MULT_MATRIX, 16 ); |
if (n) { |
GLuint i; |
for (i=0;i<16;i++) { |
n[1+i].f = m[i]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->MultMatrixf)( m ); |
} |
} |
static void save_MultMatrixd( const GLdouble *m ) |
{ |
GLfloat f[16]; |
GLint i; |
for (i = 0; i < 16; i++) { |
f[i] = (GLfloat) m[i]; |
} |
save_MultMatrixf(f); |
} |
static void save_NewList( GLuint list, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
/* It's an error to call this function while building a display list */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" ); |
(void) list; |
(void) mode; |
} |
static void save_Ortho( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ORTHO, 6 ); |
if (n) { |
n[1].f = (GLfloat) left; |
n[2].f = (GLfloat) right; |
n[3].f = (GLfloat) bottom; |
n[4].f = (GLfloat) top; |
n[5].f = (GLfloat) nearval; |
n[6].f = (GLfloat) farval; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Ortho)( left, right, bottom, top, nearval, farval ); |
} |
} |
static void |
save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_MAP, 3 ); |
if (n) { |
n[1].e = map; |
n[2].i = mapsize; |
n[3].data = (void *) MALLOC( mapsize * sizeof(GLfloat) ); |
MEMCPY( n[3].data, (void *) values, mapsize * sizeof(GLfloat) ); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PixelMapfv)( map, mapsize, values ); |
} |
} |
static void |
save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ) |
{ |
GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; |
GLint i; |
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) { |
for (i=0;i<mapsize;i++) { |
fvalues[i] = (GLfloat) values[i]; |
} |
} |
else { |
for (i=0;i<mapsize;i++) { |
fvalues[i] = UINT_TO_FLOAT( values[i] ); |
} |
} |
save_PixelMapfv(map, mapsize, fvalues); |
} |
static void |
save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values) |
{ |
GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; |
GLint i; |
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) { |
for (i=0;i<mapsize;i++) { |
fvalues[i] = (GLfloat) values[i]; |
} |
} |
else { |
for (i=0;i<mapsize;i++) { |
fvalues[i] = USHORT_TO_FLOAT( values[i] ); |
} |
} |
save_PixelMapfv(map, mapsize, fvalues); |
} |
static void |
save_PixelTransferf( GLenum pname, GLfloat param ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TRANSFER, 2 ); |
if (n) { |
n[1].e = pname; |
n[2].f = param; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PixelTransferf)( pname, param ); |
} |
} |
static void |
save_PixelTransferi( GLenum pname, GLint param ) |
{ |
save_PixelTransferf( pname, (GLfloat) param ); |
} |
static void |
save_PixelZoom( GLfloat xfactor, GLfloat yfactor ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_ZOOM, 2 ); |
if (n) { |
n[1].f = xfactor; |
n[2].f = yfactor; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PixelZoom)( xfactor, yfactor ); |
} |
} |
static void |
save_PointParameterfvEXT( GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_PARAMETERS, 4 ); |
if (n) { |
n[1].e = pname; |
n[2].f = params[0]; |
n[3].f = params[1]; |
n[4].f = params[2]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PointParameterfvEXT)( pname, params ); |
} |
} |
static void save_PointParameterfEXT( GLenum pname, GLfloat param ) |
{ |
save_PointParameterfvEXT(pname, ¶m); |
} |
static void save_PointParameteriNV( GLenum pname, GLint param ) |
{ |
GLfloat p = (GLfloat) param; |
save_PointParameterfvEXT(pname, &p); |
} |
static void save_PointParameterivNV( GLenum pname, const GLint *param ) |
{ |
GLfloat p = (GLfloat) param[0]; |
save_PointParameterfvEXT(pname, &p); |
} |
static void save_PointSize( GLfloat size ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_SIZE, 1 ); |
if (n) { |
n[1].f = size; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PointSize)( size ); |
} |
} |
static void save_PolygonMode( GLenum face, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_MODE, 2 ); |
if (n) { |
n[1].e = face; |
n[2].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PolygonMode)( face, mode ); |
} |
} |
/* |
* Polygon stipple must have been upacked already! |
*/ |
static void save_PolygonStipple( const GLubyte *pattern ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_STIPPLE, 1 ); |
if (n) { |
void *data; |
n[1].data = MALLOC( 32 * 4 ); |
data = n[1].data; /* This needed for Acorn compiler */ |
MEMCPY( data, pattern, 32 * 4 ); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PolygonStipple)( (GLubyte*) pattern ); |
} |
} |
static void save_PolygonOffset( GLfloat factor, GLfloat units ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_OFFSET, 2 ); |
if (n) { |
n[1].f = factor; |
n[2].f = units; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PolygonOffset)( factor, units ); |
} |
} |
static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
save_PolygonOffset(factor, ctx->DepthMaxF * bias); |
} |
static void save_PopAttrib( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PopAttrib)(); |
} |
} |
static void save_PopMatrix( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PopMatrix)(); |
} |
} |
static void save_PopName( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PopName)(); |
} |
} |
static void save_PrioritizeTextures( GLsizei num, const GLuint *textures, |
const GLclampf *priorities ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
for (i=0;i<num;i++) { |
Node *n; |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PRIORITIZE_TEXTURE, 2 ); |
if (n) { |
n[1].ui = textures[i]; |
n[2].f = priorities[i]; |
} |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PrioritizeTextures)( num, textures, priorities ); |
} |
} |
static void save_PushAttrib( GLbitfield mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 ); |
if (n) { |
n[1].bf = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PushAttrib)( mask ); |
} |
} |
static void save_PushMatrix( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_MATRIX, 0 ); |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PushMatrix)(); |
} |
} |
static void save_PushName( GLuint name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_NAME, 1 ); |
if (n) { |
n[1].ui = name; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PushName)( name ); |
} |
} |
static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 ); |
if (n) { |
n[1].f = x; |
n[2].f = y; |
n[3].f = z; |
n[4].f = w; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->RasterPos4f)( x, y, z, w ); |
} |
} |
static void save_RasterPos2d(GLdouble x, GLdouble y) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
static void save_RasterPos2f(GLfloat x, GLfloat y) |
{ |
save_RasterPos4f(x, y, 0.0F, 1.0F); |
} |
static void save_RasterPos2i(GLint x, GLint y) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
static void save_RasterPos2s(GLshort x, GLshort y) |
{ |
save_RasterPos4f(x, y, 0.0F, 1.0F); |
} |
static void save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
static void save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) |
{ |
save_RasterPos4f(x, y, z, 1.0F); |
} |
static void save_RasterPos3i(GLint x, GLint y, GLint z) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
static void save_RasterPos3s(GLshort x, GLshort y, GLshort z) |
{ |
save_RasterPos4f(x, y, z, 1.0F); |
} |
static void save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) |
{ |
save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
save_RasterPos4f(x, y, z, w); |
} |
static void save_RasterPos2dv(const GLdouble *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void save_RasterPos2fv(const GLfloat *v) |
{ |
save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); |
} |
static void save_RasterPos2iv(const GLint *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void save_RasterPos2sv(const GLshort *v) |
{ |
save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); |
} |
static void save_RasterPos3dv(const GLdouble *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void save_RasterPos3fv(const GLfloat *v) |
{ |
save_RasterPos4f(v[0], v[1], v[2], 1.0F); |
} |
static void save_RasterPos3iv(const GLint *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void save_RasterPos3sv(const GLshort *v) |
{ |
save_RasterPos4f(v[0], v[1], v[2], 1.0F); |
} |
static void save_RasterPos4dv(const GLdouble *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
static void save_RasterPos4fv(const GLfloat *v) |
{ |
save_RasterPos4f(v[0], v[1], v[2], v[3]); |
} |
static void save_RasterPos4iv(const GLint *v) |
{ |
save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
static void save_RasterPos4sv(const GLshort *v) |
{ |
save_RasterPos4f(v[0], v[1], v[2], v[3]); |
} |
static void save_PassThrough( GLfloat token ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PASSTHROUGH, 1 ); |
if (n) { |
n[1].f = token; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PassThrough)( token ); |
} |
} |
static void save_ReadBuffer( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_READ_BUFFER, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ReadBuffer)( mode ); |
} |
} |
static void |
save_ResetHistogram(GLenum target) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_HISTOGRAM, 1 ); |
if (n) { |
n[1].e = target; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ResetHistogram)( target ); |
} |
} |
static void |
save_ResetMinmax(GLenum target) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_MIN_MAX, 1 ); |
if (n) { |
n[1].e = target; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ResetMinmax)( target ); |
} |
} |
static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ROTATE, 4 ); |
if (n) { |
n[1].f = angle; |
n[2].f = x; |
n[3].f = y; |
n[4].f = z; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Rotatef)( angle, x, y, z ); |
} |
} |
static void save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) |
{ |
save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
static void save_Scalef( GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_SCALE, 3 ); |
if (n) { |
n[1].f = x; |
n[2].f = y; |
n[3].f = z; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Scalef)( x, y, z ); |
} |
} |
static void save_Scaled( GLdouble x, GLdouble y, GLdouble z ) |
{ |
save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_SCISSOR, 4 ); |
if (n) { |
n[1].i = x; |
n[2].i = y; |
n[3].i = width; |
n[4].i = height; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Scissor)( x, y, width, height ); |
} |
} |
static void save_ShadeModel( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ShadeModel)( mode ); |
} |
} |
static void save_StencilFunc( GLenum func, GLint ref, GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_FUNC, 3 ); |
if (n) { |
n[1].e = func; |
n[2].i = ref; |
n[3].ui = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->StencilFunc)( func, ref, mask ); |
} |
} |
static void save_StencilMask( GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_MASK, 1 ); |
if (n) { |
n[1].ui = mask; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->StencilMask)( mask ); |
} |
} |
static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP, 3 ); |
if (n) { |
n[1].e = fail; |
n[2].e = zfail; |
n[3].e = zpass; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->StencilOp)( fail, zfail, zpass ); |
} |
} |
static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXENV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].f = params[0]; |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexEnvfv)( target, pname, params ); |
} |
} |
static void save_TexEnvf( GLenum target, GLenum pname, GLfloat param ) |
{ |
save_TexEnvfv( target, pname, ¶m ); |
} |
static void save_TexEnvi( GLenum target, GLenum pname, GLint param ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) param; |
p[1] = p[2] = p[3] = 0.0; |
save_TexEnvfv( target, pname, p ); |
} |
static void save_TexEnviv( GLenum target, GLenum pname, const GLint *param ) |
{ |
GLfloat p[4]; |
p[0] = INT_TO_FLOAT( param[0] ); |
p[1] = INT_TO_FLOAT( param[1] ); |
p[2] = INT_TO_FLOAT( param[2] ); |
p[3] = INT_TO_FLOAT( param[3] ); |
save_TexEnvfv( target, pname, p ); |
} |
static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXGEN, 6 ); |
if (n) { |
n[1].e = coord; |
n[2].e = pname; |
n[3].f = params[0]; |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexGenfv)( coord, pname, params ); |
} |
} |
static void save_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) params[0]; |
p[1] = (GLfloat) params[1]; |
p[2] = (GLfloat) params[2]; |
p[3] = (GLfloat) params[3]; |
save_TexGenfv(coord, pname, p); |
} |
static void save_TexGend(GLenum coord, GLenum pname, GLdouble param ) |
{ |
GLfloat p = (GLfloat) param; |
save_TexGenfv( coord, pname, &p ); |
} |
static void save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) params[0]; |
p[1] = (GLfloat) params[1]; |
p[2] = (GLfloat) params[2]; |
p[3] = (GLfloat) params[3]; |
save_TexGenfv( coord, pname, p ); |
} |
static void save_TexGenf( GLenum coord, GLenum pname, GLfloat param ) |
{ |
save_TexGenfv(coord, pname, ¶m); |
} |
static void save_TexGeni( GLenum coord, GLenum pname, GLint param ) |
{ |
save_TexGeniv( coord, pname, ¶m ); |
} |
static void save_TexParameterfv( GLenum target, |
GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXPARAMETER, 6 ); |
if (n) { |
n[1].e = target; |
n[2].e = pname; |
n[3].f = params[0]; |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexParameterfv)( target, pname, params ); |
} |
} |
static void save_TexParameterf( GLenum target, GLenum pname, GLfloat param ) |
{ |
save_TexParameterfv(target, pname, ¶m); |
} |
static void save_TexParameteri( GLenum target, GLenum pname, GLint param ) |
{ |
GLfloat fparam[4]; |
fparam[0] = (GLfloat) param; |
fparam[1] = fparam[2] = fparam[3] = 0.0; |
save_TexParameterfv(target, pname, fparam); |
} |
static void save_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = fparam[2] = fparam[3] = 0.0; |
save_TexParameterfv(target, pname, fparam); |
} |
static void save_TexImage1D( GLenum target, |
GLint level, GLint components, |
GLsizei width, GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_1D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->TexImage1D)( target, level, components, width, |
border, format, type, pixels ); |
} |
else { |
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, |
pixels, &ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = components; |
n[4].i = (GLint) width; |
n[5].i = border; |
n[6].e = format; |
n[7].e = type; |
n[8].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexImage1D)( target, level, components, width, |
border, format, type, pixels ); |
} |
} |
} |
static void save_TexImage2D( GLenum target, |
GLint level, GLint components, |
GLsizei width, GLsizei height, GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_2D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->TexImage2D)( target, level, components, width, |
height, border, format, type, pixels ); |
} |
else { |
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, |
pixels, &ctx->Unpack); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = components; |
n[4].i = (GLint) width; |
n[5].i = (GLint) height; |
n[6].i = border; |
n[7].e = format; |
n[8].e = type; |
n[9].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexImage2D)( target, level, components, width, |
height, border, format, type, pixels ); |
} |
} |
} |
static void save_TexImage3D( GLenum target, |
GLint level, GLint internalFormat, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_3D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->TexImage3D)( target, level, internalFormat, width, |
height, depth, border, format, type, pixels ); |
} |
else { |
Node *n; |
GLvoid *image = _mesa_unpack_image(width, height, depth, format, type, |
pixels, &ctx->Unpack); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = (GLint) internalFormat; |
n[4].i = (GLint) width; |
n[5].i = (GLint) height; |
n[6].i = (GLint) depth; |
n[7].i = border; |
n[8].e = format; |
n[9].e = type; |
n[10].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexImage3D)( target, level, internalFormat, width, |
height, depth, border, format, type, pixels ); |
} |
} |
} |
static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, |
GLsizei width, GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, |
pixels, &ctx->Unpack); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = (GLint) width; |
n[5].e = format; |
n[6].e = type; |
n[7].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexSubImage1D)( target, level, xoffset, width, |
format, type, pixels ); |
} |
} |
static void save_TexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, |
pixels, &ctx->Unpack); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = (GLint) width; |
n[6].i = (GLint) height; |
n[7].e = format; |
n[8].e = type; |
n[9].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexSubImage2D)( target, level, xoffset, yoffset, |
width, height, format, type, pixels ); |
} |
} |
static void save_TexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset,GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
GLvoid *image = _mesa_unpack_image(width, height, depth, format, type, |
pixels, &ctx->Unpack); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = zoffset; |
n[6].i = (GLint) width; |
n[7].i = (GLint) height; |
n[8].i = (GLint) depth; |
n[9].e = format; |
n[10].e = type; |
n[11].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TexSubImage3D)( target, level, |
xoffset, yoffset, zoffset, |
width, height, depth, format, type, pixels ); |
} |
} |
static void save_Translatef( GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TRANSLATE, 3 ); |
if (n) { |
n[1].f = x; |
n[2].f = y; |
n[3].f = z; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Translatef)( x, y, z ); |
} |
} |
static void save_Translated( GLdouble x, GLdouble y, GLdouble z ) |
{ |
save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_VIEWPORT, 4 ); |
if (n) { |
n[1].i = x; |
n[2].i = y; |
n[3].i = (GLint) width; |
n[4].i = (GLint) height; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->Viewport)( x, y, width, height ); |
} |
} |
static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 ); |
if (n) { |
n[1].f = x; |
n[2].f = y; |
n[3].f = z; |
n[4].f = w; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->WindowPos4fMESA)( x, y, z, w ); |
} |
} |
static void save_WindowPos2dMESA(GLdouble x, GLdouble y) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
static void save_WindowPos2fMESA(GLfloat x, GLfloat y) |
{ |
save_WindowPos4fMESA(x, y, 0.0F, 1.0F); |
} |
static void save_WindowPos2iMESA(GLint x, GLint y) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
static void save_WindowPos2sMESA(GLshort x, GLshort y) |
{ |
save_WindowPos4fMESA(x, y, 0.0F, 1.0F); |
} |
static void save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
static void save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) |
{ |
save_WindowPos4fMESA(x, y, z, 1.0F); |
} |
static void save_WindowPos3iMESA(GLint x, GLint y, GLint z) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
static void save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) |
{ |
save_WindowPos4fMESA(x, y, z, 1.0F); |
} |
static void save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) |
{ |
save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
save_WindowPos4fMESA(x, y, z, w); |
} |
static void save_WindowPos2dvMESA(const GLdouble *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void save_WindowPos2fvMESA(const GLfloat *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); |
} |
static void save_WindowPos2ivMESA(const GLint *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void save_WindowPos2svMESA(const GLshort *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); |
} |
static void save_WindowPos3dvMESA(const GLdouble *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void save_WindowPos3fvMESA(const GLfloat *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); |
} |
static void save_WindowPos3ivMESA(const GLint *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void save_WindowPos3svMESA(const GLshort *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); |
} |
static void save_WindowPos4dvMESA(const GLdouble *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
static void save_WindowPos4fvMESA(const GLfloat *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); |
} |
static void save_WindowPos4ivMESA(const GLint *v) |
{ |
save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
static void save_WindowPos4svMESA(const GLshort *v) |
{ |
save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); |
} |
/* GL_ARB_multitexture */ |
static void save_ActiveTextureARB( GLenum target ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_TEXTURE, 1 ); |
if (n) { |
n[1].e = target; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ActiveTextureARB)( target ); |
} |
} |
/* GL_ARB_transpose_matrix */ |
static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) |
{ |
GLfloat tm[16]; |
_math_transposefd(tm, m); |
save_LoadMatrixf(tm); |
} |
static void save_LoadTransposeMatrixfARB( const GLfloat m[16] ) |
{ |
GLfloat tm[16]; |
_math_transposef(tm, m); |
save_LoadMatrixf(tm); |
} |
static void |
save_MultTransposeMatrixdARB( const GLdouble m[16] ) |
{ |
GLfloat tm[16]; |
_math_transposefd(tm, m); |
save_MultMatrixf(tm); |
} |
static void |
save_MultTransposeMatrixfARB( const GLfloat m[16] ) |
{ |
GLfloat tm[16]; |
_math_transposef(tm, m); |
save_MultMatrixf(tm); |
} |
static void |
save_PixelTexGenSGIX(GLenum mode) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); |
if (n) { |
n[1].e = mode; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PixelTexGenSGIX)( mode ); |
} |
} |
/* GL_ARB_texture_compression */ |
static void |
save_CompressedTexImage1DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLint border, GLsizei imageSize, |
const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_1D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, |
width, border, imageSize, data); |
} |
else { |
Node *n; |
GLvoid *image; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].e = internalFormat; |
n[4].i = (GLint) width; |
n[5].i = border; |
n[6].i = imageSize; |
n[7].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, |
width, border, imageSize, data); |
} |
} |
} |
static void |
save_CompressedTexImage2DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLsizei height, GLint border, GLsizei imageSize, |
const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_2D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, |
width, height, border, imageSize, data); |
} |
else { |
Node *n; |
GLvoid *image; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].e = internalFormat; |
n[4].i = (GLint) width; |
n[5].i = (GLint) height; |
n[6].i = border; |
n[7].i = imageSize; |
n[8].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, |
width, height, border, imageSize, data); |
} |
} |
} |
static void |
save_CompressedTexImage3DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLsizei height, GLsizei depth, GLint border, |
GLsizei imageSize, const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (target == GL_PROXY_TEXTURE_3D) { |
/* don't compile, execute immediately */ |
(*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, |
width, height, depth, border, imageSize, data); |
} |
else { |
Node *n; |
GLvoid *image; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].e = internalFormat; |
n[4].i = (GLint) width; |
n[5].i = (GLint) height; |
n[6].i = (GLint) depth; |
n[7].i = border; |
n[8].i = imageSize; |
n[9].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, |
width, height, depth, border, imageSize, data); |
} |
} |
} |
static void |
save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, |
GLsizei width, GLenum format, |
GLsizei imageSize, const GLvoid *data) |
{ |
Node *n; |
GLvoid *image; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = (GLint) width; |
n[5].e = format; |
n[6].i = imageSize; |
n[7].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset, |
width, format, imageSize, data); |
} |
} |
static void |
save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLsizei width, GLsizei height, |
GLenum format, GLsizei imageSize, |
const GLvoid *data) |
{ |
Node *n; |
GLvoid *image; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = (GLint) width; |
n[6].i = (GLint) height; |
n[7].e = format; |
n[8].i = imageSize; |
n[9].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexSubImage2DARB)(target, level, xoffset, yoffset, |
width, height, format, imageSize, data); |
} |
} |
static void |
save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLint zoffset, GLsizei width, |
GLsizei height, GLsizei depth, GLenum format, |
GLsizei imageSize, const GLvoid *data) |
{ |
Node *n; |
GLvoid *image; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
/* make copy of image */ |
image = MALLOC(imageSize); |
if (!image) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); |
return; |
} |
MEMCPY(image, data, imageSize); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11 ); |
if (n) { |
n[1].e = target; |
n[2].i = level; |
n[3].i = xoffset; |
n[4].i = yoffset; |
n[5].i = zoffset; |
n[6].i = (GLint) width; |
n[7].i = (GLint) height; |
n[8].i = (GLint) depth; |
n[9].e = format; |
n[10].i = imageSize; |
n[11].data = image; |
} |
else if (image) { |
FREE(image); |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->CompressedTexSubImage3DARB)(target, level, xoffset, yoffset, |
zoffset, width, height, depth, format, imageSize, data); |
} |
} |
/* GL_ARB_multisample */ |
static void |
save_SampleCoverageARB(GLclampf value, GLboolean invert) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_SAMPLE_COVERAGE, 2 ); |
if (n) { |
n[1].f = value; |
n[2].b = invert; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->SampleCoverageARB)( value, invert ); |
} |
} |
/* GL_SGIS_pixel_texture */ |
static void |
save_PixelTexGenParameteriSGIS(GLenum target, GLint value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); |
if (n) { |
n[1].e = target; |
n[2].i = value; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->PixelTexGenParameteriSGIS)( target, value ); |
} |
} |
static void |
save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) |
{ |
save_PixelTexGenParameteriSGIS(target, (GLint) value); |
} |
static void |
save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) |
{ |
save_PixelTexGenParameteriSGIS(target, *value); |
} |
static void |
save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) |
{ |
save_PixelTexGenParameteriSGIS(target, (GLint) *value); |
} |
/* |
* GL_NV_vertex_program |
*/ |
#if FEATURE_NV_vertex_program |
static void |
save_BindProgramNV(GLenum target, GLuint id) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_PROGRAM_NV, 2 ); |
if (n) { |
n[1].e = target; |
n[2].ui = id; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->BindProgramNV)( target, id ); |
} |
} |
static void |
save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_EXECUTE_PROGRAM_NV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].ui = id; |
n[3].f = params[0]; |
n[4].f = params[1]; |
n[5].f = params[2]; |
n[6].f = params[3]; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ExecuteProgramNV)(target, id, params); |
} |
} |
static void |
save_ProgramParameter4fNV(GLenum target, GLuint index, |
GLfloat x, GLfloat y, |
GLfloat z, GLfloat w) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6 ); |
if (n) { |
n[1].e = target; |
n[2].ui = index; |
n[3].f = x; |
n[4].f = y; |
n[5].f = z; |
n[6].f = w; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ProgramParameter4fNV)(target, index, x, y, z, w); |
} |
} |
static void |
save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) |
{ |
save_ProgramParameter4fNV(target, index, params[0], params[1], |
params[2], params[3]); |
} |
static void |
save_ProgramParameter4dNV(GLenum target, GLuint index, |
GLdouble x, GLdouble y, |
GLdouble z, GLdouble w) |
{ |
save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, |
(GLfloat) z, (GLfloat) w); |
} |
static void |
save_ProgramParameter4dvNV(GLenum target, GLuint index, |
const GLdouble *params) |
{ |
save_ProgramParameter4fNV(target, index, (GLfloat) params[0], |
(GLfloat) params[1], (GLfloat) params[2], |
(GLfloat) params[3]); |
} |
static void |
save_ProgramParameters4dvNV(GLenum target, GLuint index, |
GLuint num, const GLdouble *params) |
{ |
GLuint i; |
for (i = 0; i < num; i++) { |
save_ProgramParameter4dvNV(target, index + i, params + 4 * i); |
} |
} |
static void |
save_ProgramParameters4fvNV(GLenum target, GLuint index, |
GLuint num, const GLfloat *params) |
{ |
GLuint i; |
for (i = 0; i < num; i++) { |
save_ProgramParameter4fvNV(target, index + i, params + 4 * i); |
} |
} |
static void |
save_TrackMatrixNV(GLenum target, GLuint address, |
GLenum matrix, GLenum transform) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 4 ); |
if (n) { |
n[1].e = target; |
n[2].ui = address; |
n[3].e = matrix; |
n[4].e = transform; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->TrackMatrixNV)(target, address, matrix, transform); |
} |
} |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_EXT_stencil_two_side */ |
static void save_ActiveStencilFaceEXT( GLenum face ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
Node *n; |
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1 ); |
if (n) { |
n[1].e = face; |
} |
if (ctx->ExecuteFlag) { |
(*ctx->Exec->ActiveStencilFaceEXT)( face ); |
} |
} |
/* KW: Compile commands |
* |
* Will appear in the list before the vertex buffer containing the |
* command that provoked the error. I don't see this as a problem. |
*/ |
void |
_mesa_save_error( GLcontext *ctx, GLenum error, const char *s ) |
{ |
Node *n; |
n = ALLOC_INSTRUCTION( ctx, OPCODE_ERROR, 2 ); |
if (n) { |
n[1].e = error; |
n[2].data = (void *) s; |
} |
/* execute already done */ |
} |
/* |
* Compile an error into current display list. |
*/ |
void |
_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) |
{ |
if (ctx->CompileFlag) |
_mesa_save_error( ctx, error, s ); |
if (ctx->ExecuteFlag) |
_mesa_error( ctx, error, s ); |
} |
static GLboolean |
islist(GLcontext *ctx, GLuint list) |
{ |
if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) { |
return GL_TRUE; |
} |
else { |
return GL_FALSE; |
} |
} |
/**********************************************************************/ |
/* Display list execution */ |
/**********************************************************************/ |
/* |
* Execute a display list. Note that the ListBase offset must have already |
* been added before calling this function. I.e. the list argument is |
* the absolute list number, not relative to ListBase. |
* Input: list - display list number |
*/ |
static void |
execute_list( GLcontext *ctx, GLuint list ) |
{ |
Node *n; |
GLboolean done; |
if (!islist(ctx,list)) |
return; |
if (ctx->Driver.BeginCallList) |
ctx->Driver.BeginCallList( ctx, list ); |
ctx->CallDepth++; |
n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); |
done = GL_FALSE; |
while (!done) { |
OpCode opcode = n[0].opcode; |
int i = (int)n[0].opcode - (int)OPCODE_DRV_0; |
if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) { |
ctx->listext.opcode[i].execute(ctx, &n[1]); |
n += ctx->listext.opcode[i].size; |
} |
else { |
switch (opcode) { |
case OPCODE_ERROR: |
_mesa_error( ctx, n[1].e, (const char *) n[2].data ); |
break; |
case OPCODE_ACCUM: |
(*ctx->Exec->Accum)( n[1].e, n[2].f ); |
break; |
case OPCODE_ALPHA_FUNC: |
(*ctx->Exec->AlphaFunc)( n[1].e, n[2].f ); |
break; |
case OPCODE_BIND_TEXTURE: |
(*ctx->Exec->BindTexture)( n[1].e, n[2].ui ); |
break; |
case OPCODE_BITMAP: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i, |
n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_BLEND_COLOR: |
(*ctx->Exec->BlendColor)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_BLEND_EQUATION: |
(*ctx->Exec->BlendEquation)( n[1].e ); |
break; |
case OPCODE_BLEND_FUNC: |
(*ctx->Exec->BlendFunc)( n[1].e, n[2].e ); |
break; |
case OPCODE_BLEND_FUNC_SEPARATE: |
(*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e); |
break; |
case OPCODE_CALL_LIST: |
/* Generated by glCallList(), don't add ListBase */ |
if (ctx->CallDepth<MAX_LIST_NESTING) { |
execute_list( ctx, n[1].ui ); |
} |
break; |
case OPCODE_CALL_LIST_OFFSET: |
/* Generated by glCallLists() so we must add ListBase */ |
if (n[2].b) { |
/* user specified a bad datatype at compile time */ |
_mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); |
} |
else if (ctx->CallDepth < MAX_LIST_NESTING) { |
execute_list( ctx, ctx->List.ListBase + n[1].ui ); |
} |
break; |
case OPCODE_CLEAR: |
(*ctx->Exec->Clear)( n[1].bf ); |
break; |
case OPCODE_CLEAR_COLOR: |
(*ctx->Exec->ClearColor)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_CLEAR_ACCUM: |
(*ctx->Exec->ClearAccum)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_CLEAR_DEPTH: |
(*ctx->Exec->ClearDepth)( (GLclampd) n[1].f ); |
break; |
case OPCODE_CLEAR_INDEX: |
(*ctx->Exec->ClearIndex)( (GLfloat) n[1].ui ); |
break; |
case OPCODE_CLEAR_STENCIL: |
(*ctx->Exec->ClearStencil)( n[1].i ); |
break; |
case OPCODE_CLIP_PLANE: |
{ |
GLdouble eq[4]; |
eq[0] = n[2].f; |
eq[1] = n[3].f; |
eq[2] = n[4].f; |
eq[3] = n[5].f; |
(*ctx->Exec->ClipPlane)( n[1].e, eq ); |
} |
break; |
case OPCODE_COLOR_MASK: |
(*ctx->Exec->ColorMask)( n[1].b, n[2].b, n[3].b, n[4].b ); |
break; |
case OPCODE_COLOR_MATERIAL: |
(*ctx->Exec->ColorMaterial)( n[1].e, n[2].e ); |
break; |
case OPCODE_COLOR_TABLE: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->ColorTable)( n[1].e, n[2].e, n[3].i, n[4].e, |
n[5].e, n[6].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_COLOR_TABLE_PARAMETER_FV: |
{ |
GLfloat params[4]; |
params[0] = n[3].f; |
params[1] = n[4].f; |
params[2] = n[5].f; |
params[3] = n[6].f; |
(*ctx->Exec->ColorTableParameterfv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_COLOR_TABLE_PARAMETER_IV: |
{ |
GLint params[4]; |
params[0] = n[3].i; |
params[1] = n[4].i; |
params[2] = n[5].i; |
params[3] = n[6].i; |
(*ctx->Exec->ColorTableParameteriv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_COLOR_SUB_TABLE: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->ColorSubTable)( n[1].e, n[2].i, n[3].i, |
n[4].e, n[5].e, n[6].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_CONVOLUTION_FILTER_1D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->ConvolutionFilter1D)( n[1].e, n[2].i, n[3].i, |
n[4].e, n[5].e, n[6].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_CONVOLUTION_FILTER_2D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->ConvolutionFilter2D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].e, n[6].e, n[7].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_CONVOLUTION_PARAMETER_I: |
(*ctx->Exec->ConvolutionParameteri)( n[1].e, n[2].e, n[3].i ); |
break; |
case OPCODE_CONVOLUTION_PARAMETER_IV: |
{ |
GLint params[4]; |
params[0] = n[3].i; |
params[1] = n[4].i; |
params[2] = n[5].i; |
params[3] = n[6].i; |
(*ctx->Exec->ConvolutionParameteriv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_CONVOLUTION_PARAMETER_F: |
(*ctx->Exec->ConvolutionParameterf)( n[1].e, n[2].e, n[3].f ); |
break; |
case OPCODE_CONVOLUTION_PARAMETER_FV: |
{ |
GLfloat params[4]; |
params[0] = n[3].f; |
params[1] = n[4].f; |
params[2] = n[5].f; |
params[3] = n[6].f; |
(*ctx->Exec->ConvolutionParameterfv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_COPY_COLOR_SUB_TABLE: |
(*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, |
n[3].i, n[4].i, n[5].i ); |
break; |
case OPCODE_COPY_COLOR_TABLE: |
(*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, |
n[3].i, n[4].i, n[5].i ); |
break; |
case OPCODE_COPY_PIXELS: |
(*ctx->Exec->CopyPixels)( n[1].i, n[2].i, |
(GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e ); |
break; |
case OPCODE_COPY_TEX_IMAGE1D: |
(*ctx->Exec->CopyTexImage1D)( n[1].e, n[2].i, n[3].e, n[4].i, |
n[5].i, n[6].i, n[7].i ); |
break; |
case OPCODE_COPY_TEX_IMAGE2D: |
(*ctx->Exec->CopyTexImage2D)( n[1].e, n[2].i, n[3].e, n[4].i, |
n[5].i, n[6].i, n[7].i, n[8].i ); |
break; |
case OPCODE_COPY_TEX_SUB_IMAGE1D: |
(*ctx->Exec->CopyTexSubImage1D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i ); |
break; |
case OPCODE_COPY_TEX_SUB_IMAGE2D: |
(*ctx->Exec->CopyTexSubImage2D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i, n[7].i, n[8].i ); |
break; |
case OPCODE_COPY_TEX_SUB_IMAGE3D: |
(*ctx->Exec->CopyTexSubImage3D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i, n[7].i, n[8].i , n[9].i); |
break; |
case OPCODE_CULL_FACE: |
(*ctx->Exec->CullFace)( n[1].e ); |
break; |
case OPCODE_DEPTH_FUNC: |
(*ctx->Exec->DepthFunc)( n[1].e ); |
break; |
case OPCODE_DEPTH_MASK: |
(*ctx->Exec->DepthMask)( n[1].b ); |
break; |
case OPCODE_DEPTH_RANGE: |
(*ctx->Exec->DepthRange)( (GLclampd) n[1].f, (GLclampd) n[2].f ); |
break; |
case OPCODE_DISABLE: |
(*ctx->Exec->Disable)( n[1].e ); |
break; |
case OPCODE_DRAW_BUFFER: |
(*ctx->Exec->DrawBuffer)( n[1].e ); |
break; |
case OPCODE_DRAW_PIXELS: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->DrawPixels)( n[1].i, n[2].i, n[3].e, n[4].e, |
n[5].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_ENABLE: |
(*ctx->Exec->Enable)( n[1].e ); |
break; |
case OPCODE_EVALMESH1: |
(*ctx->Exec->EvalMesh1)( n[1].e, n[2].i, n[3].i ); |
break; |
case OPCODE_EVALMESH2: |
(*ctx->Exec->EvalMesh2)( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i ); |
break; |
case OPCODE_FOG: |
{ |
GLfloat p[4]; |
p[0] = n[2].f; |
p[1] = n[3].f; |
p[2] = n[4].f; |
p[3] = n[5].f; |
(*ctx->Exec->Fogfv)( n[1].e, p ); |
} |
break; |
case OPCODE_FRONT_FACE: |
(*ctx->Exec->FrontFace)( n[1].e ); |
break; |
case OPCODE_FRUSTUM: |
(*ctx->Exec->Frustum)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); |
break; |
case OPCODE_HINT: |
(*ctx->Exec->Hint)( n[1].e, n[2].e ); |
break; |
case OPCODE_HISTOGRAM: |
(*ctx->Exec->Histogram)( n[1].e, n[2].i, n[3].e, n[4].b ); |
break; |
case OPCODE_INDEX_MASK: |
(*ctx->Exec->IndexMask)( n[1].ui ); |
break; |
case OPCODE_INIT_NAMES: |
(*ctx->Exec->InitNames)(); |
break; |
case OPCODE_LIGHT: |
{ |
GLfloat p[4]; |
p[0] = n[3].f; |
p[1] = n[4].f; |
p[2] = n[5].f; |
p[3] = n[6].f; |
(*ctx->Exec->Lightfv)( n[1].e, n[2].e, p ); |
} |
break; |
case OPCODE_LIGHT_MODEL: |
{ |
GLfloat p[4]; |
p[0] = n[2].f; |
p[1] = n[3].f; |
p[2] = n[4].f; |
p[3] = n[5].f; |
(*ctx->Exec->LightModelfv)( n[1].e, p ); |
} |
break; |
case OPCODE_LINE_STIPPLE: |
(*ctx->Exec->LineStipple)( n[1].i, n[2].us ); |
break; |
case OPCODE_LINE_WIDTH: |
(*ctx->Exec->LineWidth)( n[1].f ); |
break; |
case OPCODE_LIST_BASE: |
(*ctx->Exec->ListBase)( n[1].ui ); |
break; |
case OPCODE_LOAD_IDENTITY: |
(*ctx->Exec->LoadIdentity)(); |
break; |
case OPCODE_LOAD_MATRIX: |
if (sizeof(Node)==sizeof(GLfloat)) { |
(*ctx->Exec->LoadMatrixf)( &n[1].f ); |
} |
else { |
GLfloat m[16]; |
GLuint i; |
for (i=0;i<16;i++) { |
m[i] = n[1+i].f; |
} |
(*ctx->Exec->LoadMatrixf)( m ); |
} |
break; |
case OPCODE_LOAD_NAME: |
(*ctx->Exec->LoadName)( n[1].ui ); |
break; |
case OPCODE_LOGIC_OP: |
(*ctx->Exec->LogicOp)( n[1].e ); |
break; |
case OPCODE_MAP1: |
{ |
GLenum target = n[1].e; |
GLint ustride = _mesa_evaluator_components(target); |
GLint uorder = n[5].i; |
GLfloat u1 = n[2].f; |
GLfloat u2 = n[3].f; |
(*ctx->Exec->Map1f)( target, u1, u2, ustride, uorder, |
(GLfloat *) n[6].data ); |
} |
break; |
case OPCODE_MAP2: |
{ |
GLenum target = n[1].e; |
GLfloat u1 = n[2].f; |
GLfloat u2 = n[3].f; |
GLfloat v1 = n[4].f; |
GLfloat v2 = n[5].f; |
GLint ustride = n[6].i; |
GLint vstride = n[7].i; |
GLint uorder = n[8].i; |
GLint vorder = n[9].i; |
(*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder, |
v1, v2, vstride, vorder, |
(GLfloat *) n[10].data ); |
} |
break; |
case OPCODE_MAPGRID1: |
(*ctx->Exec->MapGrid1f)( n[1].i, n[2].f, n[3].f ); |
break; |
case OPCODE_MAPGRID2: |
(*ctx->Exec->MapGrid2f)( n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); |
break; |
case OPCODE_MATRIX_MODE: |
(*ctx->Exec->MatrixMode)( n[1].e ); |
break; |
case OPCODE_MIN_MAX: |
(*ctx->Exec->Minmax)(n[1].e, n[2].e, n[3].b); |
break; |
case OPCODE_MULT_MATRIX: |
if (sizeof(Node)==sizeof(GLfloat)) { |
(*ctx->Exec->MultMatrixf)( &n[1].f ); |
} |
else { |
GLfloat m[16]; |
GLuint i; |
for (i=0;i<16;i++) { |
m[i] = n[1+i].f; |
} |
(*ctx->Exec->MultMatrixf)( m ); |
} |
break; |
case OPCODE_ORTHO: |
(*ctx->Exec->Ortho)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); |
break; |
case OPCODE_PASSTHROUGH: |
(*ctx->Exec->PassThrough)( n[1].f ); |
break; |
case OPCODE_PIXEL_MAP: |
(*ctx->Exec->PixelMapfv)( n[1].e, n[2].i, (GLfloat *) n[3].data ); |
break; |
case OPCODE_PIXEL_TRANSFER: |
(*ctx->Exec->PixelTransferf)( n[1].e, n[2].f ); |
break; |
case OPCODE_PIXEL_ZOOM: |
(*ctx->Exec->PixelZoom)( n[1].f, n[2].f ); |
break; |
case OPCODE_POINT_SIZE: |
(*ctx->Exec->PointSize)( n[1].f ); |
break; |
case OPCODE_POINT_PARAMETERS: |
{ |
GLfloat params[3]; |
params[0] = n[2].f; |
params[1] = n[3].f; |
params[2] = n[4].f; |
(*ctx->Exec->PointParameterfvEXT)( n[1].e, params ); |
} |
break; |
case OPCODE_POLYGON_MODE: |
(*ctx->Exec->PolygonMode)( n[1].e, n[2].e ); |
break; |
case OPCODE_POLYGON_STIPPLE: |
(*ctx->Exec->PolygonStipple)( (GLubyte *) n[1].data ); |
break; |
case OPCODE_POLYGON_OFFSET: |
(*ctx->Exec->PolygonOffset)( n[1].f, n[2].f ); |
break; |
case OPCODE_POP_ATTRIB: |
(*ctx->Exec->PopAttrib)(); |
break; |
case OPCODE_POP_MATRIX: |
(*ctx->Exec->PopMatrix)(); |
break; |
case OPCODE_POP_NAME: |
(*ctx->Exec->PopName)(); |
break; |
case OPCODE_PRIORITIZE_TEXTURE: |
(*ctx->Exec->PrioritizeTextures)( 1, &n[1].ui, &n[2].f ); |
break; |
case OPCODE_PUSH_ATTRIB: |
(*ctx->Exec->PushAttrib)( n[1].bf ); |
break; |
case OPCODE_PUSH_MATRIX: |
(*ctx->Exec->PushMatrix)(); |
break; |
case OPCODE_PUSH_NAME: |
(*ctx->Exec->PushName)( n[1].ui ); |
break; |
case OPCODE_RASTER_POS: |
(*ctx->Exec->RasterPos4f)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_READ_BUFFER: |
(*ctx->Exec->ReadBuffer)( n[1].e ); |
break; |
case OPCODE_RESET_HISTOGRAM: |
(*ctx->Exec->ResetHistogram)( n[1].e ); |
break; |
case OPCODE_RESET_MIN_MAX: |
(*ctx->Exec->ResetMinmax)( n[1].e ); |
break; |
case OPCODE_ROTATE: |
(*ctx->Exec->Rotatef)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_SCALE: |
(*ctx->Exec->Scalef)( n[1].f, n[2].f, n[3].f ); |
break; |
case OPCODE_SCISSOR: |
(*ctx->Exec->Scissor)( n[1].i, n[2].i, n[3].i, n[4].i ); |
break; |
case OPCODE_SHADE_MODEL: |
(*ctx->Exec->ShadeModel)( n[1].e ); |
break; |
case OPCODE_STENCIL_FUNC: |
(*ctx->Exec->StencilFunc)( n[1].e, n[2].i, n[3].ui ); |
break; |
case OPCODE_STENCIL_MASK: |
(*ctx->Exec->StencilMask)( n[1].ui ); |
break; |
case OPCODE_STENCIL_OP: |
(*ctx->Exec->StencilOp)( n[1].e, n[2].e, n[3].e ); |
break; |
case OPCODE_TEXENV: |
{ |
GLfloat params[4]; |
params[0] = n[3].f; |
params[1] = n[4].f; |
params[2] = n[5].f; |
params[3] = n[6].f; |
(*ctx->Exec->TexEnvfv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_TEXGEN: |
{ |
GLfloat params[4]; |
params[0] = n[3].f; |
params[1] = n[4].f; |
params[2] = n[5].f; |
params[3] = n[6].f; |
(*ctx->Exec->TexGenfv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_TEXPARAMETER: |
{ |
GLfloat params[4]; |
params[0] = n[3].f; |
params[1] = n[4].f; |
params[2] = n[5].f; |
params[3] = n[6].f; |
(*ctx->Exec->TexParameterfv)( n[1].e, n[2].e, params ); |
} |
break; |
case OPCODE_TEX_IMAGE1D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexImage1D)( |
n[1].e, /* target */ |
n[2].i, /* level */ |
n[3].i, /* components */ |
n[4].i, /* width */ |
n[5].e, /* border */ |
n[6].e, /* format */ |
n[7].e, /* type */ |
n[8].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TEX_IMAGE2D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexImage2D)( |
n[1].e, /* target */ |
n[2].i, /* level */ |
n[3].i, /* components */ |
n[4].i, /* width */ |
n[5].i, /* height */ |
n[6].e, /* border */ |
n[7].e, /* format */ |
n[8].e, /* type */ |
n[9].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TEX_IMAGE3D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexImage3D)( |
n[1].e, /* target */ |
n[2].i, /* level */ |
n[3].i, /* components */ |
n[4].i, /* width */ |
n[5].i, /* height */ |
n[6].i, /* depth */ |
n[7].e, /* border */ |
n[8].e, /* format */ |
n[9].e, /* type */ |
n[10].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TEX_SUB_IMAGE1D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexSubImage1D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].e, |
n[6].e, n[7].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TEX_SUB_IMAGE2D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexSubImage2D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].e, |
n[6].i, n[7].e, n[8].e, n[9].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TEX_SUB_IMAGE3D: |
{ |
struct gl_pixelstore_attrib save = ctx->Unpack; |
ctx->Unpack = _mesa_native_packing; |
(*ctx->Exec->TexSubImage3D)( n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i, n[7].i, |
n[8].i, n[9].e, n[10].e, |
n[11].data ); |
ctx->Unpack = save; /* restore */ |
} |
break; |
case OPCODE_TRANSLATE: |
(*ctx->Exec->Translatef)( n[1].f, n[2].f, n[3].f ); |
break; |
case OPCODE_VIEWPORT: |
(*ctx->Exec->Viewport)(n[1].i, n[2].i, |
(GLsizei) n[3].i, (GLsizei) n[4].i); |
break; |
case OPCODE_WINDOW_POS: |
(*ctx->Exec->WindowPos4fMESA)( n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ |
(*ctx->Exec->ActiveTextureARB)( n[1].e ); |
break; |
case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ |
(*ctx->Exec->PixelTexGenSGIX)( n[1].e ); |
break; |
case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ |
(*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i ); |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ |
(*ctx->Exec->CompressedTexImage1DARB)(n[1].e, n[2].i, n[3].e, |
n[4].i, n[5].i, n[6].i, n[7].data); |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ |
(*ctx->Exec->CompressedTexImage2DARB)(n[1].e, n[2].i, n[3].e, |
n[4].i, n[5].i, n[6].i, n[7].i, n[8].data); |
break; |
case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ |
(*ctx->Exec->CompressedTexImage3DARB)(n[1].e, n[2].i, n[3].e, |
n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data); |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ |
(*ctx->Exec->CompressedTexSubImage1DARB)(n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].e, n[6].i, n[7].data); |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ |
(*ctx->Exec->CompressedTexSubImage2DARB)(n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data); |
break; |
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ |
(*ctx->Exec->CompressedTexSubImage3DARB)(n[1].e, n[2].i, n[3].i, |
n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, |
n[9].e, n[10].i, n[11].data); |
break; |
case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ |
(*ctx->Exec->SampleCoverageARB)(n[1].f, n[2].b); |
break; |
case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ |
(*ctx->Exec->WindowPos3fMESA)( n[1].f, n[2].f, n[3].f ); |
break; |
case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */ |
(*ctx->Exec->BindProgramNV)( n[1].e, n[2].ui ); |
break; |
case OPCODE_EXECUTE_PROGRAM_NV: |
{ |
GLfloat v[4]; |
v[0] = n[3].f; |
v[1] = n[4].f; |
v[2] = n[5].f; |
v[3] = n[6].f; |
(*ctx->Exec->ExecuteProgramNV)(n[1].e, n[2].ui, v); |
} |
break; |
case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV: |
/* |
(*ctx->Exec->RequestResidentProgramsNV)(); |
*/ |
break; |
case OPCODE_LOAD_PROGRAM_NV: |
/* |
(*ctx->Exec->LoadProgramNV)(); |
*/ |
break; |
case OPCODE_PROGRAM_PARAMETER4F_NV: |
(*ctx->Exec->ProgramParameter4fNV)(n[1].e, n[2].ui, n[3].f, |
n[4].f, n[5].f, n[6].f); |
break; |
case OPCODE_TRACK_MATRIX_NV: |
(*ctx->Exec->TrackMatrixNV)(n[1].e, n[2].ui, n[3].e, n[4].e); |
break; |
case OPCODE_CONTINUE: |
n = (Node *) n[1].next; |
break; |
case OPCODE_END_OF_LIST: |
done = GL_TRUE; |
break; |
default: |
{ |
char msg[1000]; |
_mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); |
_mesa_problem(ctx, msg); |
} |
done = GL_TRUE; |
} |
/* increment n to point to next compiled command */ |
if (opcode!=OPCODE_CONTINUE) { |
n += InstSize[opcode]; |
} |
} |
} |
ctx->CallDepth--; |
if (ctx->Driver.EndCallList) |
ctx->Driver.EndCallList( ctx ); |
} |
/**********************************************************************/ |
/* GL functions */ |
/**********************************************************************/ |
/* |
* Test if a display list number is valid. |
*/ |
GLboolean |
_mesa_IsList( GLuint list ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
return islist(ctx, list); |
} |
/* |
* Delete a sequence of consecutive display lists. |
*/ |
void |
_mesa_DeleteLists( GLuint list, GLsizei range ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint i; |
FLUSH_VERTICES(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (range<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteLists" ); |
return; |
} |
for (i=list;i<list+range;i++) { |
_mesa_destroy_list( ctx, i ); |
} |
} |
/* |
* Return a display list number, n, such that lists n through n+range-1 |
* are free. |
*/ |
GLuint |
_mesa_GenLists(GLsizei range ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint base; |
FLUSH_VERTICES(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); |
if (range<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glGenLists" ); |
return 0; |
} |
if (range==0) { |
return 0; |
} |
/* |
* Make this an atomic operation |
*/ |
_glthread_LOCK_MUTEX(ctx->Shared->Mutex); |
base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); |
if (base) { |
/* reserve the list IDs by with empty/dummy lists */ |
GLint i; |
for (i=0; i<range; i++) { |
_mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list()); |
} |
} |
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); |
return base; |
} |
/* |
* Begin a new display list. |
*/ |
void |
_mesa_NewList( GLuint list, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_CURRENT(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glNewList %u %s\n", list, |
_mesa_lookup_enum_by_nr(mode)); |
if (list==0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glNewList" ); |
return; |
} |
if (mode!=GL_COMPILE && mode!=GL_COMPILE_AND_EXECUTE) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glNewList" ); |
return; |
} |
if (ctx->CurrentListPtr) { |
/* already compiling a display list */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" ); |
return; |
} |
/* Allocate new display list */ |
ctx->CurrentListNum = list; |
ctx->CurrentBlock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE ); |
ctx->CurrentListPtr = ctx->CurrentBlock; |
ctx->CurrentPos = 0; |
ctx->CompileFlag = GL_TRUE; |
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); |
ctx->Driver.NewList( ctx, list, mode ); |
ctx->CurrentDispatch = ctx->Save; |
_glapi_set_dispatch( ctx->CurrentDispatch ); |
} |
/* |
* End definition of current display list. Is the current |
* ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that |
* we are outside begin/end calls? |
*/ |
void |
_mesa_EndList( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_CURRENT(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glEndList\n"); |
/* Check that a list is under construction */ |
if (!ctx->CurrentListPtr) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" ); |
return; |
} |
(void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 ); |
/* Destroy old list, if any */ |
_mesa_destroy_list(ctx, ctx->CurrentListNum); |
/* Install the list */ |
_mesa_HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr); |
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) |
mesa_print_display_list(ctx->CurrentListNum); |
ctx->CurrentListNum = 0; |
ctx->CurrentListPtr = NULL; |
ctx->ExecuteFlag = GL_TRUE; |
ctx->CompileFlag = GL_FALSE; |
ctx->Driver.EndList( ctx ); |
ctx->CurrentDispatch = ctx->Exec; |
_glapi_set_dispatch( ctx->CurrentDispatch ); |
} |
void |
_mesa_CallList( GLuint list ) |
{ |
GLboolean save_compile_flag; |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_CURRENT(ctx, 0); |
/* VERY IMPORTANT: Save the CompileFlag status, turn it off, */ |
/* execute the display list, and restore the CompileFlag. */ |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "_mesa_CallList %d\n", list); |
/* mesa_print_display_list( list ); */ |
save_compile_flag = ctx->CompileFlag; |
if (save_compile_flag) { |
ctx->CompileFlag = GL_FALSE; |
} |
execute_list( ctx, list ); |
ctx->CompileFlag = save_compile_flag; |
/* also restore API function pointers to point to "save" versions */ |
if (save_compile_flag) { |
ctx->CurrentDispatch = ctx->Save; |
_glapi_set_dispatch( ctx->CurrentDispatch ); |
} |
} |
/* |
* Execute glCallLists: call multiple display lists. |
*/ |
void |
_mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint list; |
GLint i; |
GLboolean save_compile_flag; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "_mesa_CallLists %d\n", n); |
switch (type) { |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
case GL_2_BYTES: |
case GL_3_BYTES: |
case GL_4_BYTES: |
/* OK */ |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); |
return; |
} |
/* Save the CompileFlag status, turn it off, execute display list, |
* and restore the CompileFlag. |
*/ |
save_compile_flag = ctx->CompileFlag; |
ctx->CompileFlag = GL_FALSE; |
for (i=0;i<n;i++) { |
list = translate_id( i, type, lists ); |
execute_list( ctx, ctx->List.ListBase + list ); |
} |
ctx->CompileFlag = save_compile_flag; |
/* also restore API function pointers to point to "save" versions */ |
if (save_compile_flag) { |
ctx->CurrentDispatch = ctx->Save; |
_glapi_set_dispatch( ctx->CurrentDispatch ); |
} |
} |
/* |
* Set the offset added to list numbers in glCallLists. |
*/ |
void |
_mesa_ListBase( GLuint base ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); /* must be called before assert */ |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
ctx->List.ListBase = base; |
} |
/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. |
*/ |
static void exec_Finish( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->Finish(); |
} |
static void exec_Flush( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->Flush( ); |
} |
static void exec_GetBooleanv( GLenum pname, GLboolean *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetBooleanv( pname, params ); |
} |
static void exec_GetClipPlane( GLenum plane, GLdouble *equation ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetClipPlane( plane, equation ); |
} |
static void exec_GetDoublev( GLenum pname, GLdouble *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetDoublev( pname, params ); |
} |
static GLenum exec_GetError( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->GetError( ); |
} |
static void exec_GetFloatv( GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetFloatv( pname, params ); |
} |
static void exec_GetIntegerv( GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetIntegerv( pname, params ); |
} |
static void exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetLightfv( light, pname, params ); |
} |
static void exec_GetLightiv( GLenum light, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetLightiv( light, pname, params ); |
} |
static void exec_GetMapdv( GLenum target, GLenum query, GLdouble *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMapdv( target, query, v ); |
} |
static void exec_GetMapfv( GLenum target, GLenum query, GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMapfv( target, query, v ); |
} |
static void exec_GetMapiv( GLenum target, GLenum query, GLint *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMapiv( target, query, v ); |
} |
static void exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMaterialfv( face, pname, params ); |
} |
static void exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMaterialiv( face, pname, params ); |
} |
static void exec_GetPixelMapfv( GLenum map, GLfloat *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPixelMapfv( map, values ); |
} |
static void exec_GetPixelMapuiv( GLenum map, GLuint *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPixelMapuiv( map, values ); |
} |
static void exec_GetPixelMapusv( GLenum map, GLushort *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPixelMapusv( map, values ); |
} |
static void exec_GetPolygonStipple( GLubyte *dest ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPolygonStipple( dest ); |
} |
static const GLubyte *exec_GetString( GLenum name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->GetString( name ); |
} |
static void exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexEnvfv( target, pname, params ); |
} |
static void exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexEnviv( target, pname, params ); |
} |
static void exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexGendv( coord, pname, params ); |
} |
static void exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexGenfv( coord, pname, params ); |
} |
static void exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexGeniv( coord, pname, params ); |
} |
static void exec_GetTexImage( GLenum target, GLint level, GLenum format, |
GLenum type, GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexImage( target, level, format, type, pixels ); |
} |
static void exec_GetTexLevelParameterfv( GLenum target, GLint level, |
GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexLevelParameterfv( target, level, pname, params ); |
} |
static void exec_GetTexLevelParameteriv( GLenum target, GLint level, |
GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexLevelParameteriv( target, level, pname, params ); |
} |
static void exec_GetTexParameterfv( GLenum target, GLenum pname, |
GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexParameterfv( target, pname, params ); |
} |
static void exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetTexParameteriv( target, pname, params ); |
} |
static GLboolean exec_IsEnabled( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->IsEnabled( cap ); |
} |
static void exec_PixelStoref( GLenum pname, GLfloat param ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->PixelStoref( pname, param ); |
} |
static void exec_PixelStorei( GLenum pname, GLint param ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->PixelStorei( pname, param ); |
} |
static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, |
GLenum format, GLenum type, GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels ); |
} |
static GLint exec_RenderMode( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->RenderMode( mode ); |
} |
static void exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->FeedbackBuffer( size, type, buffer ); |
} |
static void exec_SelectBuffer( GLsizei size, GLuint *buffer ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->SelectBuffer( size, buffer ); |
} |
static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName, |
GLboolean *residences) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->AreTexturesResident( n, texName, residences); |
} |
static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->ColorPointer( size, type, stride, ptr); |
} |
static void exec_DeleteTextures( GLsizei n, const GLuint *texName) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->DeleteTextures( n, texName); |
} |
static void exec_DisableClientState( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->DisableClientState( cap ); |
} |
static void exec_EdgeFlagPointer(GLsizei stride, const void *vptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->EdgeFlagPointer( stride, vptr); |
} |
static void exec_EnableClientState( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->EnableClientState( cap ); |
} |
static void exec_GenTextures( GLsizei n, GLuint *texName ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GenTextures( n, texName ); |
} |
static void exec_GetPointerv( GLenum pname, GLvoid **params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPointerv( pname, params ); |
} |
static void exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->IndexPointer( type, stride, ptr); |
} |
static void exec_InterleavedArrays(GLenum format, GLsizei stride, |
const GLvoid *pointer) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->InterleavedArrays( format, stride, pointer); |
} |
static GLboolean exec_IsTexture( GLuint texture ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
return ctx->Exec->IsTexture( texture ); |
} |
static void exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->NormalPointer( type, stride, ptr ); |
} |
static void exec_PopClientAttrib(void) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->PopClientAttrib(); |
} |
static void exec_PushClientAttrib(GLbitfield mask) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->PushClientAttrib( mask); |
} |
static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->TexCoordPointer( size, type, stride, ptr); |
} |
static void exec_GetCompressedTexImageARB(GLenum target, GLint level, |
GLvoid *img) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetCompressedTexImageARB( target, level, img); |
} |
static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->VertexPointer( size, type, stride, ptr); |
} |
static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, |
GLint x, GLint y, GLsizei width) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width); |
} |
static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, |
GLint x, GLint y, GLsizei width, |
GLsizei height) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->CopyConvolutionFilter2D( target, internalFormat, x, y, width, |
height); |
} |
static void exec_GetColorTable( GLenum target, GLenum format, |
GLenum type, GLvoid *data ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetColorTable( target, format, type, data ); |
} |
static void exec_GetColorTableParameterfv( GLenum target, GLenum pname, |
GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetColorTableParameterfv( target, pname, params ); |
} |
static void exec_GetColorTableParameteriv( GLenum target, GLenum pname, |
GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetColorTableParameteriv( target, pname, params ); |
} |
static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, |
GLvoid *image) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetConvolutionFilter( target, format, type, image); |
} |
static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname, |
GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetConvolutionParameterfv( target, pname, params); |
} |
static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname, |
GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetConvolutionParameteriv( target, pname, params); |
} |
static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, |
GLenum type, GLvoid *values) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetHistogram( target, reset, format, type, values); |
} |
static void exec_GetHistogramParameterfv(GLenum target, GLenum pname, |
GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetHistogramParameterfv( target, pname, params); |
} |
static void exec_GetHistogramParameteriv(GLenum target, GLenum pname, |
GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetHistogramParameteriv( target, pname, params); |
} |
static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, |
GLenum type, GLvoid *values) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMinmax( target, reset, format, type, values); |
} |
static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname, |
GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMinmaxParameterfv( target, pname, params); |
} |
static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname, |
GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetMinmaxParameteriv( target, pname, params); |
} |
static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, |
GLvoid *row, GLvoid *column, GLvoid *span) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetSeparableFilter( target, format, type, row, column, span); |
} |
static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat, |
GLsizei width, GLsizei height, GLenum format, |
GLenum type, const GLvoid *row, |
const GLvoid *column) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->SeparableFilter2D( target, internalFormat, width, height, format, |
type, row, column); |
} |
static void exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPixelTexGenParameterivSGIS( target, value); |
} |
static void exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value); |
} |
static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr); |
} |
static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, |
const GLboolean *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr); |
} |
static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->IndexPointerEXT( type, stride, count, ptr); |
} |
static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->NormalPointerEXT( type, stride, count, ptr); |
} |
static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr); |
} |
static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr); |
} |
static void exec_LockArraysEXT(GLint first, GLsizei count) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->LockArraysEXT( first, count); |
} |
static void exec_UnlockArraysEXT( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->UnlockArraysEXT( ); |
} |
static void exec_ResizeBuffersMESA( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->ResizeBuffersMESA( ); |
} |
static void exec_ClientActiveTextureARB( GLenum target ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->ClientActiveTextureARB(target); |
} |
static void exec_SecondaryColorPointerEXT(GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr); |
} |
static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->FogCoordPointerEXT( type, stride, ptr); |
} |
/* GL_EXT_multi_draw_arrays */ |
static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first, |
GLsizei *count, GLsizei primcount) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->MultiDrawArraysEXT( mode, first, count, primcount ); |
} |
/* GL_EXT_multi_draw_arrays */ |
static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, |
GLenum type, const GLvoid **indices, |
GLsizei primcount) |
{ |
GET_CURRENT_CONTEXT(ctx); |
FLUSH_VERTICES(ctx, 0); |
ctx->Exec->MultiDrawElementsEXT(mode, count, type, indices, primcount); |
} |
/* |
* Assign all the pointers in <table> to point to Mesa's display list |
* building functions. |
* |
* This does not include any of the tnl functions - they are |
* initialized from _mesa_init_api_defaults and from the active vtxfmt |
* struct. |
*/ |
void |
_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) |
{ |
_mesa_init_no_op_table(table, tableSize); |
_mesa_loopback_init_api_table( table, GL_TRUE ); |
/* GL 1.0 */ |
table->Accum = save_Accum; |
table->AlphaFunc = save_AlphaFunc; |
table->Bitmap = save_Bitmap; |
table->BlendFunc = save_BlendFunc; |
table->CallList = _mesa_save_CallList; |
table->CallLists = _mesa_save_CallLists; |
table->Clear = save_Clear; |
table->ClearAccum = save_ClearAccum; |
table->ClearColor = save_ClearColor; |
table->ClearDepth = save_ClearDepth; |
table->ClearIndex = save_ClearIndex; |
table->ClearStencil = save_ClearStencil; |
table->ClipPlane = save_ClipPlane; |
table->ColorMask = save_ColorMask; |
table->ColorMaterial = save_ColorMaterial; |
table->CopyPixels = save_CopyPixels; |
table->CullFace = save_CullFace; |
table->DeleteLists = _mesa_DeleteLists; |
table->DepthFunc = save_DepthFunc; |
table->DepthMask = save_DepthMask; |
table->DepthRange = save_DepthRange; |
table->Disable = save_Disable; |
table->DrawBuffer = save_DrawBuffer; |
table->DrawPixels = save_DrawPixels; |
table->Enable = save_Enable; |
table->EndList = _mesa_EndList; |
table->EvalMesh1 = _mesa_save_EvalMesh1; |
table->EvalMesh2 = _mesa_save_EvalMesh2; |
table->Finish = exec_Finish; |
table->Flush = exec_Flush; |
table->Fogf = save_Fogf; |
table->Fogfv = save_Fogfv; |
table->Fogi = save_Fogi; |
table->Fogiv = save_Fogiv; |
table->FrontFace = save_FrontFace; |
table->Frustum = save_Frustum; |
table->GenLists = _mesa_GenLists; |
table->GetBooleanv = exec_GetBooleanv; |
table->GetClipPlane = exec_GetClipPlane; |
table->GetDoublev = exec_GetDoublev; |
table->GetError = exec_GetError; |
table->GetFloatv = exec_GetFloatv; |
table->GetIntegerv = exec_GetIntegerv; |
table->GetLightfv = exec_GetLightfv; |
table->GetLightiv = exec_GetLightiv; |
table->GetMapdv = exec_GetMapdv; |
table->GetMapfv = exec_GetMapfv; |
table->GetMapiv = exec_GetMapiv; |
table->GetMaterialfv = exec_GetMaterialfv; |
table->GetMaterialiv = exec_GetMaterialiv; |
table->GetPixelMapfv = exec_GetPixelMapfv; |
table->GetPixelMapuiv = exec_GetPixelMapuiv; |
table->GetPixelMapusv = exec_GetPixelMapusv; |
table->GetPolygonStipple = exec_GetPolygonStipple; |
table->GetString = exec_GetString; |
table->GetTexEnvfv = exec_GetTexEnvfv; |
table->GetTexEnviv = exec_GetTexEnviv; |
table->GetTexGendv = exec_GetTexGendv; |
table->GetTexGenfv = exec_GetTexGenfv; |
table->GetTexGeniv = exec_GetTexGeniv; |
table->GetTexImage = exec_GetTexImage; |
table->GetTexLevelParameterfv = exec_GetTexLevelParameterfv; |
table->GetTexLevelParameteriv = exec_GetTexLevelParameteriv; |
table->GetTexParameterfv = exec_GetTexParameterfv; |
table->GetTexParameteriv = exec_GetTexParameteriv; |
table->Hint = save_Hint; |
table->IndexMask = save_IndexMask; |
table->InitNames = save_InitNames; |
table->IsEnabled = exec_IsEnabled; |
table->IsList = _mesa_IsList; |
table->LightModelf = save_LightModelf; |
table->LightModelfv = save_LightModelfv; |
table->LightModeli = save_LightModeli; |
table->LightModeliv = save_LightModeliv; |
table->Lightf = save_Lightf; |
table->Lightfv = save_Lightfv; |
table->Lighti = save_Lighti; |
table->Lightiv = save_Lightiv; |
table->LineStipple = save_LineStipple; |
table->LineWidth = save_LineWidth; |
table->ListBase = save_ListBase; |
table->LoadIdentity = save_LoadIdentity; |
table->LoadMatrixd = save_LoadMatrixd; |
table->LoadMatrixf = save_LoadMatrixf; |
table->LoadName = save_LoadName; |
table->LogicOp = save_LogicOp; |
table->Map1d = save_Map1d; |
table->Map1f = save_Map1f; |
table->Map2d = save_Map2d; |
table->Map2f = save_Map2f; |
table->MapGrid1d = save_MapGrid1d; |
table->MapGrid1f = save_MapGrid1f; |
table->MapGrid2d = save_MapGrid2d; |
table->MapGrid2f = save_MapGrid2f; |
table->MatrixMode = save_MatrixMode; |
table->MultMatrixd = save_MultMatrixd; |
table->MultMatrixf = save_MultMatrixf; |
table->NewList = save_NewList; |
table->Ortho = save_Ortho; |
table->PassThrough = save_PassThrough; |
table->PixelMapfv = save_PixelMapfv; |
table->PixelMapuiv = save_PixelMapuiv; |
table->PixelMapusv = save_PixelMapusv; |
table->PixelStoref = exec_PixelStoref; |
table->PixelStorei = exec_PixelStorei; |
table->PixelTransferf = save_PixelTransferf; |
table->PixelTransferi = save_PixelTransferi; |
table->PixelZoom = save_PixelZoom; |
table->PointSize = save_PointSize; |
table->PolygonMode = save_PolygonMode; |
table->PolygonOffset = save_PolygonOffset; |
table->PolygonStipple = save_PolygonStipple; |
table->PopAttrib = save_PopAttrib; |
table->PopMatrix = save_PopMatrix; |
table->PopName = save_PopName; |
table->PushAttrib = save_PushAttrib; |
table->PushMatrix = save_PushMatrix; |
table->PushName = save_PushName; |
table->RasterPos2d = save_RasterPos2d; |
table->RasterPos2dv = save_RasterPos2dv; |
table->RasterPos2f = save_RasterPos2f; |
table->RasterPos2fv = save_RasterPos2fv; |
table->RasterPos2i = save_RasterPos2i; |
table->RasterPos2iv = save_RasterPos2iv; |
table->RasterPos2s = save_RasterPos2s; |
table->RasterPos2sv = save_RasterPos2sv; |
table->RasterPos3d = save_RasterPos3d; |
table->RasterPos3dv = save_RasterPos3dv; |
table->RasterPos3f = save_RasterPos3f; |
table->RasterPos3fv = save_RasterPos3fv; |
table->RasterPos3i = save_RasterPos3i; |
table->RasterPos3iv = save_RasterPos3iv; |
table->RasterPos3s = save_RasterPos3s; |
table->RasterPos3sv = save_RasterPos3sv; |
table->RasterPos4d = save_RasterPos4d; |
table->RasterPos4dv = save_RasterPos4dv; |
table->RasterPos4f = save_RasterPos4f; |
table->RasterPos4fv = save_RasterPos4fv; |
table->RasterPos4i = save_RasterPos4i; |
table->RasterPos4iv = save_RasterPos4iv; |
table->RasterPos4s = save_RasterPos4s; |
table->RasterPos4sv = save_RasterPos4sv; |
table->ReadBuffer = save_ReadBuffer; |
table->ReadPixels = exec_ReadPixels; |
table->RenderMode = exec_RenderMode; |
table->Rotated = save_Rotated; |
table->Rotatef = save_Rotatef; |
table->Scaled = save_Scaled; |
table->Scalef = save_Scalef; |
table->Scissor = save_Scissor; |
table->FeedbackBuffer = exec_FeedbackBuffer; |
table->SelectBuffer = exec_SelectBuffer; |
table->ShadeModel = save_ShadeModel; |
table->StencilFunc = save_StencilFunc; |
table->StencilMask = save_StencilMask; |
table->StencilOp = save_StencilOp; |
table->TexEnvf = save_TexEnvf; |
table->TexEnvfv = save_TexEnvfv; |
table->TexEnvi = save_TexEnvi; |
table->TexEnviv = save_TexEnviv; |
table->TexGend = save_TexGend; |
table->TexGendv = save_TexGendv; |
table->TexGenf = save_TexGenf; |
table->TexGenfv = save_TexGenfv; |
table->TexGeni = save_TexGeni; |
table->TexGeniv = save_TexGeniv; |
table->TexImage1D = save_TexImage1D; |
table->TexImage2D = save_TexImage2D; |
table->TexParameterf = save_TexParameterf; |
table->TexParameterfv = save_TexParameterfv; |
table->TexParameteri = save_TexParameteri; |
table->TexParameteriv = save_TexParameteriv; |
table->Translated = save_Translated; |
table->Translatef = save_Translatef; |
table->Viewport = save_Viewport; |
/* GL 1.1 */ |
table->AreTexturesResident = exec_AreTexturesResident; |
table->AreTexturesResidentEXT = exec_AreTexturesResident; |
table->BindTexture = save_BindTexture; |
table->ColorPointer = exec_ColorPointer; |
table->CopyTexImage1D = save_CopyTexImage1D; |
table->CopyTexImage2D = save_CopyTexImage2D; |
table->CopyTexSubImage1D = save_CopyTexSubImage1D; |
table->CopyTexSubImage2D = save_CopyTexSubImage2D; |
table->DeleteTextures = exec_DeleteTextures; |
table->DisableClientState = exec_DisableClientState; |
table->EdgeFlagPointer = exec_EdgeFlagPointer; |
table->EnableClientState = exec_EnableClientState; |
table->GenTextures = exec_GenTextures; |
table->GenTexturesEXT = exec_GenTextures; |
table->GetPointerv = exec_GetPointerv; |
table->IndexPointer = exec_IndexPointer; |
table->InterleavedArrays = exec_InterleavedArrays; |
table->IsTexture = exec_IsTexture; |
table->IsTextureEXT = exec_IsTexture; |
table->NormalPointer = exec_NormalPointer; |
table->PopClientAttrib = exec_PopClientAttrib; |
table->PrioritizeTextures = save_PrioritizeTextures; |
table->PushClientAttrib = exec_PushClientAttrib; |
table->TexCoordPointer = exec_TexCoordPointer; |
table->TexSubImage1D = save_TexSubImage1D; |
table->TexSubImage2D = save_TexSubImage2D; |
table->VertexPointer = exec_VertexPointer; |
/* GL 1.2 */ |
table->CopyTexSubImage3D = save_CopyTexSubImage3D; |
table->TexImage3D = save_TexImage3D; |
table->TexSubImage3D = save_TexSubImage3D; |
/* GL_ARB_imaging */ |
/* Not all are supported */ |
table->BlendColor = save_BlendColor; |
table->BlendEquation = save_BlendEquation; |
table->ColorSubTable = save_ColorSubTable; |
table->ColorTable = save_ColorTable; |
table->ColorTableParameterfv = save_ColorTableParameterfv; |
table->ColorTableParameteriv = save_ColorTableParameteriv; |
table->ConvolutionFilter1D = save_ConvolutionFilter1D; |
table->ConvolutionFilter2D = save_ConvolutionFilter2D; |
table->ConvolutionParameterf = save_ConvolutionParameterf; |
table->ConvolutionParameterfv = save_ConvolutionParameterfv; |
table->ConvolutionParameteri = save_ConvolutionParameteri; |
table->ConvolutionParameteriv = save_ConvolutionParameteriv; |
table->CopyColorSubTable = save_CopyColorSubTable; |
table->CopyColorTable = save_CopyColorTable; |
table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D; |
table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D; |
table->GetColorTable = exec_GetColorTable; |
table->GetColorTableEXT = exec_GetColorTable; |
table->GetColorTableParameterfv = exec_GetColorTableParameterfv; |
table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv; |
table->GetColorTableParameteriv = exec_GetColorTableParameteriv; |
table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv; |
table->GetConvolutionFilter = exec_GetConvolutionFilter; |
table->GetConvolutionFilterEXT = exec_GetConvolutionFilter; |
table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv; |
table->GetConvolutionParameterfvEXT = exec_GetConvolutionParameterfv; |
table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv; |
table->GetConvolutionParameterivEXT = exec_GetConvolutionParameteriv; |
table->GetHistogram = exec_GetHistogram; |
table->GetHistogramEXT = exec_GetHistogram; |
table->GetHistogramParameterfv = exec_GetHistogramParameterfv; |
table->GetHistogramParameterfvEXT = exec_GetHistogramParameterfv; |
table->GetHistogramParameteriv = exec_GetHistogramParameteriv; |
table->GetHistogramParameterivEXT = exec_GetHistogramParameteriv; |
table->GetMinmax = exec_GetMinmax; |
table->GetMinmaxEXT = exec_GetMinmax; |
table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv; |
table->GetMinmaxParameterfvEXT = exec_GetMinmaxParameterfv; |
table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv; |
table->GetMinmaxParameterivEXT = exec_GetMinmaxParameteriv; |
table->GetSeparableFilter = exec_GetSeparableFilter; |
table->GetSeparableFilterEXT = exec_GetSeparableFilter; |
table->Histogram = save_Histogram; |
table->Minmax = save_Minmax; |
table->ResetHistogram = save_ResetHistogram; |
table->ResetMinmax = save_ResetMinmax; |
table->SeparableFilter2D = exec_SeparableFilter2D; |
/* 2. GL_EXT_blend_color */ |
#if 0 |
table->BlendColorEXT = save_BlendColorEXT; |
#endif |
/* 3. GL_EXT_polygon_offset */ |
table->PolygonOffsetEXT = save_PolygonOffsetEXT; |
/* 6. GL_EXT_texture3d */ |
#if 0 |
table->CopyTexSubImage3DEXT = save_CopyTexSubImage3D; |
table->TexImage3DEXT = save_TexImage3DEXT; |
table->TexSubImage3DEXT = save_TexSubImage3D; |
#endif |
/* 15. GL_SGIX_pixel_texture */ |
table->PixelTexGenSGIX = save_PixelTexGenSGIX; |
/* 15. GL_SGIS_pixel_texture */ |
table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS; |
table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS; |
table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS; |
table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS; |
table->GetPixelTexGenParameterivSGIS = exec_GetPixelTexGenParameterivSGIS; |
table->GetPixelTexGenParameterfvSGIS = exec_GetPixelTexGenParameterfvSGIS; |
/* 30. GL_EXT_vertex_array */ |
table->ColorPointerEXT = exec_ColorPointerEXT; |
table->EdgeFlagPointerEXT = exec_EdgeFlagPointerEXT; |
table->IndexPointerEXT = exec_IndexPointerEXT; |
table->NormalPointerEXT = exec_NormalPointerEXT; |
table->TexCoordPointerEXT = exec_TexCoordPointerEXT; |
table->VertexPointerEXT = exec_VertexPointerEXT; |
/* 37. GL_EXT_blend_minmax */ |
#if 0 |
table->BlendEquationEXT = save_BlendEquationEXT; |
#endif |
/* 54. GL_EXT_point_parameters */ |
table->PointParameterfEXT = save_PointParameterfEXT; |
table->PointParameterfvEXT = save_PointParameterfvEXT; |
/* 78. GL_EXT_paletted_texture */ |
#if 0 |
table->ColorTableEXT = save_ColorTable; |
table->ColorSubTableEXT = save_ColorSubTable; |
#endif |
table->GetColorTableEXT = exec_GetColorTable; |
table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv; |
table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv; |
/* 97. GL_EXT_compiled_vertex_array */ |
table->LockArraysEXT = exec_LockArraysEXT; |
table->UnlockArraysEXT = exec_UnlockArraysEXT; |
/* 145. GL_EXT_secondary_color */ |
table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT; |
/* 148. GL_EXT_multi_draw_arrays */ |
table->MultiDrawArraysEXT = exec_MultiDrawArraysEXT; |
table->MultiDrawElementsEXT = exec_MultiDrawElementsEXT; |
/* 149. GL_EXT_fog_coord */ |
table->FogCoordPointerEXT = exec_FogCoordPointerEXT; |
/* 173. GL_EXT_blend_func_separate */ |
table->BlendFuncSeparateEXT = save_BlendFuncSeparateEXT; |
/* 196. GL_MESA_resize_buffers */ |
table->ResizeBuffersMESA = exec_ResizeBuffersMESA; |
/* 197. GL_MESA_window_pos */ |
table->WindowPos2dMESA = save_WindowPos2dMESA; |
table->WindowPos2dvMESA = save_WindowPos2dvMESA; |
table->WindowPos2fMESA = save_WindowPos2fMESA; |
table->WindowPos2fvMESA = save_WindowPos2fvMESA; |
table->WindowPos2iMESA = save_WindowPos2iMESA; |
table->WindowPos2ivMESA = save_WindowPos2ivMESA; |
table->WindowPos2sMESA = save_WindowPos2sMESA; |
table->WindowPos2svMESA = save_WindowPos2svMESA; |
table->WindowPos3dMESA = save_WindowPos3dMESA; |
table->WindowPos3dvMESA = save_WindowPos3dvMESA; |
table->WindowPos3fMESA = save_WindowPos3fMESA; |
table->WindowPos3fvMESA = save_WindowPos3fvMESA; |
table->WindowPos3iMESA = save_WindowPos3iMESA; |
table->WindowPos3ivMESA = save_WindowPos3ivMESA; |
table->WindowPos3sMESA = save_WindowPos3sMESA; |
table->WindowPos3svMESA = save_WindowPos3svMESA; |
table->WindowPos4dMESA = save_WindowPos4dMESA; |
table->WindowPos4dvMESA = save_WindowPos4dvMESA; |
table->WindowPos4fMESA = save_WindowPos4fMESA; |
table->WindowPos4fvMESA = save_WindowPos4fvMESA; |
table->WindowPos4iMESA = save_WindowPos4iMESA; |
table->WindowPos4ivMESA = save_WindowPos4ivMESA; |
table->WindowPos4sMESA = save_WindowPos4sMESA; |
table->WindowPos4svMESA = save_WindowPos4svMESA; |
#if FEATURE_NV_vertex_program |
/* 233. GL_NV_vertex_program */ |
/* The following commands DO NOT go into display lists: |
* AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, |
* VertexAttribPointerNV, GetProgram*, GetVertexAttrib* |
*/ |
table->BindProgramNV = save_BindProgramNV; |
table->DeleteProgramsNV = _mesa_DeleteProgramsNV; |
table->ExecuteProgramNV = save_ExecuteProgramNV; |
table->GenProgramsNV = _mesa_GenProgramsNV; |
table->AreProgramsResidentNV = _mesa_AreProgramsResidentNV; |
table->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV; |
table->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV; |
table->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV; |
table->GetProgramivNV = _mesa_GetProgramivNV; |
table->GetProgramStringNV = _mesa_GetProgramStringNV; |
table->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV; |
table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV; |
table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV; |
table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV; |
table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV; |
table->IsProgramNV = _mesa_IsProgramNV; |
table->LoadProgramNV = _mesa_LoadProgramNV; |
table->ProgramParameter4dNV = save_ProgramParameter4dNV; |
table->ProgramParameter4dvNV = save_ProgramParameter4dvNV; |
table->ProgramParameter4fNV = save_ProgramParameter4fNV; |
table->ProgramParameter4fvNV = save_ProgramParameter4fvNV; |
table->ProgramParameters4dvNV = save_ProgramParameters4dvNV; |
table->ProgramParameters4fvNV = save_ProgramParameters4fvNV; |
table->TrackMatrixNV = save_TrackMatrixNV; |
table->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; |
#endif |
/* 262. GL_NV_point_sprite */ |
table->PointParameteriNV = save_PointParameteriNV; |
table->PointParameterivNV = save_PointParameterivNV; |
/* 268. GL_EXT_stencil_two_side */ |
table->ActiveStencilFaceEXT = save_ActiveStencilFaceEXT; |
/* ARB 1. GL_ARB_multitexture */ |
table->ActiveTextureARB = save_ActiveTextureARB; |
table->ClientActiveTextureARB = exec_ClientActiveTextureARB; |
/* ARB 3. GL_ARB_transpose_matrix */ |
table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB; |
table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB; |
table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; |
table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; |
/* ARB 5. GL_ARB_multisample */ |
table->SampleCoverageARB = save_SampleCoverageARB; |
/* ARB 12. GL_ARB_texture_compression */ |
table->CompressedTexImage3DARB = save_CompressedTexImage3DARB; |
table->CompressedTexImage2DARB = save_CompressedTexImage2DARB; |
table->CompressedTexImage1DARB = save_CompressedTexImage1DARB; |
table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB; |
table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB; |
table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; |
table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB; |
/* ARB 14. GL_ARB_point_parameters */ |
/* re-use EXT_point_parameters functions */ |
/* ARB 25. GL_ARB_window_pos */ |
/* re-use MESA_window_pos functions */ |
} |
/*** |
*** Debugging code |
***/ |
static const char *enum_string( GLenum k ) |
{ |
return _mesa_lookup_enum_by_nr( k ); |
} |
/* |
* Print the commands in a display list. For debugging only. |
* TODO: many commands aren't handled yet. |
*/ |
static void print_list( GLcontext *ctx, GLuint list ) |
{ |
Node *n; |
GLboolean done; |
if (!glIsList(list)) { |
_mesa_printf("%u is not a display list ID\n", list); |
return; |
} |
n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); |
_mesa_printf("START-LIST %u, address %p\n", list, (void*)n ); |
done = n ? GL_FALSE : GL_TRUE; |
while (!done) { |
OpCode opcode = n[0].opcode; |
GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0; |
if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) { |
ctx->listext.opcode[i].print(ctx, &n[1]); |
n += ctx->listext.opcode[i].size; |
} |
else { |
switch (opcode) { |
case OPCODE_ACCUM: |
_mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f ); |
break; |
case OPCODE_BITMAP: |
_mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, |
n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data ); |
break; |
case OPCODE_CALL_LIST: |
_mesa_printf("CallList %d\n", (int) n[1].ui ); |
break; |
case OPCODE_CALL_LIST_OFFSET: |
_mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, |
ctx->List.ListBase, ctx->List.ListBase + n[1].ui ); |
break; |
case OPCODE_COLOR_TABLE_PARAMETER_FV: |
_mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", |
enum_string(n[1].e), enum_string(n[2].e), |
n[3].f, n[4].f, n[5].f, n[6].f); |
break; |
case OPCODE_COLOR_TABLE_PARAMETER_IV: |
_mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", |
enum_string(n[1].e), enum_string(n[2].e), |
n[3].i, n[4].i, n[5].i, n[6].i); |
break; |
case OPCODE_DISABLE: |
_mesa_printf("Disable %s\n", enum_string(n[1].e)); |
break; |
case OPCODE_ENABLE: |
_mesa_printf("Enable %s\n", enum_string(n[1].e)); |
break; |
case OPCODE_FRUSTUM: |
_mesa_printf("Frustum %g %g %g %g %g %g\n", |
n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); |
break; |
case OPCODE_LINE_STIPPLE: |
_mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us ); |
break; |
case OPCODE_LOAD_IDENTITY: |
_mesa_printf("LoadIdentity\n"); |
break; |
case OPCODE_LOAD_MATRIX: |
_mesa_printf("LoadMatrix\n"); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[1].f, n[5].f, n[9].f, n[13].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[2].f, n[6].f, n[10].f, n[14].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[3].f, n[7].f, n[11].f, n[15].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[4].f, n[8].f, n[12].f, n[16].f); |
break; |
case OPCODE_MULT_MATRIX: |
_mesa_printf("MultMatrix (or Rotate)\n"); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[1].f, n[5].f, n[9].f, n[13].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[2].f, n[6].f, n[10].f, n[14].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[3].f, n[7].f, n[11].f, n[15].f); |
_mesa_printf(" %8f %8f %8f %8f\n", |
n[4].f, n[8].f, n[12].f, n[16].f); |
break; |
case OPCODE_ORTHO: |
_mesa_printf("Ortho %g %g %g %g %g %g\n", |
n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); |
break; |
case OPCODE_POP_ATTRIB: |
_mesa_printf("PopAttrib\n"); |
break; |
case OPCODE_POP_MATRIX: |
_mesa_printf("PopMatrix\n"); |
break; |
case OPCODE_POP_NAME: |
_mesa_printf("PopName\n"); |
break; |
case OPCODE_PUSH_ATTRIB: |
_mesa_printf("PushAttrib %x\n", n[1].bf ); |
break; |
case OPCODE_PUSH_MATRIX: |
_mesa_printf("PushMatrix\n"); |
break; |
case OPCODE_PUSH_NAME: |
_mesa_printf("PushName %d\n", (int) n[1].ui ); |
break; |
case OPCODE_RASTER_POS: |
_mesa_printf("RasterPos %g %g %g %g\n", |
n[1].f, n[2].f,n[3].f,n[4].f); |
break; |
case OPCODE_ROTATE: |
_mesa_printf("Rotate %g %g %g %g\n", |
n[1].f, n[2].f, n[3].f, n[4].f ); |
break; |
case OPCODE_SCALE: |
_mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); |
break; |
case OPCODE_TRANSLATE: |
_mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); |
break; |
case OPCODE_BIND_TEXTURE: |
_mesa_printf("BindTexture %s %d\n", |
_mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); |
break; |
case OPCODE_SHADE_MODEL: |
_mesa_printf("ShadeModel %s\n", |
_mesa_lookup_enum_by_nr(n[1].ui)); |
break; |
case OPCODE_MAP1: |
_mesa_printf("Map1 %s %.3f %.3f %d %d\n", |
_mesa_lookup_enum_by_nr(n[1].ui), |
n[2].f, n[3].f, n[4].i, n[5].i); |
break; |
case OPCODE_MAP2: |
_mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", |
_mesa_lookup_enum_by_nr(n[1].ui), |
n[2].f, n[3].f, n[4].f, n[5].f, |
n[6].i, n[7].i, n[8].i, n[9].i); |
break; |
case OPCODE_MAPGRID1: |
_mesa_printf("MapGrid1 %d %.3f %.3f\n", |
n[1].i, n[2].f, n[3].f); |
break; |
case OPCODE_MAPGRID2: |
_mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", |
n[1].i, n[2].f, n[3].f, |
n[4].i, n[5].f, n[6].f); |
break; |
case OPCODE_EVALMESH1: |
_mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); |
break; |
case OPCODE_EVALMESH2: |
_mesa_printf("EvalMesh2 %d %d %d %d\n", |
n[1].i, n[2].i, n[3].i, n[4].i); |
break; |
/* |
* meta opcodes/commands |
*/ |
case OPCODE_ERROR: |
_mesa_printf("Error: %s %s\n", |
enum_string(n[1].e), (const char *)n[2].data ); |
break; |
case OPCODE_CONTINUE: |
_mesa_printf("DISPLAY-LIST-CONTINUE\n"); |
n = (Node *) n[1].next; |
break; |
case OPCODE_END_OF_LIST: |
_mesa_printf("END-LIST %u\n", list); |
done = GL_TRUE; |
break; |
default: |
if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { |
_mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", |
opcode, (void*) n); |
return; |
} |
else { |
_mesa_printf("command %d, %u operands\n", opcode, InstSize[opcode]); |
} |
} |
/* increment n to point to next compiled command */ |
if (opcode!=OPCODE_CONTINUE) { |
n += InstSize[opcode]; |
} |
} |
} |
} |
/* |
* Clients may call this function to help debug display list problems. |
* This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed, |
* changed, or break in the future without notice. |
*/ |
void mesa_print_display_list( GLuint list ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
print_list( ctx, list ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/points.h |
---|
0,0 → 1,51 |
/* $Id: points.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef POINTS_H |
#define POINTS_H |
#include "mtypes.h" |
extern void |
_mesa_PointSize( GLfloat size ); |
extern void |
_mesa_PointParameteriNV( GLenum pname, GLint param ); |
extern void |
_mesa_PointParameterivNV( GLenum pname, const GLint *params ); |
extern void |
_mesa_PointParameterfEXT( GLenum pname, GLfloat param ); |
extern void |
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texstore.h |
---|
0,0 → 1,179 |
/* $Id: texstore.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Authors: |
* Brian Paul |
*/ |
#ifndef TEXSTORE_H |
#define TEXSTORE_H |
#include "mtypes.h" |
extern void |
_mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, |
GLenum baseInternalFormat, |
const struct gl_texture_format *texDestFormat, |
GLvoid *texDestAddr, |
GLint srcWidth, GLint srcHeight, GLint srcDepth, |
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, |
GLint dstRowStride, GLint dstImageStride, |
GLenum srcFormat, GLenum srcType, |
const GLvoid *srcAddr, |
const struct gl_pixelstore_attrib *srcPacking); |
extern void |
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint border, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint depth, GLint border, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint width, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint width, GLint height, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint width, GLint height, GLint depth, |
GLenum format, GLenum type, const void *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint depth, |
GLint border, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_compressed_texsubimage1d(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); |
extern void |
_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, |
GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern void |
_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, |
GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
extern GLboolean |
_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, GLenum format, GLenum type, |
GLint width, GLint height, GLint depth, GLint border); |
extern void |
_mesa_generate_mipmap(GLcontext *ctx, GLenum target, |
const struct gl_texture_unit *texUnit, |
struct gl_texture_object *texObj); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/image.c |
---|
0,0 → 1,3943 |
/* $Id: image.c,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "image.h" |
#include "imports.h" |
#include "histogram.h" |
#include "macros.h" |
#include "mmath.h" |
#include "pixel.h" |
#include "mtypes.h" |
/* |
* These are the image packing parameters for Mesa's internal images. |
* That is, _mesa_unpack_image() returns image data in this format. |
* When we execute image commands (glDrawPixels, glTexImage, etc) |
* from within display lists we have to be sure to set the current |
* unpacking params to these values! |
*/ |
const struct gl_pixelstore_attrib _mesa_native_packing = { |
1, /* Alignment */ |
0, /* RowLength */ |
0, /* SkipPixels */ |
0, /* SkipRows */ |
0, /* ImageHeight */ |
0, /* SkipImages */ |
GL_FALSE, /* SwapBytes */ |
GL_FALSE, /* LsbFirst */ |
GL_FALSE, /* ClientStorage */ |
GL_FALSE /* Invert */ |
}; |
/* |
* Flip the 8 bits in each byte of the given array. |
* |
* XXX try this trick to flip bytes someday: |
* v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); |
* v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); |
* v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); |
*/ |
static void |
flip_bytes( GLubyte *p, GLuint n ) |
{ |
register GLuint i, a, b; |
for (i=0;i<n;i++) { |
b = (GLuint) p[i]; /* words are often faster than bytes */ |
a = ((b & 0x01) << 7) | |
((b & 0x02) << 5) | |
((b & 0x04) << 3) | |
((b & 0x08) << 1) | |
((b & 0x10) >> 1) | |
((b & 0x20) >> 3) | |
((b & 0x40) >> 5) | |
((b & 0x80) >> 7); |
p[i] = (GLubyte) a; |
} |
} |
/* |
* Flip the order of the 2 bytes in each word in the given array. |
*/ |
void |
_mesa_swap2( GLushort *p, GLuint n ) |
{ |
register GLuint i; |
for (i=0;i<n;i++) { |
p[i] = (p[i] >> 8) | ((p[i] << 8) & 0xff00); |
} |
} |
/* |
* Flip the order of the 4 bytes in each word in the given array. |
*/ |
void |
_mesa_swap4( GLuint *p, GLuint n ) |
{ |
register GLuint i, a, b; |
for (i=0;i<n;i++) { |
b = p[i]; |
a = (b >> 24) |
| ((b >> 8) & 0xff00) |
| ((b << 8) & 0xff0000) |
| ((b << 24) & 0xff000000); |
p[i] = a; |
} |
} |
/* |
* Return the size, in bytes, of the given GL datatype. |
* Return 0 if GL_BITMAP. |
* Return -1 if invalid type enum. |
*/ |
GLint _mesa_sizeof_type( GLenum type ) |
{ |
switch (type) { |
case GL_BITMAP: |
return 0; |
case GL_UNSIGNED_BYTE: |
return sizeof(GLubyte); |
case GL_BYTE: |
return sizeof(GLbyte); |
case GL_UNSIGNED_SHORT: |
return sizeof(GLushort); |
case GL_SHORT: |
return sizeof(GLshort); |
case GL_UNSIGNED_INT: |
return sizeof(GLuint); |
case GL_INT: |
return sizeof(GLint); |
case GL_FLOAT: |
return sizeof(GLfloat); |
default: |
return -1; |
} |
} |
/* |
* Same as _mesa_sizeof_packed_type() but we also accept the |
* packed pixel format datatypes. |
*/ |
GLint _mesa_sizeof_packed_type( GLenum type ) |
{ |
switch (type) { |
case GL_BITMAP: |
return 0; |
case GL_UNSIGNED_BYTE: |
return sizeof(GLubyte); |
case GL_BYTE: |
return sizeof(GLbyte); |
case GL_UNSIGNED_SHORT: |
return sizeof(GLushort); |
case GL_SHORT: |
return sizeof(GLshort); |
case GL_UNSIGNED_INT: |
return sizeof(GLuint); |
case GL_INT: |
return sizeof(GLint); |
case GL_FLOAT: |
return sizeof(GLfloat); |
case GL_UNSIGNED_BYTE_3_3_2: |
return sizeof(GLubyte); |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
return sizeof(GLubyte); |
case GL_UNSIGNED_SHORT_5_6_5: |
return sizeof(GLushort); |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
return sizeof(GLushort); |
case GL_UNSIGNED_SHORT_4_4_4_4: |
return sizeof(GLushort); |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
return sizeof(GLushort); |
case GL_UNSIGNED_SHORT_5_5_5_1: |
return sizeof(GLushort); |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
return sizeof(GLushort); |
case GL_UNSIGNED_INT_8_8_8_8: |
return sizeof(GLuint); |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
return sizeof(GLuint); |
case GL_UNSIGNED_INT_10_10_10_2: |
return sizeof(GLuint); |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
return sizeof(GLuint); |
case GL_UNSIGNED_SHORT_8_8_MESA: |
case GL_UNSIGNED_SHORT_8_8_REV_MESA: |
return sizeof(GLushort); |
default: |
return -1; |
} |
} |
/* |
* Return the number of components in a GL enum pixel type. |
* Return -1 if bad format. |
*/ |
GLint _mesa_components_in_format( GLenum format ) |
{ |
switch (format) { |
case GL_COLOR_INDEX: |
case GL_COLOR_INDEX1_EXT: |
case GL_COLOR_INDEX2_EXT: |
case GL_COLOR_INDEX4_EXT: |
case GL_COLOR_INDEX8_EXT: |
case GL_COLOR_INDEX12_EXT: |
case GL_COLOR_INDEX16_EXT: |
case GL_STENCIL_INDEX: |
case GL_DEPTH_COMPONENT: |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_LUMINANCE: |
case GL_INTENSITY: |
return 1; |
case GL_LUMINANCE_ALPHA: |
return 2; |
case GL_RGB: |
return 3; |
case GL_RGBA: |
return 4; |
case GL_BGR: |
return 3; |
case GL_BGRA: |
return 4; |
case GL_ABGR_EXT: |
return 4; |
case GL_YCBCR_MESA: |
return 2; |
default: |
return -1; |
} |
} |
/* |
* Return bytes per pixel for given format and type |
* Return -1 if bad format or type. |
*/ |
GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) |
{ |
GLint comps = _mesa_components_in_format( format ); |
if (comps < 0) |
return -1; |
switch (type) { |
case GL_BITMAP: |
return 0; /* special case */ |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
return comps * sizeof(GLubyte); |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
return comps * sizeof(GLshort); |
case GL_INT: |
case GL_UNSIGNED_INT: |
return comps * sizeof(GLint); |
case GL_FLOAT: |
return comps * sizeof(GLfloat); |
case GL_UNSIGNED_BYTE_3_3_2: |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
if (format == GL_RGB || format == GL_BGR) |
return sizeof(GLubyte); |
else |
return -1; /* error */ |
case GL_UNSIGNED_SHORT_5_6_5: |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
if (format == GL_RGB || format == GL_BGR) |
return sizeof(GLushort); |
else |
return -1; /* error */ |
case GL_UNSIGNED_SHORT_4_4_4_4: |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
case GL_UNSIGNED_SHORT_5_5_5_1: |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) |
return sizeof(GLushort); |
else |
return -1; |
case GL_UNSIGNED_INT_8_8_8_8: |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
case GL_UNSIGNED_INT_10_10_10_2: |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) |
return sizeof(GLuint); |
else |
return -1; |
case GL_UNSIGNED_SHORT_8_8_MESA: |
case GL_UNSIGNED_SHORT_8_8_REV_MESA: |
if (format == GL_YCBCR_MESA) |
return sizeof(GLushort); |
else |
return -1; |
default: |
return -1; |
} |
} |
/* |
* Test if the given pixel format and type are legal. |
* Return GL_TRUE for legal, GL_FALSE for illegal. |
*/ |
GLboolean |
_mesa_is_legal_format_and_type( GLenum format, GLenum type ) |
{ |
switch (format) { |
case GL_COLOR_INDEX: |
case GL_STENCIL_INDEX: |
switch (type) { |
case GL_BITMAP: |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_INTENSITY: |
case GL_LUMINANCE: |
case GL_LUMINANCE_ALPHA: |
case GL_DEPTH_COMPONENT: |
switch (type) { |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
case GL_RGB: |
case GL_BGR: |
switch (type) { |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
case GL_UNSIGNED_BYTE_3_3_2: |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
case GL_UNSIGNED_SHORT_5_6_5: |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
case GL_RGBA: |
case GL_BGRA: |
case GL_ABGR_EXT: |
switch (type) { |
case GL_BYTE: |
case GL_UNSIGNED_BYTE: |
case GL_SHORT: |
case GL_UNSIGNED_SHORT: |
case GL_INT: |
case GL_UNSIGNED_INT: |
case GL_FLOAT: |
case GL_UNSIGNED_SHORT_4_4_4_4: |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
case GL_UNSIGNED_SHORT_5_5_5_1: |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
case GL_UNSIGNED_INT_8_8_8_8: |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
case GL_UNSIGNED_INT_10_10_10_2: |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
case GL_YCBCR_MESA: |
if (type == GL_UNSIGNED_SHORT_8_8_MESA || |
type == GL_UNSIGNED_SHORT_8_8_REV_MESA) |
return GL_TRUE; |
else |
return GL_FALSE; |
default: |
; /* fall-through */ |
} |
return GL_FALSE; |
} |
/* |
* Return the address of a pixel in an image (actually a volume). |
* Pixel unpacking/packing parameters are observed according to 'packing'. |
* Input: image - start of image data |
* width, height - size of image |
* format - image format |
* type - pixel component type |
* packing - the pixelstore attributes |
* img - which image in the volume (0 for 1D or 2D images) |
* row, column - location of pixel in the image |
* Return: address of pixel at (image,row,column) in image or NULL if error. |
*/ |
GLvoid * |
_mesa_image_address( const struct gl_pixelstore_attrib *packing, |
const GLvoid *image, GLsizei width, |
GLsizei height, GLenum format, GLenum type, |
GLint img, GLint row, GLint column ) |
{ |
GLint alignment; /* 1, 2 or 4 */ |
GLint pixels_per_row; |
GLint rows_per_image; |
GLint skiprows; |
GLint skippixels; |
GLint skipimages; /* for 3-D volume images */ |
GLubyte *pixel_addr; |
alignment = packing->Alignment; |
if (packing->RowLength > 0) { |
pixels_per_row = packing->RowLength; |
} |
else { |
pixels_per_row = width; |
} |
if (packing->ImageHeight > 0) { |
rows_per_image = packing->ImageHeight; |
} |
else { |
rows_per_image = height; |
} |
skiprows = packing->SkipRows; |
skippixels = packing->SkipPixels; |
skipimages = packing->SkipImages; |
if (type==GL_BITMAP) { |
/* BITMAP data */ |
GLint comp_per_pixel; /* components per pixel */ |
GLint bytes_per_comp; /* bytes per component */ |
GLint bytes_per_row; |
GLint bytes_per_image; |
/* Compute bytes per component */ |
bytes_per_comp = _mesa_sizeof_packed_type( type ); |
if (bytes_per_comp<0) { |
return NULL; |
} |
/* Compute number of components per pixel */ |
comp_per_pixel = _mesa_components_in_format( format ); |
if (comp_per_pixel<0 && type != GL_BITMAP) { |
return NULL; |
} |
bytes_per_row = alignment |
* CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); |
bytes_per_image = bytes_per_row * rows_per_image; |
pixel_addr = (GLubyte *) image |
+ (skipimages + img) * bytes_per_image |
+ (skiprows + row) * bytes_per_row |
+ (skippixels + column) / 8; |
} |
else { |
/* Non-BITMAP data */ |
GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; |
GLint topOfImage; |
bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); |
/* The pixel type and format should have been error checked earlier */ |
assert(bytes_per_pixel > 0); |
bytes_per_row = pixels_per_row * bytes_per_pixel; |
remainder = bytes_per_row % alignment; |
if (remainder > 0) |
bytes_per_row += (alignment - remainder); |
ASSERT(bytes_per_row % alignment == 0); |
bytes_per_image = bytes_per_row * rows_per_image; |
if (packing->Invert) { |
/* set pixel_addr to the last row */ |
topOfImage = bytes_per_row * (height - 1); |
bytes_per_row = -bytes_per_row; |
} |
else { |
topOfImage = 0; |
} |
/* compute final pixel address */ |
pixel_addr = (GLubyte *) image |
+ (skipimages + img) * bytes_per_image |
+ topOfImage |
+ (skiprows + row) * bytes_per_row |
+ (skippixels + column) * bytes_per_pixel; |
} |
return (GLvoid *) pixel_addr; |
} |
/* |
* Compute the stride between image rows (in bytes) for the given |
* pixel packing parameters and image width, format and type. |
*/ |
GLint |
_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, |
GLint width, GLenum format, GLenum type ) |
{ |
ASSERT(packing); |
if (type == GL_BITMAP) { |
/* BITMAP data */ |
GLint bytes; |
if (packing->RowLength == 0) { |
bytes = (width + 7) / 8; |
} |
else { |
bytes = (packing->RowLength + 7) / 8; |
} |
if (packing->Invert) { |
/* negate the bytes per row (negative row stride) */ |
bytes = -bytes; |
} |
return bytes; |
} |
else { |
/* Non-BITMAP data */ |
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); |
GLint bytesPerRow, remainder; |
if (bytesPerPixel <= 0) |
return -1; /* error */ |
if (packing->RowLength == 0) { |
bytesPerRow = bytesPerPixel * width; |
} |
else { |
bytesPerRow = bytesPerPixel * packing->RowLength; |
} |
remainder = bytesPerRow % packing->Alignment; |
if (remainder > 0) |
bytesPerRow += (packing->Alignment - remainder); |
if (packing->Invert) |
bytesPerRow = -bytesPerRow; |
return bytesPerRow; |
} |
} |
/* |
* Compute the stride between images in a 3D texture (in bytes) for the given |
* pixel packing parameters and image width, format and type. |
*/ |
GLint |
_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, |
GLint width, GLint height, |
GLenum format, GLenum type ) |
{ |
ASSERT(packing); |
ASSERT(type != GL_BITMAP); |
{ |
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); |
GLint bytesPerRow, bytesPerImage, remainder; |
if (bytesPerPixel <= 0) |
return -1; /* error */ |
if (packing->RowLength == 0) { |
bytesPerRow = bytesPerPixel * width; |
} |
else { |
bytesPerRow = bytesPerPixel * packing->RowLength; |
} |
remainder = bytesPerRow % packing->Alignment; |
if (remainder > 0) |
bytesPerRow += (packing->Alignment - remainder); |
if (packing->ImageHeight == 0) |
bytesPerImage = bytesPerRow * height; |
else |
bytesPerImage = bytesPerRow * packing->ImageHeight; |
return bytesPerImage; |
} |
} |
/* |
* Unpack a 32x32 pixel polygon stipple from user memory using the |
* current pixel unpack settings. |
*/ |
void |
_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], |
const struct gl_pixelstore_attrib *unpacking ) |
{ |
GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); |
if (ptrn) { |
/* Convert pattern from GLubytes to GLuints and handle big/little |
* endian differences |
*/ |
GLubyte *p = ptrn; |
GLint i; |
for (i = 0; i < 32; i++) { |
dest[i] = (p[0] << 24) |
| (p[1] << 16) |
| (p[2] << 8) |
| (p[3] ); |
p += 4; |
} |
FREE(ptrn); |
} |
} |
/* |
* Pack polygon stipple into user memory given current pixel packing |
* settings. |
*/ |
void |
_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, |
const struct gl_pixelstore_attrib *packing ) |
{ |
/* Convert pattern from GLuints to GLubytes to handle big/little |
* endian differences. |
*/ |
GLubyte ptrn[32*4]; |
GLint i; |
for (i = 0; i < 32; i++) { |
ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff); |
ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff); |
ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff); |
ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff); |
} |
_mesa_pack_bitmap(32, 32, ptrn, dest, packing); |
} |
/* |
* Unpack bitmap data. Resulting data will be in most-significant-bit-first |
* order with row alignment = 1 byte. |
*/ |
GLvoid * |
_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, |
const struct gl_pixelstore_attrib *packing ) |
{ |
GLint bytes, row, width_in_bytes; |
GLubyte *buffer, *dst; |
if (!pixels) |
return NULL; |
/* Alloc dest storage */ |
bytes = ((width + 7) / 8 * height); |
buffer = (GLubyte *) MALLOC( bytes ); |
if (!buffer) |
return NULL; |
width_in_bytes = CEILING( width, 8 ); |
dst = buffer; |
for (row = 0; row < height; row++) { |
const GLubyte *src = (const GLubyte *) |
_mesa_image_address(packing, pixels, width, height, |
GL_COLOR_INDEX, GL_BITMAP, 0, row, 0); |
if (!src) { |
FREE(buffer); |
return NULL; |
} |
if (packing->SkipPixels == 0) { |
MEMCPY( dst, src, width_in_bytes ); |
if (packing->LsbFirst) { |
flip_bytes( dst, width_in_bytes ); |
} |
} |
else { |
/* handling SkipPixels is a bit tricky (no pun intended!) */ |
GLint i; |
if (packing->LsbFirst) { |
GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); |
GLubyte dstMask = 128; |
const GLubyte *s = src; |
GLubyte *d = dst; |
*d = 0; |
for (i = 0; i < width; i++) { |
if (*s & srcMask) { |
*d |= dstMask; |
} |
if (srcMask == 128) { |
srcMask = 1; |
s++; |
} |
else { |
srcMask = srcMask << 1; |
} |
if (dstMask == 1) { |
dstMask = 128; |
d++; |
*d = 0; |
} |
else { |
dstMask = dstMask >> 1; |
} |
} |
} |
else { |
GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); |
GLubyte dstMask = 128; |
const GLubyte *s = src; |
GLubyte *d = dst; |
*d = 0; |
for (i = 0; i < width; i++) { |
if (*s & srcMask) { |
*d |= dstMask; |
} |
if (srcMask == 1) { |
srcMask = 128; |
s++; |
} |
else { |
srcMask = srcMask >> 1; |
} |
if (dstMask == 1) { |
dstMask = 128; |
d++; |
*d = 0; |
} |
else { |
dstMask = dstMask >> 1; |
} |
} |
} |
} |
dst += width_in_bytes; |
} |
return buffer; |
} |
/* |
* Pack bitmap data. |
*/ |
void |
_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, |
GLubyte *dest, const struct gl_pixelstore_attrib *packing ) |
{ |
GLint row, width_in_bytes; |
const GLubyte *src; |
if (!source) |
return; |
width_in_bytes = CEILING( width, 8 ); |
src = source; |
for (row = 0; row < height; row++) { |
GLubyte *dst = (GLubyte *) _mesa_image_address( packing, dest, |
width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); |
if (!dst) |
return; |
if (packing->SkipPixels == 0) { |
MEMCPY( dst, src, width_in_bytes ); |
if (packing->LsbFirst) { |
flip_bytes( dst, width_in_bytes ); |
} |
} |
else { |
/* handling SkipPixels is a bit tricky (no pun intended!) */ |
GLint i; |
if (packing->LsbFirst) { |
GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); |
GLubyte dstMask = 128; |
const GLubyte *s = src; |
GLubyte *d = dst; |
*d = 0; |
for (i = 0; i < width; i++) { |
if (*s & srcMask) { |
*d |= dstMask; |
} |
if (srcMask == 128) { |
srcMask = 1; |
s++; |
} |
else { |
srcMask = srcMask << 1; |
} |
if (dstMask == 1) { |
dstMask = 128; |
d++; |
*d = 0; |
} |
else { |
dstMask = dstMask >> 1; |
} |
} |
} |
else { |
GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); |
GLubyte dstMask = 128; |
const GLubyte *s = src; |
GLubyte *d = dst; |
*d = 0; |
for (i = 0; i < width; i++) { |
if (*s & srcMask) { |
*d |= dstMask; |
} |
if (srcMask == 1) { |
srcMask = 128; |
s++; |
} |
else { |
srcMask = srcMask >> 1; |
} |
if (dstMask == 1) { |
dstMask = 128; |
d++; |
*d = 0; |
} |
else { |
dstMask = dstMask >> 1; |
} |
} |
} |
} |
src += width_in_bytes; |
} |
} |
/* |
* Used to pack an array [][4] of RGBA GLchan colors as specified |
* by the dstFormat, dstType and dstPacking. Used by glReadPixels, |
* glGetConvolutionFilter(), etc. |
*/ |
void |
_mesa_pack_float_rgba_span( GLcontext *ctx, |
GLuint n, CONST GLfloat rgbaIn[][4], |
GLenum dstFormat, GLenum dstType, |
GLvoid *dstAddr, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps ) |
{ |
const GLint comps = _mesa_components_in_format(dstFormat); |
GLfloat luminance[MAX_WIDTH]; |
GLfloat (*rgba)[4]; |
GLuint i; |
if (transferOps) { |
/* make copy of incoming data */ |
DEFMARRAY(GLfloat, rgbaCopy, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgbaCopy, return); /* mac 32k limitation */ |
for (i = 0; i < n; i++) { |
rgbaCopy[i][0] = rgbaIn[i][0]; |
rgbaCopy[i][1] = rgbaIn[i][1]; |
rgbaCopy[i][2] = rgbaIn[i][2]; |
rgbaCopy[i][3] = rgbaIn[i][3]; |
} |
rgba = (GLfloat (*)[4]) rgbaCopy; |
/* scale & bias */ |
if (transferOps & IMAGE_SCALE_BIAS_BIT) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.RedScale, ctx->Pixel.GreenScale, |
ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, |
ctx->Pixel.RedBias, ctx->Pixel.GreenBias, |
ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); |
} |
/* color map lookup */ |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_rgba( ctx, n, rgba ); |
} |
/* GL_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba); |
} |
/* convolution */ |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
/* this has to be done in the calling code */ |
} |
/* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ |
if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.PostConvolutionScale[RCOMP], |
ctx->Pixel.PostConvolutionScale[GCOMP], |
ctx->Pixel.PostConvolutionScale[BCOMP], |
ctx->Pixel.PostConvolutionScale[ACOMP], |
ctx->Pixel.PostConvolutionBias[RCOMP], |
ctx->Pixel.PostConvolutionBias[GCOMP], |
ctx->Pixel.PostConvolutionBias[BCOMP], |
ctx->Pixel.PostConvolutionBias[ACOMP]); |
} |
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba); |
} |
/* color matrix transform */ |
if (transferOps & IMAGE_COLOR_MATRIX_BIT) { |
_mesa_transform_rgba(ctx, n, rgba); |
} |
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); |
} |
/* update histogram count */ |
if (transferOps & IMAGE_HISTOGRAM_BIT) { |
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); |
} |
/* min/max here */ |
if (transferOps & IMAGE_MIN_MAX_BIT) { |
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); |
if (ctx->MinMax.Sink) { |
UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ |
return; |
} |
} |
UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ |
} |
else { |
/* use incoming data, not a copy */ |
rgba = (GLfloat (*)[4]) rgbaIn; |
} |
/* XXX clamp rgba to [0,1]? */ |
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { |
for (i = 0; i < n; i++) { |
GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; |
#if CHAN_TYPE == GL_FLOAT |
luminance[i] = sum; |
#else |
luminance[i] = CLAMP(sum, 0.0F, 1.0F); |
#endif |
} |
} |
/* |
* Pack/store the pixels. Ugh! Lots of cases!!! |
*/ |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UBYTE(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); |
dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); |
} |
break; |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
} |
break; |
case GL_BYTE: |
{ |
GLbyte *dst = (GLbyte *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_BYTE(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); |
dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); |
} |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLushort *dst = (GLushort *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_USHORT(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); |
dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); |
} |
break; |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n * comps); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLshort *dst = (GLshort *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_SHORT(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); |
dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); |
} |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n * comps ); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint *dst = (GLuint *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_UINT(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); |
dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); |
} |
break; |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n * comps ); |
} |
} |
break; |
case GL_INT: |
{ |
GLint *dst = (GLint *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = FLOAT_TO_INT(luminance[i]); |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = FLOAT_TO_INT(luminance[i]); |
dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); |
dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); |
dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); |
dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); |
dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); |
dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); |
dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); |
dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); |
dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); |
} |
break; |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); |
dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); |
dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); |
dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n * comps ); |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLfloat *dst = (GLfloat *) dstAddr; |
switch (dstFormat) { |
case GL_RED: |
for (i=0;i<n;i++) |
dst[i] = rgba[i][RCOMP]; |
break; |
case GL_GREEN: |
for (i=0;i<n;i++) |
dst[i] = rgba[i][GCOMP]; |
break; |
case GL_BLUE: |
for (i=0;i<n;i++) |
dst[i] = rgba[i][BCOMP]; |
break; |
case GL_ALPHA: |
for (i=0;i<n;i++) |
dst[i] = rgba[i][ACOMP]; |
break; |
case GL_LUMINANCE: |
for (i=0;i<n;i++) |
dst[i] = luminance[i]; |
break; |
case GL_LUMINANCE_ALPHA: |
for (i=0;i<n;i++) { |
dst[i*2+0] = luminance[i]; |
dst[i*2+1] = rgba[i][ACOMP]; |
} |
break; |
case GL_RGB: |
for (i=0;i<n;i++) { |
dst[i*3+0] = rgba[i][RCOMP]; |
dst[i*3+1] = rgba[i][GCOMP]; |
dst[i*3+2] = rgba[i][BCOMP]; |
} |
break; |
case GL_RGBA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = rgba[i][RCOMP]; |
dst[i*4+1] = rgba[i][GCOMP]; |
dst[i*4+2] = rgba[i][BCOMP]; |
dst[i*4+3] = rgba[i][ACOMP]; |
} |
break; |
case GL_BGR: |
for (i=0;i<n;i++) { |
dst[i*3+0] = rgba[i][BCOMP]; |
dst[i*3+1] = rgba[i][GCOMP]; |
dst[i*3+2] = rgba[i][RCOMP]; |
} |
break; |
case GL_BGRA: |
for (i=0;i<n;i++) { |
dst[i*4+0] = rgba[i][BCOMP]; |
dst[i*4+1] = rgba[i][GCOMP]; |
dst[i*4+2] = rgba[i][RCOMP]; |
dst[i*4+3] = rgba[i][ACOMP]; |
} |
break; |
case GL_ABGR_EXT: |
for (i=0;i<n;i++) { |
dst[i*4+0] = rgba[i][ACOMP]; |
dst[i*4+1] = rgba[i][BCOMP]; |
dst[i*4+2] = rgba[i][GCOMP]; |
dst[i*4+3] = rgba[i][RCOMP]; |
} |
break; |
default: |
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n * comps ); |
} |
} |
break; |
case GL_UNSIGNED_BYTE_3_3_2: |
if (dstFormat == GL_RGB) { |
GLubyte *dst = (GLubyte *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) |
| (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) |
| (((GLint) (rgba[i][BCOMP] * 3.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
if (dstFormat == GL_RGB) { |
GLubyte *dst = (GLubyte *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) |
| (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5: |
if (dstFormat == GL_RGB) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) |
| (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
if (dstFormat == GL_RGB) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4: |
if (dstFormat == GL_RGBA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][ACOMP] * 15.0F)) ); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) << 12) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][RCOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][ACOMP] * 15.0F)) ); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 12) |
| (((GLint) (rgba[i][RCOMP] * 15.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
if (dstFormat == GL_RGBA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][BCOMP] * 15.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][RCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][ACOMP] * 15.0F)) ) |
| (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) |
| (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) |
| (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_5_5_1: |
if (dstFormat == GL_RGBA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) |
| (((GLint) (rgba[i][ACOMP] * 1.0F)) ); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) |
| (((GLint) (rgba[i][RCOMP] * 31.0F)) << 1) |
| (((GLint) (rgba[i][ACOMP] * 1.0F)) ); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) << 11) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) << 6) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 1) |
| (((GLint) (rgba[i][RCOMP] * 1.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
if (dstFormat == GL_RGBA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) |
| (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][BCOMP] * 31.0F)) ) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) |
| (((GLint) (rgba[i][RCOMP] * 31.0F)) << 10) |
| (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLushort *dst = (GLushort *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLint) (rgba[i][ACOMP] * 31.0F)) ) |
| (((GLint) (rgba[i][BCOMP] * 31.0F)) << 5) |
| (((GLint) (rgba[i][GCOMP] * 31.0F)) << 10) |
| (((GLint) (rgba[i][RCOMP] * 1.0F)) << 15); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8: |
if (dstFormat == GL_RGBA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) |
| (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
if (dstFormat == GL_RGBA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) |
| (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) |
| (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) |
| (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); |
} |
} |
break; |
case GL_UNSIGNED_INT_10_10_10_2: |
if (dstFormat == GL_RGBA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) |
| (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) |
| (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) |
| (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) |
| (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) |
| (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) |
| (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
if (dstFormat == GL_RGBA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) |
| (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) |
| (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); |
} |
} |
else if (dstFormat == GL_BGRA) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) |
| (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) |
| (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); |
} |
} |
else if (dstFormat == GL_ABGR_EXT) { |
GLuint *dst = (GLuint *) dstAddr; |
for (i=0;i<n;i++) { |
dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) |
| (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) |
| (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) |
| (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad type in _mesa_pack_float_rgba_span"); |
} |
} |
/* |
* Pack the given RGBA span into client memory at 'dest' address |
* in the given pixel format and type. |
* Optionally apply the enabled pixel transfer ops. |
* Pack into memory using the given packing params struct. |
* This is used by glReadPixels and glGetTexImage?D() |
* Input: ctx - the context |
* n - number of pixels in the span |
* rgba - the pixels |
* format - dest packing format |
* type - dest packing datatype |
* destination - destination packing address |
* packing - pixel packing parameters |
* transferOps - bitmask of IMAGE_*_BIT operations to apply |
*/ |
void |
_mesa_pack_rgba_span( GLcontext *ctx, |
GLuint n, CONST GLchan srcRgba[][4], |
GLenum dstFormat, GLenum dstType, |
GLvoid *dstAddr, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps) |
{ |
ASSERT((ctx->NewState & _NEW_PIXEL) == 0 || transferOps == 0); |
/* Test for optimized case first */ |
if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) { |
/* common simple case */ |
MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan)); |
} |
else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) { |
/* common simple case */ |
GLuint i; |
GLchan *dest = (GLchan *) dstAddr; |
for (i = 0; i < n; i++) { |
dest[0] = srcRgba[i][RCOMP]; |
dest[1] = srcRgba[i][GCOMP]; |
dest[2] = srcRgba[i][BCOMP]; |
dest += 3; |
} |
} |
else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) { |
/* common simple case */ |
GLuint i; |
GLubyte *dest = (GLubyte *) dstAddr; |
for (i = 0; i < n; i++) { |
dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]); |
dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]); |
dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]); |
dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]); |
dest += 4; |
} |
} |
else { |
/* general solution */ |
GLuint i; |
DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgba, return); /* mac 32k limitation */ |
assert(n <= MAX_WIDTH); |
/* convert color components to floating point */ |
for (i=0;i<n;i++) { |
rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]); |
rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]); |
rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]); |
rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]); |
} |
_mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba, |
dstFormat, dstType, dstAddr, |
dstPacking, transferOps); |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
} |
} |
#define SWAP2BYTE(VALUE) \ |
{ \ |
GLubyte *bytes = (GLubyte *) &(VALUE); \ |
GLubyte tmp = bytes[0]; \ |
bytes[0] = bytes[1]; \ |
bytes[1] = tmp; \ |
} |
#define SWAP4BYTE(VALUE) \ |
{ \ |
GLubyte *bytes = (GLubyte *) &(VALUE); \ |
GLubyte tmp = bytes[0]; \ |
bytes[0] = bytes[3]; \ |
bytes[3] = tmp; \ |
tmp = bytes[1]; \ |
bytes[1] = bytes[2]; \ |
bytes[2] = tmp; \ |
} |
static void |
extract_uint_indexes(GLuint n, GLuint indexes[], |
GLenum srcFormat, GLenum srcType, const GLvoid *src, |
const struct gl_pixelstore_attrib *unpack ) |
{ |
assert(srcFormat == GL_COLOR_INDEX); |
ASSERT(srcType == GL_BITMAP || |
srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT); |
switch (srcType) { |
case GL_BITMAP: |
{ |
GLubyte *ubsrc = (GLubyte *) src; |
if (unpack->LsbFirst) { |
GLubyte mask = 1 << (unpack->SkipPixels & 0x7); |
GLuint i; |
for (i = 0; i < n; i++) { |
indexes[i] = (*ubsrc & mask) ? 1 : 0; |
if (mask == 128) { |
mask = 1; |
ubsrc++; |
} |
else { |
mask = mask << 1; |
} |
} |
} |
else { |
GLubyte mask = 128 >> (unpack->SkipPixels & 0x7); |
GLuint i; |
for (i = 0; i < n; i++) { |
indexes[i] = (*ubsrc & mask) ? 1 : 0; |
if (mask == 1) { |
mask = 128; |
ubsrc++; |
} |
else { |
mask = mask >> 1; |
} |
} |
} |
} |
break; |
case GL_UNSIGNED_BYTE: |
{ |
GLuint i; |
const GLubyte *s = (const GLubyte *) src; |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
break; |
case GL_BYTE: |
{ |
GLuint i; |
const GLbyte *s = (const GLbyte *) src; |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLuint i; |
const GLushort *s = (const GLushort *) src; |
if (unpack->SwapBytes) { |
for (i = 0; i < n; i++) { |
GLushort value = s[i]; |
SWAP2BYTE(value); |
indexes[i] = value; |
} |
} |
else { |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
} |
break; |
case GL_SHORT: |
{ |
GLuint i; |
const GLshort *s = (const GLshort *) src; |
if (unpack->SwapBytes) { |
for (i = 0; i < n; i++) { |
GLshort value = s[i]; |
SWAP2BYTE(value); |
indexes[i] = value; |
} |
} |
else { |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint i; |
const GLuint *s = (const GLuint *) src; |
if (unpack->SwapBytes) { |
for (i = 0; i < n; i++) { |
GLuint value = s[i]; |
SWAP4BYTE(value); |
indexes[i] = value; |
} |
} |
else { |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
} |
break; |
case GL_INT: |
{ |
GLuint i; |
const GLint *s = (const GLint *) src; |
if (unpack->SwapBytes) { |
for (i = 0; i < n; i++) { |
GLint value = s[i]; |
SWAP4BYTE(value); |
indexes[i] = value; |
} |
} |
else { |
for (i = 0; i < n; i++) |
indexes[i] = s[i]; |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLuint i; |
const GLfloat *s = (const GLfloat *) src; |
if (unpack->SwapBytes) { |
for (i = 0; i < n; i++) { |
GLfloat value = s[i]; |
SWAP4BYTE(value); |
indexes[i] = (GLuint) value; |
} |
} |
else { |
for (i = 0; i < n; i++) |
indexes[i] = (GLuint) s[i]; |
} |
} |
break; |
default: |
_mesa_problem(NULL, "bad srcType in extract_uint_indexes"); |
return; |
} |
} |
/* |
* This function extracts floating point RGBA values from arbitrary |
* image data. srcFormat and srcType are the format and type parameters |
* passed to glDrawPixels, glTexImage[123]D, glTexSubImage[123]D, etc. |
* |
* Refering to section 3.6.4 of the OpenGL 1.2 spec, this function |
* implements the "Conversion to floating point", "Conversion to RGB", |
* and "Final Expansion to RGBA" operations. |
* |
* Args: n - number of pixels |
* rgba - output colors |
* srcFormat - format of incoming data |
* srcType - datatype of incoming data |
* src - source data pointer |
* swapBytes - perform byteswapping of incoming data? |
*/ |
static void |
extract_float_rgba(GLuint n, GLfloat rgba[][4], |
GLenum srcFormat, GLenum srcType, const GLvoid *src, |
GLboolean swapBytes) |
{ |
GLint redIndex, greenIndex, blueIndex, alphaIndex; |
GLint stride; |
GLint rComp, bComp, gComp, aComp; |
ASSERT(srcFormat == GL_RED || |
srcFormat == GL_GREEN || |
srcFormat == GL_BLUE || |
srcFormat == GL_ALPHA || |
srcFormat == GL_LUMINANCE || |
srcFormat == GL_LUMINANCE_ALPHA || |
srcFormat == GL_INTENSITY || |
srcFormat == GL_RGB || |
srcFormat == GL_BGR || |
srcFormat == GL_RGBA || |
srcFormat == GL_BGRA || |
srcFormat == GL_ABGR_EXT); |
ASSERT(srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT || |
srcType == GL_UNSIGNED_BYTE_3_3_2 || |
srcType == GL_UNSIGNED_BYTE_2_3_3_REV || |
srcType == GL_UNSIGNED_SHORT_5_6_5 || |
srcType == GL_UNSIGNED_SHORT_5_6_5_REV || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4 || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || |
srcType == GL_UNSIGNED_SHORT_5_5_5_1 || |
srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || |
srcType == GL_UNSIGNED_INT_8_8_8_8 || |
srcType == GL_UNSIGNED_INT_8_8_8_8_REV || |
srcType == GL_UNSIGNED_INT_10_10_10_2 || |
srcType == GL_UNSIGNED_INT_2_10_10_10_REV); |
rComp = gComp = bComp = aComp = -1; |
switch (srcFormat) { |
case GL_RED: |
redIndex = 0; |
greenIndex = blueIndex = alphaIndex = -1; |
stride = 1; |
break; |
case GL_GREEN: |
greenIndex = 0; |
redIndex = blueIndex = alphaIndex = -1; |
stride = 1; |
break; |
case GL_BLUE: |
blueIndex = 0; |
redIndex = greenIndex = alphaIndex = -1; |
stride = 1; |
break; |
case GL_ALPHA: |
redIndex = greenIndex = blueIndex = -1; |
alphaIndex = 0; |
stride = 1; |
break; |
case GL_LUMINANCE: |
redIndex = greenIndex = blueIndex = 0; |
alphaIndex = -1; |
stride = 1; |
break; |
case GL_LUMINANCE_ALPHA: |
redIndex = greenIndex = blueIndex = 0; |
alphaIndex = 1; |
stride = 2; |
break; |
case GL_INTENSITY: |
redIndex = greenIndex = blueIndex = alphaIndex = 0; |
stride = 1; |
break; |
case GL_RGB: |
redIndex = 0; |
greenIndex = 1; |
blueIndex = 2; |
alphaIndex = -1; |
stride = 3; |
break; |
case GL_BGR: |
redIndex = 2; |
greenIndex = 1; |
blueIndex = 0; |
alphaIndex = -1; |
stride = 3; |
break; |
case GL_RGBA: |
redIndex = 0; |
greenIndex = 1; |
blueIndex = 2; |
alphaIndex = 3; |
rComp = 0; |
gComp = 1; |
bComp = 2; |
aComp = 3; |
stride = 4; |
break; |
case GL_BGRA: |
redIndex = 2; |
greenIndex = 1; |
blueIndex = 0; |
alphaIndex = 3; |
rComp = 2; |
gComp = 1; |
bComp = 0; |
aComp = 3; |
stride = 4; |
break; |
case GL_ABGR_EXT: |
redIndex = 3; |
greenIndex = 2; |
blueIndex = 1; |
alphaIndex = 0; |
rComp = 3; |
gComp = 2; |
bComp = 1; |
aComp = 0; |
stride = 4; |
break; |
default: |
_mesa_problem(NULL, "bad srcFormat in extract float data"); |
return; |
} |
#define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION) \ |
if ((INDEX) < 0) { \ |
GLuint i; \ |
for (i = 0; i < n; i++) { \ |
rgba[i][CHANNEL] = DEFAULT; \ |
} \ |
} \ |
else if (swapBytes) { \ |
const TYPE *s = (const TYPE *) src; \ |
GLuint i; \ |
for (i = 0; i < n; i++) { \ |
TYPE value = s[INDEX]; \ |
if (sizeof(TYPE) == 2) { \ |
SWAP2BYTE(value); \ |
} \ |
else if (sizeof(TYPE) == 4) { \ |
SWAP4BYTE(value); \ |
} \ |
rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \ |
s += stride; \ |
} \ |
} \ |
else { \ |
const TYPE *s = (const TYPE *) src; \ |
GLuint i; \ |
for (i = 0; i < n; i++) { \ |
rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \ |
s += stride; \ |
} \ |
} |
switch (srcType) { |
case GL_UNSIGNED_BYTE: |
PROCESS(redIndex, RCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLubyte, UBYTE_TO_FLOAT); |
break; |
case GL_BYTE: |
PROCESS(redIndex, RCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLbyte, BYTE_TO_FLOAT); |
break; |
case GL_UNSIGNED_SHORT: |
PROCESS(redIndex, RCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLushort, USHORT_TO_FLOAT); |
break; |
case GL_SHORT: |
PROCESS(redIndex, RCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLshort, SHORT_TO_FLOAT); |
break; |
case GL_UNSIGNED_INT: |
PROCESS(redIndex, RCOMP, 0.0F, GLuint, UINT_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLuint, UINT_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLuint, UINT_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLuint, UINT_TO_FLOAT); |
break; |
case GL_INT: |
PROCESS(redIndex, RCOMP, 0.0F, GLint, INT_TO_FLOAT); |
PROCESS(greenIndex, GCOMP, 0.0F, GLint, INT_TO_FLOAT); |
PROCESS(blueIndex, BCOMP, 0.0F, GLint, INT_TO_FLOAT); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLint, INT_TO_FLOAT); |
break; |
case GL_FLOAT: |
PROCESS(redIndex, RCOMP, 0.0F, GLfloat, (GLfloat)); |
PROCESS(greenIndex, GCOMP, 0.0F, GLfloat, (GLfloat)); |
PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat)); |
PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat)); |
break; |
case GL_UNSIGNED_BYTE_3_3_2: |
{ |
const GLubyte *ubsrc = (const GLubyte *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLubyte p = ubsrc[i]; |
rgba[i][RCOMP] = ((p >> 5) ) * (1.0F / 7.0F); |
rgba[i][GCOMP] = ((p >> 2) & 0x7) * (1.0F / 7.0F); |
rgba[i][BCOMP] = ((p ) & 0x3) * (1.0F / 3.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
break; |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
{ |
const GLubyte *ubsrc = (const GLubyte *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLubyte p = ubsrc[i]; |
rgba[i][RCOMP] = ((p ) & 0x7) * (1.0F / 7.0F); |
rgba[i][GCOMP] = ((p >> 3) & 0x7) * (1.0F / 7.0F); |
rgba[i][BCOMP] = ((p >> 6) ) * (1.0F / 3.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][RCOMP] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][GCOMP] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); |
rgba[i][BCOMP] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][RCOMP] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][GCOMP] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); |
rgba[i][BCOMP] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][RCOMP] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][GCOMP] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); |
rgba[i][BCOMP] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][RCOMP] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][GCOMP] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); |
rgba[i][BCOMP] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][ACOMP] = 1.0F; |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); |
rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); |
rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); |
rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); |
rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); |
rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); |
rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); |
rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); |
rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); |
rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); |
rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); |
rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); |
rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_5_5_1: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); |
rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); |
rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); |
rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); |
rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); |
rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
if (swapBytes) { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
SWAP2BYTE(p); |
rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); |
rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); |
rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); |
} |
} |
else { |
const GLushort *ussrc = (const GLushort *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLushort p = ussrc[i]; |
rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); |
rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); |
rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); |
rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8: |
if (swapBytes) { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); |
rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); |
rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); |
rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); |
} |
} |
else { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); |
rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); |
rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); |
rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
if (swapBytes) { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); |
rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); |
rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); |
rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); |
} |
} |
else { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); |
rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); |
rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); |
rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_10_10_10_2: |
if (swapBytes) { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
SWAP4BYTE(p); |
rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); |
rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); |
} |
} |
else { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); |
rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); |
} |
} |
break; |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
if (swapBytes) { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
SWAP4BYTE(p); |
rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); |
} |
} |
else { |
const GLuint *uisrc = (const GLuint *) src; |
GLuint i; |
for (i = 0; i < n; i ++) { |
GLuint p = uisrc[i]; |
rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); |
rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); |
} |
} |
break; |
default: |
_mesa_problem(NULL, "bad srcType in extract float data"); |
break; |
} |
} |
/* |
* Unpack a row of color image data from a client buffer according to |
* the pixel unpacking parameters. |
* Return GLubyte values in the specified dest image format. |
* This is (or will be) used by glDrawPixels and glTexImage?D(). |
* Input: ctx - the context |
* n - number of pixels in the span |
* dstFormat - format of destination color array |
* dest - the destination color array |
* srcFormat - source image format |
* srcType - source image datatype |
* source - source image pointer |
* srcPacking - pixel unpacking parameters |
* transferOps - bitmask of IMAGE_*_BIT values of operations to apply |
* |
* XXX perhaps expand this to process whole images someday. |
*/ |
void |
_mesa_unpack_chan_color_span( GLcontext *ctx, |
GLuint n, GLenum dstFormat, GLchan dest[], |
GLenum srcFormat, GLenum srcType, |
const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ) |
{ |
ASSERT(dstFormat == GL_ALPHA || |
dstFormat == GL_LUMINANCE || |
dstFormat == GL_LUMINANCE_ALPHA || |
dstFormat == GL_INTENSITY || |
dstFormat == GL_RGB || |
dstFormat == GL_RGBA || |
dstFormat == GL_COLOR_INDEX); |
ASSERT(srcFormat == GL_RED || |
srcFormat == GL_GREEN || |
srcFormat == GL_BLUE || |
srcFormat == GL_ALPHA || |
srcFormat == GL_LUMINANCE || |
srcFormat == GL_LUMINANCE_ALPHA || |
srcFormat == GL_INTENSITY || |
srcFormat == GL_RGB || |
srcFormat == GL_BGR || |
srcFormat == GL_RGBA || |
srcFormat == GL_BGRA || |
srcFormat == GL_ABGR_EXT || |
srcFormat == GL_COLOR_INDEX); |
ASSERT(srcType == GL_BITMAP || |
srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT || |
srcType == GL_UNSIGNED_BYTE_3_3_2 || |
srcType == GL_UNSIGNED_BYTE_2_3_3_REV || |
srcType == GL_UNSIGNED_SHORT_5_6_5 || |
srcType == GL_UNSIGNED_SHORT_5_6_5_REV || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4 || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || |
srcType == GL_UNSIGNED_SHORT_5_5_5_1 || |
srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || |
srcType == GL_UNSIGNED_INT_8_8_8_8 || |
srcType == GL_UNSIGNED_INT_8_8_8_8_REV || |
srcType == GL_UNSIGNED_INT_10_10_10_2 || |
srcType == GL_UNSIGNED_INT_2_10_10_10_REV); |
/* Try simple cases first */ |
if (transferOps == 0 ){ |
if (srcType == CHAN_TYPE) { |
if (dstFormat == GL_RGBA) { |
if (srcFormat == GL_RGBA) { |
MEMCPY( dest, source, n * 4 * sizeof(GLchan) ); |
return; |
} |
else if (srcFormat == GL_RGB) { |
GLuint i; |
const GLchan *src = (const GLchan *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = src[0]; |
dst[1] = src[1]; |
dst[2] = src[2]; |
dst[3] = CHAN_MAX; |
src += 3; |
dst += 4; |
} |
return; |
} |
} |
else if (dstFormat == GL_RGB) { |
if (srcFormat == GL_RGB) { |
MEMCPY( dest, source, n * 3 * sizeof(GLchan) ); |
return; |
} |
else if (srcFormat == GL_RGBA) { |
GLuint i; |
const GLchan *src = (const GLchan *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = src[0]; |
dst[1] = src[1]; |
dst[2] = src[2]; |
src += 4; |
dst += 3; |
} |
return; |
} |
} |
else if (dstFormat == srcFormat) { |
GLint comps = _mesa_components_in_format(srcFormat); |
assert(comps > 0); |
MEMCPY( dest, source, n * comps * sizeof(GLchan) ); |
return; |
} |
} |
/* |
* Common situation, loading 8bit RGBA/RGB source images |
* into 16/32 bit destination. (OSMesa16/32) |
*/ |
else if (srcType == GL_UNSIGNED_BYTE) { |
if (dstFormat == GL_RGBA) { |
if (srcFormat == GL_RGB) { |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = UBYTE_TO_CHAN(src[0]); |
dst[1] = UBYTE_TO_CHAN(src[1]); |
dst[2] = UBYTE_TO_CHAN(src[2]); |
dst[3] = CHAN_MAX; |
src += 3; |
dst += 4; |
} |
return; |
} |
else if (srcFormat == GL_RGBA) { |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = UBYTE_TO_CHAN(src[0]); |
dst[1] = UBYTE_TO_CHAN(src[1]); |
dst[2] = UBYTE_TO_CHAN(src[2]); |
dst[3] = UBYTE_TO_CHAN(src[3]); |
src += 4; |
dst += 4; |
} |
return; |
} |
} |
else if (dstFormat == GL_RGB) { |
if (srcFormat == GL_RGB) { |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = UBYTE_TO_CHAN(src[0]); |
dst[1] = UBYTE_TO_CHAN(src[1]); |
dst[2] = UBYTE_TO_CHAN(src[2]); |
src += 3; |
dst += 3; |
} |
return; |
} |
else if (srcFormat == GL_RGBA) { |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
GLchan *dst = dest; |
for (i = 0; i < n; i++) { |
dst[0] = UBYTE_TO_CHAN(src[0]); |
dst[1] = UBYTE_TO_CHAN(src[1]); |
dst[2] = UBYTE_TO_CHAN(src[2]); |
src += 4; |
dst += 3; |
} |
return; |
} |
} |
} |
} |
/* general solution begins here */ |
{ |
GLint dstComponents; |
GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; |
GLint dstLuminanceIndex, dstIntensityIndex; |
DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgba, return); /* mac 32k limitation */ |
dstComponents = _mesa_components_in_format( dstFormat ); |
/* source & dest image formats should have been error checked by now */ |
assert(dstComponents > 0); |
/* |
* Extract image data and convert to RGBA floats |
*/ |
assert(n <= MAX_WIDTH); |
if (srcFormat == GL_COLOR_INDEX) { |
GLuint indexes[MAX_WIDTH]; |
extract_uint_indexes(n, indexes, srcFormat, srcType, source, |
srcPacking); |
if (dstFormat == GL_COLOR_INDEX |
&& (transferOps & IMAGE_MAP_COLOR_BIT)) { |
_mesa_map_ci(ctx, n, indexes); |
} |
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { |
_mesa_shift_and_offset_ci(ctx, n, indexes); |
} |
if (dstFormat == GL_COLOR_INDEX) { |
/* convert to GLchan and return */ |
GLuint i; |
for (i = 0; i < n; i++) { |
dest[i] = (GLchan) (indexes[i] & 0xff); |
} |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
return; |
} |
else { |
/* Convert indexes to RGBA */ |
_mesa_map_ci_to_rgba(ctx, n, indexes, rgba); |
} |
} |
else { |
extract_float_rgba(n, rgba, srcFormat, srcType, source, |
srcPacking->SwapBytes); |
/* scale and bias colors */ |
if (transferOps & IMAGE_SCALE_BIAS_BIT) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.RedScale, ctx->Pixel.GreenScale, |
ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, |
ctx->Pixel.RedBias, ctx->Pixel.GreenBias, |
ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); |
} |
/* color map lookup */ |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_rgba(ctx, n, rgba); |
} |
} |
if (transferOps) { |
/* GL_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba); |
} |
/* convolution */ |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
/* this has to be done in the calling code */ |
} |
/* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ |
if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.PostConvolutionScale[RCOMP], |
ctx->Pixel.PostConvolutionScale[GCOMP], |
ctx->Pixel.PostConvolutionScale[BCOMP], |
ctx->Pixel.PostConvolutionScale[ACOMP], |
ctx->Pixel.PostConvolutionBias[RCOMP], |
ctx->Pixel.PostConvolutionBias[GCOMP], |
ctx->Pixel.PostConvolutionBias[BCOMP], |
ctx->Pixel.PostConvolutionBias[ACOMP]); |
} |
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba); |
} |
/* color matrix transform */ |
if (transferOps & IMAGE_COLOR_MATRIX_BIT) { |
_mesa_transform_rgba(ctx, n, rgba); |
} |
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); |
} |
/* update histogram count */ |
if (transferOps & IMAGE_HISTOGRAM_BIT) { |
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); |
} |
/* min/max here */ |
if (transferOps & IMAGE_MIN_MAX_BIT) { |
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); |
} |
} |
/* clamp to [0,1] */ |
#if CHAN_TYPE != GL_FLOAT |
{ |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); |
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); |
rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); |
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); |
} |
} |
#endif |
/* Now determine which color channels we need to produce. |
* And determine the dest index (offset) within each color tuple. |
*/ |
switch (dstFormat) { |
case GL_ALPHA: |
dstAlphaIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = -1; |
dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
case GL_LUMINANCE: |
dstLuminanceIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; |
dstIntensityIndex = -1; |
break; |
case GL_LUMINANCE_ALPHA: |
dstLuminanceIndex = 0; |
dstAlphaIndex = 1; |
dstRedIndex = dstGreenIndex = dstBlueIndex = -1; |
dstIntensityIndex = -1; |
break; |
case GL_INTENSITY: |
dstIntensityIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; |
dstLuminanceIndex = -1; |
break; |
case GL_RGB: |
dstRedIndex = 0; |
dstGreenIndex = 1; |
dstBlueIndex = 2; |
dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
case GL_RGBA: |
dstRedIndex = 0; |
dstGreenIndex = 1; |
dstBlueIndex = 2; |
dstAlphaIndex = 3; |
dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
default: |
_mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()"); |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
return; |
} |
/* Now return the GLchan data in the requested dstFormat */ |
if (dstRedIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
CLAMPED_FLOAT_TO_CHAN(dst[dstRedIndex], rgba[i][RCOMP]); |
dst += dstComponents; |
} |
} |
if (dstGreenIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
CLAMPED_FLOAT_TO_CHAN(dst[dstGreenIndex], rgba[i][GCOMP]); |
dst += dstComponents; |
} |
} |
if (dstBlueIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
CLAMPED_FLOAT_TO_CHAN(dst[dstBlueIndex], rgba[i][BCOMP]); |
dst += dstComponents; |
} |
} |
if (dstAlphaIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
CLAMPED_FLOAT_TO_CHAN(dst[dstAlphaIndex], rgba[i][ACOMP]); |
dst += dstComponents; |
} |
} |
if (dstIntensityIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
assert(dstIntensityIndex == 0); |
assert(dstComponents == 1); |
for (i = 0; i < n; i++) { |
/* Intensity comes from red channel */ |
CLAMPED_FLOAT_TO_CHAN(dst[i], rgba[i][RCOMP]); |
} |
} |
if (dstLuminanceIndex >= 0) { |
GLchan *dst = dest; |
GLuint i; |
assert(dstLuminanceIndex == 0); |
for (i = 0; i < n; i++) { |
/* Luminance comes from red channel */ |
CLAMPED_FLOAT_TO_CHAN(dst[0], rgba[i][RCOMP]); |
dst += dstComponents; |
} |
} |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
} |
} |
void |
_mesa_unpack_float_color_span( GLcontext *ctx, |
GLuint n, GLenum dstFormat, GLfloat dest[], |
GLenum srcFormat, GLenum srcType, |
const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps, GLboolean clamp ) |
{ |
ASSERT(dstFormat == GL_ALPHA || |
dstFormat == GL_LUMINANCE || |
dstFormat == GL_LUMINANCE_ALPHA || |
dstFormat == GL_INTENSITY || |
dstFormat == GL_RGB || |
dstFormat == GL_RGBA || |
dstFormat == GL_COLOR_INDEX); |
ASSERT(srcFormat == GL_RED || |
srcFormat == GL_GREEN || |
srcFormat == GL_BLUE || |
srcFormat == GL_ALPHA || |
srcFormat == GL_LUMINANCE || |
srcFormat == GL_LUMINANCE_ALPHA || |
srcFormat == GL_INTENSITY || |
srcFormat == GL_RGB || |
srcFormat == GL_BGR || |
srcFormat == GL_RGBA || |
srcFormat == GL_BGRA || |
srcFormat == GL_ABGR_EXT || |
srcFormat == GL_COLOR_INDEX); |
ASSERT(srcType == GL_BITMAP || |
srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT || |
srcType == GL_UNSIGNED_BYTE_3_3_2 || |
srcType == GL_UNSIGNED_BYTE_2_3_3_REV || |
srcType == GL_UNSIGNED_SHORT_5_6_5 || |
srcType == GL_UNSIGNED_SHORT_5_6_5_REV || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4 || |
srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || |
srcType == GL_UNSIGNED_SHORT_5_5_5_1 || |
srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || |
srcType == GL_UNSIGNED_INT_8_8_8_8 || |
srcType == GL_UNSIGNED_INT_8_8_8_8_REV || |
srcType == GL_UNSIGNED_INT_10_10_10_2 || |
srcType == GL_UNSIGNED_INT_2_10_10_10_REV); |
/* general solution, no special cases, yet */ |
{ |
GLint dstComponents; |
GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; |
GLint dstLuminanceIndex, dstIntensityIndex; |
DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ |
CHECKARRAY(rgba, return); /* mac 32k limitation */ |
dstComponents = _mesa_components_in_format( dstFormat ); |
/* source & dest image formats should have been error checked by now */ |
assert(dstComponents > 0); |
/* |
* Extract image data and convert to RGBA floats |
*/ |
assert(n <= MAX_WIDTH); |
if (srcFormat == GL_COLOR_INDEX) { |
GLuint indexes[MAX_WIDTH]; |
extract_uint_indexes(n, indexes, srcFormat, srcType, source, |
srcPacking); |
if (dstFormat == GL_COLOR_INDEX |
&& (transferOps & IMAGE_MAP_COLOR_BIT)) { |
_mesa_map_ci(ctx, n, indexes); |
} |
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { |
_mesa_shift_and_offset_ci(ctx, n, indexes); |
} |
if (dstFormat == GL_COLOR_INDEX) { |
/* convert to GLchan and return */ |
GLuint i; |
for (i = 0; i < n; i++) { |
dest[i] = (GLchan) (indexes[i] & 0xff); |
} |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
return; |
} |
else { |
/* Convert indexes to RGBA */ |
_mesa_map_ci_to_rgba(ctx, n, indexes, rgba); |
} |
} |
else { |
extract_float_rgba(n, rgba, srcFormat, srcType, source, |
srcPacking->SwapBytes); |
/* scale and bias colors */ |
if (transferOps & IMAGE_SCALE_BIAS_BIT) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.RedScale, ctx->Pixel.GreenScale, |
ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, |
ctx->Pixel.RedBias, ctx->Pixel.GreenBias, |
ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); |
} |
/* color map lookup */ |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_rgba(ctx, n, rgba); |
} |
} |
if (transferOps) { |
/* GL_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->ColorTable, n, rgba); |
} |
/* convolution */ |
if (transferOps & IMAGE_CONVOLUTION_BIT) { |
/* XXX to do */ |
} |
/* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ |
if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { |
_mesa_scale_and_bias_rgba(ctx, n, rgba, |
ctx->Pixel.PostConvolutionScale[RCOMP], |
ctx->Pixel.PostConvolutionScale[GCOMP], |
ctx->Pixel.PostConvolutionScale[BCOMP], |
ctx->Pixel.PostConvolutionScale[ACOMP], |
ctx->Pixel.PostConvolutionBias[RCOMP], |
ctx->Pixel.PostConvolutionBias[GCOMP], |
ctx->Pixel.PostConvolutionBias[BCOMP], |
ctx->Pixel.PostConvolutionBias[ACOMP]); |
} |
/* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba); |
} |
/* color matrix transform */ |
if (transferOps & IMAGE_COLOR_MATRIX_BIT) { |
_mesa_transform_rgba(ctx, n, rgba); |
} |
/* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ |
if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { |
_mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); |
} |
/* update histogram count */ |
if (transferOps & IMAGE_HISTOGRAM_BIT) { |
_mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); |
} |
/* min/max here */ |
if (transferOps & IMAGE_MIN_MAX_BIT) { |
_mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); |
} |
} |
/* clamp to [0,1] */ |
#if CHAN_TYPE != GL_FLOAT |
if (clamp) { |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); |
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); |
rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); |
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); |
} |
} |
#endif |
/* Now determine which color channels we need to produce. |
* And determine the dest index (offset) within each color tuple. |
*/ |
switch (dstFormat) { |
case GL_ALPHA: |
dstAlphaIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = -1; |
dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
case GL_LUMINANCE: |
dstLuminanceIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; |
dstIntensityIndex = -1; |
break; |
case GL_LUMINANCE_ALPHA: |
dstLuminanceIndex = 0; |
dstAlphaIndex = 1; |
dstRedIndex = dstGreenIndex = dstBlueIndex = -1; |
dstIntensityIndex = -1; |
break; |
case GL_INTENSITY: |
dstIntensityIndex = 0; |
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; |
dstLuminanceIndex = -1; |
break; |
case GL_RGB: |
dstRedIndex = 0; |
dstGreenIndex = 1; |
dstBlueIndex = 2; |
dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
case GL_RGBA: |
dstRedIndex = 0; |
dstGreenIndex = 1; |
dstBlueIndex = 2; |
dstAlphaIndex = 3; |
dstLuminanceIndex = dstIntensityIndex = -1; |
break; |
default: |
_mesa_problem(ctx, "bad dstFormat in _mesa_unpack_float_color_span()"); |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
return; |
} |
/* Now pack results in the requested dstFormat */ |
if (dstRedIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[dstRedIndex] = rgba[i][RCOMP]; |
dst += dstComponents; |
} |
} |
if (dstGreenIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[dstGreenIndex] = rgba[i][GCOMP]; |
dst += dstComponents; |
} |
} |
if (dstBlueIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[dstBlueIndex] = rgba[i][BCOMP]; |
dst += dstComponents; |
} |
} |
if (dstAlphaIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[dstAlphaIndex] = rgba[i][ACOMP]; |
dst += dstComponents; |
} |
} |
if (dstIntensityIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
assert(dstIntensityIndex == 0); |
assert(dstComponents == 1); |
for (i = 0; i < n; i++) { |
/* Intensity comes from red channel */ |
dst[i] = rgba[i][RCOMP]; |
} |
} |
if (dstLuminanceIndex >= 0) { |
GLfloat *dst = dest; |
GLuint i; |
assert(dstLuminanceIndex == 0); |
for (i = 0; i < n; i++) { |
/* Luminance comes from red channel */ |
dst[0] = rgba[i][RCOMP]; |
dst += dstComponents; |
} |
} |
UNDEFARRAY(rgba); /* mac 32k limitation */ |
} |
} |
/* |
* Unpack a row of color index data from a client buffer according to |
* the pixel unpacking parameters. |
* This is (or will be) used by glDrawPixels, glTexImage[123]D, etc. |
* |
* Args: ctx - the context |
* n - number of pixels |
* dstType - destination datatype |
* dest - destination array |
* srcType - source pixel type |
* source - source data pointer |
* srcPacking - pixel unpacking parameters |
* transferOps - the pixel transfer operations to apply |
*/ |
void |
_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ) |
{ |
ASSERT(srcType == GL_BITMAP || |
srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT); |
ASSERT(dstType == GL_UNSIGNED_BYTE || |
dstType == GL_UNSIGNED_SHORT || |
dstType == GL_UNSIGNED_INT); |
transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT); |
/* |
* Try simple cases first |
*/ |
if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE |
&& dstType == GL_UNSIGNED_BYTE) { |
MEMCPY(dest, source, n * sizeof(GLubyte)); |
} |
else if (transferOps == 0 && srcType == GL_UNSIGNED_INT |
&& dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) { |
MEMCPY(dest, source, n * sizeof(GLuint)); |
} |
else { |
/* |
* general solution |
*/ |
GLuint indexes[MAX_WIDTH]; |
assert(n <= MAX_WIDTH); |
extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, |
srcPacking); |
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { |
/* shift and offset indexes */ |
_mesa_shift_and_offset_ci(ctx, n, indexes); |
} |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
/* Apply lookup table */ |
_mesa_map_ci(ctx, n, indexes); |
} |
/* convert to dest type */ |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLubyte) (indexes[i] & 0xff); |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLuint *dst = (GLuint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLushort) (indexes[i] & 0xffff); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
MEMCPY(dest, indexes, n * sizeof(GLuint)); |
break; |
default: |
_mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span"); |
} |
} |
} |
void |
_mesa_pack_index_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, const GLuint *source, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps ) |
{ |
GLuint indexes[MAX_WIDTH]; |
ASSERT(n <= MAX_WIDTH); |
transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT); |
if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) { |
/* make a copy of input */ |
MEMCPY(indexes, source, n * sizeof(GLuint)); |
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { |
_mesa_shift_and_offset_ci( ctx, n, indexes); |
} |
if (transferOps & IMAGE_MAP_COLOR_BIT) { |
_mesa_map_ci(ctx, n, indexes); |
} |
source = indexes; |
} |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
*dst++ = (GLubyte) source[i]; |
} |
} |
break; |
case GL_BYTE: |
{ |
GLbyte *dst = (GLbyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLbyte) source[i]; |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLushort *dst = (GLushort *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLushort) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLshort *dst = (GLshort *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLshort) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint *dst = (GLuint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLuint) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_INT: |
{ |
GLint *dst = (GLint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLint) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLfloat *dst = (GLfloat *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLfloat) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad type in _mesa_pack_index_span"); |
} |
} |
/* |
* Unpack a row of stencil data from a client buffer according to |
* the pixel unpacking parameters. |
* This is (or will be) used by glDrawPixels |
* |
* Args: ctx - the context |
* n - number of pixels |
* dstType - destination datatype |
* dest - destination array |
* srcType - source pixel type |
* source - source data pointer |
* srcPacking - pixel unpacking parameters |
* transferOps - apply offset/bias/lookup ops? |
*/ |
void |
_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ) |
{ |
ASSERT(srcType == GL_BITMAP || |
srcType == GL_UNSIGNED_BYTE || |
srcType == GL_BYTE || |
srcType == GL_UNSIGNED_SHORT || |
srcType == GL_SHORT || |
srcType == GL_UNSIGNED_INT || |
srcType == GL_INT || |
srcType == GL_FLOAT); |
ASSERT(dstType == GL_UNSIGNED_BYTE || |
dstType == GL_UNSIGNED_SHORT || |
dstType == GL_UNSIGNED_INT); |
/* only shift and offset apply to stencil */ |
transferOps &= IMAGE_SHIFT_OFFSET_BIT; |
/* |
* Try simple cases first |
*/ |
if (transferOps == 0 && |
srcType == GL_UNSIGNED_BYTE && |
dstType == GL_UNSIGNED_BYTE) { |
MEMCPY(dest, source, n * sizeof(GLubyte)); |
} |
else if (transferOps == 0 && |
srcType == GL_UNSIGNED_INT && |
dstType == GL_UNSIGNED_INT && |
!srcPacking->SwapBytes) { |
MEMCPY(dest, source, n * sizeof(GLuint)); |
} |
else { |
/* |
* general solution |
*/ |
GLuint indexes[MAX_WIDTH]; |
assert(n <= MAX_WIDTH); |
extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, |
srcPacking); |
if (transferOps) { |
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { |
/* shift and offset indexes */ |
_mesa_shift_and_offset_ci(ctx, n, indexes); |
} |
if (ctx->Pixel.MapStencilFlag) { |
/* Apply stencil lookup table */ |
GLuint mask = ctx->Pixel.MapStoSsize - 1; |
GLuint i; |
for (i=0;i<n;i++) { |
indexes[i] = ctx->Pixel.MapStoS[ indexes[i] & mask ]; |
} |
} |
} |
/* convert to dest type */ |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLubyte) (indexes[i] & 0xff); |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLuint *dst = (GLuint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = (GLushort) (indexes[i] & 0xffff); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
MEMCPY(dest, indexes, n * sizeof(GLuint)); |
break; |
default: |
_mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span"); |
} |
} |
} |
void |
_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, const GLstencil *source, |
const struct gl_pixelstore_attrib *dstPacking ) |
{ |
GLstencil stencil[MAX_WIDTH]; |
ASSERT(n <= MAX_WIDTH); |
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || |
ctx->Pixel.MapStencilFlag) { |
/* make a copy of input */ |
MEMCPY(stencil, source, n * sizeof(GLstencil)); |
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { |
_mesa_shift_and_offset_stencil( ctx, n, stencil ); |
} |
if (ctx->Pixel.MapStencilFlag) { |
_mesa_map_stencil( ctx, n, stencil ); |
} |
source = stencil; |
} |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
if (sizeof(GLstencil) == 8) { |
MEMCPY( dest, source, n ); |
} |
else { |
GLubyte *dst = (GLubyte *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLubyte) source[i]; |
} |
} |
break; |
case GL_BYTE: |
if (sizeof(GLstencil) == 8) { |
MEMCPY( dest, source, n ); |
} |
else { |
GLbyte *dst = (GLbyte *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLbyte) source[i]; |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLushort *dst = (GLushort *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLushort) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLshort *dst = (GLshort *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLshort) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint *dst = (GLuint *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLuint) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_INT: |
{ |
GLint *dst = (GLint *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
*dst++ = (GLint) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLfloat *dst = (GLfloat *) dest; |
GLuint i; |
for (i=0;i<n;i++) { |
dst[i] = (GLfloat) source[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_BITMAP: |
if (dstPacking->LsbFirst) { |
GLubyte *dst = (GLubyte *) dest; |
GLint shift = 0; |
GLuint i; |
for (i = 0; i < n; i++) { |
if (shift == 0) |
*dst = 0; |
*dst |= ((source[i] != 0) << shift); |
shift++; |
if (shift == 8) { |
shift = 0; |
dst++; |
} |
} |
} |
else { |
GLubyte *dst = (GLubyte *) dest; |
GLint shift = 7; |
GLuint i; |
for (i = 0; i < n; i++) { |
if (shift == 7) |
*dst = 0; |
*dst |= ((source[i] != 0) << shift); |
shift--; |
if (shift < 0) { |
shift = 7; |
dst++; |
} |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad type in _mesa_pack_index_span"); |
} |
} |
void |
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking ) |
{ |
switch (srcType) { |
case GL_BYTE: |
{ |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
for (i = 0; i < n; i++) { |
dest[i] = BYTE_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_UNSIGNED_BYTE: |
{ |
GLuint i; |
const GLubyte *src = (const GLubyte *) source; |
for (i = 0; i < n; i++) { |
dest[i] = UBYTE_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLuint i; |
const GLshort *src = (const GLshort *) source; |
for (i = 0; i < n; i++) { |
dest[i] = SHORT_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLuint i; |
const GLushort *src = (const GLushort *) source; |
for (i = 0; i < n; i++) { |
dest[i] = USHORT_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_INT: |
{ |
GLuint i; |
const GLint *src = (const GLint *) source; |
for (i = 0; i < n; i++) { |
dest[i] = INT_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint i; |
const GLuint *src = (const GLuint *) source; |
for (i = 0; i < n; i++) { |
dest[i] = UINT_TO_FLOAT(src[i]); |
} |
} |
break; |
case GL_FLOAT: |
MEMCPY(dest, source, n * sizeof(GLfloat)); |
break; |
default: |
_mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()"); |
return; |
} |
/* apply depth scale and bias and clamp to [0,1] */ |
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) { |
GLuint i; |
for (i = 0; i < n; i++) { |
GLfloat d = dest[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; |
dest[i] = CLAMP(d, 0.0F, 1.0F); |
} |
} |
} |
/* |
* Pack an array of depth values. The values are floats in [0,1]. |
*/ |
void |
_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, |
GLenum dstType, const GLfloat *depthSpan, |
const struct gl_pixelstore_attrib *dstPacking ) |
{ |
GLfloat depthCopy[MAX_WIDTH]; |
const GLboolean bias_or_scale = ctx->Pixel.DepthBias != 0.0 || |
ctx->Pixel.DepthScale != 1.0; |
ASSERT(n <= MAX_WIDTH); |
if (bias_or_scale) { |
GLuint i; |
for (i = 0; i < n; i++) { |
GLfloat d; |
d = depthSpan[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; |
depthCopy[i] = CLAMP(d, 0.0F, 1.0F); |
} |
depthSpan = depthCopy; |
} |
switch (dstType) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_UBYTE( depthSpan[i] ); |
} |
} |
break; |
case GL_BYTE: |
{ |
GLbyte *dst = (GLbyte *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_BYTE( depthSpan[i] ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLushort *dst = (GLushort *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_USHORT( depthSpan[i] ); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLshort *dst = (GLshort *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_SHORT( depthSpan[i] ); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap2( (GLushort *) dst, n ); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint *dst = (GLuint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_UINT( depthSpan[i] ); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_INT: |
{ |
GLint *dst = (GLint *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = FLOAT_TO_INT( depthSpan[i] ); |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLfloat *dst = (GLfloat *) dest; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = depthSpan[i]; |
} |
if (dstPacking->SwapBytes) { |
_mesa_swap4( (GLuint *) dst, n ); |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad type in _mesa_pack_depth_span"); |
} |
} |
/* |
* Unpack image data. Apply byteswapping, byte flipping (bitmap). |
* Return all image data in a contiguous block. |
*/ |
void * |
_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *unpack ) |
{ |
GLint bytesPerRow, compsPerRow; |
GLboolean flipBytes, swap2, swap4; |
if (!pixels) |
return NULL; /* not necessarily an error */ |
if (width <= 0 || height <= 0 || depth <= 0) |
return NULL; /* generate error later */ |
if (format == GL_BITMAP) { |
bytesPerRow = (width + 7) >> 3; |
flipBytes = !unpack->LsbFirst; |
swap2 = swap4 = GL_FALSE; |
compsPerRow = 0; |
} |
else { |
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); |
const GLint components = _mesa_components_in_format(format); |
GLint bytesPerComp; |
if (bytesPerPixel <= 0 || components <= 0) |
return NULL; /* bad format or type. generate error later */ |
bytesPerRow = bytesPerPixel * width; |
bytesPerComp = bytesPerPixel / components; |
flipBytes = GL_FALSE; |
swap2 = (bytesPerComp == 2) && unpack->SwapBytes; |
swap4 = (bytesPerComp == 4) && unpack->SwapBytes; |
compsPerRow = components * width; |
assert(compsPerRow >= width); |
} |
{ |
GLubyte *destBuffer = (GLubyte *) MALLOC(bytesPerRow * height * depth); |
GLubyte *dst; |
GLint img, row; |
if (!destBuffer) |
return NULL; /* generate GL_OUT_OF_MEMORY later */ |
dst = destBuffer; |
for (img = 0; img < depth; img++) { |
for (row = 0; row < height; row++) { |
const GLvoid *src = _mesa_image_address(unpack, pixels, |
width, height, format, type, img, row, 0); |
MEMCPY(dst, src, bytesPerRow); |
/* byte flipping/swapping */ |
if (flipBytes) { |
flip_bytes((GLubyte *) dst, bytesPerRow); |
} |
else if (swap2) { |
_mesa_swap2((GLushort*) dst, compsPerRow); |
} |
else if (swap4) { |
_mesa_swap4((GLuint*) dst, compsPerRow); |
} |
dst += bytesPerRow; |
} |
} |
return destBuffer; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/drawpix.h |
---|
0,0 → 1,56 |
/* $Id: drawpix.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef DRAWPIXELS_H |
#define DRAWPIXELS_H |
#include "mtypes.h" |
extern void |
_mesa_DrawPixels( GLsizei width, GLsizei height, |
GLenum format, GLenum type, const GLvoid *pixels ); |
extern void |
_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, |
GLenum format, GLenum type, GLvoid *pixels ); |
extern void |
_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, |
GLenum type ); |
extern void |
_mesa_Bitmap( GLsizei width, GLsizei height, |
GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, |
const GLubyte *bitmap ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/hash.c |
---|
0,0 → 1,323 |
/* $Id: hash.c,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "glthread.h" |
#include "hash.h" |
#include "context.h" |
/** |
* \file hash.c |
* \brief Generic hash table. Used for display lists and texture objects. |
* The hash functions are thread-safe. |
* \author Brian Paul |
* \note key=0 is illegal |
*/ |
#define TABLE_SIZE 1023 /**< Size of lookup table/array */ |
/** |
* An entry in the hash table. This struct is private to this file. |
*/ |
struct HashEntry { |
GLuint Key; /**< the entry's key */ |
void *Data; /**< the entry's data */ |
struct HashEntry *Next; /**< pointer to next entry */ |
}; |
/** |
* The hashtable data structure. This is an opaque types (it's not |
* defined in the .h file). |
*/ |
struct _mesa_HashTable { |
struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */ |
GLuint MaxKey; /**< highest key inserted so far */ |
_glthread_Mutex Mutex; /**< mutual exclusion lock */ |
}; |
/** |
* Create a new hash table. |
* \return pointer to a new, empty hash table. |
*/ |
struct _mesa_HashTable *_mesa_NewHashTable(void) |
{ |
struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); |
if (table) { |
_glthread_INIT_MUTEX(table->Mutex); |
} |
return table; |
} |
/** |
* Delete a hash table. |
* \param table - the hash table to delete |
*/ |
void _mesa_DeleteHashTable(struct _mesa_HashTable *table) |
{ |
GLuint i; |
assert(table); |
for (i=0;i<TABLE_SIZE;i++) { |
struct HashEntry *entry = table->Table[i]; |
while (entry) { |
struct HashEntry *next = entry->Next; |
FREE(entry); |
entry = next; |
} |
} |
FREE(table); |
} |
/** |
* Lookup an entry in the hash table. |
* \param table - the hash table |
* \param key - the key |
* \return pointer to user's data or NULL if key not in table |
*/ |
void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) |
{ |
GLuint pos; |
const struct HashEntry *entry; |
assert(table); |
assert(key); |
pos = key & (TABLE_SIZE-1); |
entry = table->Table[pos]; |
while (entry) { |
if (entry->Key == key) { |
return entry->Data; |
} |
entry = entry->Next; |
} |
return NULL; |
} |
/** |
* Insert into the hash table. If an entry with this key already exists |
* we'll replace the existing entry. |
* \param table - the hash table |
* \param key - the key (not zero) |
* \param data - pointer to user data |
*/ |
void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) |
{ |
/* search for existing entry with this key */ |
GLuint pos; |
struct HashEntry *entry; |
assert(table); |
assert(key); |
_glthread_LOCK_MUTEX(table->Mutex); |
if (key > table->MaxKey) |
table->MaxKey = key; |
pos = key & (TABLE_SIZE-1); |
entry = table->Table[pos]; |
while (entry) { |
if (entry->Key == key) { |
/* replace entry's data */ |
entry->Data = data; |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return; |
} |
entry = entry->Next; |
} |
/* alloc and insert new table entry */ |
entry = MALLOC_STRUCT(HashEntry); |
entry->Key = key; |
entry->Data = data; |
entry->Next = table->Table[pos]; |
table->Table[pos] = entry; |
_glthread_UNLOCK_MUTEX(table->Mutex); |
} |
/** |
* Remove an entry from the hash table. |
* \param table - the hash table |
* \param key - key of entry to remove |
*/ |
void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) |
{ |
GLuint pos; |
struct HashEntry *entry, *prev; |
assert(table); |
assert(key); |
_glthread_LOCK_MUTEX(table->Mutex); |
pos = key & (TABLE_SIZE-1); |
prev = NULL; |
entry = table->Table[pos]; |
while (entry) { |
if (entry->Key == key) { |
/* found it! */ |
if (prev) { |
prev->Next = entry->Next; |
} |
else { |
table->Table[pos] = entry->Next; |
} |
FREE(entry); |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return; |
} |
prev = entry; |
entry = entry->Next; |
} |
_glthread_UNLOCK_MUTEX(table->Mutex); |
} |
/** |
* Get the key of the "first" entry in the hash table. |
* This is used in the course of deleting all display lists when |
* a context is destroyed. |
* \param table - the hash table |
* \return key for the "first" entry in the hash table. |
*/ |
GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table) |
{ |
GLuint pos; |
assert(table); |
_glthread_LOCK_MUTEX(table->Mutex); |
for (pos=0; pos < TABLE_SIZE; pos++) { |
if (table->Table[pos]) { |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return table->Table[pos]->Key; |
} |
} |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return 0; |
} |
/** |
* Dump contents of hash table for debugging. |
* \param table - the hash table |
*/ |
void _mesa_HashPrint(const struct _mesa_HashTable *table) |
{ |
GLuint i; |
assert(table); |
for (i=0;i<TABLE_SIZE;i++) { |
const struct HashEntry *entry = table->Table[i]; |
while (entry) { |
_mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data); |
entry = entry->Next; |
} |
} |
} |
/** |
* Find a block of 'numKeys' adjacent unused hash keys. |
* \param table - the hash table |
* \param numKeys - number of keys needed |
* \return Starting key of free block or 0 if failure |
*/ |
GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) |
{ |
GLuint maxKey = ~((GLuint) 0); |
_glthread_LOCK_MUTEX(table->Mutex); |
if (maxKey - numKeys > table->MaxKey) { |
/* the quick solution */ |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return table->MaxKey + 1; |
} |
else { |
/* the slow solution */ |
GLuint freeCount = 0; |
GLuint freeStart = 1; |
GLuint key; |
for (key=1; key!=maxKey; key++) { |
if (_mesa_HashLookup(table, key)) { |
/* darn, this key is already in use */ |
freeCount = 0; |
freeStart = key+1; |
} |
else { |
/* this key not in use, check if we've found enough */ |
freeCount++; |
if (freeCount == numKeys) { |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return freeStart; |
} |
} |
} |
/* cannot allocate a block of numKeys consecutive keys */ |
_glthread_UNLOCK_MUTEX(table->Mutex); |
return 0; |
} |
} |
#ifdef HASH_TEST_HARNESS |
int main(int argc, char *argv[]) |
{ |
int a, b, c; |
struct HashTable *t; |
_mesa_printf("&a = %p\n", &a); |
_mesa_printf("&b = %p\n", &b); |
t = _mesa_NewHashTable(); |
_mesa_HashInsert(t, 501, &a); |
_mesa_HashInsert(t, 10, &c); |
_mesa_HashInsert(t, 0xfffffff8, &b); |
_mesa_HashPrint(t); |
_mesa_printf("Find 501: %p\n", _mesa_HashLookup(t,501)); |
_mesa_printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); |
_mesa_printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); |
_mesa_DeleteHashTable(t); |
return 0; |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/dlist.h |
---|
0,0 → 1,109 |
/* $Id: dlist.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef DLIST_H |
#define DLIST_H |
#include "mtypes.h" |
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ |
do { \ |
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ |
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ |
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ |
return retval; \ |
} \ |
} while (0) |
#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ |
do { \ |
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ |
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ |
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ |
return; \ |
} \ |
} while (0) |
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \ |
do { \ |
ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \ |
FLUSH_VERTICES(ctx, 0); \ |
} while (0) |
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\ |
do { \ |
ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \ |
FLUSH_VERTICES(ctx, 0); \ |
} while (0) |
extern void _mesa_init_lists( void ); |
extern void _mesa_destroy_list( GLcontext *ctx, GLuint list ); |
extern void _mesa_CallList( GLuint list ); |
extern void _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); |
extern void _mesa_DeleteLists( GLuint list, GLsizei range ); |
extern void _mesa_EndList( void ); |
extern GLuint _mesa_GenLists( GLsizei range ); |
extern GLboolean _mesa_IsList( GLuint list ); |
extern void _mesa_ListBase( GLuint base ); |
extern void _mesa_NewList( GLuint list, GLenum mode ); |
extern void _mesa_init_dlist_table( struct _glapi_table *table, |
GLuint tableSize ); |
extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ); |
extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); |
extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); |
extern int _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, |
void (*execute)( GLcontext *, void * ), |
void (*destroy)( GLcontext *, void * ), |
void (*print)( GLcontext *, void * ) ); |
extern void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, |
GLint j1, GLint j2 ); |
extern void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); |
extern void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); |
extern void _mesa_save_CallList( GLuint list ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/blend.c |
---|
0,0 → 1,460 |
/* $Id: blend.c,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "blend.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "macros.h" |
#include "mtypes.h" |
void |
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glBlendFunc %s %s\n", |
_mesa_lookup_enum_by_nr(sfactor), |
_mesa_lookup_enum_by_nr(dfactor)); |
switch (sfactor) { |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" ); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_SRC_ALPHA_SATURATE: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" ); |
return; |
} |
switch (dfactor) { |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" ); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" ); |
return; |
} |
if (ctx->Color.BlendDstRGB == dfactor && |
ctx->Color.BlendSrcRGB == sfactor && |
ctx->Color.BlendDstA == dfactor && |
ctx->Color.BlendSrcA == sfactor) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor; |
ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor; |
if (ctx->Driver.BlendFunc) |
ctx->Driver.BlendFunc( ctx, sfactor, dfactor ); |
} |
/* GL_EXT_blend_func_separate */ |
void |
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, |
GLenum sfactorA, GLenum dfactorA ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", |
_mesa_lookup_enum_by_nr(sfactorRGB), |
_mesa_lookup_enum_by_nr(dfactorRGB), |
_mesa_lookup_enum_by_nr(sfactorA), |
_mesa_lookup_enum_by_nr(dfactorA)); |
switch (sfactorRGB) { |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)"); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_SRC_ALPHA_SATURATE: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)"); |
return; |
} |
switch (dfactorRGB) { |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)"); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)"); |
return; |
} |
switch (sfactorA) { |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)"); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_SRC_ALPHA_SATURATE: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)"); |
return; |
} |
switch (dfactorA) { |
case GL_DST_COLOR: |
case GL_ONE_MINUS_DST_COLOR: |
if (!ctx->Extensions.NV_blend_square) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)"); |
return; |
} |
/* fall-through */ |
case GL_ZERO: |
case GL_ONE: |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
case GL_DST_ALPHA: |
case GL_ONE_MINUS_DST_ALPHA: |
case GL_CONSTANT_COLOR: |
case GL_ONE_MINUS_CONSTANT_COLOR: |
case GL_CONSTANT_ALPHA: |
case GL_ONE_MINUS_CONSTANT_ALPHA: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)" ); |
return; |
} |
if (ctx->Color.BlendSrcRGB == sfactorRGB && |
ctx->Color.BlendDstRGB == dfactorRGB && |
ctx->Color.BlendSrcA == sfactorA && |
ctx->Color.BlendDstA == dfactorA) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.BlendSrcRGB = sfactorRGB; |
ctx->Color.BlendDstRGB = dfactorRGB; |
ctx->Color.BlendSrcA = sfactorA; |
ctx->Color.BlendDstA = dfactorA; |
if (ctx->Driver.BlendFuncSeparate) { |
(*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB, |
sfactorA, dfactorA ); |
} |
} |
/* This is really an extension function! */ |
void |
_mesa_BlendEquation( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glBlendEquation %s\n", |
_mesa_lookup_enum_by_nr(mode)); |
switch (mode) { |
case GL_FUNC_ADD_EXT: |
break; |
case GL_MIN_EXT: |
case GL_MAX_EXT: |
if (!ctx->Extensions.EXT_blend_minmax && |
!ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); |
return; |
} |
break; |
case GL_LOGIC_OP: |
if (!ctx->Extensions.EXT_blend_logic_op) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); |
return; |
} |
break; |
case GL_FUNC_SUBTRACT_EXT: |
case GL_FUNC_REVERSE_SUBTRACT_EXT: |
if (!ctx->Extensions.EXT_blend_subtract && |
!ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glBlendEquation" ); |
return; |
} |
if (ctx->Color.BlendEquation == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.BlendEquation = mode; |
/* This is needed to support 1.1's RGB logic ops AND |
* 1.0's blending logicops. |
*/ |
ctx->Color.ColorLogicOpEnabled = (mode==GL_LOGIC_OP && |
ctx->Color.BlendEnabled); |
if (ctx->Driver.BlendEquation) |
(*ctx->Driver.BlendEquation)( ctx, mode ); |
} |
void |
_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) |
{ |
GLfloat tmp[4]; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
tmp[0] = CLAMP( red, 0.0F, 1.0F ); |
tmp[1] = CLAMP( green, 0.0F, 1.0F ); |
tmp[2] = CLAMP( blue, 0.0F, 1.0F ); |
tmp[3] = CLAMP( alpha, 0.0F, 1.0F ); |
if (TEST_EQ_4V(tmp, ctx->Color.BlendColor)) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
COPY_4FV( ctx->Color.BlendColor, tmp ); |
if (ctx->Driver.BlendColor) |
(*ctx->Driver.BlendColor)(ctx, tmp); |
} |
void |
_mesa_AlphaFunc( GLenum func, GLclampf ref ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (func) { |
case GL_NEVER: |
case GL_LESS: |
case GL_EQUAL: |
case GL_LEQUAL: |
case GL_GREATER: |
case GL_NOTEQUAL: |
case GL_GEQUAL: |
case GL_ALWAYS: |
ref = CLAMP(ref, 0.0F, 1.0F); |
if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref) |
return; /* no change */ |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.AlphaFunc = func; |
ctx->Color.AlphaRef = ref; |
if (ctx->Driver.AlphaFunc) |
ctx->Driver.AlphaFunc(ctx, func, ref); |
return; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" ); |
return; |
} |
} |
void |
_mesa_LogicOp( GLenum opcode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (opcode) { |
case GL_CLEAR: |
case GL_SET: |
case GL_COPY: |
case GL_COPY_INVERTED: |
case GL_NOOP: |
case GL_INVERT: |
case GL_AND: |
case GL_NAND: |
case GL_OR: |
case GL_NOR: |
case GL_XOR: |
case GL_EQUIV: |
case GL_AND_REVERSE: |
case GL_AND_INVERTED: |
case GL_OR_REVERSE: |
case GL_OR_INVERTED: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glLogicOp" ); |
return; |
} |
if (ctx->Color.LogicOp == opcode) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.LogicOp = opcode; |
if (ctx->Driver.LogicOpcode) |
ctx->Driver.LogicOpcode( ctx, opcode ); |
} |
void |
_mesa_IndexMask( GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Color.IndexMask == mask) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.IndexMask = mask; |
if (ctx->Driver.IndexMask) |
ctx->Driver.IndexMask( ctx, mask ); |
} |
void |
_mesa_ColorMask( GLboolean red, GLboolean green, |
GLboolean blue, GLboolean alpha ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLubyte tmp[4]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha); |
/* Shouldn't have any information about channel depth in core mesa |
* -- should probably store these as the native booleans: |
*/ |
tmp[RCOMP] = red ? 0xff : 0x0; |
tmp[GCOMP] = green ? 0xff : 0x0; |
tmp[BCOMP] = blue ? 0xff : 0x0; |
tmp[ACOMP] = alpha ? 0xff : 0x0; |
if (TEST_EQ_4UBV(tmp, ctx->Color.ColorMask)) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
COPY_4UBV(ctx->Color.ColorMask, tmp); |
if (ctx->Driver.ColorMask) |
ctx->Driver.ColorMask( ctx, red, green, blue, alpha ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/attrib.c |
---|
0,0 → 1,1216 |
/* $Id: attrib.c,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "accum.h" |
#include "attrib.h" |
#include "blend.h" |
#include "buffers.h" |
#include "colormac.h" |
#include "context.h" |
#include "depth.h" |
#include "enable.h" |
#include "enums.h" |
#include "fog.h" |
#include "hint.h" |
#include "light.h" |
#include "lines.h" |
#include "matrix.h" |
#include "points.h" |
#include "polygon.h" |
#include "simple_list.h" |
#include "stencil.h" |
#include "texobj.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
/* |
* Allocate a new attribute state node. These nodes have a |
* "kind" value and a pointer to a struct of state data. |
*/ |
static struct gl_attrib_node * |
new_attrib_node( GLbitfield kind ) |
{ |
struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node); |
if (an) { |
an->kind = kind; |
} |
return an; |
} |
void |
_mesa_PushAttrib(GLbitfield mask) |
{ |
struct gl_attrib_node *newnode; |
struct gl_attrib_node *head; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); |
if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) { |
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); |
return; |
} |
/* Build linked list of attribute nodes which save all attribute */ |
/* groups specified by the mask. */ |
head = NULL; |
if (mask & GL_ACCUM_BUFFER_BIT) { |
struct gl_accum_attrib *attr; |
attr = MALLOC_STRUCT( gl_accum_attrib ); |
MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) ); |
newnode = new_attrib_node( GL_ACCUM_BUFFER_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_COLOR_BUFFER_BIT) { |
struct gl_colorbuffer_attrib *attr; |
attr = MALLOC_STRUCT( gl_colorbuffer_attrib ); |
MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) ); |
newnode = new_attrib_node( GL_COLOR_BUFFER_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_CURRENT_BIT) { |
struct gl_current_attrib *attr; |
FLUSH_CURRENT( ctx, 0 ); |
attr = MALLOC_STRUCT( gl_current_attrib ); |
MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) ); |
newnode = new_attrib_node( GL_CURRENT_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_DEPTH_BUFFER_BIT) { |
struct gl_depthbuffer_attrib *attr; |
attr = MALLOC_STRUCT( gl_depthbuffer_attrib ); |
MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) ); |
newnode = new_attrib_node( GL_DEPTH_BUFFER_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_ENABLE_BIT) { |
struct gl_enable_attrib *attr; |
GLuint i; |
attr = MALLOC_STRUCT( gl_enable_attrib ); |
/* Copy enable flags from all other attributes into the enable struct. */ |
attr->AlphaTest = ctx->Color.AlphaEnabled; |
attr->AutoNormal = ctx->Eval.AutoNormal; |
attr->Blend = ctx->Color.BlendEnabled; |
attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; |
attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; |
attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; |
attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; |
attr->Separable2D = ctx->Pixel.Separable2DEnabled; |
attr->CullFace = ctx->Polygon.CullFlag; |
attr->DepthTest = ctx->Depth.Test; |
attr->Dither = ctx->Color.DitherFlag; |
attr->Fog = ctx->Fog.Enabled; |
for (i=0;i<MAX_LIGHTS;i++) { |
attr->Light[i] = ctx->Light.Light[i].Enabled; |
} |
attr->Lighting = ctx->Light.Enabled; |
attr->LineSmooth = ctx->Line.SmoothFlag; |
attr->LineStipple = ctx->Line.StippleFlag; |
attr->Histogram = ctx->Pixel.HistogramEnabled; |
attr->MinMax = ctx->Pixel.MinMaxEnabled; |
attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; |
attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; |
attr->Map1Color4 = ctx->Eval.Map1Color4; |
attr->Map1Index = ctx->Eval.Map1Index; |
attr->Map1Normal = ctx->Eval.Map1Normal; |
attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1; |
attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2; |
attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3; |
attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4; |
attr->Map1Vertex3 = ctx->Eval.Map1Vertex3; |
attr->Map1Vertex4 = ctx->Eval.Map1Vertex4; |
MEMCPY(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib)); |
attr->Map2Color4 = ctx->Eval.Map2Color4; |
attr->Map2Index = ctx->Eval.Map2Index; |
attr->Map2Normal = ctx->Eval.Map2Normal; |
attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1; |
attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2; |
attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3; |
attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4; |
attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; |
attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; |
MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib)); |
attr->Normalize = ctx->Transform.Normalize; |
attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped; |
attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; |
attr->PointSmooth = ctx->Point.SmoothFlag; |
attr->PointSprite = ctx->Point.PointSprite; |
attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; |
attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; |
attr->PolygonOffsetFill = ctx->Polygon.OffsetFill; |
attr->PolygonSmooth = ctx->Polygon.SmoothFlag; |
attr->PolygonStipple = ctx->Polygon.StippleFlag; |
attr->RescaleNormals = ctx->Transform.RescaleNormals; |
attr->Scissor = ctx->Scissor.Enabled; |
attr->Stencil = ctx->Stencil.Enabled; |
attr->MultisampleEnabled = ctx->Multisample.Enabled; |
attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage; |
attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne; |
attr->SampleCoverage = ctx->Multisample.SampleCoverage; |
attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert; |
for (i=0; i<MAX_TEXTURE_UNITS; i++) { |
attr->Texture[i] = ctx->Texture.Unit[i].Enabled; |
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; |
} |
/* GL_NV_vertex_program */ |
attr->VertexProgram = ctx->VertexProgram.Enabled; |
attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; |
attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; |
newnode = new_attrib_node( GL_ENABLE_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_EVAL_BIT) { |
struct gl_eval_attrib *attr; |
attr = MALLOC_STRUCT( gl_eval_attrib ); |
MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) ); |
newnode = new_attrib_node( GL_EVAL_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_FOG_BIT) { |
struct gl_fog_attrib *attr; |
attr = MALLOC_STRUCT( gl_fog_attrib ); |
MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) ); |
newnode = new_attrib_node( GL_FOG_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_HINT_BIT) { |
struct gl_hint_attrib *attr; |
attr = MALLOC_STRUCT( gl_hint_attrib ); |
MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) ); |
newnode = new_attrib_node( GL_HINT_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_LIGHTING_BIT) { |
struct gl_light_attrib *attr; |
FLUSH_CURRENT(ctx, 0); /* flush material changes */ |
attr = MALLOC_STRUCT( gl_light_attrib ); |
MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) ); |
newnode = new_attrib_node( GL_LIGHTING_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_LINE_BIT) { |
struct gl_line_attrib *attr; |
attr = MALLOC_STRUCT( gl_line_attrib ); |
MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) ); |
newnode = new_attrib_node( GL_LINE_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_LIST_BIT) { |
struct gl_list_attrib *attr; |
attr = MALLOC_STRUCT( gl_list_attrib ); |
MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) ); |
newnode = new_attrib_node( GL_LIST_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_PIXEL_MODE_BIT) { |
struct gl_pixel_attrib *attr; |
attr = MALLOC_STRUCT( gl_pixel_attrib ); |
MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) ); |
newnode = new_attrib_node( GL_PIXEL_MODE_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_POINT_BIT) { |
struct gl_point_attrib *attr; |
attr = MALLOC_STRUCT( gl_point_attrib ); |
MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) ); |
newnode = new_attrib_node( GL_POINT_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_POLYGON_BIT) { |
struct gl_polygon_attrib *attr; |
attr = MALLOC_STRUCT( gl_polygon_attrib ); |
MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) ); |
newnode = new_attrib_node( GL_POLYGON_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_POLYGON_STIPPLE_BIT) { |
GLuint *stipple; |
stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) ); |
MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) ); |
newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT ); |
newnode->data = stipple; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_SCISSOR_BIT) { |
struct gl_scissor_attrib *attr; |
attr = MALLOC_STRUCT( gl_scissor_attrib ); |
MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) ); |
newnode = new_attrib_node( GL_SCISSOR_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_STENCIL_BUFFER_BIT) { |
struct gl_stencil_attrib *attr; |
attr = MALLOC_STRUCT( gl_stencil_attrib ); |
MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) ); |
newnode = new_attrib_node( GL_STENCIL_BUFFER_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_TEXTURE_BIT) { |
struct gl_texture_attrib *attr; |
GLuint u; |
/* Bump the texture object reference counts so that they don't |
* inadvertantly get deleted. |
*/ |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
ctx->Texture.Unit[u].Current1D->RefCount++; |
ctx->Texture.Unit[u].Current2D->RefCount++; |
ctx->Texture.Unit[u].Current3D->RefCount++; |
ctx->Texture.Unit[u].CurrentCubeMap->RefCount++; |
ctx->Texture.Unit[u].CurrentRect->RefCount++; |
} |
attr = MALLOC_STRUCT( gl_texture_attrib ); |
MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); |
/* copy state of the currently bound texture objects */ |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
_mesa_copy_texture_object(&attr->Unit[u].Saved1D, |
attr->Unit[u].Current1D); |
_mesa_copy_texture_object(&attr->Unit[u].Saved2D, |
attr->Unit[u].Current2D); |
_mesa_copy_texture_object(&attr->Unit[u].Saved3D, |
attr->Unit[u].Current3D); |
_mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap, |
attr->Unit[u].CurrentCubeMap); |
_mesa_copy_texture_object(&attr->Unit[u].SavedRect, |
attr->Unit[u].CurrentRect); |
} |
newnode = new_attrib_node( GL_TEXTURE_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_TRANSFORM_BIT) { |
struct gl_transform_attrib *attr; |
attr = MALLOC_STRUCT( gl_transform_attrib ); |
MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) ); |
newnode = new_attrib_node( GL_TRANSFORM_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_VIEWPORT_BIT) { |
struct gl_viewport_attrib *attr; |
attr = MALLOC_STRUCT( gl_viewport_attrib ); |
MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) ); |
newnode = new_attrib_node( GL_VIEWPORT_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
/* GL_ARB_multisample */ |
if (mask & GL_MULTISAMPLE_BIT_ARB) { |
struct gl_multisample_attrib *attr; |
attr = MALLOC_STRUCT( gl_multisample_attrib ); |
MEMCPY( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) ); |
newnode = new_attrib_node( GL_MULTISAMPLE_BIT_ARB ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
ctx->AttribStack[ctx->AttribStackDepth] = head; |
ctx->AttribStackDepth++; |
} |
static void |
pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) |
{ |
GLuint i; |
#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \ |
if ((VALUE) != (NEWVALUE)) { \ |
_mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \ |
} |
TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST); |
TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND); |
for (i=0;i<MAX_CLIP_PLANES;i++) { |
const GLuint mask = 1 << i; |
if ((ctx->Transform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask)) |
_mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i), |
(GLboolean) ((enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE)); |
} |
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, |
GL_COLOR_MATERIAL); |
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); |
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); |
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); |
TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, |
GL_CONVOLUTION_1D); |
TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, |
GL_CONVOLUTION_2D); |
TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, |
GL_SEPARABLE_2D); |
TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); |
TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); |
TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); |
TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple, |
GL_LINE_STIPPLE); |
TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp, |
GL_INDEX_LOGIC_OP); |
TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp, |
GL_COLOR_LOGIC_OP); |
TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4); |
TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX); |
TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL); |
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1, |
GL_MAP1_TEXTURE_COORD_1); |
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2, |
GL_MAP1_TEXTURE_COORD_2); |
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3, |
GL_MAP1_TEXTURE_COORD_3); |
TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4, |
GL_MAP1_TEXTURE_COORD_4); |
TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3, |
GL_MAP1_VERTEX_3); |
TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4, |
GL_MAP1_VERTEX_4); |
for (i = 0; i < 16; i++) { |
TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i], |
GL_MAP1_VERTEX_ATTRIB0_4_NV + i); |
} |
TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4); |
TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX); |
TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL); |
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1, |
GL_MAP2_TEXTURE_COORD_1); |
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2, |
GL_MAP2_TEXTURE_COORD_2); |
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3, |
GL_MAP2_TEXTURE_COORD_3); |
TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4, |
GL_MAP2_TEXTURE_COORD_4); |
TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3, |
GL_MAP2_VERTEX_3); |
TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, |
GL_MAP2_VERTEX_4); |
for (i = 0; i < 16; i++) { |
TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i], |
GL_MAP2_VERTEX_ATTRIB0_4_NV + i); |
} |
TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL); |
TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); |
TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, |
GL_RESCALE_NORMAL_EXT); |
TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped, |
enable->RasterPositionUnclipped, |
GL_RASTER_POSITION_UNCLIPPED_IBM); |
TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, |
GL_POINT_SMOOTH); |
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, |
GL_POINT_SMOOTH); |
if (ctx->Extensions.NV_point_sprite) { |
TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite, |
GL_POINT_SPRITE_NV); |
} |
TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, |
GL_POLYGON_OFFSET_POINT); |
TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, |
GL_POLYGON_OFFSET_LINE); |
TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill, |
GL_POLYGON_OFFSET_FILL); |
TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth, |
GL_POLYGON_SMOOTH); |
TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, |
GL_POLYGON_STIPPLE); |
TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); |
TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); |
/* XXX two-sided stencil */ |
TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled, |
GL_MULTISAMPLE_ARB); |
TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage, |
enable->SampleAlphaToCoverage, |
GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); |
TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne, |
enable->SampleAlphaToOne, |
GL_SAMPLE_ALPHA_TO_ONE_ARB); |
TEST_AND_UPDATE(ctx->Multisample.SampleCoverage, |
enable->SampleCoverage, |
GL_SAMPLE_COVERAGE_ARB); |
TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, |
enable->SampleCoverageInvert, |
GL_SAMPLE_COVERAGE_INVERT_ARB); |
/* GL_NV_vertex_program */ |
TEST_AND_UPDATE(ctx->VertexProgram.Enabled, |
enable->VertexProgram, |
GL_VERTEX_PROGRAM_NV); |
TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled, |
enable->VertexProgramPointSize, |
GL_VERTEX_PROGRAM_POINT_SIZE_NV); |
TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled, |
enable->VertexProgramTwoSide, |
GL_VERTEX_PROGRAM_TWO_SIDE_NV); |
#undef TEST_AND_UPDATE |
/* texture unit enables */ |
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { |
if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) { |
ctx->Texture.Unit[i].Enabled = enable->Texture[i]; |
if (ctx->Driver.Enable) { |
if (ctx->Driver.ActiveTexture) { |
(*ctx->Driver.ActiveTexture)(ctx, i); |
} |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, |
(GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) ); |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, |
(GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) ); |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, |
(GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) ); |
if (ctx->Extensions.ARB_texture_cube_map) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, |
(GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) ); |
if (ctx->Extensions.NV_texture_rectangle) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, |
(GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) ); |
} |
} |
if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) { |
ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i]; |
if (ctx->Driver.Enable) { |
if (ctx->Driver.ActiveTexture) { |
(*ctx->Driver.ActiveTexture)(ctx, i); |
} |
if (enable->TexGen[i] & S_BIT) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE); |
else |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE); |
if (enable->TexGen[i] & T_BIT) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE); |
else |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE); |
if (enable->TexGen[i] & R_BIT) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE); |
else |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE); |
if (enable->TexGen[i] & Q_BIT) |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE); |
else |
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE); |
} |
} |
} |
if (ctx->Driver.ActiveTexture) { |
(*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit); |
} |
} |
static void |
pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) |
{ |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
const struct gl_texture_unit *unit = &texAttrib->Unit[u]; |
GLuint i; |
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); |
_mesa_set_enable(ctx, GL_TEXTURE_1D, |
(GLboolean) (unit->Enabled & TEXTURE_1D_BIT ? GL_TRUE : GL_FALSE)); |
_mesa_set_enable(ctx, GL_TEXTURE_2D, |
(GLboolean) (unit->Enabled & TEXTURE_2D_BIT ? GL_TRUE : GL_FALSE)); |
_mesa_set_enable(ctx, GL_TEXTURE_3D, |
(GLboolean) (unit->Enabled & TEXTURE_3D_BIT ? GL_TRUE : GL_FALSE)); |
if (ctx->Extensions.ARB_texture_cube_map) { |
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, |
(GLboolean) (unit->Enabled & TEXTURE_CUBE_BIT ? GL_TRUE : GL_FALSE)); |
} |
if (ctx->Extensions.NV_texture_rectangle) { |
_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, |
(GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE)); |
} |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); |
_mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); |
_mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); |
_mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT); |
_mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR); |
_mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ); |
_mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS); |
_mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT); |
_mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR); |
_mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ); |
_mesa_TexGenfv(GL_S, GL_EYE_PLANE, unit->EyePlaneS); |
_mesa_TexGenfv(GL_T, GL_EYE_PLANE, unit->EyePlaneT); |
_mesa_TexGenfv(GL_R, GL_EYE_PLANE, unit->EyePlaneR); |
_mesa_TexGenfv(GL_Q, GL_EYE_PLANE, unit->EyePlaneQ); |
if (ctx->Extensions.EXT_texture_lod_bias) { |
_mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, |
GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias); |
} |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, |
unit->CombineModeRGB); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, |
unit->CombineModeA); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, |
unit->CombineSourceRGB[0]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, |
unit->CombineSourceRGB[1]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, |
unit->CombineSourceRGB[2]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, |
unit->CombineSourceA[0]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, |
unit->CombineSourceA[1]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA_EXT, |
unit->CombineSourceA[2]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, |
unit->CombineOperandRGB[0]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, |
unit->CombineOperandRGB[1]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, |
unit->CombineOperandRGB[2]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, |
unit->CombineOperandA[0]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, |
unit->CombineOperandA[1]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_EXT, |
unit->CombineOperandA[2]); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, |
1 << unit->CombineScaleShiftRGB); |
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, |
1 << unit->CombineScaleShiftA); |
} |
/* Restore texture object state */ |
for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { |
GLenum target = 0; |
const struct gl_texture_object *obj = NULL; |
GLfloat bordColor[4]; |
switch (i) { |
case 0: |
target = GL_TEXTURE_1D; |
obj = &unit->Saved1D; |
break; |
case 1: |
target = GL_TEXTURE_2D; |
obj = &unit->Saved2D; |
break; |
case 2: |
target = GL_TEXTURE_3D; |
obj = &unit->Saved3D; |
break; |
case 3: |
if (!ctx->Extensions.ARB_texture_cube_map) |
continue; |
target = GL_TEXTURE_CUBE_MAP_ARB; |
obj = &unit->SavedCubeMap; |
break; |
case 4: |
if (!ctx->Extensions.NV_texture_rectangle) |
continue; |
target = GL_TEXTURE_RECTANGLE_NV; |
obj = &unit->SavedRect; |
break; |
default: |
; /* silence warnings */ |
} |
_mesa_BindTexture(target, obj->Name); |
bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]); |
bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]); |
bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]); |
bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]); |
_mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority); |
_mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor); |
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS); |
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT); |
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR); |
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter); |
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); |
_mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); |
_mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); |
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); |
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); |
if (ctx->Extensions.EXT_texture_filter_anisotropic) { |
_mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, |
obj->MaxAnisotropy); |
} |
if (ctx->Extensions.SGIX_shadow) { |
_mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, |
obj->CompareFlag); |
_mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, |
obj->CompareOperator); |
} |
if (ctx->Extensions.SGIX_shadow_ambient) { |
_mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, |
obj->ShadowAmbient); |
} |
} |
} |
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB |
+ texAttrib->CurrentUnit); |
/* "un-bump" the texture object reference counts. We did that so they |
* wouldn't inadvertantly get deleted while they were still referenced |
* inside the attribute state stack. |
*/ |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
ctx->Texture.Unit[u].Current1D->RefCount--; |
ctx->Texture.Unit[u].Current2D->RefCount--; |
ctx->Texture.Unit[u].Current3D->RefCount--; |
ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; |
ctx->Texture.Unit[u].CurrentRect->RefCount--; |
} |
} |
/* |
* This function is kind of long just because we have to call a lot |
* of device driver functions to update device driver state. |
* |
* XXX As it is now, most of the pop-code calls immediate-mode Mesa functions |
* in order to restore GL state. This isn't terribly efficient but it |
* ensures that dirty flags and any derived state gets updated correctly. |
* We could at least check if the value to restore equals the current value |
* and then skip the Mesa call. |
*/ |
void |
_mesa_PopAttrib(void) |
{ |
struct gl_attrib_node *attr, *next; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->AttribStackDepth == 0) { |
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" ); |
return; |
} |
ctx->AttribStackDepth--; |
attr = ctx->AttribStack[ctx->AttribStackDepth]; |
while (attr) { |
if (MESA_VERBOSE & VERBOSE_API) { |
_mesa_debug(ctx, "glPopAttrib %s\n", |
_mesa_lookup_enum_by_nr(attr->kind)); |
} |
switch (attr->kind) { |
case GL_ACCUM_BUFFER_BIT: |
{ |
const struct gl_accum_attrib *accum; |
accum = (const struct gl_accum_attrib *) attr->data; |
_mesa_ClearAccum(accum->ClearColor[0], |
accum->ClearColor[1], |
accum->ClearColor[2], |
accum->ClearColor[3]); |
} |
break; |
case GL_COLOR_BUFFER_BIT: |
{ |
const struct gl_colorbuffer_attrib *color; |
color = (const struct gl_colorbuffer_attrib *) attr->data; |
_mesa_ClearIndex((GLfloat) color->ClearIndex); |
_mesa_ClearColor(color->ClearColor[0], |
color->ClearColor[1], |
color->ClearColor[2], |
color->ClearColor[3]); |
_mesa_IndexMask(color->IndexMask); |
_mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0), |
(GLboolean) (color->ColorMask[1] != 0), |
(GLboolean) (color->ColorMask[2] != 0), |
(GLboolean) (color->ColorMask[3] != 0)); |
_mesa_DrawBuffer(color->DrawBuffer); |
_mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); |
_mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef); |
_mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled); |
_mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, |
color->BlendDstRGB, |
color->BlendSrcA, |
color->BlendDstA); |
_mesa_BlendEquation(color->BlendEquation); |
_mesa_BlendColor(color->BlendColor[0], |
color->BlendColor[1], |
color->BlendColor[2], |
color->BlendColor[3]); |
_mesa_LogicOp(color->LogicOp); |
_mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, |
color->ColorLogicOpEnabled); |
_mesa_set_enable(ctx, GL_INDEX_LOGIC_OP, |
color->IndexLogicOpEnabled); |
_mesa_set_enable(ctx, GL_DITHER, color->DitherFlag); |
} |
break; |
case GL_CURRENT_BIT: |
FLUSH_CURRENT( ctx, 0 ); |
MEMCPY( &ctx->Current, attr->data, |
sizeof(struct gl_current_attrib) ); |
break; |
case GL_DEPTH_BUFFER_BIT: |
{ |
const struct gl_depthbuffer_attrib *depth; |
depth = (const struct gl_depthbuffer_attrib *) attr->data; |
_mesa_DepthFunc(depth->Func); |
_mesa_ClearDepth(depth->Clear); |
_mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test); |
_mesa_DepthMask(depth->Mask); |
if (ctx->Extensions.HP_occlusion_test) |
_mesa_set_enable(ctx, GL_OCCLUSION_TEST_HP, |
depth->OcclusionTest); |
} |
break; |
case GL_ENABLE_BIT: |
{ |
const struct gl_enable_attrib *enable; |
enable = (const struct gl_enable_attrib *) attr->data; |
pop_enable_group(ctx, enable); |
ctx->NewState |= _NEW_ALL; |
} |
break; |
case GL_EVAL_BIT: |
MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) ); |
ctx->NewState |= _NEW_EVAL; |
break; |
case GL_FOG_BIT: |
{ |
const struct gl_fog_attrib *fog; |
fog = (const struct gl_fog_attrib *) attr->data; |
_mesa_set_enable(ctx, GL_FOG, fog->Enabled); |
_mesa_Fogfv(GL_FOG_COLOR, fog->Color); |
_mesa_Fogf(GL_FOG_DENSITY, fog->Density); |
_mesa_Fogf(GL_FOG_START, fog->Start); |
_mesa_Fogf(GL_FOG_END, fog->End); |
_mesa_Fogf(GL_FOG_INDEX, fog->Index); |
_mesa_Fogi(GL_FOG_MODE, fog->Mode); |
} |
break; |
case GL_HINT_BIT: |
{ |
const struct gl_hint_attrib *hint; |
hint = (const struct gl_hint_attrib *) attr->data; |
_mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT, |
hint->PerspectiveCorrection ); |
_mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth); |
_mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth); |
_mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth); |
_mesa_Hint(GL_FOG_HINT, hint->Fog); |
_mesa_Hint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT, |
hint->ClipVolumeClipping); |
if (ctx->Extensions.ARB_texture_compression) |
_mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB, |
hint->TextureCompression); |
} |
break; |
case GL_LIGHTING_BIT: |
{ |
GLuint i; |
const struct gl_light_attrib *light; |
light = (const struct gl_light_attrib *) attr->data; |
/* lighting enable */ |
_mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); |
/* per-light state */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
for (i = 0; i < MAX_LIGHTS; i++) { |
GLenum lgt = (GLenum) (GL_LIGHT0 + i); |
const struct gl_light *l = &light->Light[i]; |
GLfloat tmp[4]; |
_mesa_set_enable(ctx, lgt, l->Enabled); |
_mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient ); |
_mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse ); |
_mesa_Lightfv( lgt, GL_SPECULAR, l->Specular ); |
TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition ); |
_mesa_Lightfv( lgt, GL_POSITION, tmp ); |
TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, l->EyeDirection ); |
_mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp ); |
_mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent ); |
_mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff ); |
_mesa_Lightfv( lgt, GL_CONSTANT_ATTENUATION, |
&l->ConstantAttenuation ); |
_mesa_Lightfv( lgt, GL_LINEAR_ATTENUATION, |
&l->LinearAttenuation ); |
_mesa_Lightfv( lgt, GL_QUADRATIC_ATTENUATION, |
&l->QuadraticAttenuation ); |
} |
/* light model */ |
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, |
light->Model.Ambient); |
_mesa_LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, |
(GLfloat) light->Model.LocalViewer); |
_mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE, |
(GLfloat) light->Model.TwoSide); |
_mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL, |
(GLfloat) light->Model.ColorControl); |
/* materials */ |
MEMCPY(ctx->Light.Material, light->Material, |
2 * sizeof(struct gl_material)); |
/* shade model */ |
_mesa_ShadeModel(light->ShadeModel); |
/* color material */ |
_mesa_ColorMaterial(light->ColorMaterialFace, |
light->ColorMaterialMode); |
_mesa_set_enable(ctx, GL_COLOR_MATERIAL, |
light->ColorMaterialEnabled); |
} |
break; |
case GL_LINE_BIT: |
{ |
const struct gl_line_attrib *line; |
line = (const struct gl_line_attrib *) attr->data; |
_mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag); |
_mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag); |
_mesa_LineStipple(line->StippleFactor, line->StipplePattern); |
_mesa_LineWidth(line->Width); |
} |
break; |
case GL_LIST_BIT: |
MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); |
break; |
case GL_PIXEL_MODE_BIT: |
MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) ); |
ctx->NewState |= _NEW_PIXEL; |
break; |
case GL_POINT_BIT: |
{ |
const struct gl_point_attrib *point; |
point = (const struct gl_point_attrib *) attr->data; |
_mesa_PointSize(point->Size); |
_mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); |
if (ctx->Extensions.EXT_point_parameters) { |
_mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, |
point->Params); |
_mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, |
point->MinSize); |
_mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, |
point->MaxSize); |
_mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, |
point->Threshold); |
} |
if (ctx->Extensions.NV_point_sprite) { |
GLuint u; |
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { |
_mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV, |
(GLint) point->CoordReplace[u]); |
} |
_mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); |
_mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, |
ctx->Point.SpriteRMode); |
} |
} |
break; |
case GL_POLYGON_BIT: |
{ |
const struct gl_polygon_attrib *polygon; |
polygon = (const struct gl_polygon_attrib *) attr->data; |
_mesa_CullFace(polygon->CullFaceMode); |
_mesa_FrontFace(polygon->FrontFace); |
_mesa_PolygonMode(GL_FRONT, polygon->FrontMode); |
_mesa_PolygonMode(GL_BACK, polygon->BackMode); |
_mesa_PolygonOffset(polygon->OffsetFactor, |
polygon->OffsetUnits); |
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag); |
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag); |
_mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag); |
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT, |
polygon->OffsetPoint); |
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE, |
polygon->OffsetLine); |
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, |
polygon->OffsetFill); |
} |
break; |
case GL_POLYGON_STIPPLE_BIT: |
MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); |
ctx->NewState |= _NEW_POLYGONSTIPPLE; |
if (ctx->Driver.PolygonStipple) |
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); |
break; |
case GL_SCISSOR_BIT: |
{ |
const struct gl_scissor_attrib *scissor; |
scissor = (const struct gl_scissor_attrib *) attr->data; |
_mesa_Scissor(scissor->X, scissor->Y, |
scissor->Width, scissor->Height); |
_mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); |
} |
break; |
case GL_STENCIL_BUFFER_BIT: |
{ |
const GLint face = 0; /* XXX stencil two side */ |
const struct gl_stencil_attrib *stencil; |
stencil = (const struct gl_stencil_attrib *) attr->data; |
_mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); |
_mesa_ClearStencil(stencil->Clear); |
_mesa_StencilFunc(stencil->Function[face], stencil->Ref[face], |
stencil->ValueMask[face]); |
_mesa_StencilMask(stencil->WriteMask[face]); |
_mesa_StencilOp(stencil->FailFunc[face], |
stencil->ZFailFunc[face], |
stencil->ZPassFunc[face]); |
} |
break; |
case GL_TRANSFORM_BIT: |
{ |
GLuint i; |
const struct gl_transform_attrib *xform; |
xform = (const struct gl_transform_attrib *) attr->data; |
_mesa_MatrixMode(xform->MatrixMode); |
if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) |
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
/* restore clip planes */ |
for (i = 0; i < MAX_CLIP_PLANES; i++) { |
const GLuint mask = 1 << 1; |
const GLfloat *eyePlane = xform->EyeUserPlane[i]; |
COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane); |
if (xform->ClipPlanesEnabled & mask) { |
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); |
} |
else { |
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); |
} |
if (ctx->Driver.ClipPlane) |
ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane ); |
} |
/* normalize/rescale */ |
if (xform->Normalize != ctx->Transform.Normalize) |
_mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize); |
if (xform->RescaleNormals != ctx->Transform.RescaleNormals) |
_mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, |
ctx->Transform.RescaleNormals); |
} |
break; |
case GL_TEXTURE_BIT: |
/* Take care of texture object reference counters */ |
{ |
const struct gl_texture_attrib *texture; |
texture = (const struct gl_texture_attrib *) attr->data; |
pop_texture_group(ctx, texture); |
ctx->NewState |= _NEW_TEXTURE; |
} |
break; |
case GL_VIEWPORT_BIT: |
{ |
const struct gl_viewport_attrib *vp; |
vp = (const struct gl_viewport_attrib *) attr->data; |
_mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height); |
_mesa_DepthRange(vp->Near, vp->Far); |
} |
break; |
case GL_MULTISAMPLE_BIT_ARB: |
{ |
const struct gl_multisample_attrib *ms; |
ms = (const struct gl_multisample_attrib *) attr->data; |
_mesa_SampleCoverageARB(ms->SampleCoverageValue, |
ms->SampleCoverageInvert); |
} |
break; |
default: |
_mesa_problem( ctx, "Bad attrib flag in PopAttrib"); |
break; |
} |
next = attr->next; |
FREE( attr->data ); |
FREE( attr ); |
attr = next; |
} |
} |
#define GL_CLIENT_PACK_BIT (1<<20) |
#define GL_CLIENT_UNPACK_BIT (1<<21) |
void |
_mesa_PushClientAttrib(GLbitfield mask) |
{ |
struct gl_attrib_node *newnode; |
struct gl_attrib_node *head; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) { |
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" ); |
return; |
} |
/* Build linked list of attribute nodes which save all attribute */ |
/* groups specified by the mask. */ |
head = NULL; |
if (mask & GL_CLIENT_PIXEL_STORE_BIT) { |
struct gl_pixelstore_attrib *attr; |
/* packing attribs */ |
attr = MALLOC_STRUCT( gl_pixelstore_attrib ); |
MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); |
newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
/* unpacking attribs */ |
attr = MALLOC_STRUCT( gl_pixelstore_attrib ); |
MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); |
newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { |
struct gl_array_attrib *attr; |
attr = MALLOC_STRUCT( gl_array_attrib ); |
MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) ); |
newnode = new_attrib_node( GL_CLIENT_VERTEX_ARRAY_BIT ); |
newnode->data = attr; |
newnode->next = head; |
head = newnode; |
} |
ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head; |
ctx->ClientAttribStackDepth++; |
} |
void |
_mesa_PopClientAttrib(void) |
{ |
struct gl_attrib_node *attr, *next; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->ClientAttribStackDepth == 0) { |
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" ); |
return; |
} |
ctx->ClientAttribStackDepth--; |
attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; |
while (attr) { |
switch (attr->kind) { |
case GL_CLIENT_PACK_BIT: |
MEMCPY( &ctx->Pack, attr->data, |
sizeof(struct gl_pixelstore_attrib) ); |
ctx->NewState |= _NEW_PACKUNPACK; |
break; |
case GL_CLIENT_UNPACK_BIT: |
MEMCPY( &ctx->Unpack, attr->data, |
sizeof(struct gl_pixelstore_attrib) ); |
ctx->NewState |= _NEW_PACKUNPACK; |
break; |
case GL_CLIENT_VERTEX_ARRAY_BIT: |
MEMCPY( &ctx->Array, attr->data, |
sizeof(struct gl_array_attrib) ); |
ctx->NewState |= _NEW_ARRAY; |
break; |
default: |
_mesa_problem( ctx, "Bad attrib flag in PopClientAttrib"); |
break; |
} |
next = attr->next; |
FREE( attr->data ); |
FREE( attr ); |
attr = next; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/debug.c |
---|
0,0 → 1,90 |
/* $Id: debug.c,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "mtypes.h" |
#include "context.h" |
#include "imports.h" |
#include "debug.h" |
void |
_mesa_print_state( const char *msg, GLuint state ) |
{ |
_mesa_debug(NULL, |
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", |
msg, |
state, |
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", |
(state & _NEW_PROJECTION) ? "ctx->Projection, " : "", |
(state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", |
(state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", |
(state & _NEW_ACCUM) ? "ctx->Accum, " : "", |
(state & _NEW_COLOR) ? "ctx->Color, " : "", |
(state & _NEW_DEPTH) ? "ctx->Depth, " : "", |
(state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", |
(state & _NEW_FOG) ? "ctx->Fog, " : "", |
(state & _NEW_HINT) ? "ctx->Hint, " : "", |
(state & _NEW_LIGHT) ? "ctx->Light, " : "", |
(state & _NEW_LINE) ? "ctx->Line, " : "", |
(state & _NEW_PIXEL) ? "ctx->Pixel, " : "", |
(state & _NEW_POINT) ? "ctx->Point, " : "", |
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "", |
(state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", |
(state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", |
(state & _NEW_TEXTURE) ? "ctx->Texture, " : "", |
(state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", |
(state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", |
(state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", |
(state & _NEW_ARRAY) ? "ctx->Array, " : "", |
(state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", |
(state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); |
} |
void |
_mesa_print_tri_caps( const char *name, GLuint flags ) |
{ |
_mesa_debug(NULL, |
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", |
name, |
flags, |
(flags & DD_FLATSHADE) ? "flat-shade, " : "", |
(flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", |
(flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", |
(flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", |
(flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", |
(flags & DD_TRI_OFFSET) ? "tri-offset, " : "", |
(flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", |
(flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", |
(flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", |
(flags & DD_LINE_WIDTH) ? "line-wide, " : "", |
(flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", |
(flags & DD_POINT_SIZE) ? "point-size, " : "", |
(flags & DD_POINT_ATTEN) ? "point-atten, " : "", |
(flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" |
); |
} |
/shark/tags/rel_0_4/ports/mesa/src/image.h |
---|
0,0 → 1,175 |
/* $Id: image.h,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef IMAGE_H |
#define IMAGE_H |
#include "mtypes.h" |
extern const struct gl_pixelstore_attrib _mesa_native_packing; |
extern void |
_mesa_swap2( GLushort *p, GLuint n ); |
extern void |
_mesa_swap4( GLuint *p, GLuint n ); |
extern GLint |
_mesa_sizeof_type( GLenum type ); |
extern GLint |
_mesa_sizeof_packed_type( GLenum type ); |
extern GLint |
_mesa_components_in_format( GLenum format ); |
extern GLint |
_mesa_bytes_per_pixel( GLenum format, GLenum type ); |
extern GLboolean |
_mesa_is_legal_format_and_type( GLenum format, GLenum type ); |
extern GLvoid * |
_mesa_image_address( const struct gl_pixelstore_attrib *packing, |
const GLvoid *image, GLsizei width, |
GLsizei height, GLenum format, GLenum type, |
GLint img, GLint row, GLint column ); |
extern GLint |
_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, |
GLint width, GLenum format, GLenum type ); |
extern GLint |
_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, |
GLint width, GLint height, |
GLenum format, GLenum type ); |
extern void |
_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], |
const struct gl_pixelstore_attrib *unpacking ); |
extern void |
_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, |
const struct gl_pixelstore_attrib *packing ); |
extern GLvoid * |
_mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, |
const struct gl_pixelstore_attrib *packing ); |
extern void |
_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, |
GLubyte *dest, const struct gl_pixelstore_attrib *packing ); |
extern void |
_mesa_pack_float_rgba_span( GLcontext *ctx, |
GLuint n, CONST GLfloat rgba[][4], |
GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps ); |
extern void |
_mesa_pack_rgba_span( GLcontext *ctx, |
GLuint n, CONST GLchan rgba[][4], |
GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps ); |
extern void |
_mesa_unpack_chan_color_span( GLcontext *ctx, |
GLuint n, GLenum dstFormat, GLchan dest[], |
GLenum srcFormat, GLenum srcType, |
const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ); |
extern void |
_mesa_unpack_float_color_span( GLcontext *ctx, |
GLuint n, GLenum dstFormat, GLfloat dest[], |
GLenum srcFormat, GLenum srcType, |
const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps, GLboolean clamp ); |
extern void |
_mesa_unpack_index_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ); |
extern void |
_mesa_pack_index_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, const GLuint *source, |
const struct gl_pixelstore_attrib *dstPacking, |
GLuint transferOps ); |
extern void |
_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking, |
GLuint transferOps ); |
extern void |
_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, |
GLenum dstType, GLvoid *dest, const GLstencil *source, |
const struct gl_pixelstore_attrib *dstPacking ); |
extern void |
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, |
GLenum srcType, const GLvoid *source, |
const struct gl_pixelstore_attrib *srcPacking ); |
extern void |
_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, |
GLenum dstType, const GLfloat *depthSpan, |
const struct gl_pixelstore_attrib *dstPacking ); |
extern void * |
_mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *unpack ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/enums.c |
---|
0,0 → 1,930 |
/* $Id: enums.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Author: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "enums.h" |
#include "imports.h" |
typedef struct { |
const char *c; |
int n; |
} enum_elt; |
enum_elt all_enums[] = |
{ |
/* Boolean values */ |
{ "GL_FALSE", 0 }, |
{ "GL_TRUE", 1 }, |
/* Data types */ |
{ "GL_BYTE", 0x1400 }, |
{ "GL_UNSIGNED_BYTE", 0x1401 }, |
{ "GL_SHORT", 0x1402 }, |
{ "GL_UNSIGNED_SHORT", 0x1403 }, |
{ "GL_INT", 0x1404 }, |
{ "GL_UNSIGNED_INT", 0x1405 }, |
{ "GL_FLOAT", 0x1406 }, |
{ "GL_DOUBLE", 0x140A }, |
{ "GL_2_BYTES", 0x1407 }, |
{ "GL_3_BYTES", 0x1408 }, |
{ "GL_4_BYTES", 0x1409 }, |
/* Primitives */ |
{ "GL_LINES", 0x0001 }, |
{ "GL_POINTS", 0x0000 }, |
{ "GL_LINE_STRIP", 0x0003 }, |
{ "GL_LINE_LOOP", 0x0002 }, |
{ "GL_TRIANGLES", 0x0004 }, |
{ "GL_TRIANGLE_STRIP", 0x0005 }, |
{ "GL_TRIANGLE_FAN", 0x0006 }, |
{ "GL_QUADS", 0x0007 }, |
{ "GL_QUAD_STRIP", 0x0008 }, |
{ "GL_POLYGON", 0x0009 }, |
{ "GL_EDGE_FLAG", 0x0B43 }, |
/* Vertex Arrays */ |
{ "GL_VERTEX_ARRAY", 0x8074 }, |
{ "GL_NORMAL_ARRAY", 0x8075 }, |
{ "GL_COLOR_ARRAY", 0x8076 }, |
{ "GL_INDEX_ARRAY", 0x8077 }, |
{ "GL_TEXTURE_COORD_ARRAY", 0x8078 }, |
{ "GL_EDGE_FLAG_ARRAY", 0x8079 }, |
{ "GL_VERTEX_ARRAY_SIZE", 0x807A }, |
{ "GL_VERTEX_ARRAY_TYPE", 0x807B }, |
{ "GL_VERTEX_ARRAY_STRIDE", 0x807C }, |
{ "GL_NORMAL_ARRAY_TYPE", 0x807E }, |
{ "GL_NORMAL_ARRAY_STRIDE", 0x807F }, |
{ "GL_COLOR_ARRAY_SIZE", 0x8081 }, |
{ "GL_COLOR_ARRAY_TYPE", 0x8082 }, |
{ "GL_COLOR_ARRAY_STRIDE", 0x8083 }, |
{ "GL_INDEX_ARRAY_TYPE", 0x8085 }, |
{ "GL_INDEX_ARRAY_STRIDE", 0x8086 }, |
{ "GL_TEXTURE_COORD_ARRAY_SIZE", 0x8088 }, |
{ "GL_TEXTURE_COORD_ARRAY_TYPE", 0x8089 }, |
{ "GL_TEXTURE_COORD_ARRAY_STRIDE", 0x808A }, |
{ "GL_EDGE_FLAG_ARRAY_STRIDE", 0x808C }, |
{ "GL_VERTEX_ARRAY_POINTER", 0x808E }, |
{ "GL_NORMAL_ARRAY_POINTER", 0x808F }, |
{ "GL_COLOR_ARRAY_POINTER", 0x8090 }, |
{ "GL_INDEX_ARRAY_POINTER", 0x8091 }, |
{ "GL_TEXTURE_COORD_ARRAY_POINTER", 0x8092 }, |
{ "GL_EDGE_FLAG_ARRAY_POINTER", 0x8093 }, |
{ "GL_V2F", 0x2A20 }, |
{ "GL_V3F", 0x2A21 }, |
{ "GL_C4UB_V2F", 0x2A22 }, |
{ "GL_C4UB_V3F", 0x2A23 }, |
{ "GL_C3F_V3F", 0x2A24 }, |
{ "GL_N3F_V3F", 0x2A25 }, |
{ "GL_C4F_N3F_V3F", 0x2A26 }, |
{ "GL_T2F_V3F", 0x2A27 }, |
{ "GL_T4F_V4F", 0x2A28 }, |
{ "GL_T2F_C4UB_V3F", 0x2A29 }, |
{ "GL_T2F_C3F_V3F", 0x2A2A }, |
{ "GL_T2F_N3F_V3F", 0x2A2B }, |
{ "GL_T2F_C4F_N3F_V3F", 0x2A2C }, |
{ "GL_T4F_C4F_N3F_V4F", 0x2A2D }, |
/* Matrix Mode */ |
{ "GL_MATRIX_MODE", 0x0BA0 }, |
{ "GL_MODELVIEW", 0x1700 }, |
{ "GL_PROJECTION", 0x1701 }, |
{ "GL_TEXTURE", 0x1702 }, |
/* Points */ |
{ "GL_POINT_SMOOTH", 0x0B10 }, |
{ "GL_POINT_SIZE", 0x0B11 }, |
{ "GL_POINT_SIZE_GRANULARITY ", 0x0B13 }, |
{ "GL_POINT_SIZE_RANGE", 0x0B12 }, |
/* Lines */ |
{ "GL_LINE_SMOOTH", 0x0B20 }, |
{ "GL_LINE_STIPPLE", 0x0B24 }, |
{ "GL_LINE_STIPPLE_PATTERN", 0x0B25 }, |
{ "GL_LINE_STIPPLE_REPEAT", 0x0B26 }, |
{ "GL_LINE_WIDTH", 0x0B21 }, |
{ "GL_LINE_WIDTH_GRANULARITY", 0x0B23 }, |
{ "GL_LINE_WIDTH_RANGE", 0x0B22 }, |
/* Polygons */ |
{ "GL_POINT", 0x1B00 }, |
{ "GL_LINE", 0x1B01 }, |
{ "GL_FILL", 0x1B02 }, |
{ "GL_CCW", 0x0901 }, |
{ "GL_CW", 0x0900 }, |
{ "GL_FRONT", 0x0404 }, |
{ "GL_BACK", 0x0405 }, |
{ "GL_CULL_FACE", 0x0B44 }, |
{ "GL_CULL_FACE_MODE", 0x0B45 }, |
{ "GL_POLYGON_SMOOTH", 0x0B41 }, |
{ "GL_POLYGON_STIPPLE", 0x0B42 }, |
{ "GL_FRONT_FACE", 0x0B46 }, |
{ "GL_POLYGON_MODE", 0x0B40 }, |
{ "GL_POLYGON_OFFSET_FACTOR", 0x8038 }, |
{ "GL_POLYGON_OFFSET_UNITS", 0x2A00 }, |
{ "GL_POLYGON_OFFSET_POINT", 0x2A01 }, |
{ "GL_POLYGON_OFFSET_LINE", 0x2A02 }, |
{ "GL_POLYGON_OFFSET_FILL", 0x8037 }, |
/* Display Lists */ |
{ "GL_COMPILE", 0x1300 }, |
{ "GL_COMPILE_AND_EXECUTE", 0x1301 }, |
{ "GL_LIST_BASE", 0x0B32 }, |
{ "GL_LIST_INDEX", 0x0B33 }, |
{ "GL_LIST_MODE", 0x0B30 }, |
/* Depth buffer */ |
{ "GL_NEVER", 0x0200 }, |
{ "GL_LESS", 0x0201 }, |
{ "GL_GEQUAL", 0x0206 }, |
{ "GL_LEQUAL", 0x0203 }, |
{ "GL_GREATER", 0x0204 }, |
{ "GL_NOTEQUAL", 0x0205 }, |
{ "GL_EQUAL", 0x0202 }, |
{ "GL_ALWAYS", 0x0207 }, |
{ "GL_DEPTH_TEST", 0x0B71 }, |
{ "GL_DEPTH_BITS", 0x0D56 }, |
{ "GL_DEPTH_CLEAR_VALUE", 0x0B73 }, |
{ "GL_DEPTH_FUNC", 0x0B74 }, |
{ "GL_DEPTH_RANGE", 0x0B70 }, |
{ "GL_DEPTH_WRITEMASK", 0x0B72 }, |
{ "GL_DEPTH_COMPONENT", 0x1902 }, |
/* Lighting */ |
{ "GL_LIGHTING", 0x0B50 }, |
{ "GL_LIGHT0", 0x4000 }, |
{ "GL_LIGHT1", 0x4001 }, |
{ "GL_LIGHT2", 0x4002 }, |
{ "GL_LIGHT3", 0x4003 }, |
{ "GL_LIGHT4", 0x4004 }, |
{ "GL_LIGHT5", 0x4005 }, |
{ "GL_LIGHT6", 0x4006 }, |
{ "GL_LIGHT7", 0x4007 }, |
{ "GL_SPOT_EXPONENT", 0x1205 }, |
{ "GL_SPOT_CUTOFF", 0x1206 }, |
{ "GL_CONSTANT_ATTENUATION", 0x1207 }, |
{ "GL_LINEAR_ATTENUATION", 0x1208 }, |
{ "GL_QUADRATIC_ATTENUATION", 0x1209 }, |
{ "GL_AMBIENT", 0x1200 }, |
{ "GL_DIFFUSE", 0x1201 }, |
{ "GL_SPECULAR", 0x1202 }, |
{ "GL_SHININESS", 0x1601 }, |
{ "GL_EMISSION", 0x1600 }, |
{ "GL_POSITION", 0x1203 }, |
{ "GL_SPOT_DIRECTION", 0x1204 }, |
{ "GL_AMBIENT_AND_DIFFUSE", 0x1602 }, |
{ "GL_COLOR_INDEXES", 0x1603 }, |
{ "GL_LIGHT_MODEL_TWO_SIDE", 0x0B52 }, |
{ "GL_LIGHT_MODEL_LOCAL_VIEWER", 0x0B51 }, |
{ "GL_LIGHT_MODEL_AMBIENT", 0x0B53 }, |
{ "GL_FRONT_AND_BACK", 0x0408 }, |
{ "GL_SHADE_MODEL", 0x0B54 }, |
{ "GL_FLAT", 0x1D00 }, |
{ "GL_SMOOTH", 0x1D01 }, |
{ "GL_COLOR_MATERIAL", 0x0B57 }, |
{ "GL_COLOR_MATERIAL_FACE", 0x0B55 }, |
{ "GL_COLOR_MATERIAL_PARAMETER", 0x0B56 }, |
{ "GL_NORMALIZE", 0x0BA1 }, |
/* User clipping planes */ |
{ "GL_CLIP_PLANE0", 0x3000 }, |
{ "GL_CLIP_PLANE1", 0x3001 }, |
{ "GL_CLIP_PLANE2", 0x3002 }, |
{ "GL_CLIP_PLANE3", 0x3003 }, |
{ "GL_CLIP_PLANE4", 0x3004 }, |
{ "GL_CLIP_PLANE5", 0x3005 }, |
/* Accumulation buffer */ |
{ "GL_ACCUM_RED_BITS", 0x0D58 }, |
{ "GL_ACCUM_GREEN_BITS", 0x0D59 }, |
{ "GL_ACCUM_BLUE_BITS", 0x0D5A }, |
{ "GL_ACCUM_ALPHA_BITS", 0x0D5B }, |
{ "GL_ACCUM_CLEAR_VALUE", 0x0B80 }, |
{ "GL_ACCUM", 0x0100 }, |
{ "GL_ADD", 0x0104 }, |
{ "GL_LOAD", 0x0101 }, |
{ "GL_MULT", 0x0103 }, |
{ "GL_RETURN", 0x0102 }, |
/* Alpha testing */ |
{ "GL_ALPHA_TEST", 0x0BC0 }, |
{ "GL_ALPHA_TEST_REF", 0x0BC2 }, |
{ "GL_ALPHA_TEST_FUNC", 0x0BC1 }, |
/* Blending */ |
{ "GL_BLEND", 0x0BE2 }, |
{ "GL_BLEND_SRC", 0x0BE1 }, |
{ "GL_BLEND_DST", 0x0BE0 }, |
{ "GL_ZERO", 0 }, |
{ "GL_ONE", 1 }, |
{ "GL_SRC_COLOR", 0x0300 }, |
{ "GL_ONE_MINUS_SRC_COLOR", 0x0301 }, |
{ "GL_DST_COLOR", 0x0306 }, |
{ "GL_ONE_MINUS_DST_COLOR", 0x0307 }, |
{ "GL_SRC_ALPHA", 0x0302 }, |
{ "GL_ONE_MINUS_SRC_ALPHA", 0x0303 }, |
{ "GL_DST_ALPHA", 0x0304 }, |
{ "GL_ONE_MINUS_DST_ALPHA", 0x0305 }, |
{ "GL_SRC_ALPHA_SATURATE", 0x0308 }, |
{ "GL_CONSTANT_COLOR", 0x8001 }, |
{ "GL_ONE_MINUS_CONSTANT_COLOR", 0x8002 }, |
{ "GL_CONSTANT_ALPHA", 0x8003 }, |
{ "GL_ONE_MINUS_CONSTANT_ALPHA", 0x8004 }, |
/* Render Mode */ |
{ "GL_FEEDBACK", 0x1C01 }, |
{ "GL_RENDER", 0x1C00 }, |
{ "GL_SELECT", 0x1C02 }, |
/* Feedback */ |
{ "GL_2D", 0x0600 }, |
{ "GL_3D", 0x0601 }, |
{ "GL_3D_COLOR", 0x0602 }, |
{ "GL_3D_COLOR_TEXTURE", 0x0603 }, |
{ "GL_4D_COLOR_TEXTURE", 0x0604 }, |
{ "GL_POINT_TOKEN", 0x0701 }, |
{ "GL_LINE_TOKEN", 0x0702 }, |
{ "GL_LINE_RESET_TOKEN", 0x0707 }, |
{ "GL_POLYGON_TOKEN", 0x0703 }, |
{ "GL_BITMAP_TOKEN", 0x0704 }, |
{ "GL_DRAW_PIXEL_TOKEN", 0x0705 }, |
{ "GL_COPY_PIXEL_TOKEN", 0x0706 }, |
{ "GL_PASS_THROUGH_TOKEN", 0x0700 }, |
{ "GL_FEEDBACK_BUFFER_POINTER", 0x0DF0 }, |
{ "GL_FEEDBACK_BUFFER_SIZE", 0x0DF1 }, |
{ "GL_FEEDBACK_BUFFER_TYPE", 0x0DF2 }, |
/* Selection */ |
{ "GL_SELECTION_BUFFER_POINTER", 0x0DF3 }, |
{ "GL_SELECTION_BUFFER_SIZE", 0x0DF4 }, |
/* Fog */ |
{ "GL_FOG", 0x0B60 }, |
{ "GL_FOG_MODE", 0x0B65 }, |
{ "GL_FOG_DENSITY", 0x0B62 }, |
{ "GL_FOG_COLOR", 0x0B66 }, |
{ "GL_FOG_INDEX", 0x0B61 }, |
{ "GL_FOG_START", 0x0B63 }, |
{ "GL_FOG_END", 0x0B64 }, |
{ "GL_LINEAR", 0x2601 }, |
{ "GL_EXP", 0x0800 }, |
{ "GL_EXP2", 0x0801 }, |
/* Logic Ops */ |
{ "GL_LOGIC_OP", 0x0BF1 }, |
{ "GL_INDEX_LOGIC_OP", 0x0BF1 }, |
{ "GL_COLOR_LOGIC_OP", 0x0BF2 }, |
{ "GL_LOGIC_OP_MODE", 0x0BF0 }, |
{ "GL_CLEAR", 0x1500 }, |
{ "GL_SET", 0x150F }, |
{ "GL_COPY", 0x1503 }, |
{ "GL_COPY_INVERTED", 0x150C }, |
{ "GL_NOOP", 0x1505 }, |
{ "GL_INVERT", 0x150A }, |
{ "GL_AND", 0x1501 }, |
{ "GL_NAND", 0x150E }, |
{ "GL_OR", 0x1507 }, |
{ "GL_NOR", 0x1508 }, |
{ "GL_XOR", 0x1506 }, |
{ "GL_EQUIV", 0x1509 }, |
{ "GL_AND_REVERSE", 0x1502 }, |
{ "GL_AND_INVERTED", 0x1504 }, |
{ "GL_OR_REVERSE", 0x150B }, |
{ "GL_OR_INVERTED", 0x150D }, |
/* Stencil */ |
{ "GL_STENCIL_TEST", 0x0B90 }, |
{ "GL_STENCIL_WRITEMASK", 0x0B98 }, |
{ "GL_STENCIL_BITS", 0x0D57 }, |
{ "GL_STENCIL_FUNC", 0x0B92 }, |
{ "GL_STENCIL_VALUE_MASK", 0x0B93 }, |
{ "GL_STENCIL_REF", 0x0B97 }, |
{ "GL_STENCIL_FAIL", 0x0B94 }, |
{ "GL_STENCIL_PASS_DEPTH_PASS", 0x0B96 }, |
{ "GL_STENCIL_PASS_DEPTH_FAIL", 0x0B95 }, |
{ "GL_STENCIL_CLEAR_VALUE", 0x0B91 }, |
{ "GL_STENCIL_INDEX", 0x1901 }, |
{ "GL_KEEP", 0x1E00 }, |
{ "GL_REPLACE", 0x1E01 }, |
{ "GL_INCR", 0x1E02 }, |
{ "GL_DECR", 0x1E03 }, |
/* Buffers, Pixel Drawing/Reading */ |
{ "GL_NONE", 0 }, |
{ "GL_LEFT", 0x0406 }, |
{ "GL_RIGHT", 0x0407 }, |
{ "GL_FRONT_LEFT", 0x0400 }, |
{ "GL_FRONT_RIGHT", 0x0401 }, |
{ "GL_BACK_LEFT", 0x0402 }, |
{ "GL_BACK_RIGHT", 0x0403 }, |
{ "GL_AUX0", 0x0409 }, |
{ "GL_AUX1", 0x040A }, |
{ "GL_AUX2", 0x040B }, |
{ "GL_AUX3", 0x040C }, |
{ "GL_COLOR_INDEX", 0x1900 }, |
{ "GL_RED", 0x1903 }, |
{ "GL_GREEN", 0x1904 }, |
{ "GL_BLUE", 0x1905 }, |
{ "GL_ALPHA", 0x1906 }, |
{ "GL_LUMINANCE", 0x1909 }, |
{ "GL_LUMINANCE_ALPHA", 0x190A }, |
{ "GL_ALPHA_BITS", 0x0D55 }, |
{ "GL_RED_BITS", 0x0D52 }, |
{ "GL_GREEN_BITS", 0x0D53 }, |
{ "GL_BLUE_BITS", 0x0D54 }, |
{ "GL_INDEX_BITS", 0x0D51 }, |
{ "GL_SUBPIXEL_BITS", 0x0D50 }, |
{ "GL_AUX_BUFFERS", 0x0C00 }, |
{ "GL_READ_BUFFER", 0x0C02 }, |
{ "GL_DRAW_BUFFER", 0x0C01 }, |
{ "GL_DOUBLEBUFFER", 0x0C32 }, |
{ "GL_STEREO", 0x0C33 }, |
{ "GL_BITMAP", 0x1A00 }, |
{ "GL_COLOR", 0x1800 }, |
{ "GL_DEPTH", 0x1801 }, |
{ "GL_STENCIL", 0x1802 }, |
{ "GL_DITHER", 0x0BD0 }, |
{ "GL_RGB", 0x1907 }, |
{ "GL_RGBA", 0x1908 }, |
/* Implementation limits */ |
{ "GL_MAX_LIST_NESTING", 0x0B31 }, |
{ "GL_MAX_ATTRIB_STACK_DEPTH", 0x0D35 }, |
{ "GL_MAX_MODELVIEW_STACK_DEPTH", 0x0D36 }, |
{ "GL_MAX_NAME_STACK_DEPTH", 0x0D37 }, |
{ "GL_MAX_PROJECTION_STACK_DEPTH", 0x0D38 }, |
{ "GL_MAX_TEXTURE_STACK_DEPTH", 0x0D39 }, |
{ "GL_MAX_EVAL_ORDER", 0x0D30 }, |
{ "GL_MAX_LIGHTS", 0x0D31 }, |
{ "GL_MAX_CLIP_PLANES", 0x0D32 }, |
{ "GL_MAX_TEXTURE_SIZE", 0x0D33 }, |
{ "GL_MAX_PIXEL_MAP_TABLE", 0x0D34 }, |
{ "GL_MAX_VIEWPORT_DIMS", 0x0D3A }, |
{ "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", 0x0D3B }, |
{ "GL_ATTRIB_STACK_DEPTH", 0x0BB0 }, |
{ "GL_CLIENT_ATTRIB_STACK_DEPTH", 0x0BB1 }, |
{ "GL_COLOR_CLEAR_VALUE", 0x0C22 }, |
{ "GL_COLOR_WRITEMASK", 0x0C23 }, |
{ "GL_CURRENT_INDEX", 0x0B01 }, |
{ "GL_CURRENT_COLOR", 0x0B00 }, |
{ "GL_CURRENT_NORMAL", 0x0B02 }, |
{ "GL_CURRENT_RASTER_COLOR", 0x0B04 }, |
{ "GL_CURRENT_RASTER_DISTANCE", 0x0B09 }, |
{ "GL_CURRENT_RASTER_INDEX", 0x0B05 }, |
{ "GL_CURRENT_RASTER_POSITION", 0x0B07 }, |
{ "GL_CURRENT_RASTER_TEXTURE_COORDS", 0x0B06}, |
{ "GL_CURRENT_RASTER_POSITION_VALID", 0x0B08 }, |
{ "GL_CURRENT_TEXTURE_COORDS", 0x0B03 }, |
{ "GL_INDEX_CLEAR_VALUE", 0x0C20 }, |
{ "GL_INDEX_MODE", 0x0C30 }, |
{ "GL_INDEX_WRITEMASK", 0x0C21 }, |
{ "GL_MODELVIEW_MATRIX", 0x0BA6 }, |
{ "GL_MODELVIEW_STACK_DEPTH", 0x0BA3 }, |
{ "GL_NAME_STACK_DEPTH", 0x0D70 }, |
{ "GL_PROJECTION_MATRIX", 0x0BA7 }, |
{ "GL_PROJECTION_STACK_DEPTH", 0x0BA4 }, |
{ "GL_RENDER_MODE", 0x0C40 }, |
{ "GL_RGBA_MODE", 0x0C31 }, |
{ "GL_TEXTURE_MATRIX", 0x0BA8 }, |
{ "GL_TEXTURE_STACK_DEPTH", 0x0BA5 }, |
{ "GL_VIEWPORT", 0x0BA2 }, |
/* Evaluators */ |
{ "GL_AUTO_NORMAL", 0x0D80 }, |
{ "GL_MAP1_COLOR_4", 0x0D90 }, |
{ "GL_MAP1_GRID_DOMAIN", 0x0DD0 }, |
{ "GL_MAP1_GRID_SEGMENTS", 0x0DD1 }, |
{ "GL_MAP1_INDEX", 0x0D91 }, |
{ "GL_MAP1_NORMAL", 0x0D92 }, |
{ "GL_MAP1_TEXTURE_COORD_1", 0x0D93 }, |
{ "GL_MAP1_TEXTURE_COORD_2", 0x0D94 }, |
{ "GL_MAP1_TEXTURE_COORD_3", 0x0D95 }, |
{ "GL_MAP1_TEXTURE_COORD_4", 0x0D96 }, |
{ "GL_MAP1_VERTEX_3", 0x0D97 }, |
{ "GL_MAP1_VERTEX_4", 0x0D98 }, |
{ "GL_MAP2_COLOR_4", 0x0DB0 }, |
{ "GL_MAP2_GRID_DOMAIN", 0x0DD2 }, |
{ "GL_MAP2_GRID_SEGMENTS", 0x0DD3 }, |
{ "GL_MAP2_INDEX", 0x0DB1 }, |
{ "GL_MAP2_NORMAL", 0x0DB2 }, |
{ "GL_MAP2_TEXTURE_COORD_1", 0x0DB3 }, |
{ "GL_MAP2_TEXTURE_COORD_2", 0x0DB4 }, |
{ "GL_MAP2_TEXTURE_COORD_3", 0x0DB5 }, |
{ "GL_MAP2_TEXTURE_COORD_4", 0x0DB6 }, |
{ "GL_MAP2_VERTEX_3", 0x0DB7 }, |
{ "GL_MAP2_VERTEX_4", 0x0DB8 }, |
{ "GL_COEFF", 0x0A00 }, |
{ "GL_DOMAIN", 0x0A02 }, |
{ "GL_ORDER", 0x0A01 }, |
/* Hints */ |
{ "GL_FOG_HINT", 0x0C54 }, |
{ "GL_LINE_SMOOTH_HINT", 0x0C52 }, |
{ "GL_PERSPECTIVE_CORRECTION_HINT", 0x0C50 }, |
{ "GL_POINT_SMOOTH_HINT", 0x0C51 }, |
{ "GL_POLYGON_SMOOTH_HINT", 0x0C53 }, |
{ "GL_DONT_CARE", 0x1100 }, |
{ "GL_FASTEST", 0x1101 }, |
{ "GL_NICEST", 0x1102 }, |
/* Scissor box */ |
{ "GL_SCISSOR_TEST", 0x0C11 }, |
{ "GL_SCISSOR_BOX", 0x0C10 }, |
/* Pixel Mode / Transfer */ |
{ "GL_MAP_COLOR", 0x0D10 }, |
{ "GL_MAP_STENCIL", 0x0D11 }, |
{ "GL_INDEX_SHIFT", 0x0D12 }, |
{ "GL_INDEX_OFFSET", 0x0D13 }, |
{ "GL_RED_SCALE", 0x0D14 }, |
{ "GL_RED_BIAS", 0x0D15 }, |
{ "GL_GREEN_SCALE", 0x0D18 }, |
{ "GL_GREEN_BIAS", 0x0D19 }, |
{ "GL_BLUE_SCALE", 0x0D1A }, |
{ "GL_BLUE_BIAS", 0x0D1B }, |
{ "GL_ALPHA_SCALE", 0x0D1C }, |
{ "GL_ALPHA_BIAS", 0x0D1D }, |
{ "GL_DEPTH_SCALE", 0x0D1E }, |
{ "GL_DEPTH_BIAS", 0x0D1F }, |
{ "GL_PIXEL_MAP_S_TO_S_SIZE", 0x0CB1 }, |
{ "GL_PIXEL_MAP_I_TO_I_SIZE", 0x0CB0 }, |
{ "GL_PIXEL_MAP_I_TO_R_SIZE", 0x0CB2 }, |
{ "GL_PIXEL_MAP_I_TO_G_SIZE", 0x0CB3 }, |
{ "GL_PIXEL_MAP_I_TO_B_SIZE", 0x0CB4 }, |
{ "GL_PIXEL_MAP_I_TO_A_SIZE", 0x0CB5 }, |
{ "GL_PIXEL_MAP_R_TO_R_SIZE", 0x0CB6 }, |
{ "GL_PIXEL_MAP_G_TO_G_SIZE", 0x0CB7 }, |
{ "GL_PIXEL_MAP_B_TO_B_SIZE", 0x0CB8 }, |
{ "GL_PIXEL_MAP_A_TO_A_SIZE", 0x0CB9 }, |
{ "GL_PIXEL_MAP_S_TO_S", 0x0C71 }, |
{ "GL_PIXEL_MAP_I_TO_I", 0x0C70 }, |
{ "GL_PIXEL_MAP_I_TO_R", 0x0C72 }, |
{ "GL_PIXEL_MAP_I_TO_G", 0x0C73 }, |
{ "GL_PIXEL_MAP_I_TO_B", 0x0C74 }, |
{ "GL_PIXEL_MAP_I_TO_A", 0x0C75 }, |
{ "GL_PIXEL_MAP_R_TO_R", 0x0C76 }, |
{ "GL_PIXEL_MAP_G_TO_G", 0x0C77 }, |
{ "GL_PIXEL_MAP_B_TO_B", 0x0C78 }, |
{ "GL_PIXEL_MAP_A_TO_A", 0x0C79 }, |
{ "GL_PACK_ALIGNMENT", 0x0D05 }, |
{ "GL_PACK_LSB_FIRST", 0x0D01 }, |
{ "GL_PACK_ROW_LENGTH", 0x0D02 }, |
{ "GL_PACK_SKIP_PIXELS", 0x0D04 }, |
{ "GL_PACK_SKIP_ROWS", 0x0D03 }, |
{ "GL_PACK_SWAP_BYTES", 0x0D00 }, |
{ "GL_UNPACK_ALIGNMENT", 0x0CF5 }, |
{ "GL_UNPACK_LSB_FIRST", 0x0CF1 }, |
{ "GL_UNPACK_ROW_LENGTH", 0x0CF2 }, |
{ "GL_UNPACK_SKIP_PIXELS", 0x0CF4 }, |
{ "GL_UNPACK_SKIP_ROWS", 0x0CF3 }, |
{ "GL_UNPACK_SWAP_BYTES", 0x0CF0 }, |
{ "GL_ZOOM_X", 0x0D16 }, |
{ "GL_ZOOM_Y", 0x0D17 }, |
/* Texture mapping */ |
{ "GL_TEXTURE_ENV", 0x2300 }, |
{ "GL_TEXTURE_ENV_MODE", 0x2200 }, |
{ "GL_TEXTURE_1D", 0x0DE0 }, |
{ "GL_TEXTURE_2D", 0x0DE1 }, |
{ "GL_TEXTURE_WRAP_S", 0x2802 }, |
{ "GL_TEXTURE_WRAP_T", 0x2803 }, |
{ "GL_TEXTURE_MAG_FILTER", 0x2800 }, |
{ "GL_TEXTURE_MIN_FILTER", 0x2801 }, |
{ "GL_TEXTURE_ENV_COLOR", 0x2201 }, |
{ "GL_TEXTURE_GEN_S", 0x0C60 }, |
{ "GL_TEXTURE_GEN_T", 0x0C61 }, |
{ "GL_TEXTURE_GEN_MODE", 0x2500 }, |
{ "GL_TEXTURE_BORDER_COLOR", 0x1004 }, |
{ "GL_TEXTURE_WIDTH", 0x1000 }, |
{ "GL_TEXTURE_HEIGHT", 0x1001 }, |
{ "GL_TEXTURE_BORDER", 0x1005 }, |
{ "GL_TEXTURE_COMPONENTS", 0x1003 }, |
{ "GL_TEXTURE_RED_SIZE", 0x805C }, |
{ "GL_TEXTURE_GREEN_SIZE", 0x805D }, |
{ "GL_TEXTURE_BLUE_SIZE", 0x805E }, |
{ "GL_TEXTURE_ALPHA_SIZE", 0x805F }, |
{ "GL_TEXTURE_LUMINANCE_SIZE", 0x8060 }, |
{ "GL_TEXTURE_INTENSITY_SIZE", 0x8061 }, |
{ "GL_NEAREST_MIPMAP_NEAREST", 0x2700 }, |
{ "GL_NEAREST_MIPMAP_LINEAR", 0x2702 }, |
{ "GL_LINEAR_MIPMAP_NEAREST", 0x2701 }, |
{ "GL_LINEAR_MIPMAP_LINEAR", 0x2703 }, |
{ "GL_OBJECT_LINEAR", 0x2401 }, |
{ "GL_OBJECT_PLANE", 0x2501 }, |
{ "GL_EYE_LINEAR", 0x2400 }, |
{ "GL_EYE_PLANE", 0x2502 }, |
{ "GL_SPHERE_MAP", 0x2402 }, |
{ "GL_DECAL", 0x2101 }, |
{ "GL_MODULATE", 0x2100 }, |
{ "GL_NEAREST", 0x2600 }, |
{ "GL_REPEAT", 0x2901 }, |
{ "GL_CLAMP", 0x2900 }, |
{ "GL_S", 0x2000 }, |
{ "GL_T", 0x2001 }, |
{ "GL_R", 0x2002 }, |
{ "GL_Q", 0x2003 }, |
{ "GL_TEXTURE_GEN_R", 0x0C62 }, |
{ "GL_TEXTURE_GEN_Q", 0x0C63 }, |
/* GL 1.1 texturing */ |
{ "GL_PROXY_TEXTURE_1D", 0x8063 }, |
{ "GL_PROXY_TEXTURE_2D", 0x8064 }, |
{ "GL_TEXTURE_PRIORITY", 0x8066 }, |
{ "GL_TEXTURE_RESIDENT", 0x8067 }, |
{ "GL_TEXTURE_BINDING_1D", 0x8068 }, |
{ "GL_TEXTURE_BINDING_2D", 0x8069 }, |
{ "GL_TEXTURE_INTERNAL_FORMAT", 0x1003 }, |
/* GL 1.2 texturing */ |
{ "GL_PACK_SKIP_IMAGES", 0x806B }, |
{ "GL_PACK_IMAGE_HEIGHT", 0x806C }, |
{ "GL_UNPACK_SKIP_IMAGES", 0x806D }, |
{ "GL_UNPACK_IMAGE_HEIGHT", 0x806E }, |
{ "GL_TEXTURE_3D", 0x806F }, |
{ "GL_PROXY_TEXTURE_3D", 0x8070 }, |
{ "GL_TEXTURE_DEPTH", 0x8071 }, |
{ "GL_TEXTURE_WRAP_R", 0x8072 }, |
{ "GL_MAX_3D_TEXTURE_SIZE", 0x8073 }, |
{ "GL_TEXTURE_BINDING_3D", 0x806A }, |
/* Internal texture formats (GL 1.1) */ |
{ "GL_ALPHA4", 0x803B }, |
{ "GL_ALPHA8", 0x803C }, |
{ "GL_ALPHA12", 0x803D }, |
{ "GL_ALPHA16", 0x803E }, |
{ "GL_LUMINANCE4", 0x803F }, |
{ "GL_LUMINANCE8", 0x8040 }, |
{ "GL_LUMINANCE12", 0x8041 }, |
{ "GL_LUMINANCE16", 0x8042 }, |
{ "GL_LUMINANCE4_ALPHA4", 0x8043 }, |
{ "GL_LUMINANCE6_ALPHA2", 0x8044 }, |
{ "GL_LUMINANCE8_ALPHA8", 0x8045 }, |
{ "GL_LUMINANCE12_ALPHA4", 0x8046 }, |
{ "GL_LUMINANCE12_ALPHA12", 0x8047 }, |
{ "GL_LUMINANCE16_ALPHA16", 0x8048 }, |
{ "GL_INTENSITY", 0x8049 }, |
{ "GL_INTENSITY4", 0x804A }, |
{ "GL_INTENSITY8", 0x804B }, |
{ "GL_INTENSITY12", 0x804C }, |
{ "GL_INTENSITY16", 0x804D }, |
{ "GL_R3_G3_B2", 0x2A10 }, |
{ "GL_RGB4", 0x804F }, |
{ "GL_RGB5", 0x8050 }, |
{ "GL_RGB8", 0x8051 }, |
{ "GL_RGB10", 0x8052 }, |
{ "GL_RGB12", 0x8053 }, |
{ "GL_RGB16", 0x8054 }, |
{ "GL_RGBA2", 0x8055 }, |
{ "GL_RGBA4", 0x8056 }, |
{ "GL_RGB5_A1", 0x8057 }, |
{ "GL_RGBA8", 0x8058 }, |
{ "GL_RGB10_A2", 0x8059 }, |
{ "GL_RGBA12", 0x805A }, |
{ "GL_RGBA16", 0x805B }, |
/* Utility */ |
{ "GL_VENDOR", 0x1F00 }, |
{ "GL_RENDERER", 0x1F01 }, |
{ "GL_VERSION", 0x1F02 }, |
{ "GL_EXTENSIONS", 0x1F03 }, |
/* Errors */ |
{ "GL_INVALID_VALUE", 0x0501 }, |
{ "GL_INVALID_ENUM", 0x0500 }, |
{ "GL_INVALID_OPERATION", 0x0502 }, |
{ "GL_STACK_OVERFLOW", 0x0503 }, |
{ "GL_STACK_UNDERFLOW", 0x0504 }, |
{ "GL_OUT_OF_MEMORY", 0x0505 }, |
/* |
* Extensions |
*/ |
{ "GL_CONSTANT_COLOR_EXT", 0x8001 }, |
{ "GL_ONE_MINUS_CONSTANT_COLOR_EXT", 0x8002 }, |
{ "GL_CONSTANT_ALPHA_EXT", 0x8003 }, |
{ "GL_ONE_MINUS_CONSTANT_ALPHA_EXT", 0x8004 }, |
{ "GL_BLEND_EQUATION_EXT", 0x8009 }, |
{ "GL_MIN_EXT", 0x8007 }, |
{ "GL_MAX_EXT", 0x8008 }, |
{ "GL_FUNC_ADD_EXT", 0x8006 }, |
{ "GL_FUNC_SUBTRACT_EXT", 0x800A }, |
{ "GL_FUNC_REVERSE_SUBTRACT_EXT", 0x800B }, |
{ "GL_BLEND_COLOR_EXT", 0x8005 }, |
{ "GL_POLYGON_OFFSET_EXT", 0x8037 }, |
{ "GL_POLYGON_OFFSET_FACTOR_EXT", 0x8038 }, |
{ "GL_POLYGON_OFFSET_BIAS_EXT", 0x8039 }, |
{ "GL_VERTEX_ARRAY_EXT", 0x8074 }, |
{ "GL_NORMAL_ARRAY_EXT", 0x8075 }, |
{ "GL_COLOR_ARRAY_EXT", 0x8076 }, |
{ "GL_INDEX_ARRAY_EXT", 0x8077 }, |
{ "GL_TEXTURE_COORD_ARRAY_EXT", 0x8078 }, |
{ "GL_EDGE_FLAG_ARRAY_EXT", 0x8079 }, |
{ "GL_VERTEX_ARRAY_SIZE_EXT", 0x807A }, |
{ "GL_VERTEX_ARRAY_TYPE_EXT", 0x807B }, |
{ "GL_VERTEX_ARRAY_STRIDE_EXT", 0x807C }, |
{ "GL_VERTEX_ARRAY_COUNT_EXT", 0x807D }, |
{ "GL_NORMAL_ARRAY_TYPE_EXT", 0x807E }, |
{ "GL_NORMAL_ARRAY_STRIDE_EXT", 0x807F }, |
{ "GL_NORMAL_ARRAY_COUNT_EXT", 0x8080 }, |
{ "GL_COLOR_ARRAY_SIZE_EXT", 0x8081 }, |
{ "GL_COLOR_ARRAY_TYPE_EXT", 0x8082 }, |
{ "GL_COLOR_ARRAY_STRIDE_EXT", 0x8083 }, |
{ "GL_COLOR_ARRAY_COUNT_EXT", 0x8084 }, |
{ "GL_INDEX_ARRAY_TYPE_EXT", 0x8085 }, |
{ "GL_INDEX_ARRAY_STRIDE_EXT", 0x8086 }, |
{ "GL_INDEX_ARRAY_COUNT_EXT", 0x8087 }, |
{ "GL_TEXTURE_COORD_ARRAY_SIZE_EXT", 0x8088 }, |
{ "GL_TEXTURE_COORD_ARRAY_TYPE_EXT", 0x8089 }, |
{ "GL_TEXTURE_COORD_ARRAY_STRIDE_EXT", 0x808A }, |
{ "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", 0x808B }, |
{ "GL_EDGE_FLAG_ARRAY_STRIDE_EXT", 0x808C }, |
{ "GL_EDGE_FLAG_ARRAY_COUNT_EXT", 0x808D }, |
{ "GL_VERTEX_ARRAY_POINTER_EXT", 0x808E }, |
{ "GL_NORMAL_ARRAY_POINTER_EXT", 0x808F }, |
{ "GL_COLOR_ARRAY_POINTER_EXT", 0x8090 }, |
{ "GL_INDEX_ARRAY_POINTER_EXT", 0x8091 }, |
{ "GL_TEXTURE_COORD_ARRAY_POINTER_EXT", 0x8092 }, |
{ "GL_EDGE_FLAG_ARRAY_POINTER_EXT", 0x8093 }, |
{ "GL_TEXTURE_PRIORITY_EXT", 0x8066 }, |
{ "GL_TEXTURE_RESIDENT_EXT", 0x8067 }, |
{ "GL_TEXTURE_1D_BINDING_EXT", 0x8068 }, |
{ "GL_TEXTURE_2D_BINDING_EXT", 0x8069 }, |
{ "GL_PACK_SKIP_IMAGES_EXT", 0x806B }, |
{ "GL_PACK_IMAGE_HEIGHT_EXT", 0x806C }, |
{ "GL_UNPACK_SKIP_IMAGES_EXT", 0x806D }, |
{ "GL_UNPACK_IMAGE_HEIGHT_EXT", 0x806E }, |
{ "GL_TEXTURE_3D_EXT", 0x806F }, |
{ "GL_PROXY_TEXTURE_3D_EXT", 0x8070 }, |
{ "GL_TEXTURE_DEPTH_EXT", 0x8071 }, |
{ "GL_TEXTURE_WRAP_R_EXT", 0x8072 }, |
{ "GL_MAX_3D_TEXTURE_SIZE_EXT", 0x8073 }, |
{ "GL_TEXTURE_3D_BINDING_EXT", 0x806A }, |
{ "GL_TABLE_TOO_LARGE_EXT", 0x8031 }, |
{ "GL_COLOR_TABLE_FORMAT_EXT", 0x80D8 }, |
{ "GL_COLOR_TABLE_WIDTH_EXT", 0x80D9 }, |
{ "GL_COLOR_TABLE_RED_SIZE_EXT", 0x80DA }, |
{ "GL_COLOR_TABLE_GREEN_SIZE_EXT", 0x80DB }, |
{ "GL_COLOR_TABLE_BLUE_SIZE_EXT", 0x80DC }, |
{ "GL_COLOR_TABLE_ALPHA_SIZE_EXT", 0x80DD }, |
{ "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT", 0x80DE }, |
{ "GL_COLOR_TABLE_INTENSITY_SIZE_EXT", 0x80DF }, |
{ "GL_TEXTURE_INDEX_SIZE_EXT", 0x80ED }, |
{ "GL_COLOR_INDEX1_EXT", 0x80E2 }, |
{ "GL_COLOR_INDEX2_EXT", 0x80E3 }, |
{ "GL_COLOR_INDEX4_EXT", 0x80E4 }, |
{ "GL_COLOR_INDEX8_EXT", 0x80E5 }, |
{ "GL_COLOR_INDEX12_EXT", 0x80E6 }, |
{ "GL_COLOR_INDEX16_EXT", 0x80E7 }, |
{ "GL_SHARED_TEXTURE_PALETTE_EXT", 0x81FB }, |
{ "GL_POINT_SIZE_MIN_EXT", 0x8126 }, |
{ "GL_POINT_SIZE_MAX_EXT", 0x8127 }, |
{ "GL_POINT_FADE_THRESHOLD_SIZE_EXT", 0x8128 }, |
{ "GL_DISTANCE_ATTENUATION_EXT", 0x8129 }, |
{ "GL_RESCALE_NORMAL_EXT", 0x803A }, |
{ "GL_ABGR_EXT", 0x8000 }, |
{ "GL_INCR_WRAP_EXT", 0x8507 }, |
{ "GL_DECR_WRAP_EXT", 0x8508 }, |
{ "GL_CLAMP_TO_EDGE_SGIS", 0x812F }, |
{ "GL_BLEND_DST_RGB_INGR", 0x80C8 }, |
{ "GL_BLEND_SRC_RGB_INGR", 0x80C9 }, |
{ "GL_BLEND_DST_ALPHA_INGR", 0x80CA }, |
{ "GL_BLEND_SRC_ALPHA_INGR", 0x80CB }, |
{ "GL_RESCALE_NORMAL", 0x803A }, |
{ "GL_CLAMP_TO_EDGE", 0x812F }, |
{ "GL_MAX_ELEMENTS_VERTICES", 0xF0E8 }, |
{ "GL_MAX_ELEMENTS_INDICES", 0xF0E9 }, |
{ "GL_BGR", 0x80E0 }, |
{ "GL_BGRA", 0x80E1 }, |
{ "GL_UNSIGNED_BYTE_3_3_2", 0x8032 }, |
{ "GL_UNSIGNED_BYTE_2_3_3_REV", 0x8362 }, |
{ "GL_UNSIGNED_SHORT_5_6_5", 0x8363 }, |
{ "GL_UNSIGNED_SHORT_5_6_5_REV", 0x8364 }, |
{ "GL_UNSIGNED_SHORT_4_4_4_4", 0x8033 }, |
{ "GL_UNSIGNED_SHORT_4_4_4_4_REV", 0x8365 }, |
{ "GL_UNSIGNED_SHORT_5_5_5_1", 0x8034 }, |
{ "GL_UNSIGNED_SHORT_1_5_5_5_REV", 0x8366 }, |
{ "GL_UNSIGNED_INT_8_8_8_8", 0x8035 }, |
{ "GL_UNSIGNED_INT_8_8_8_8_REV", 0x8367 }, |
{ "GL_UNSIGNED_INT_10_10_10_2", 0x8036 }, |
{ "GL_UNSIGNED_INT_2_10_10_10_REV", 0x8368 }, |
{ "GL_LIGHT_MODEL_COLOR_CONTROL", 0x81F8 }, |
{ "GL_SINGLE_COLOR", 0x81F9 }, |
{ "GL_SEPARATE_SPECULAR_COLOR", 0x81FA }, |
{ "GL_TEXTURE_MIN_LOD", 0x813A }, |
{ "GL_TEXTURE_MAX_LOD", 0x813B }, |
{ "GL_TEXTURE_BASE_LEVEL", 0x813C }, |
{ "GL_TEXTURE_MAX_LEVEL", 0x813D }, |
{ "GL_TEXTURE0_ARB", 0x84C0 }, |
{ "GL_TEXTURE1_ARB", 0x84C1 }, |
{ "GL_TEXTURE2_ARB", 0x84C2 }, |
{ "GL_TEXTURE3_ARB", 0x84C3 }, |
{ "GL_ACTIVE_TEXTURE_ARB", 0x84E0 }, |
{ "GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1 }, |
{ "GL_MAX_TEXTURE_UNITS_ARB", 0x84E2 }, |
{ "GL_OCCLUSION_TEST_HP", 0x8165 }, |
{ "GL_OCCLUSION_TEST_RESULT_HP", 0x8166 }, |
{ "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 }, |
{ "GL_TEXTUER_LOD_BIAS_EXT", 0x8501 }, |
{ "GL_NORMAL_MAP_NV", 0x8511 }, |
{ "GL_REFLECTION_MAP_NV", 0x8512 }, |
{ "GL_PREFER_DOUBLEBUFFER_HINT_PGI", 107000 }, |
{ "GL_STRICT_DEPTHFUNC_HINT_PGI", 107030 }, |
{ "GL_STRICT_LIGHTING_HINT_PGI", 107031 }, |
{ "GL_STRICT_SCISSOR_HINT_PGI", 107032 }, |
{ "GL_FULL_STIPPLE_HINT_PGI", 107033 }, |
{ "GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI", 107011 }, |
{ "GL_NATIVE_GRAPHICS_END_HINT_PGI", 107012 }, |
{ "GL_CONSERVE_MEMORY_HINT_PGI", 107005 }, |
{ "GL_RECLAIM_MEMORY_HINT_PGI", 107006 }, |
{ "GL_ALWAYS_FAST_HINT_PGI", 107020 }, |
{ "GL_ALWAYS_SOFT_HINT_PGI", 107021 }, |
{ "GL_ALLOW_DRAW_OBJ_HINT_PGI", 107022 }, |
{ "GL_ALLOW_DRAW_WIN_HINT_PGI", 107023 }, |
{ "GL_ALLOW_DRAW_FRG_HINT_PGI", 107024 }, |
{ "GL_ALLOW_DRAW_SPN_HINT_PGI", 107024 }, |
{ "GL_ALLOW_DRAW_MEM_HINT_PGI", 107025 }, |
{ "GL_CLIP_NEAR_HINT_PGI", 107040 }, |
{ "GL_CLIP_FAR_HINT_PGI", 107041 }, |
{ "GL_WIDE_LINE_HINT_PGI", 107042 }, |
{ "GL_BACK_NORMALS_HINT_PGI", 107043 }, |
{ "GL_NATIVE_GRAPHICS_HANDLE_PGI", 107010 }, |
/* GL_EXT_compiled_vertex_array */ |
{ "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", 0x81A8}, |
{ "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9}, |
/* GL_EXT_clip_volume_hint */ |
{ "GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0}, |
/* GL_EXT_texture_env_combine */ |
{ "GL_COMBINE_EXT", 0x8570 }, |
{ "GL_COMBINE_RGB_EXT", 0x8571 }, |
{ "GL_COMBINE_ALPHA_EXT", 0x8572 }, |
{ "GL_SOURCE0_RGB_EXT", 0x8580 }, |
{ "GL_SOURCE1_RGB_EXT", 0x8581 }, |
{ "GL_SOURCE2_RGB_EXT", 0x8582 }, |
{ "GL_SOURCE0_ALPHA_EXT", 0x8588 }, |
{ "GL_SOURCE1_ALPHA_EXT", 0x8589 }, |
{ "GL_SOURCE2_ALPHA_EXT", 0x858A }, |
{ "GL_OPERAND0_RGB_EXT", 0x8590 }, |
{ "GL_OPERAND1_RGB_EXT", 0x8591 }, |
{ "GL_OPERAND2_RGB_EXT", 0x8592 }, |
{ "GL_OPERAND0_ALPHA_EXT", 0x8598 }, |
{ "GL_OPERAND1_ALPHA_EXT", 0x8599 }, |
{ "GL_OPERAND2_ALPHA_EXT", 0x859A }, |
{ "GL_RGB_SCALE_EXT", 0x8573 }, |
{ "GL_ADD_SIGNED_EXT", 0x8574 }, |
{ "GL_INTERPOLATE_EXT", 0x8575 }, |
{ "GL_CONSTANT_EXT", 0x8576 }, |
{ "GL_PRIMARY_COLOR_EXT", 0x8577 }, |
{ "GL_PREVIOUS_EXT", 0x8578 }, |
/* GL_ARB_texture_env_combine */ |
{ "GL_SUBTRACT_ARB", 0x84E7 }, |
/* GL_EXT_texture_env_dot3 */ |
{ "GL_DOT3_RGB_EXT", 0x8740 }, |
{ "GL_DOT3_RGBA_EXT", 0x8741 }, |
/* GL_ARB_texture_env_dot3 */ |
{ "GL_DOT3_RGB_EXT", 0x86ae }, |
{ "GL_DOT3_RGBA_EXT", 0x86af }, |
/* GL_ARB_texture_border_clamp */ |
{ "GL_CLAMP_TO_BORDER_ARB", 0x812D }, |
}; |
#define Elements(x) sizeof(x)/sizeof(*x) |
typedef int (GLWINAPIV *cfunc)(const void *, const void *); |
static enum_elt **index1 = 0; |
static int sorted = 0; |
static int compar_name( const enum_elt *a, const enum_elt *b ) |
{ |
return _mesa_strcmp(a->c, b->c); |
} |
/* note the extra level of indirection |
*/ |
static int compar_nr( const enum_elt **a, const enum_elt **b ) |
{ |
return (*a)->n - (*b)->n; |
} |
static void sort_enums( void ) |
{ |
GLuint i; |
index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) ); |
sorted = 1; |
if (!index1) |
return; /* what else can we do? */ |
qsort( all_enums, Elements(all_enums), sizeof(*all_enums), |
(cfunc) compar_name ); |
for (i = 0 ; i < Elements(all_enums) ; i++) |
index1[i] = &all_enums[i]; |
qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr ); |
} |
int _mesa_lookup_enum_by_name( const char *symbol ) |
{ |
enum_elt tmp; |
enum_elt *e; |
if (!sorted) |
sort_enums(); |
if (!symbol) |
return 0; |
tmp.c = symbol; |
e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums), |
sizeof(*all_enums), (cfunc) compar_name ); |
return e ? e->n : -1; |
} |
static char token_tmp[20]; |
const char *_mesa_lookup_enum_by_nr( int nr ) |
{ |
enum_elt tmp, *e, **f; |
if (!sorted) |
sort_enums(); |
tmp.n = nr; |
e = &tmp; |
f = (enum_elt **)bsearch( &e, index1, Elements(all_enums), |
sizeof(*index1), (cfunc) compar_nr ); |
if (f) { |
return (*f)->c; |
} |
else { |
/* this isn't re-entrant safe, no big deal here */ |
_mesa_sprintf(token_tmp, "0x%x", nr); |
return token_tmp; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/accum.c |
---|
0,0 → 1,88 |
/* $Id: accum.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "accum.h" |
#include "context.h" |
#include "imports.h" |
#include "macros.h" |
#include "state.h" |
#include "mtypes.h" |
void |
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) |
{ |
GLfloat tmp[4]; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
tmp[0] = CLAMP( red, -1.0F, 1.0F ); |
tmp[1] = CLAMP( green, -1.0F, 1.0F ); |
tmp[2] = CLAMP( blue, -1.0F, 1.0F ); |
tmp[3] = CLAMP( alpha, -1.0F, 1.0F ); |
if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor)) |
return; |
FLUSH_VERTICES(ctx, _NEW_ACCUM); |
COPY_4FV( ctx->Accum.ClearColor, tmp ); |
} |
/* Should really be a driver-supplied function? |
*/ |
void |
_mesa_Accum( GLenum op, GLfloat value ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint xpos, ypos, width, height; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->Visual.accumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glAccum"); |
return; |
} |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
/* Determine region to operate upon. */ |
if (ctx->Scissor.Enabled) { |
xpos = ctx->Scissor.X; |
ypos = ctx->Scissor.Y; |
width = ctx->Scissor.Width; |
height = ctx->Scissor.Height; |
} |
else { |
/* whole window */ |
xpos = 0; |
ypos = 0; |
width = ctx->DrawBuffer->Width; |
height = ctx->DrawBuffer->Height; |
} |
ctx->Driver.Accum( ctx, op, value, xpos, ypos, width, height ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/vtxfmt.c |
---|
0,0 → 1,177 |
/* $Id: vtxfmt.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
* Gareth Hughes |
*/ |
#include "glheader.h" |
#include "api_loopback.h" |
#include "context.h" |
#include "imports.h" |
#include "mtypes.h" |
#include "state.h" |
#include "vtxfmt.h" |
/* The neutral vertex format. This wraps all tnl module functions, |
* verifying that the currently-installed module is valid and then |
* installing the function pointers in a lazy fashion. It records the |
* function pointers that have been swapped out, which allows a fast |
* restoration of the neutral module in almost all cases -- a typical |
* app might only require 4-6 functions to be modified from the neutral |
* baseline, and only restoring these is certainly preferable to doing |
* the entire module's 60 or so function pointers. |
*/ |
#define PRE_LOOPBACK( FUNC ) \ |
{ \ |
GET_CURRENT_CONTEXT(ctx); \ |
struct gl_tnl_module *tnl = &(ctx->TnlModule); \ |
\ |
ASSERT( tnl->Current ); \ |
ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ |
\ |
/* Save the swapped function's dispatch entry so it can be */ \ |
/* restored later. */ \ |
tnl->Swapped[tnl->SwapCount][0] = (void *)&(ctx->Exec->FUNC); \ |
tnl->Swapped[tnl->SwapCount][1] = (void *)TAG(FUNC); \ |
tnl->SwapCount++; \ |
\ |
if ( 0 ) \ |
_mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ |
\ |
/* Install the tnl function pointer. */ \ |
ctx->Exec->FUNC = tnl->Current->FUNC; \ |
} |
#define TAG(x) neutral_##x |
#include "vtxfmt_tmp.h" |
static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt ) |
{ |
tab->ArrayElement = vfmt->ArrayElement; |
tab->Color3f = vfmt->Color3f; |
tab->Color3fv = vfmt->Color3fv; |
tab->Color3ub = vfmt->Color3ub; |
tab->Color3ubv = vfmt->Color3ubv; |
tab->Color4f = vfmt->Color4f; |
tab->Color4fv = vfmt->Color4fv; |
tab->Color4ub = vfmt->Color4ub; |
tab->Color4ubv = vfmt->Color4ubv; |
tab->EdgeFlag = vfmt->EdgeFlag; |
tab->EdgeFlagv = vfmt->EdgeFlagv; |
tab->EvalCoord1f = vfmt->EvalCoord1f; |
tab->EvalCoord1fv = vfmt->EvalCoord1fv; |
tab->EvalCoord2f = vfmt->EvalCoord2f; |
tab->EvalCoord2fv = vfmt->EvalCoord2fv; |
tab->EvalPoint1 = vfmt->EvalPoint1; |
tab->EvalPoint2 = vfmt->EvalPoint2; |
tab->FogCoordfEXT = vfmt->FogCoordfEXT; |
tab->FogCoordfvEXT = vfmt->FogCoordfvEXT; |
tab->Indexi = vfmt->Indexi; |
tab->Indexiv = vfmt->Indexiv; |
tab->Materialfv = vfmt->Materialfv; |
tab->MultiTexCoord1fARB = vfmt->MultiTexCoord1fARB; |
tab->MultiTexCoord1fvARB = vfmt->MultiTexCoord1fvARB; |
tab->MultiTexCoord2fARB = vfmt->MultiTexCoord2fARB; |
tab->MultiTexCoord2fvARB = vfmt->MultiTexCoord2fvARB; |
tab->MultiTexCoord3fARB = vfmt->MultiTexCoord3fARB; |
tab->MultiTexCoord3fvARB = vfmt->MultiTexCoord3fvARB; |
tab->MultiTexCoord4fARB = vfmt->MultiTexCoord4fARB; |
tab->MultiTexCoord4fvARB = vfmt->MultiTexCoord4fvARB; |
tab->Normal3f = vfmt->Normal3f; |
tab->Normal3fv = vfmt->Normal3fv; |
tab->SecondaryColor3fEXT = vfmt->SecondaryColor3fEXT; |
tab->SecondaryColor3fvEXT = vfmt->SecondaryColor3fvEXT; |
tab->SecondaryColor3ubEXT = vfmt->SecondaryColor3ubEXT; |
tab->SecondaryColor3ubvEXT = vfmt->SecondaryColor3ubvEXT; |
tab->TexCoord1f = vfmt->TexCoord1f; |
tab->TexCoord1fv = vfmt->TexCoord1fv; |
tab->TexCoord2f = vfmt->TexCoord2f; |
tab->TexCoord2fv = vfmt->TexCoord2fv; |
tab->TexCoord3f = vfmt->TexCoord3f; |
tab->TexCoord3fv = vfmt->TexCoord3fv; |
tab->TexCoord4f = vfmt->TexCoord4f; |
tab->TexCoord4fv = vfmt->TexCoord4fv; |
tab->Vertex2f = vfmt->Vertex2f; |
tab->Vertex2fv = vfmt->Vertex2fv; |
tab->Vertex3f = vfmt->Vertex3f; |
tab->Vertex3fv = vfmt->Vertex3fv; |
tab->Vertex4f = vfmt->Vertex4f; |
tab->Vertex4fv = vfmt->Vertex4fv; |
tab->CallList = vfmt->CallList; |
tab->Begin = vfmt->Begin; |
tab->End = vfmt->End; |
tab->VertexAttrib4fNV = vfmt->VertexAttrib4fNV; |
tab->Rectf = vfmt->Rectf; |
tab->DrawArrays = vfmt->DrawArrays; |
tab->DrawElements = vfmt->DrawElements; |
tab->DrawRangeElements = vfmt->DrawRangeElements; |
tab->EvalMesh1 = vfmt->EvalMesh1; |
tab->EvalMesh2 = vfmt->EvalMesh2; |
assert(tab->EvalMesh2); |
} |
void _mesa_init_exec_vtxfmt( GLcontext *ctx ) |
{ |
install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); |
ctx->TnlModule.SwapCount = 0; |
} |
void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt ) |
{ |
ctx->TnlModule.Current = vfmt; |
_mesa_restore_exec_vtxfmt( ctx ); |
if ( ctx->ExecPrefersFloat != vfmt->prefer_float_colors ) |
_mesa_loopback_prefer_float( ctx->Exec, vfmt->prefer_float_colors ); |
} |
void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt ) |
{ |
install_vtxfmt( ctx->Save, vfmt ); |
if ( ctx->SavePrefersFloat != vfmt->prefer_float_colors ) |
_mesa_loopback_prefer_float( ctx->Save, vfmt->prefer_float_colors ); |
} |
void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) |
{ |
struct gl_tnl_module *tnl = &(ctx->TnlModule); |
GLuint i; |
/* Restore the neutral tnl module wrapper. |
*/ |
for ( i = 0 ; i < tnl->SwapCount ; i++ ) { |
*(void **)tnl->Swapped[i][0] = tnl->Swapped[i][1]; |
} |
tnl->SwapCount = 0; |
} |
/shark/tags/rel_0_4/ports/mesa/src/hash.h |
---|
0,0 → 1,59 |
/* $Id: hash.h,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef HASH_H |
#define HASH_H |
#include "glheader.h" |
/** |
* Opaque hash table type. |
*/ |
struct HashTable; |
extern struct _mesa_HashTable *_mesa_NewHashTable(void); |
extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table); |
extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key); |
extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data); |
extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key); |
extern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table); |
extern void _mesa_HashPrint(const struct _mesa_HashTable *table); |
extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/blend.h |
---|
0,0 → 1,68 |
/* $Id: blend.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef BLEND_H |
#define BLEND_H |
#include "mtypes.h" |
extern void |
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); |
extern void |
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, |
GLenum sfactorA, GLenum dfactorA ); |
extern void |
_mesa_BlendEquation( GLenum mode ); |
extern void |
_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
extern void |
_mesa_AlphaFunc( GLenum func, GLclampf ref ); |
extern void |
_mesa_LogicOp( GLenum opcode ); |
extern void |
_mesa_IndexMask( GLuint mask ); |
extern void |
_mesa_ColorMask( GLboolean red, GLboolean green, |
GLboolean blue, GLboolean alpha ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glthread.c |
---|
0,0 → 1,368 |
/* $Id: glthread.c,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* XXX There's probably some work to do in order to make this file |
* truly reusable outside of Mesa. First, the glheader.h include must go. |
*/ |
#include "glheader.h" |
#include "glthread.h" |
/* |
* This file should still compile even when THREADS is not defined. |
* This is to make things easier to deal with on the makefile scene.. |
*/ |
#ifdef THREADS |
#include <errno.h> |
/* |
* Error messages |
*/ |
#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" |
#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" |
#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" |
/* |
* Magic number to determine if a TSD object has been initialized. |
* Kind of a hack but there doesn't appear to be a better cross-platform |
* solution. |
*/ |
#define INIT_MAGIC 0xff8adc98 |
/* |
* POSIX Threads -- The best way to go if your platform supports them. |
* Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly |
* has them, and many of the free Unixes now have them. |
* Be sure to use appropriate -mt or -D_REENTRANT type |
* compile flags when building. |
*/ |
#ifdef PTHREADS |
unsigned long |
_glthread_GetID(void) |
{ |
return (unsigned long) pthread_self(); |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { |
perror(INIT_TSD_ERROR); |
exit(-1); |
} |
tsd->initMagic = INIT_MAGIC; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
if (tsd->initMagic != (int) INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
return pthread_getspecific(tsd->key); |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
if (tsd->initMagic != (int) INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
if (pthread_setspecific(tsd->key, ptr) != 0) { |
perror(SET_TSD_ERROR); |
exit(-1); |
} |
} |
#endif /* PTHREADS */ |
/* |
* Solaris/Unix International Threads -- Use only if POSIX threads |
* aren't available on your Unix platform. Solaris 2.[34] are examples |
* of platforms where this is the case. Be sure to use -mt and/or |
* -D_REENTRANT when compiling. |
*/ |
#ifdef SOLARIS_THREADS |
#define USE_LOCK_FOR_KEY /* undef this to try a version without |
lock for the global key... */ |
unsigned long |
_glthread_GetID(void) |
{ |
abort(); /* XXX not implemented yet */ |
return (unsigned long) 0; |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
if ((errno = mutex_init(&tsd->keylock, 0, NULL)) != 0 || |
(errno = thr_keycreate(&(tsd->key), free)) != 0) { |
perror(INIT_TSD_ERROR); |
exit(-1); |
} |
tsd->initMagic = INIT_MAGIC; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
void* ret; |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
#ifdef USE_LOCK_FOR_KEY |
mutex_lock(&tsd->keylock); |
thr_getspecific(tsd->key, &ret); |
mutex_unlock(&tsd->keylock); |
#else |
if ((errno = thr_getspecific(tsd->key, &ret)) != 0) { |
perror(GET_TSD_ERROR); |
exit(-1); |
} |
#endif |
return ret; |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
if ((errno = thr_setspecific(tsd->key, ptr)) != 0) { |
perror(SET_TSD_ERROR); |
exit(-1); |
} |
} |
#undef USE_LOCK_FOR_KEY |
#endif /* SOLARIS_THREADS */ |
/* |
* Win32 Threads. The only available option for Windows 95/NT. |
* Be sure that you compile using the Multithreaded runtime, otherwise |
* bad things will happen. |
*/ |
#ifdef WIN32_THREADS |
unsigned long |
_glthread_GetID(void) |
{ |
abort(); /* XXX not implemented yet */ |
return (unsigned long) 0; |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
tsd->key = TlsAlloc(); |
if (tsd->key == 0xffffffff) { |
/* Can Windows handle stderr messages for non-console |
applications? Does Windows have perror? */ |
/* perror(SET_INIT_ERROR);*/ |
exit(-1); |
} |
tsd->initMagic = INIT_MAGIC; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
return TlsGetValue(tsd->key); |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
/* the following code assumes that the _glthread_TSD has been initialized |
to zero at creation */ |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
if (TlsSetValue(tsd->key, ptr) == 0) { |
/* Can Windows handle stderr messages for non-console |
applications? Does Windows have perror? */ |
/* perror(SET_TSD_ERROR);*/ |
exit(-1); |
} |
} |
#endif /* WIN32_THREADS */ |
/* |
* XFree86 has its own thread wrapper, Xthreads.h |
* We wrap it again for GL. |
*/ |
#ifdef XTHREADS |
unsigned long |
_glthread_GetID(void) |
{ |
return (unsigned long) xthread_self(); |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
if (xthread_key_create(&tsd->key, NULL) != 0) { |
perror(INIT_TSD_ERROR); |
exit(-1); |
} |
tsd->initMagic = INIT_MAGIC; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
void *ptr; |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
xthread_get_specific(tsd->key, &ptr); |
return ptr; |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
if (tsd->initMagic != INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
xthread_set_specific(tsd->key, ptr); |
} |
#endif /* XTHREAD */ |
/* |
* BeOS threads |
*/ |
#ifdef BEOS_THREADS |
unsigned long |
_glthread_GetID(void) |
{ |
return (unsigned long) find_thread(NULL); |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
tsd->key = tls_allocate(); |
tsd->initMagic = INIT_MAGIC; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
if (tsd->initMagic != (int) INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
return tls_get(tsd->key); |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
if (tsd->initMagic != (int) INIT_MAGIC) { |
_glthread_InitTSD(tsd); |
} |
tls_set(tsd->key, ptr); |
} |
#endif /* BEOS_THREADS */ |
#else /* THREADS */ |
/* |
* no-op functions |
*/ |
unsigned long |
_glthread_GetID(void) |
{ |
return 0; |
} |
void |
_glthread_InitTSD(_glthread_TSD *tsd) |
{ |
(void) tsd; |
} |
void * |
_glthread_GetTSD(_glthread_TSD *tsd) |
{ |
(void) tsd; |
return NULL; |
} |
void |
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) |
{ |
(void) tsd; |
(void) ptr; |
} |
#endif /* THREADS */ |
/shark/tags/rel_0_4/ports/mesa/src/attrib.h |
---|
0,0 → 1,47 |
/* $Id: attrib.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef ATTRIB_H |
#define ATTRIB_h |
#include "mtypes.h" |
extern void |
_mesa_PushAttrib( GLbitfield mask ); |
extern void |
_mesa_PopAttrib( void ); |
extern void |
_mesa_PushClientAttrib( GLbitfield mask ); |
extern void |
_mesa_PopClientAttrib( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/debug.h |
---|
0,0 → 1,34 |
/* $Id: debug.h,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _DEBUG_H |
#define _DEBUG_H |
void _mesa_print_tri_caps( const char *name, GLuint flags ); |
void _mesa_print_enable_flags( const char *msg, GLuint flags ); |
void _mesa_print_state( const char *msg, GLuint state ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glapioffsets.h |
---|
0,0 → 1,660 |
/* DO NOT EDIT - This file generated automatically by gloffsets.py script */ |
#ifndef _GLAPI_OFFSETS_H_ |
#define _GLAPI_OFFSETS_H_ |
#define _gloffset_NewList 0 |
#define _gloffset_EndList 1 |
#define _gloffset_CallList 2 |
#define _gloffset_CallLists 3 |
#define _gloffset_DeleteLists 4 |
#define _gloffset_GenLists 5 |
#define _gloffset_ListBase 6 |
#define _gloffset_Begin 7 |
#define _gloffset_Bitmap 8 |
#define _gloffset_Color3b 9 |
#define _gloffset_Color3bv 10 |
#define _gloffset_Color3d 11 |
#define _gloffset_Color3dv 12 |
#define _gloffset_Color3f 13 |
#define _gloffset_Color3fv 14 |
#define _gloffset_Color3i 15 |
#define _gloffset_Color3iv 16 |
#define _gloffset_Color3s 17 |
#define _gloffset_Color3sv 18 |
#define _gloffset_Color3ub 19 |
#define _gloffset_Color3ubv 20 |
#define _gloffset_Color3ui 21 |
#define _gloffset_Color3uiv 22 |
#define _gloffset_Color3us 23 |
#define _gloffset_Color3usv 24 |
#define _gloffset_Color4b 25 |
#define _gloffset_Color4bv 26 |
#define _gloffset_Color4d 27 |
#define _gloffset_Color4dv 28 |
#define _gloffset_Color4f 29 |
#define _gloffset_Color4fv 30 |
#define _gloffset_Color4i 31 |
#define _gloffset_Color4iv 32 |
#define _gloffset_Color4s 33 |
#define _gloffset_Color4sv 34 |
#define _gloffset_Color4ub 35 |
#define _gloffset_Color4ubv 36 |
#define _gloffset_Color4ui 37 |
#define _gloffset_Color4uiv 38 |
#define _gloffset_Color4us 39 |
#define _gloffset_Color4usv 40 |
#define _gloffset_EdgeFlag 41 |
#define _gloffset_EdgeFlagv 42 |
#define _gloffset_End 43 |
#define _gloffset_Indexd 44 |
#define _gloffset_Indexdv 45 |
#define _gloffset_Indexf 46 |
#define _gloffset_Indexfv 47 |
#define _gloffset_Indexi 48 |
#define _gloffset_Indexiv 49 |
#define _gloffset_Indexs 50 |
#define _gloffset_Indexsv 51 |
#define _gloffset_Normal3b 52 |
#define _gloffset_Normal3bv 53 |
#define _gloffset_Normal3d 54 |
#define _gloffset_Normal3dv 55 |
#define _gloffset_Normal3f 56 |
#define _gloffset_Normal3fv 57 |
#define _gloffset_Normal3i 58 |
#define _gloffset_Normal3iv 59 |
#define _gloffset_Normal3s 60 |
#define _gloffset_Normal3sv 61 |
#define _gloffset_RasterPos2d 62 |
#define _gloffset_RasterPos2dv 63 |
#define _gloffset_RasterPos2f 64 |
#define _gloffset_RasterPos2fv 65 |
#define _gloffset_RasterPos2i 66 |
#define _gloffset_RasterPos2iv 67 |
#define _gloffset_RasterPos2s 68 |
#define _gloffset_RasterPos2sv 69 |
#define _gloffset_RasterPos3d 70 |
#define _gloffset_RasterPos3dv 71 |
#define _gloffset_RasterPos3f 72 |
#define _gloffset_RasterPos3fv 73 |
#define _gloffset_RasterPos3i 74 |
#define _gloffset_RasterPos3iv 75 |
#define _gloffset_RasterPos3s 76 |
#define _gloffset_RasterPos3sv 77 |
#define _gloffset_RasterPos4d 78 |
#define _gloffset_RasterPos4dv 79 |
#define _gloffset_RasterPos4f 80 |
#define _gloffset_RasterPos4fv 81 |
#define _gloffset_RasterPos4i 82 |
#define _gloffset_RasterPos4iv 83 |
#define _gloffset_RasterPos4s 84 |
#define _gloffset_RasterPos4sv 85 |
#define _gloffset_Rectd 86 |
#define _gloffset_Rectdv 87 |
#define _gloffset_Rectf 88 |
#define _gloffset_Rectfv 89 |
#define _gloffset_Recti 90 |
#define _gloffset_Rectiv 91 |
#define _gloffset_Rects 92 |
#define _gloffset_Rectsv 93 |
#define _gloffset_TexCoord1d 94 |
#define _gloffset_TexCoord1dv 95 |
#define _gloffset_TexCoord1f 96 |
#define _gloffset_TexCoord1fv 97 |
#define _gloffset_TexCoord1i 98 |
#define _gloffset_TexCoord1iv 99 |
#define _gloffset_TexCoord1s 100 |
#define _gloffset_TexCoord1sv 101 |
#define _gloffset_TexCoord2d 102 |
#define _gloffset_TexCoord2dv 103 |
#define _gloffset_TexCoord2f 104 |
#define _gloffset_TexCoord2fv 105 |
#define _gloffset_TexCoord2i 106 |
#define _gloffset_TexCoord2iv 107 |
#define _gloffset_TexCoord2s 108 |
#define _gloffset_TexCoord2sv 109 |
#define _gloffset_TexCoord3d 110 |
#define _gloffset_TexCoord3dv 111 |
#define _gloffset_TexCoord3f 112 |
#define _gloffset_TexCoord3fv 113 |
#define _gloffset_TexCoord3i 114 |
#define _gloffset_TexCoord3iv 115 |
#define _gloffset_TexCoord3s 116 |
#define _gloffset_TexCoord3sv 117 |
#define _gloffset_TexCoord4d 118 |
#define _gloffset_TexCoord4dv 119 |
#define _gloffset_TexCoord4f 120 |
#define _gloffset_TexCoord4fv 121 |
#define _gloffset_TexCoord4i 122 |
#define _gloffset_TexCoord4iv 123 |
#define _gloffset_TexCoord4s 124 |
#define _gloffset_TexCoord4sv 125 |
#define _gloffset_Vertex2d 126 |
#define _gloffset_Vertex2dv 127 |
#define _gloffset_Vertex2f 128 |
#define _gloffset_Vertex2fv 129 |
#define _gloffset_Vertex2i 130 |
#define _gloffset_Vertex2iv 131 |
#define _gloffset_Vertex2s 132 |
#define _gloffset_Vertex2sv 133 |
#define _gloffset_Vertex3d 134 |
#define _gloffset_Vertex3dv 135 |
#define _gloffset_Vertex3f 136 |
#define _gloffset_Vertex3fv 137 |
#define _gloffset_Vertex3i 138 |
#define _gloffset_Vertex3iv 139 |
#define _gloffset_Vertex3s 140 |
#define _gloffset_Vertex3sv 141 |
#define _gloffset_Vertex4d 142 |
#define _gloffset_Vertex4dv 143 |
#define _gloffset_Vertex4f 144 |
#define _gloffset_Vertex4fv 145 |
#define _gloffset_Vertex4i 146 |
#define _gloffset_Vertex4iv 147 |
#define _gloffset_Vertex4s 148 |
#define _gloffset_Vertex4sv 149 |
#define _gloffset_ClipPlane 150 |
#define _gloffset_ColorMaterial 151 |
#define _gloffset_CullFace 152 |
#define _gloffset_Fogf 153 |
#define _gloffset_Fogfv 154 |
#define _gloffset_Fogi 155 |
#define _gloffset_Fogiv 156 |
#define _gloffset_FrontFace 157 |
#define _gloffset_Hint 158 |
#define _gloffset_Lightf 159 |
#define _gloffset_Lightfv 160 |
#define _gloffset_Lighti 161 |
#define _gloffset_Lightiv 162 |
#define _gloffset_LightModelf 163 |
#define _gloffset_LightModelfv 164 |
#define _gloffset_LightModeli 165 |
#define _gloffset_LightModeliv 166 |
#define _gloffset_LineStipple 167 |
#define _gloffset_LineWidth 168 |
#define _gloffset_Materialf 169 |
#define _gloffset_Materialfv 170 |
#define _gloffset_Materiali 171 |
#define _gloffset_Materialiv 172 |
#define _gloffset_PointSize 173 |
#define _gloffset_PolygonMode 174 |
#define _gloffset_PolygonStipple 175 |
#define _gloffset_Scissor 176 |
#define _gloffset_ShadeModel 177 |
#define _gloffset_TexParameterf 178 |
#define _gloffset_TexParameterfv 179 |
#define _gloffset_TexParameteri 180 |
#define _gloffset_TexParameteriv 181 |
#define _gloffset_TexImage1D 182 |
#define _gloffset_TexImage2D 183 |
#define _gloffset_TexEnvf 184 |
#define _gloffset_TexEnvfv 185 |
#define _gloffset_TexEnvi 186 |
#define _gloffset_TexEnviv 187 |
#define _gloffset_TexGend 188 |
#define _gloffset_TexGendv 189 |
#define _gloffset_TexGenf 190 |
#define _gloffset_TexGenfv 191 |
#define _gloffset_TexGeni 192 |
#define _gloffset_TexGeniv 193 |
#define _gloffset_FeedbackBuffer 194 |
#define _gloffset_SelectBuffer 195 |
#define _gloffset_RenderMode 196 |
#define _gloffset_InitNames 197 |
#define _gloffset_LoadName 198 |
#define _gloffset_PassThrough 199 |
#define _gloffset_PopName 200 |
#define _gloffset_PushName 201 |
#define _gloffset_DrawBuffer 202 |
#define _gloffset_Clear 203 |
#define _gloffset_ClearAccum 204 |
#define _gloffset_ClearIndex 205 |
#define _gloffset_ClearColor 206 |
#define _gloffset_ClearStencil 207 |
#define _gloffset_ClearDepth 208 |
#define _gloffset_StencilMask 209 |
#define _gloffset_ColorMask 210 |
#define _gloffset_DepthMask 211 |
#define _gloffset_IndexMask 212 |
#define _gloffset_Accum 213 |
#define _gloffset_Disable 214 |
#define _gloffset_Enable 215 |
#define _gloffset_Finish 216 |
#define _gloffset_Flush 217 |
#define _gloffset_PopAttrib 218 |
#define _gloffset_PushAttrib 219 |
#define _gloffset_Map1d 220 |
#define _gloffset_Map1f 221 |
#define _gloffset_Map2d 222 |
#define _gloffset_Map2f 223 |
#define _gloffset_MapGrid1d 224 |
#define _gloffset_MapGrid1f 225 |
#define _gloffset_MapGrid2d 226 |
#define _gloffset_MapGrid2f 227 |
#define _gloffset_EvalCoord1d 228 |
#define _gloffset_EvalCoord1dv 229 |
#define _gloffset_EvalCoord1f 230 |
#define _gloffset_EvalCoord1fv 231 |
#define _gloffset_EvalCoord2d 232 |
#define _gloffset_EvalCoord2dv 233 |
#define _gloffset_EvalCoord2f 234 |
#define _gloffset_EvalCoord2fv 235 |
#define _gloffset_EvalMesh1 236 |
#define _gloffset_EvalPoint1 237 |
#define _gloffset_EvalMesh2 238 |
#define _gloffset_EvalPoint2 239 |
#define _gloffset_AlphaFunc 240 |
#define _gloffset_BlendFunc 241 |
#define _gloffset_LogicOp 242 |
#define _gloffset_StencilFunc 243 |
#define _gloffset_StencilOp 244 |
#define _gloffset_DepthFunc 245 |
#define _gloffset_PixelZoom 246 |
#define _gloffset_PixelTransferf 247 |
#define _gloffset_PixelTransferi 248 |
#define _gloffset_PixelStoref 249 |
#define _gloffset_PixelStorei 250 |
#define _gloffset_PixelMapfv 251 |
#define _gloffset_PixelMapuiv 252 |
#define _gloffset_PixelMapusv 253 |
#define _gloffset_ReadBuffer 254 |
#define _gloffset_CopyPixels 255 |
#define _gloffset_ReadPixels 256 |
#define _gloffset_DrawPixels 257 |
#define _gloffset_GetBooleanv 258 |
#define _gloffset_GetClipPlane 259 |
#define _gloffset_GetDoublev 260 |
#define _gloffset_GetError 261 |
#define _gloffset_GetFloatv 262 |
#define _gloffset_GetIntegerv 263 |
#define _gloffset_GetLightfv 264 |
#define _gloffset_GetLightiv 265 |
#define _gloffset_GetMapdv 266 |
#define _gloffset_GetMapfv 267 |
#define _gloffset_GetMapiv 268 |
#define _gloffset_GetMaterialfv 269 |
#define _gloffset_GetMaterialiv 270 |
#define _gloffset_GetPixelMapfv 271 |
#define _gloffset_GetPixelMapuiv 272 |
#define _gloffset_GetPixelMapusv 273 |
#define _gloffset_GetPolygonStipple 274 |
#define _gloffset_GetString 275 |
#define _gloffset_GetTexEnvfv 276 |
#define _gloffset_GetTexEnviv 277 |
#define _gloffset_GetTexGendv 278 |
#define _gloffset_GetTexGenfv 279 |
#define _gloffset_GetTexGeniv 280 |
#define _gloffset_GetTexImage 281 |
#define _gloffset_GetTexParameterfv 282 |
#define _gloffset_GetTexParameteriv 283 |
#define _gloffset_GetTexLevelParameterfv 284 |
#define _gloffset_GetTexLevelParameteriv 285 |
#define _gloffset_IsEnabled 286 |
#define _gloffset_IsList 287 |
#define _gloffset_DepthRange 288 |
#define _gloffset_Frustum 289 |
#define _gloffset_LoadIdentity 290 |
#define _gloffset_LoadMatrixf 291 |
#define _gloffset_LoadMatrixd 292 |
#define _gloffset_MatrixMode 293 |
#define _gloffset_MultMatrixf 294 |
#define _gloffset_MultMatrixd 295 |
#define _gloffset_Ortho 296 |
#define _gloffset_PopMatrix 297 |
#define _gloffset_PushMatrix 298 |
#define _gloffset_Rotated 299 |
#define _gloffset_Rotatef 300 |
#define _gloffset_Scaled 301 |
#define _gloffset_Scalef 302 |
#define _gloffset_Translated 303 |
#define _gloffset_Translatef 304 |
#define _gloffset_Viewport 305 |
#define _gloffset_ArrayElement 306 |
#define _gloffset_BindTexture 307 |
#define _gloffset_ColorPointer 308 |
#define _gloffset_DisableClientState 309 |
#define _gloffset_DrawArrays 310 |
#define _gloffset_DrawElements 311 |
#define _gloffset_EdgeFlagPointer 312 |
#define _gloffset_EnableClientState 313 |
#define _gloffset_IndexPointer 314 |
#define _gloffset_Indexub 315 |
#define _gloffset_Indexubv 316 |
#define _gloffset_InterleavedArrays 317 |
#define _gloffset_NormalPointer 318 |
#define _gloffset_PolygonOffset 319 |
#define _gloffset_TexCoordPointer 320 |
#define _gloffset_VertexPointer 321 |
#define _gloffset_AreTexturesResident 322 |
#define _gloffset_CopyTexImage1D 323 |
#define _gloffset_CopyTexImage2D 324 |
#define _gloffset_CopyTexSubImage1D 325 |
#define _gloffset_CopyTexSubImage2D 326 |
#define _gloffset_DeleteTextures 327 |
#define _gloffset_GenTextures 328 |
#define _gloffset_GetPointerv 329 |
#define _gloffset_IsTexture 330 |
#define _gloffset_PrioritizeTextures 331 |
#define _gloffset_TexSubImage1D 332 |
#define _gloffset_TexSubImage2D 333 |
#define _gloffset_PopClientAttrib 334 |
#define _gloffset_PushClientAttrib 335 |
#define _gloffset_BlendColor 336 |
#define _gloffset_BlendEquation 337 |
#define _gloffset_DrawRangeElements 338 |
#define _gloffset_ColorTable 339 |
#define _gloffset_ColorTableParameterfv 340 |
#define _gloffset_ColorTableParameteriv 341 |
#define _gloffset_CopyColorTable 342 |
#define _gloffset_GetColorTable 343 |
#define _gloffset_GetColorTableParameterfv 344 |
#define _gloffset_GetColorTableParameteriv 345 |
#define _gloffset_ColorSubTable 346 |
#define _gloffset_CopyColorSubTable 347 |
#define _gloffset_ConvolutionFilter1D 348 |
#define _gloffset_ConvolutionFilter2D 349 |
#define _gloffset_ConvolutionParameterf 350 |
#define _gloffset_ConvolutionParameterfv 351 |
#define _gloffset_ConvolutionParameteri 352 |
#define _gloffset_ConvolutionParameteriv 353 |
#define _gloffset_CopyConvolutionFilter1D 354 |
#define _gloffset_CopyConvolutionFilter2D 355 |
#define _gloffset_GetConvolutionFilter 356 |
#define _gloffset_GetConvolutionParameterfv 357 |
#define _gloffset_GetConvolutionParameteriv 358 |
#define _gloffset_GetSeparableFilter 359 |
#define _gloffset_SeparableFilter2D 360 |
#define _gloffset_GetHistogram 361 |
#define _gloffset_GetHistogramParameterfv 362 |
#define _gloffset_GetHistogramParameteriv 363 |
#define _gloffset_GetMinmax 364 |
#define _gloffset_GetMinmaxParameterfv 365 |
#define _gloffset_GetMinmaxParameteriv 366 |
#define _gloffset_Histogram 367 |
#define _gloffset_Minmax 368 |
#define _gloffset_ResetHistogram 369 |
#define _gloffset_ResetMinmax 370 |
#define _gloffset_TexImage3D 371 |
#define _gloffset_TexSubImage3D 372 |
#define _gloffset_CopyTexSubImage3D 373 |
#define _gloffset_ActiveTextureARB 374 |
#define _gloffset_ClientActiveTextureARB 375 |
#define _gloffset_MultiTexCoord1dARB 376 |
#define _gloffset_MultiTexCoord1dvARB 377 |
#define _gloffset_MultiTexCoord1fARB 378 |
#define _gloffset_MultiTexCoord1fvARB 379 |
#define _gloffset_MultiTexCoord1iARB 380 |
#define _gloffset_MultiTexCoord1ivARB 381 |
#define _gloffset_MultiTexCoord1sARB 382 |
#define _gloffset_MultiTexCoord1svARB 383 |
#define _gloffset_MultiTexCoord2dARB 384 |
#define _gloffset_MultiTexCoord2dvARB 385 |
#define _gloffset_MultiTexCoord2fARB 386 |
#define _gloffset_MultiTexCoord2fvARB 387 |
#define _gloffset_MultiTexCoord2iARB 388 |
#define _gloffset_MultiTexCoord2ivARB 389 |
#define _gloffset_MultiTexCoord2sARB 390 |
#define _gloffset_MultiTexCoord2svARB 391 |
#define _gloffset_MultiTexCoord3dARB 392 |
#define _gloffset_MultiTexCoord3dvARB 393 |
#define _gloffset_MultiTexCoord3fARB 394 |
#define _gloffset_MultiTexCoord3fvARB 395 |
#define _gloffset_MultiTexCoord3iARB 396 |
#define _gloffset_MultiTexCoord3ivARB 397 |
#define _gloffset_MultiTexCoord3sARB 398 |
#define _gloffset_MultiTexCoord3svARB 399 |
#define _gloffset_MultiTexCoord4dARB 400 |
#define _gloffset_MultiTexCoord4dvARB 401 |
#define _gloffset_MultiTexCoord4fARB 402 |
#define _gloffset_MultiTexCoord4fvARB 403 |
#define _gloffset_MultiTexCoord4iARB 404 |
#define _gloffset_MultiTexCoord4ivARB 405 |
#define _gloffset_MultiTexCoord4sARB 406 |
#define _gloffset_MultiTexCoord4svARB 407 |
#define _gloffset_LoadTransposeMatrixfARB 408 |
#define _gloffset_LoadTransposeMatrixdARB 409 |
#define _gloffset_MultTransposeMatrixfARB 410 |
#define _gloffset_MultTransposeMatrixdARB 411 |
#define _gloffset_SampleCoverageARB 412 |
#define _gloffset___unused413 413 |
#define _gloffset_PolygonOffsetEXT 414 |
#define _gloffset_GetTexFilterFuncSGIS 415 |
#define _gloffset_TexFilterFuncSGIS 416 |
#define _gloffset_GetHistogramEXT 417 |
#define _gloffset_GetHistogramParameterfvEXT 418 |
#define _gloffset_GetHistogramParameterivEXT 419 |
#define _gloffset_GetMinmaxEXT 420 |
#define _gloffset_GetMinmaxParameterfvEXT 421 |
#define _gloffset_GetMinmaxParameterivEXT 422 |
#define _gloffset_GetConvolutionFilterEXT 423 |
#define _gloffset_GetConvolutionParameterfvEXT 424 |
#define _gloffset_GetConvolutionParameterivEXT 425 |
#define _gloffset_GetSeparableFilterEXT 426 |
#define _gloffset_GetColorTableSGI 427 |
#define _gloffset_GetColorTableParameterfvSGI 428 |
#define _gloffset_GetColorTableParameterivSGI 429 |
#define _gloffset_PixelTexGenSGIX 430 |
#define _gloffset_PixelTexGenParameteriSGIS 431 |
#define _gloffset_PixelTexGenParameterivSGIS 432 |
#define _gloffset_PixelTexGenParameterfSGIS 433 |
#define _gloffset_PixelTexGenParameterfvSGIS 434 |
#define _gloffset_GetPixelTexGenParameterivSGIS 435 |
#define _gloffset_GetPixelTexGenParameterfvSGIS 436 |
#define _gloffset_TexImage4DSGIS 437 |
#define _gloffset_TexSubImage4DSGIS 438 |
#define _gloffset_AreTexturesResidentEXT 439 |
#define _gloffset_GenTexturesEXT 440 |
#define _gloffset_IsTextureEXT 441 |
#define _gloffset_DetailTexFuncSGIS 442 |
#define _gloffset_GetDetailTexFuncSGIS 443 |
#define _gloffset_SharpenTexFuncSGIS 444 |
#define _gloffset_GetSharpenTexFuncSGIS 445 |
#define _gloffset_SampleMaskSGIS 446 |
#define _gloffset_SamplePatternSGIS 447 |
#define _gloffset_ColorPointerEXT 448 |
#define _gloffset_EdgeFlagPointerEXT 449 |
#define _gloffset_IndexPointerEXT 450 |
#define _gloffset_NormalPointerEXT 451 |
#define _gloffset_TexCoordPointerEXT 452 |
#define _gloffset_VertexPointerEXT 453 |
#define _gloffset_SpriteParameterfSGIX 454 |
#define _gloffset_SpriteParameterfvSGIX 455 |
#define _gloffset_SpriteParameteriSGIX 456 |
#define _gloffset_SpriteParameterivSGIX 457 |
#define _gloffset_PointParameterfEXT 458 |
#define _gloffset_PointParameterfvEXT 459 |
#define _gloffset_GetInstrumentsSGIX 460 |
#define _gloffset_InstrumentsBufferSGIX 461 |
#define _gloffset_PollInstrumentsSGIX 462 |
#define _gloffset_ReadInstrumentsSGIX 463 |
#define _gloffset_StartInstrumentsSGIX 464 |
#define _gloffset_StopInstrumentsSGIX 465 |
#define _gloffset_FrameZoomSGIX 466 |
#define _gloffset_TagSampleBufferSGIX 467 |
#define _gloffset_ReferencePlaneSGIX 468 |
#define _gloffset_FlushRasterSGIX 469 |
#define _gloffset_GetListParameterfvSGIX 470 |
#define _gloffset_GetListParameterivSGIX 471 |
#define _gloffset_ListParameterfSGIX 472 |
#define _gloffset_ListParameterfvSGIX 473 |
#define _gloffset_ListParameteriSGIX 474 |
#define _gloffset_ListParameterivSGIX 475 |
#define _gloffset_FragmentColorMaterialSGIX 476 |
#define _gloffset_FragmentLightfSGIX 477 |
#define _gloffset_FragmentLightfvSGIX 478 |
#define _gloffset_FragmentLightiSGIX 479 |
#define _gloffset_FragmentLightivSGIX 480 |
#define _gloffset_FragmentLightModelfSGIX 481 |
#define _gloffset_FragmentLightModelfvSGIX 482 |
#define _gloffset_FragmentLightModeliSGIX 483 |
#define _gloffset_FragmentLightModelivSGIX 484 |
#define _gloffset_FragmentMaterialfSGIX 485 |
#define _gloffset_FragmentMaterialfvSGIX 486 |
#define _gloffset_FragmentMaterialiSGIX 487 |
#define _gloffset_FragmentMaterialivSGIX 488 |
#define _gloffset_GetFragmentLightfvSGIX 489 |
#define _gloffset_GetFragmentLightivSGIX 490 |
#define _gloffset_GetFragmentMaterialfvSGIX 491 |
#define _gloffset_GetFragmentMaterialivSGIX 492 |
#define _gloffset_LightEnviSGIX 493 |
#define _gloffset_VertexWeightfEXT 494 |
#define _gloffset_VertexWeightfvEXT 495 |
#define _gloffset_VertexWeightPointerEXT 496 |
#define _gloffset_FlushVertexArrayRangeNV 497 |
#define _gloffset_VertexArrayRangeNV 498 |
#define _gloffset_CombinerParameterfvNV 499 |
#define _gloffset_CombinerParameterfNV 500 |
#define _gloffset_CombinerParameterivNV 501 |
#define _gloffset_CombinerParameteriNV 502 |
#define _gloffset_CombinerInputNV 503 |
#define _gloffset_CombinerOutputNV 504 |
#define _gloffset_FinalCombinerInputNV 505 |
#define _gloffset_GetCombinerInputParameterfvNV 506 |
#define _gloffset_GetCombinerInputParameterivNV 507 |
#define _gloffset_GetCombinerOutputParameterfvNV 508 |
#define _gloffset_GetCombinerOutputParameterivNV 509 |
#define _gloffset_GetFinalCombinerInputParameterfvNV 510 |
#define _gloffset_GetFinalCombinerInputParameterivNV 511 |
#define _gloffset_ResizeBuffersMESA 512 |
#define _gloffset_WindowPos2dMESA 513 |
#define _gloffset_WindowPos2dvMESA 514 |
#define _gloffset_WindowPos2fMESA 515 |
#define _gloffset_WindowPos2fvMESA 516 |
#define _gloffset_WindowPos2iMESA 517 |
#define _gloffset_WindowPos2ivMESA 518 |
#define _gloffset_WindowPos2sMESA 519 |
#define _gloffset_WindowPos2svMESA 520 |
#define _gloffset_WindowPos3dMESA 521 |
#define _gloffset_WindowPos3dvMESA 522 |
#define _gloffset_WindowPos3fMESA 523 |
#define _gloffset_WindowPos3fvMESA 524 |
#define _gloffset_WindowPos3iMESA 525 |
#define _gloffset_WindowPos3ivMESA 526 |
#define _gloffset_WindowPos3sMESA 527 |
#define _gloffset_WindowPos3svMESA 528 |
#define _gloffset_WindowPos4dMESA 529 |
#define _gloffset_WindowPos4dvMESA 530 |
#define _gloffset_WindowPos4fMESA 531 |
#define _gloffset_WindowPos4fvMESA 532 |
#define _gloffset_WindowPos4iMESA 533 |
#define _gloffset_WindowPos4ivMESA 534 |
#define _gloffset_WindowPos4sMESA 535 |
#define _gloffset_WindowPos4svMESA 536 |
#define _gloffset_BlendFuncSeparateEXT 537 |
#define _gloffset_IndexMaterialEXT 538 |
#define _gloffset_IndexFuncEXT 539 |
#define _gloffset_LockArraysEXT 540 |
#define _gloffset_UnlockArraysEXT 541 |
#define _gloffset_CullParameterdvEXT 542 |
#define _gloffset_CullParameterfvEXT 543 |
#define _gloffset_HintPGI 544 |
#define _gloffset_FogCoordfEXT 545 |
#define _gloffset_FogCoordfvEXT 546 |
#define _gloffset_FogCoorddEXT 547 |
#define _gloffset_FogCoorddvEXT 548 |
#define _gloffset_FogCoordPointerEXT 549 |
#define _gloffset_GetColorTableEXT 550 |
#define _gloffset_GetColorTableParameterivEXT 551 |
#define _gloffset_GetColorTableParameterfvEXT 552 |
#define _gloffset_TbufferMask3DFX 553 |
#define _gloffset_CompressedTexImage3DARB 554 |
#define _gloffset_CompressedTexImage2DARB 555 |
#define _gloffset_CompressedTexImage1DARB 556 |
#define _gloffset_CompressedTexSubImage3DARB 557 |
#define _gloffset_CompressedTexSubImage2DARB 558 |
#define _gloffset_CompressedTexSubImage1DARB 559 |
#define _gloffset_GetCompressedTexImageARB 560 |
#define _gloffset_SecondaryColor3bEXT 561 |
#define _gloffset_SecondaryColor3bvEXT 562 |
#define _gloffset_SecondaryColor3dEXT 563 |
#define _gloffset_SecondaryColor3dvEXT 564 |
#define _gloffset_SecondaryColor3fEXT 565 |
#define _gloffset_SecondaryColor3fvEXT 566 |
#define _gloffset_SecondaryColor3iEXT 567 |
#define _gloffset_SecondaryColor3ivEXT 568 |
#define _gloffset_SecondaryColor3sEXT 569 |
#define _gloffset_SecondaryColor3svEXT 570 |
#define _gloffset_SecondaryColor3ubEXT 571 |
#define _gloffset_SecondaryColor3ubvEXT 572 |
#define _gloffset_SecondaryColor3uiEXT 573 |
#define _gloffset_SecondaryColor3uivEXT 574 |
#define _gloffset_SecondaryColor3usEXT 575 |
#define _gloffset_SecondaryColor3usvEXT 576 |
#define _gloffset_SecondaryColorPointerEXT 577 |
#define _gloffset_AreProgramsResidentNV 578 |
#define _gloffset_BindProgramNV 579 |
#define _gloffset_DeleteProgramsNV 580 |
#define _gloffset_ExecuteProgramNV 581 |
#define _gloffset_GenProgramsNV 582 |
#define _gloffset_GetProgramParameterdvNV 583 |
#define _gloffset_GetProgramParameterfvNV 584 |
#define _gloffset_GetProgramivNV 585 |
#define _gloffset_GetProgramStringNV 586 |
#define _gloffset_GetTrackMatrixivNV 587 |
#define _gloffset_GetVertexAttribdvNV 588 |
#define _gloffset_GetVertexAttribfvNV 589 |
#define _gloffset_GetVertexAttribivNV 590 |
#define _gloffset_GetVertexAttribPointervNV 591 |
#define _gloffset_IsProgramNV 592 |
#define _gloffset_LoadProgramNV 593 |
#define _gloffset_ProgramParameter4dNV 594 |
#define _gloffset_ProgramParameter4dvNV 595 |
#define _gloffset_ProgramParameter4fNV 596 |
#define _gloffset_ProgramParameter4fvNV 597 |
#define _gloffset_ProgramParameters4dvNV 598 |
#define _gloffset_ProgramParameters4fvNV 599 |
#define _gloffset_RequestResidentProgramsNV 600 |
#define _gloffset_TrackMatrixNV 601 |
#define _gloffset_VertexAttribPointerNV 602 |
#define _gloffset_VertexAttrib1dNV 603 |
#define _gloffset_VertexAttrib1dvNV 604 |
#define _gloffset_VertexAttrib1fNV 605 |
#define _gloffset_VertexAttrib1fvNV 606 |
#define _gloffset_VertexAttrib1sNV 607 |
#define _gloffset_VertexAttrib1svNV 608 |
#define _gloffset_VertexAttrib2dNV 609 |
#define _gloffset_VertexAttrib2dvNV 610 |
#define _gloffset_VertexAttrib2fNV 611 |
#define _gloffset_VertexAttrib2fvNV 612 |
#define _gloffset_VertexAttrib2sNV 613 |
#define _gloffset_VertexAttrib2svNV 614 |
#define _gloffset_VertexAttrib3dNV 615 |
#define _gloffset_VertexAttrib3dvNV 616 |
#define _gloffset_VertexAttrib3fNV 617 |
#define _gloffset_VertexAttrib3fvNV 618 |
#define _gloffset_VertexAttrib3sNV 619 |
#define _gloffset_VertexAttrib3svNV 620 |
#define _gloffset_VertexAttrib4dNV 621 |
#define _gloffset_VertexAttrib4dvNV 622 |
#define _gloffset_VertexAttrib4fNV 623 |
#define _gloffset_VertexAttrib4fvNV 624 |
#define _gloffset_VertexAttrib4sNV 625 |
#define _gloffset_VertexAttrib4svNV 626 |
#define _gloffset_VertexAttrib4ubNV 627 |
#define _gloffset_VertexAttrib4ubvNV 628 |
#define _gloffset_VertexAttribs1dvNV 629 |
#define _gloffset_VertexAttribs1fvNV 630 |
#define _gloffset_VertexAttribs1svNV 631 |
#define _gloffset_VertexAttribs2dvNV 632 |
#define _gloffset_VertexAttribs2fvNV 633 |
#define _gloffset_VertexAttribs2svNV 634 |
#define _gloffset_VertexAttribs3dvNV 635 |
#define _gloffset_VertexAttribs3fvNV 636 |
#define _gloffset_VertexAttribs3svNV 637 |
#define _gloffset_VertexAttribs4dvNV 638 |
#define _gloffset_VertexAttribs4fvNV 639 |
#define _gloffset_VertexAttribs4svNV 640 |
#define _gloffset_VertexAttribs4ubvNV 641 |
#define _gloffset_PointParameteriNV 642 |
#define _gloffset_PointParameterivNV 643 |
#define _gloffset_MultiDrawArraysEXT 644 |
#define _gloffset_MultiDrawElementsEXT 645 |
#define _gloffset_ActiveStencilFaceEXT 646 |
#define _gloffset_DeleteFencesNV 647 |
#define _gloffset_GenFencesNV 648 |
#define _gloffset_IsFenceNV 649 |
#define _gloffset_TestFenceNV 650 |
#define _gloffset_GetFenceivNV 651 |
#define _gloffset_FinishFenceNV 652 |
#define _gloffset_SetFenceNV 653 |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/enums.h |
---|
0,0 → 1,34 |
/* $Id: enums.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _ENUMS_H_ |
#define _ENUMS_H_ |
extern const char *_mesa_lookup_enum_by_nr( int nr ); |
extern int _mesa_lookup_enum_by_name( const char *symbol ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/dd.h |
---|
0,0 → 1,700 |
/* $Id: dd.h,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef DD_INCLUDED |
#define DD_INCLUDED |
/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ |
struct gl_pixelstore_attrib; |
/* Mask bits sent to the driver Clear() function */ |
#define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */ |
#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */ |
#define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */ |
#define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */ |
#define DD_AUX0 AUX0_BIT /* future use */ |
#define DD_AUX1 AUX1_BIT /* future use */ |
#define DD_AUX2 AUX2_BIT /* future use */ |
#define DD_AUX3 AUX3_BIT /* future use */ |
#define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */ |
#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */ |
#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ |
/* |
* Device Driver function table. |
*/ |
struct dd_function_table { |
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. |
*/ |
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 |
* 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 |
* settings! |
* Software Mesa can do masked clears if the device driver can't. |
*/ |
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. |
*/ |
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. |
* Mesa uses this to determine when the driver's 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. |
*/ |
void (*Finish)( GLcontext *ctx ); |
/* |
* This is called whenever glFinish() 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 |
* the error value. |
*/ |
/*** |
*** For hardware accumulation buffer: |
***/ |
void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value, |
GLint xpos, GLint ypos, GLint width, GLint height ); |
/* Execute glAccum command within the given scissor region. |
*/ |
/*** |
*** glDraw/Read/CopyPixels and glBitmap functions: |
***/ |
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. |
*/ |
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. |
*/ |
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. |
*/ |
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: |
***/ |
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. |
*/ |
void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage ); |
void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage ); |
void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, |
GLint internalFormat, |
GLint width, GLint height, GLint depth, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels, |
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. |
*/ |
void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLsizei width, |
GLenum format, GLenum type, |
const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage ); |
void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels, |
const struct gl_pixelstore_attrib *packing, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage ); |
void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLint depth, |
GLenum format, GLenum type, |
const GLvoid *pixels, |
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. |
*/ |
void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, |
GLenum internalFormat, GLint x, GLint y, |
GLsizei width, GLint border ); |
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. |
* 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 ); |
void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, |
GLsizei width, GLsizei height ); |
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. |
*/ |
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. |
*/ |
/*** |
*** Compressed texture functions: |
***/ |
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 ); |
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 ); |
void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, |
GLint level, GLint internalFormat, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, |
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. |
*/ |
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); |
void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLint height, |
GLenum format, |
GLsizei imageSize, const GLvoid *data, |
struct gl_texture_object *texObj, |
struct gl_texture_image *texImage); |
void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLint height, GLint depth, |
GLenum format, |
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. |
*/ |
/*** |
*** Texture object functions: |
***/ |
void (*BindTexture)( GLcontext *ctx, GLenum target, |
struct gl_texture_object *tObj ); |
/* Called by glBindTexture(). |
*/ |
void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); |
/* Called when a texture object is created. |
*/ |
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. |
*/ |
GLboolean (*IsTextureResident)( GLcontext *ctx, |
struct gl_texture_object *t ); |
/* Called by glAreTextureResident(). |
*/ |
void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, |
GLclampf priority ); |
/* Called by glPrioritizeTextures(). |
*/ |
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 |
* is to be updated. |
*/ |
/*** |
*** Imaging functionality: |
***/ |
void (*CopyColorTable)( GLcontext *ctx, |
GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width ); |
void (*CopyColorSubTable)( GLcontext *ctx, |
GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width ); |
void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target, |
GLenum internalFormat, |
GLint x, GLint y, GLsizei width ); |
void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target, |
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. |
***/ |
void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); |
void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); |
void (*BlendEquation)(GLcontext *ctx, GLenum mode); |
void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor); |
void (*BlendFuncSeparate)(GLcontext *ctx, |
GLenum sfactorRGB, GLenum dfactorRGB, |
GLenum sfactorA, GLenum dfactorA); |
void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); |
void (*ClearDepth)(GLcontext *ctx, GLclampd d); |
void (*ClearIndex)(GLcontext *ctx, GLuint index); |
void (*ClearStencil)(GLcontext *ctx, GLint s); |
void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation ); |
void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, |
GLboolean bmask, GLboolean amask ); |
void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode); |
void (*CullFace)(GLcontext *ctx, GLenum mode); |
void (*FrontFace)(GLcontext *ctx, GLenum mode); |
void (*DepthFunc)(GLcontext *ctx, GLenum func); |
void (*DepthMask)(GLcontext *ctx, GLboolean flag); |
void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); |
void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state); |
void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); |
void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode); |
void (*IndexMask)(GLcontext *ctx, GLuint mask); |
void (*Lightfv)(GLcontext *ctx, GLenum light, |
GLenum pname, const GLfloat *params ); |
void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); |
void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); |
void (*LineWidth)(GLcontext *ctx, GLfloat width); |
void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); |
void (*PointParameterfv)(GLcontext *ctx, GLenum pname, |
const GLfloat *params); |
void (*PointSize)(GLcontext *ctx, GLfloat size); |
void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); |
void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); |
void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); |
void (*RenderMode)(GLcontext *ctx, GLenum mode ); |
void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); |
void (*ShadeModel)(GLcontext *ctx, GLenum mode); |
void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); |
void (*StencilMask)(GLcontext *ctx, GLuint mask); |
void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass); |
void (*ActiveStencilFace)(GLcontext *ctx, GLuint face); |
void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, |
const GLfloat *params); |
void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, |
const GLfloat *param); |
void (*TexParameter)(GLcontext *ctx, GLenum target, |
struct gl_texture_object *texObj, |
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. |
***/ |
void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*NormalPointer)(GLcontext *ctx, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*FogCoordPointer)(GLcontext *ctx, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*IndexPointer)(GLcontext *ctx, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
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. |
***/ |
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 |
***/ |
GLuint NeedValidate; |
/* Bitmask of state changes that require the current tnl module to be |
* validated, using ValidateTnlModule() below. |
*/ |
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. |
* |
* This must be non-NULL if a driver installs a custom tnl module and |
* sets the NeedValidate bitmask, but may be NULL otherwise. |
*/ |
#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 |
#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 |
#define PRIM_UNKNOWN GL_POLYGON+3 |
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. |
*/ |
#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. |
* |
* The FlushVertices() call below may be used to resolve |
* these conditions. |
*/ |
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 |
* |
* Note that the default t&l engine never clears the |
* FLUSH_UPDATE_CURRENT bit, even after performing the update. |
*/ |
void (*LightingSpaceChange)( GLcontext *ctx ); |
/* Notify driver that the special derived value _NeedEyeCoords has |
* changed. |
*/ |
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 |
* in time to make changes to dispatch tables, etc. |
* Called by glNewList() and glEndList(), respectively. |
*/ |
void (*BeginCallList)( GLcontext *ctx, GLuint list ); |
void (*EndCallList)( GLcontext *ctx ); |
/* Notify the t&l component before and after calling a display list. |
* Called by glCallList(s), but not recursively. |
*/ |
void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, |
GLframebuffer *readBuffer ); |
/* Let the t&l component know when the context becomes current. |
*/ |
void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); |
void (*UnlockArraysEXT)( GLcontext *ctx ); |
/* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively. |
*/ |
}; |
/* |
* Transform/Clip/Lighting interface |
*/ |
typedef struct { |
void (*ArrayElement)( GLint ); /* NOTE */ |
void (*Color3f)( GLfloat, GLfloat, GLfloat ); |
void (*Color3fv)( const GLfloat * ); |
void (*Color3ub)( GLubyte, GLubyte, GLubyte ); |
void (*Color3ubv)( const GLubyte * ); |
void (*Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); |
void (*Color4fv)( const GLfloat * ); |
void (*Color4ub)( GLubyte, GLubyte, GLubyte, GLubyte ); |
void (*Color4ubv)( const GLubyte * ); |
void (*EdgeFlag)( GLboolean ); |
void (*EdgeFlagv)( const GLboolean * ); |
void (*EvalCoord1f)( GLfloat ); /* NOTE */ |
void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */ |
void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ |
void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */ |
void (*EvalPoint1)( GLint ); /* NOTE */ |
void (*EvalPoint2)( GLint, GLint ); /* NOTE */ |
void (*FogCoordfEXT)( GLfloat ); |
void (*FogCoordfvEXT)( const GLfloat * ); |
void (*Indexi)( GLint ); |
void (*Indexiv)( const GLint * ); |
void (*Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ |
void (*MultiTexCoord1fARB)( GLenum, GLfloat ); |
void (*MultiTexCoord1fvARB)( GLenum, const GLfloat * ); |
void (*MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); |
void (*MultiTexCoord2fvARB)( GLenum, const GLfloat * ); |
void (*MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); |
void (*MultiTexCoord3fvARB)( GLenum, const GLfloat * ); |
void (*MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); |
void (*MultiTexCoord4fvARB)( GLenum, const GLfloat * ); |
void (*Normal3f)( GLfloat, GLfloat, GLfloat ); |
void (*Normal3fv)( const GLfloat * ); |
void (*SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); |
void (*SecondaryColor3fvEXT)( const GLfloat * ); |
void (*SecondaryColor3ubEXT)( GLubyte, GLubyte, GLubyte ); |
void (*SecondaryColor3ubvEXT)( const GLubyte * ); |
void (*TexCoord1f)( GLfloat ); |
void (*TexCoord1fv)( const GLfloat * ); |
void (*TexCoord2f)( GLfloat, GLfloat ); |
void (*TexCoord2fv)( const GLfloat * ); |
void (*TexCoord3f)( GLfloat, GLfloat, GLfloat ); |
void (*TexCoord3fv)( const GLfloat * ); |
void (*TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); |
void (*TexCoord4fv)( const GLfloat * ); |
void (*Vertex2f)( GLfloat, GLfloat ); |
void (*Vertex2fv)( const GLfloat * ); |
void (*Vertex3f)( GLfloat, GLfloat, GLfloat ); |
void (*Vertex3fv)( const GLfloat * ); |
void (*Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); |
void (*Vertex4fv)( const GLfloat * ); |
void (*CallList)( GLuint ); /* NOTE */ |
void (*Begin)( GLenum ); |
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 (*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 |
* on receiving an eval call and use the pipeline mechanism to |
* provide partial t&l acceleration. |
* |
* Mesa will provide a set of helper functions to do eval within |
* accelerated vertex formats, eventually... |
*/ |
GLboolean prefer_float_colors; |
/* Should core try to send colors to glColor4f or glColor4chan, |
* where it has a choice? |
*/ |
} GLvertexformat; |
#endif /* DD_INCLUDED */ |
/shark/tags/rel_0_4/ports/mesa/src/vtxfmt.h |
---|
0,0 → 1,41 |
/* $Id: vtxfmt.h,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
* Gareth Hughes |
*/ |
#ifndef _VTXFMT_H_ |
#define _VTXFMT_H_ |
extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); |
extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt ); |
extern void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt ); |
extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/accum.h |
---|
0,0 → 1,43 |
/* $Id: accum.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef ACCUM_H |
#define ACCUM_H |
#include "mtypes.h" |
extern void |
_mesa_Accum( GLenum op, GLfloat value ); |
extern void |
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glthread.h |
---|
0,0 → 1,286 |
/* $Id: glthread.h,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Thread support for gl dispatch. |
* |
* Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu) |
* and Christoph Poliwoda (poliwoda@volumegraphics.com) |
* Revised by Keith Whitwell |
* Adapted for new gl dispatcher by Brian Paul |
* |
* |
* |
* DOCUMENTATION |
* |
* This thread module exports the following types: |
* _glthread_TSD Thread-specific data area |
* _glthread_Thread Thread datatype |
* _glthread_Mutex Mutual exclusion lock |
* |
* Macros: |
* _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex |
* _glthread_INIT_MUTEX(name) Initialize a mutex |
* _glthread_LOCK_MUTEX(name) Lock a mutex |
* _glthread_UNLOCK_MUTEX(name) Unlock a mutex |
* |
* Functions: |
* _glthread_GetID(v) Get integer thread ID |
* _glthread_InitTSD() Initialize thread-specific data |
* _glthread_GetTSD() Get thread-specific data |
* _glthread_SetTSD() Set thread-specific data |
* |
*/ |
/* |
* If this file is accidentally included by a non-threaded build, |
* it should not cause the build to fail, or otherwise cause problems. |
* In general, it should only be included when needed however. |
*/ |
#ifndef GLTHREAD_H |
#define GLTHREAD_H |
#if defined(PTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(XTHREADS) |
#define THREADS |
#endif |
#ifdef VMS |
#include <GL/vms_x_fix.h> |
#endif |
/* |
* POSIX threads. This should be your choice in the Unix world |
* whenever possible. When building with POSIX threads, be sure |
* to enable any compiler flags which will cause the MT-safe |
* libc (if one exists) to be used when linking, as well as any |
* header macros for MT-safe errno, etc. For Solaris, this is the -mt |
* compiler flag. On Solaris with gcc, use -D_REENTRANT to enable |
* proper compiling for MT-safe libc etc. |
*/ |
#if defined(PTHREADS) |
#include <pthread.h> /* POSIX threads headers */ |
typedef struct { |
pthread_key_t key; |
int initMagic; |
} _glthread_TSD; |
typedef pthread_t _glthread_Thread; |
typedef pthread_mutex_t _glthread_Mutex; |
#define _glthread_DECLARE_STATIC_MUTEX(name) \ |
static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER |
#define _glthread_INIT_MUTEX(name) \ |
pthread_mutex_init(&(name), NULL) |
#define _glthread_LOCK_MUTEX(name) \ |
(void) pthread_mutex_lock(&(name)) |
#define _glthread_UNLOCK_MUTEX(name) \ |
(void) pthread_mutex_unlock(&(name)) |
#endif /* PTHREADS */ |
/* |
* Solaris threads. Use only up to Solaris 2.4. |
* Solaris 2.5 and higher provide POSIX threads. |
* Be sure to compile with -mt on the Solaris compilers, or |
* use -D_REENTRANT if using gcc. |
*/ |
#ifdef SOLARIS_THREADS |
#include <thread.h> |
typedef struct { |
thread_key_t key; |
mutex_t keylock; |
int initMagic; |
} _glthread_TSD; |
typedef thread_t _glthread_Thread; |
typedef mutex_t _glthread_Mutex; |
/* XXX need to really implement mutex-related macros */ |
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 |
#define _glthread_INIT_MUTEX(name) (void) name |
#define _glthread_LOCK_MUTEX(name) (void) name |
#define _glthread_UNLOCK_MUTEX(name) (void) name |
#endif /* SOLARIS_THREADS */ |
/* |
* Windows threads. Should work with Windows NT and 95. |
* IMPORTANT: Link with multithreaded runtime library when THREADS are |
* used! |
*/ |
#ifdef WIN32_THREADS |
#include <windows.h> |
typedef struct { |
DWORD key; |
int initMagic; |
} _glthread_TSD; |
typedef HANDLE _glthread_Thread; |
typedef CRITICAL_SECTION _glthread_Mutex; |
/* XXX need to really implement mutex-related macros */ |
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 |
#define _glthread_INIT_MUTEX(name) (void) name |
#define _glthread_LOCK_MUTEX(name) (void) name |
#define _glthread_UNLOCK_MUTEX(name) (void) name |
#endif /* WIN32_THREADS */ |
/* |
* XFree86 has its own thread wrapper, Xthreads.h |
* We wrap it again for GL. |
*/ |
#ifdef XTHREADS |
#include "Xthreads.h" |
typedef struct { |
xthread_key_t key; |
int initMagic; |
} _glthread_TSD; |
typedef xthread_t _glthread_Thread; |
typedef xmutex_rec _glthread_Mutex; |
#ifdef XMUTEX_INITIALIZER |
#define _glthread_DECLARE_STATIC_MUTEX(name) \ |
static _glthread_Mutex name = XMUTEX_INITIALIZER |
#else |
#define _glthread_DECLARE_STATIC_MUTEX(name) \ |
static _glthread_Mutex name |
#endif |
#define _glthread_INIT_MUTEX(name) \ |
xmutex_init(&(name)) |
#define _glthread_LOCK_MUTEX(name) \ |
(void) xmutex_lock(&(name)) |
#define _glthread_UNLOCK_MUTEX(name) \ |
(void) xmutex_unlock(&(name)) |
#endif /* XTHREADS */ |
/* |
* BeOS threads. R5.x required. |
*/ |
#ifdef BEOS_THREADS |
#include <kernel/OS.h> |
#include <support/TLS.h> |
typedef struct { |
int32 key; |
int initMagic; |
} _glthread_TSD; |
typedef thread_id _glthread_Thread; |
/* Use Benaphore, aka speeder semaphore */ |
typedef struct { |
int32 lock; |
sem_id sem; |
} benaphore; |
typedef benaphore _glthread_Mutex; |
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, |
create_sem(0, #name"_benaphore") } |
#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0 |
#define _glthread_LOCK_MUTEX(name) if((atomic_add(&(name.lock), 1)) >= 1) acquire_sem(name.sem) |
#define _glthread_UNLOCK_MUTEX(name) if((atomic_add(&(name.lock), -1)) > 1) release_sem(name.sem) |
#endif /* BEOS_THREADS */ |
#ifndef THREADS |
/* |
* THREADS not defined |
*/ |
typedef GLuint _glthread_TSD; |
typedef GLuint _glthread_Thread; |
typedef GLuint _glthread_Mutex; |
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 |
#define _glthread_INIT_MUTEX(name) (void) name |
#define _glthread_LOCK_MUTEX(name) (void) name |
#define _glthread_UNLOCK_MUTEX(name) (void) name |
#endif /* THREADS */ |
/* |
* Platform independent thread specific data API. |
*/ |
extern unsigned long |
_glthread_GetID(void); |
extern void |
_glthread_InitTSD(_glthread_TSD *); |
extern void * |
_glthread_GetTSD(_glthread_TSD *); |
extern void |
_glthread_SetTSD(_glthread_TSD *, void *); |
#endif /* THREADS_H */ |
/shark/tags/rel_0_4/ports/mesa/src/extensions.c |
---|
0,0 → 1,468 |
/* $Id: extensions.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "context.h" |
#include "extensions.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#define MAX_EXT_NAMELEN 80 |
struct extension { |
struct extension *next, *prev; |
GLint enabled; |
GLboolean *flag; /* optional flag stored elsewhere */ |
char name[MAX_EXT_NAMELEN+1]; |
void (*notify)( GLcontext *, GLboolean ); |
}; |
#define F(x) (int)&(((struct gl_extensions *)0)->x) |
#define ON GL_TRUE |
#define OFF GL_FALSE |
static struct { |
GLboolean enabled; |
const char *name; |
int flag_offset; |
} default_extensions[] = { |
{ OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, |
{ OFF, "GL_ARB_imaging", F(ARB_imaging) }, |
{ OFF, "GL_ARB_multisample", F(ARB_multisample) }, |
{ OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, |
{ OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, |
{ OFF, "GL_ARB_shadow", F(ARB_shadow) }, |
{ OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, |
{ OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, |
{ OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, |
{ OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, |
{ OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, |
{ OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) }, |
{ OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) }, |
{ OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, |
{ OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, |
{ ON, "GL_ARB_transpose_matrix", 0 }, |
{ ON, "GL_ARB_window_pos", F(ARB_window_pos) }, |
{ OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, |
{ ON, "GL_EXT_abgr", 0 }, |
{ ON, "GL_EXT_bgra", 0 }, |
{ OFF, "GL_EXT_blend_color", F(EXT_blend_color) }, |
{ OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) }, |
{ OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) }, |
{ OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, |
{ OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, |
{ ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, |
{ OFF, "GL_EXT_convolution", F(EXT_convolution) }, |
{ ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, |
{ OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, |
{ OFF, "GL_EXT_histogram", F(EXT_histogram) }, |
{ OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, |
{ ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, |
{ OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, |
{ OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) }, |
{ ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, |
{ ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, |
{ OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, |
{ OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) }, |
{ OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, |
{ OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, |
{ OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) }, |
{ ON, "GL_EXT_texture3D", F(EXT_texture3D) }, |
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, |
{ OFF, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, |
{ OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, |
{ OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, |
{ OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, |
{ OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, |
{ ON, "GL_EXT_texture_object", F(EXT_texture_object) }, |
{ OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, |
{ ON, "GL_EXT_vertex_array", 0 }, |
{ OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, |
{ OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) }, |
{ ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, |
{ OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, |
{ OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) }, |
{ OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, |
{ OFF, "GL_MESA_packed_depth_stencil", 0 }, |
{ OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, |
{ OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, |
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) }, |
{ OFF, "GL_NV_blend_square", F(NV_blend_square) }, |
{ OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, |
{ OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, |
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, |
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, |
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, |
{ OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, |
{ OFF, "GL_SGI_color_table", F(SGI_color_table) }, |
{ OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, |
{ OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) }, |
{ OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, |
{ OFF, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, |
{ OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, |
{ OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, |
{ OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, |
{ OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, |
{ OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) }, |
{ OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) } |
}; |
/* |
* Enable all extensions suitable for a software-only renderer. |
* This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc. |
*/ |
void |
_mesa_enable_sw_extensions(GLcontext *ctx) |
{ |
const char *extensions[] = { |
"GL_ARB_depth_texture", |
"GL_ARB_imaging", |
"GL_ARB_multitexture", |
"GL_ARB_point_parameters", |
"GL_ARB_shadow", |
"GL_ARB_shadow_ambient", |
"GL_ARB_texture_border_clamp", |
"GL_ARB_texture_cube_map", |
"GL_ARB_texture_env_add", |
"GL_ARB_texture_env_combine", |
"GL_ARB_texture_env_crossbar", |
"GL_ARB_texture_env_dot3", |
"GL_ARB_texture_mirrored_repeat", |
"GL_ATI_texture_mirror_once", |
"GL_EXT_blend_color", |
"GL_EXT_blend_func_separate", |
"GL_EXT_blend_logic_op", |
"GL_EXT_blend_minmax", |
"GL_EXT_blend_subtract", |
"GL_EXT_convolution", |
"GL_EXT_fog_coord", |
"GL_EXT_histogram", |
"GL_EXT_paletted_texture", |
"GL_EXT_point_parameters", |
"GL_EXT_shadow_funcs", |
"GL_EXT_secondary_color", |
"GL_EXT_shared_texture_palette", |
"GL_EXT_stencil_wrap", |
"GL_EXT_stencil_two_side", |
"GL_EXT_texture_edge_clamp", |
"GL_EXT_texture_env_add", |
"GL_EXT_texture_env_combine", |
"GL_EXT_texture_env_dot3", |
"GL_EXT_texture_lod_bias", |
"GL_HP_occlusion_test", |
"GL_IBM_texture_mirrored_repeat", |
"GL_INGR_blend_func_separate", |
"GL_MESA_pack_invert", |
"GL_MESA_resize_buffers", |
"GL_MESA_ycbcr_texture", |
"GL_NV_blend_square", |
"GL_NV_point_sprite", |
"GL_NV_texture_rectangle", |
"GL_NV_texgen_reflection", |
#if FEATURE_NV_vertex_program |
"GL_NV_vertex_program", |
"GL_NV_vertex_program1_1", |
#endif |
"GL_SGI_color_matrix", |
"GL_SGI_color_table", |
"GL_SGIS_generate_mipmap", |
"GL_SGIS_pixel_texture", |
"GL_SGIS_texture_edge_clamp", |
"GL_SGIS_texture_border_clamp", |
"GL_SGIX_depth_texture", |
"GL_SGIX_pixel_texture", |
"GL_SGIX_shadow", |
"GL_SGIX_shadow_ambient", |
NULL |
}; |
GLuint i; |
for (i = 0; extensions[i]; i++) { |
_mesa_enable_extension(ctx, extensions[i]); |
} |
} |
/* |
* Enable GL_ARB_imaging and all the EXT extensions that are subsets of it. |
*/ |
void |
_mesa_enable_imaging_extensions(GLcontext *ctx) |
{ |
const char *extensions[] = { |
"GL_ARB_imaging", |
"GL_EXT_blend_color", |
"GL_EXT_blend_minmax", |
"GL_EXT_blend_subtract", |
"GL_EXT_convolution", |
"GL_EXT_histogram", |
"GL_SGI_color_matrix", |
"GL_SGI_color_table", |
NULL |
}; |
GLuint i; |
for (i = 0; extensions[i]; i++) { |
_mesa_enable_extension(ctx, extensions[i]); |
} |
} |
/* |
* Enable all OpenGL 1.3 features and extensions. |
*/ |
void |
_mesa_enable_1_3_extensions(GLcontext *ctx) |
{ |
const char *extensions[] = { |
"GL_ARB_multisample", |
"GL_ARB_multitexture", |
"GL_ARB_texture_border_clamp", |
"GL_ARB_texture_compression", |
"GL_ARB_texture_cube_map", |
"GL_ARB_texture_env_add", |
"GL_ARB_texture_env_combine", |
"GL_ARB_texture_env_dot3", |
"GL_ARB_transpose_matrix", |
NULL |
}; |
GLuint i; |
for (i = 0; extensions[i]; i++) { |
_mesa_enable_extension(ctx, extensions[i]); |
} |
} |
/* |
* Enable all OpenGL 1.4 features and extensions. |
*/ |
void |
_mesa_enable_1_4_extensions(GLcontext *ctx) |
{ |
const char *extensions[] = { |
"GL_ARB_depth_texture", |
"GL_ARB_point_parameters", |
"GL_ARB_shadow", |
"GL_ARB_texture_env_crossbar", |
"GL_ARB_texture_mirrored_repeat", |
"GL_ARB_window_pos", |
"GL_EXT_blend_color", |
"GL_EXT_blend_func_separate", |
"GL_EXT_blend_logic_op", |
"GL_EXT_blend_minmax", |
"GL_EXT_blend_subtract", |
"GL_EXT_fog_coord", |
"GL_EXT_multi_draw_arrays", |
"GL_EXT_secondary_color", |
"GL_EXT_stencil_wrap", |
"GL_SGIS_generate_mipmap", |
NULL |
}; |
GLuint i; |
for (i = 0; extensions[i]; i++) { |
_mesa_enable_extension(ctx, extensions[i]); |
} |
} |
/* |
* Add a new extenstion. This would be called from a Mesa driver. |
*/ |
void |
_mesa_add_extension( GLcontext *ctx, |
GLboolean enabled, |
const char *name, |
GLboolean *flag_ptr ) |
{ |
/* We should never try to add an extension after |
* _mesa_extensions_get_string() has been called! |
*/ |
assert(ctx->Extensions.ext_string == 0); |
{ |
struct extension *t = MALLOC_STRUCT(extension); |
t->enabled = enabled; |
_mesa_strncpy(t->name, name, MAX_EXT_NAMELEN); |
t->name[MAX_EXT_NAMELEN] = 0; |
t->flag = flag_ptr; |
if (t->flag) |
*t->flag = enabled; |
insert_at_tail( ctx->Extensions.ext_list, t ); |
} |
} |
/* |
* Either enable or disable the named extension. |
*/ |
static void |
set_extension( GLcontext *ctx, const char *name, GLint state ) |
{ |
/* XXX we should assert that ext_string is null. We should never be |
* enabling/disabling extensions after _mesa_extensions_get_string() |
* has been called! |
*/ |
struct extension *i; |
foreach( i, ctx->Extensions.ext_list ) |
if (_mesa_strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) |
break; |
if (i == ctx->Extensions.ext_list) { |
/* this is an error. Drivers should never try to enable/disable |
* an extension which is unknown to Mesa or wasn't added by calling |
* _mesa_add_extension(). |
*/ |
return; |
} |
if (i->flag) |
*(i->flag) = state; |
i->enabled = state; |
} |
void |
_mesa_enable_extension( GLcontext *ctx, const char *name ) |
{ |
if (ctx->Extensions.ext_string == 0) |
set_extension( ctx, name, 1 ); |
} |
void |
_mesa_disable_extension( GLcontext *ctx, const char *name ) |
{ |
if (ctx->Extensions.ext_string == 0) |
set_extension( ctx, name, 0 ); |
} |
/* |
* Test if the named extension is enabled in this context. |
*/ |
GLboolean |
_mesa_extension_is_enabled( GLcontext *ctx, const char *name) |
{ |
struct extension *i; |
foreach( i, ctx->Extensions.ext_list ) |
if (_mesa_strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) { |
if (i->enabled) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
return GL_FALSE; |
} |
void |
_mesa_extensions_dtr( GLcontext *ctx ) |
{ |
struct extension *i, *nexti; |
if (ctx->Extensions.ext_string) { |
FREE( ctx->Extensions.ext_string ); |
ctx->Extensions.ext_string = 0; |
} |
if (ctx->Extensions.ext_list) { |
foreach_s( i, nexti, ctx->Extensions.ext_list ) { |
remove_from_list( i ); |
FREE( i ); |
} |
FREE(ctx->Extensions.ext_list); |
ctx->Extensions.ext_list = 0; |
} |
} |
void |
_mesa_extensions_ctr( GLcontext *ctx ) |
{ |
GLuint i; |
GLboolean *base = (GLboolean *)&ctx->Extensions; |
ctx->Extensions.ext_string = NULL; |
ctx->Extensions.ext_list = MALLOC_STRUCT(extension); |
make_empty_list( ctx->Extensions.ext_list ); |
for (i = 0 ; i < Elements(default_extensions) ; i++) { |
GLboolean *ptr = NULL; |
if (default_extensions[i].flag_offset) |
ptr = base + default_extensions[i].flag_offset; |
(void) _mesa_add_extension( ctx, |
default_extensions[i].enabled, |
default_extensions[i].name, |
ptr); |
} |
} |
const char * |
_mesa_extensions_get_string( GLcontext *ctx ) |
{ |
if (ctx->Extensions.ext_string == 0) |
{ |
struct extension *i; |
char *str; |
GLuint len = 0; |
foreach (i, ctx->Extensions.ext_list) |
if (i->enabled) |
len += _mesa_strlen(i->name) + 1; |
if (len == 0) |
return ""; |
str = (char *) _mesa_malloc(len * sizeof(char)); |
ctx->Extensions.ext_string = str; |
foreach (i, ctx->Extensions.ext_list) |
if (i->enabled) { |
_mesa_strcpy(str, i->name); |
str += _mesa_strlen(str); |
*str++ = ' '; |
} |
*(str-1) = 0; |
} |
return ctx->Extensions.ext_string; |
} |
/shark/tags/rel_0_4/ports/mesa/src/stencil.c |
---|
0,0 → 1,214 |
/* $Id: stencil.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "context.h" |
#include "depth.h" |
#include "macros.h" |
#include "stencil.h" |
#include "mtypes.h" |
#include "enable.h" |
void |
_mesa_ClearStencil( GLint s ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Stencil.Clear == (GLstencil) s) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.Clear = (GLstencil) s; |
if (ctx->Driver.ClearStencil) { |
(*ctx->Driver.ClearStencil)( ctx, s ); |
} |
} |
void |
_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const GLint face = ctx->Stencil.ActiveFace; |
GLint maxref; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (func) { |
case GL_NEVER: |
case GL_LESS: |
case GL_LEQUAL: |
case GL_GREATER: |
case GL_GEQUAL: |
case GL_EQUAL: |
case GL_NOTEQUAL: |
case GL_ALWAYS: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc" ); |
return; |
} |
maxref = (1 << STENCIL_BITS) - 1; |
ref = (GLstencil) CLAMP( ref, 0, maxref ); |
if (ctx->Stencil.Function[face] == func && |
ctx->Stencil.ValueMask[face] == (GLstencil) mask && |
ctx->Stencil.Ref[face] == ref) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.Function[face] = func; |
ctx->Stencil.Ref[face] = ref; |
ctx->Stencil.ValueMask[face] = (GLstencil) mask; |
if (ctx->Driver.StencilFunc) { |
(*ctx->Driver.StencilFunc)( ctx, func, ref, mask ); |
} |
} |
void |
_mesa_StencilMask( GLuint mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const GLint face = ctx->Stencil.ActiveFace; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Stencil.WriteMask[face] == (GLstencil) mask) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.WriteMask[face] = (GLstencil) mask; |
if (ctx->Driver.StencilMask) { |
(*ctx->Driver.StencilMask)( ctx, mask ); |
} |
} |
void |
_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const GLint face = ctx->Stencil.ActiveFace; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (fail) { |
case GL_KEEP: |
case GL_ZERO: |
case GL_REPLACE: |
case GL_INCR: |
case GL_DECR: |
case GL_INVERT: |
break; |
case GL_INCR_WRAP_EXT: |
case GL_DECR_WRAP_EXT: |
if (!ctx->Extensions.EXT_stencil_wrap) { |
break; |
} |
/* FALL-THROUGH */ |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); |
return; |
} |
switch (zfail) { |
case GL_KEEP: |
case GL_ZERO: |
case GL_REPLACE: |
case GL_INCR: |
case GL_DECR: |
case GL_INVERT: |
break; |
case GL_INCR_WRAP_EXT: |
case GL_DECR_WRAP_EXT: |
if (ctx->Extensions.EXT_stencil_wrap) { |
break; |
} |
/* FALL-THROUGH */ |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); |
return; |
} |
switch (zpass) { |
case GL_KEEP: |
case GL_ZERO: |
case GL_REPLACE: |
case GL_INCR: |
case GL_DECR: |
case GL_INVERT: |
break; |
case GL_INCR_WRAP_EXT: |
case GL_DECR_WRAP_EXT: |
if (ctx->Extensions.EXT_stencil_wrap) { |
break; |
} |
/* FALL-THROUGH */ |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); |
return; |
} |
if (ctx->Stencil.ZFailFunc[face] == zfail && |
ctx->Stencil.ZPassFunc[face] == zpass && |
ctx->Stencil.FailFunc[face] == fail) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.ZFailFunc[face] = zfail; |
ctx->Stencil.ZPassFunc[face] = zpass; |
ctx->Stencil.FailFunc[face] = fail; |
if (ctx->Driver.StencilOp) { |
(*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); |
} |
} |
/* GL_EXT_stencil_two_side */ |
void |
_mesa_ActiveStencilFaceEXT(GLenum face) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (face == GL_FRONT || face == GL_BACK) { |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 1; |
} |
if (ctx->Driver.ActiveStencilFace) { |
(*ctx->Driver.ActiveStencilFace)( ctx, (GLuint) ctx->Stencil.ActiveFace ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/colormac.h |
---|
0,0 → 1,136 |
/* $Id: colormac.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Color-related macros |
*/ |
#ifndef COLORMAC_H |
#define COLORMAC_H |
#include "glheader.h" |
#include "config.h" |
#include "macros.h" |
#include "mmath.h" |
/* Do not reference mtypes.h from this file. |
*/ |
#if CHAN_BITS == 8 |
#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b)) |
#define UBYTE_TO_CHAN(b) (b) |
#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7)) |
#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8)) |
#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23)) |
#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24)) |
#define CHAN_TO_UBYTE(c) (c) |
#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c) |
#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f) |
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f) |
#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC) |
#define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8)) |
#elif CHAN_BITS == 16 |
#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516)) |
#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b))) |
#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s)) |
#define USHORT_TO_CHAN(s) (s) |
#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15)) |
#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16)) |
#define CHAN_TO_UBYTE(c) ((c) >> 8) |
#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF))) |
#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f) |
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f) |
#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) |
#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535)) |
#elif CHAN_BITS == 32 |
/* XXX floating-point color channels not fully thought-out */ |
#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F))) |
#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F))) |
#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F))) |
#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F))) |
#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F))) |
#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F))) |
#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c) |
#define CHAN_TO_FLOAT(c) (c) |
#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f) |
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f) |
#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) |
#define CHAN_PRODUCT(a, b) ((a) * (b)) |
#else |
#error unexpected CHAN_BITS size |
#endif |
/* |
* Convert 3 channels at once. |
*/ |
#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \ |
do { \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ |
} while (0) |
/* |
* Convert 4 channels at once. |
*/ |
#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \ |
do { \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ |
UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \ |
} while (0) |
#endif /* COLORMAC_H */ |
/shark/tags/rel_0_4/ports/mesa/src/extensions.h |
---|
0,0 → 1,57 |
/* $Id: extensions.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _EXTENSIONS_H_ |
#define _EXTENSIONS_H_ |
#include "mtypes.h" |
extern void _mesa_enable_sw_extensions(GLcontext *ctx); |
extern void _mesa_enable_imaging_extensions(GLcontext *ctx); |
extern void _mesa_enable_1_3_extensions(GLcontext *ctx); |
extern void _mesa_enable_1_4_extensions(GLcontext *ctx); |
extern void _mesa_add_extension( GLcontext *ctx, GLboolean enabled, |
const char *name, GLboolean *flag_ptr ); |
extern void _mesa_enable_extension( GLcontext *ctx, const char *name ); |
extern void _mesa_disable_extension( GLcontext *ctx, const char *name ); |
extern GLboolean _mesa_extension_is_enabled( GLcontext *ctx, const char *name); |
extern void _mesa_extensions_dtr( GLcontext *ctx ); |
extern void _mesa_extensions_ctr( GLcontext *ctx ); |
extern const char *_mesa_extensions_get_string( GLcontext *ctx ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/stencil.h |
---|
0,0 → 1,55 |
/* $Id: stencil.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef STENCIL_H |
#define STENCIL_H |
#include "mtypes.h" |
extern void |
_mesa_ClearStencil( GLint s ); |
extern void |
_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); |
extern void |
_mesa_StencilMask( GLuint mask ); |
extern void |
_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); |
extern void |
_mesa_ActiveStencilFaceEXT(GLenum face); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/lines.c |
---|
0,0 → 1,88 |
/* $Id: lines.c,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "depth.h" |
#include "lines.h" |
#include "macros.h" |
#include "mmath.h" |
#include "texstate.h" |
#include "mtypes.h" |
void |
_mesa_LineWidth( GLfloat width ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (width<=0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); |
return; |
} |
if (ctx->Line.Width == width) |
return; |
FLUSH_VERTICES(ctx, _NEW_LINE); |
ctx->Line.Width = width; |
ctx->Line._Width = CLAMP(width, |
ctx->Const.MinLineWidth, |
ctx->Const.MaxLineWidth); |
if (width != 1.0) |
ctx->_TriangleCaps |= DD_LINE_WIDTH; |
else |
ctx->_TriangleCaps &= ~DD_LINE_WIDTH; |
if (ctx->Driver.LineWidth) |
(*ctx->Driver.LineWidth)(ctx, width); |
} |
void |
_mesa_LineStipple( GLint factor, GLushort pattern ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
factor = CLAMP( factor, 1, 256 ); |
if (ctx->Line.StippleFactor == factor && |
ctx->Line.StipplePattern == pattern) |
return; |
FLUSH_VERTICES(ctx, _NEW_LINE); |
ctx->Line.StippleFactor = factor; |
ctx->Line.StipplePattern = pattern; |
if (ctx->Driver.LineStipple) |
ctx->Driver.LineStipple( ctx, factor, pattern ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/lines.h |
---|
0,0 → 1,42 |
/* $Id: lines.h,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef LINES_H |
#define LINES_H |
#include "mtypes.h" |
extern void |
_mesa_LineWidth( GLfloat width ); |
extern void |
_mesa_LineStipple( GLint factor, GLushort pattern ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glheader.h |
---|
0,0 → 1,296 |
/* $Id: glheader.h,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef 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) |
#include "xf86_ansic.h" |
#else |
#include <assert.h> |
#include <ctype.h> |
/* If we can use Compaq's Fast Math Library on Alpha */ |
#if defined(__alpha__) && defined(CCPML) |
#include <cpml.h> |
#else |
#include <math.h> |
#endif |
#include <limits.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#if defined(__linux__) && defined(__i386__) |
#include <fpu_control.h> |
#endif |
#endif |
#include <float.h> |
#include <stdarg.h> |
#ifdef HAVE_CONFIG_H |
#include "conf.h" |
#endif |
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) |
# define __WIN32__ |
# define finite _finite |
#endif |
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) |
# pragma warning( disable : 4068 ) /* unknown pragma */ |
# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ |
# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ |
# pragma warning( disable : 4127 ) /* conditional expression is constant */ |
# if defined(MESA_MINWARN) |
# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ |
# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ |
# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ |
# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ |
# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ |
# endif |
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ |
# define GLAPI __declspec(dllexport) |
# define WGLAPI __declspec(dllexport) |
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ |
# define GLAPI __declspec(dllimport) |
# define WGLAPI __declspec(dllimport) |
# else /* for use with static link lib build of Win32 edition only */ |
# define GLAPI extern |
# define WGLAPI __declspec(dllimport) |
# endif /* _STATIC_MESA support */ |
# define GLAPIENTRY __stdcall |
# define GLAPIENTRYP __stdcall * |
# define GLCALLBACK __stdcall |
# define GLCALLBACKP __stdcall * |
# if defined(__CYGWIN__) |
# define GLCALLBACKPCAST * |
# else |
# define GLCALLBACKPCAST __stdcall * |
# endif |
# define GLWINAPI __stdcall |
# define GLWINAPIV __cdecl |
#else |
/* non-Windows compilation */ |
# define GLAPI extern |
# define GLAPIENTRY |
# define GLAPIENTRYP * |
# define GLCALLBACK |
# define GLCALLBACKP * |
# define GLCALLBACKPCAST * |
# define GLWINAPI |
# define GLWINAPIV |
#endif /* WIN32 / CYGWIN bracket */ |
/* compatability guard so we don't need to change client code */ |
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) |
#if 0 |
# define CALLBACK GLCALLBACK |
typedef void *HGLRC; |
typedef void *HDC; |
#endif |
typedef int (GLAPIENTRY *PROC)(); |
typedef unsigned long COLORREF; |
#endif |
/* Make sure we include glext.h from gl.h */ |
#define GL_GLEXT_PROTOTYPES |
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) |
# define WGL_FONT_LINES 0 |
# define WGL_FONT_POLYGONS 1 |
#ifndef _GNU_H_WINDOWS32_FUNCTIONS |
# ifdef UNICODE |
# define wglUseFontBitmaps wglUseFontBitmapsW |
# define wglUseFontOutlines wglUseFontOutlinesW |
# else |
# define wglUseFontBitmaps wglUseFontBitmapsA |
# define wglUseFontOutlines wglUseFontOutlinesA |
# endif /* !UNICODE */ |
#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ |
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; |
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; |
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; |
#if !defined(GLX_USE_MESA) |
#include <gl/mesa_wgl.h> |
#endif |
#endif |
/* |
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. |
* Do not use them unless absolutely necessary! |
* Try to use a runtime test instead. |
* For now, only used by some DRI hardware drivers for color/texel packing. |
*/ |
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN |
#if defined(__linux__) |
#include <byteswap.h> |
#define CPU_TO_LE32( x ) bswap_32( x ) |
#else /*__linux__*/ |
#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */ |
#endif /*__linux__*/ |
#define MESA_BIG_ENDIAN 1 |
#else |
#define CPU_TO_LE32( x ) ( x ) |
#define MESA_LITTLE_ENDIAN 1 |
#endif |
#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) |
/* This is a macro on IRIX */ |
#ifdef _P |
#undef _P |
#endif |
#include "GL/gl.h" |
#include "GL/glext.h" |
#ifndef CAPI |
#ifdef WIN32 |
#define CAPI _cdecl |
#else |
#define CAPI |
#endif |
#endif |
#include <GL/internal/glcore.h> |
/* Disable unreachable code warnings for Watcom C++ */ |
#ifdef __WATCOMC__ |
#pragma disable_message(201) |
#endif |
/* Turn off macro checking systems used by other libraries */ |
#ifdef CHECK |
#undef CHECK |
#endif |
/* Create a macro so that asm functions can be linked into compilers other |
* than GNU C |
*/ |
#ifndef _ASMAPI |
#if !defined( __GNUC__ ) && !defined( VMS ) |
#define _ASMAPI __cdecl |
#else |
#define _ASMAPI |
#endif |
#ifdef PTR_DECL_IN_FRONT |
#define _ASMAPIP * _ASMAPI |
#else |
#define _ASMAPIP _ASMAPI * |
#endif |
#endif |
#ifdef USE_X86_ASM |
#define _NORMAPI _ASMAPI |
#define _NORMAPIP _ASMAPIP |
#else |
#define _NORMAPI |
#define _NORMAPIP * |
#endif |
/* Function inlining */ |
#if defined(__GNUC__) |
# define INLINE __inline__ |
#elif defined(__MSC__) |
# define INLINE __inline |
#elif defined(_MSC_VER) |
# define INLINE __inline |
#elif defined(__ICL) |
# define INLINE __inline |
#else |
# define INLINE |
#endif |
/* |
* Provide a reasonable replacement for __FUNCTION__ when using |
* non-GNU C compilers. |
*/ |
#if !defined(__GNUC__) |
#define STRINGIZE(x) #x |
#define STRINGIZE_EVAL(x) STRINGIZE(x) |
#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__) |
#endif |
/* Some compilers don't like some of Mesa's const usage */ |
#ifdef NO_CONST |
# define CONST |
#else |
# define CONST const |
#endif |
#ifdef DEBUG |
# define ASSERT(X) assert(X) |
#else |
# define ASSERT(X) |
#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. |
* But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) |
* these casts generate warnings. |
* The following union typedef is used to solve that. |
*/ |
typedef union { GLfloat f; GLint i; } fi_type; |
#endif /* GLHEADER_H */ |
/shark/tags/rel_0_4/ports/mesa/src/api_validate.c |
---|
0,0 → 1,142 |
/* $Id: api_validate.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "api_validate.h" |
#include "context.h" |
#include "imports.h" |
#include "mtypes.h" |
#include "state.h" |
GLboolean |
_mesa_validate_DrawElements(GLcontext *ctx, |
GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices) |
{ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (count <= 0) { |
if (count < 0) |
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); |
return GL_FALSE; |
} |
if (mode < 0 || |
mode > GL_POLYGON) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); |
return GL_FALSE; |
} |
if (type != GL_UNSIGNED_INT && |
type != GL_UNSIGNED_BYTE && |
type != GL_UNSIGNED_SHORT) |
{ |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); |
return GL_FALSE; |
} |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
if (ctx->Array.Vertex.Enabled |
|| (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) |
return GL_TRUE; |
else |
return GL_FALSE; |
return GL_TRUE; |
} |
GLboolean |
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, GLenum type, |
const GLvoid *indices) |
{ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (count <= 0) { |
if (count < 0) |
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); |
return GL_FALSE; |
} |
if (mode < 0 || mode > GL_POLYGON) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); |
return GL_FALSE; |
} |
if (end < start) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)"); |
return GL_FALSE; |
} |
if (type != GL_UNSIGNED_INT && |
type != GL_UNSIGNED_BYTE && |
type != GL_UNSIGNED_SHORT) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); |
return GL_FALSE; |
} |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
if (ctx->Array.Vertex.Enabled |
|| (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
GLboolean |
_mesa_validate_DrawArrays(GLcontext *ctx, |
GLenum mode, GLint start, GLsizei count) |
{ |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (count<0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); |
return GL_FALSE; |
} |
if (mode < 0 || mode > GL_POLYGON) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); |
return GL_FALSE; |
} |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
if (ctx->Array.Vertex.Enabled |
|| (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_loopback.c |
---|
0,0 → 1,1875 |
/* $Id: api_loopback.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "glapi.h" |
#include "glapitable.h" |
#include "macros.h" |
#include "colormac.h" |
#include "api_loopback.h" |
/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc |
* calls to a smaller set of driver-provided formats. Currently just |
* go back to dispatch to find these (eg. call glNormal3f directly), |
* hence 'loopback'. |
* |
* The driver must supply all of the remaining entry points, which are |
* listed in dd.h. The easiest way for a driver to do this is to |
* install the supplied software t&l module. |
*/ |
#define COLORUBV(v) glColor4ubv(v) |
#define COLORF(r,g,b,a) glColor4f(r,g,b,a) |
#define VERTEX2(x,y) glVertex2f(x,y) |
#define VERTEX3(x,y,z) glVertex3f(x,y,z) |
#define VERTEX4(x,y,z,w) glVertex4f(x,y,z,w) |
#define NORMAL(x,y,z) glNormal3f(x,y,z) |
#define TEXCOORD1(s) glTexCoord1f(s) |
#define TEXCOORD2(s,t) glTexCoord2f(s,t) |
#define TEXCOORD3(s,t,u) glTexCoord3f(s,t,u) |
#define TEXCOORD4(s,t,u,v) glTexCoord4f(s,t,u,v) |
#define INDEX(c) glIndexi(c) |
#define MULTI_TEXCOORD1(z,s) glMultiTexCoord1fARB(z,s) |
#define MULTI_TEXCOORD2(z,s,t) glMultiTexCoord2fARB(z,s,t) |
#define MULTI_TEXCOORD3(z,s,t,u) glMultiTexCoord3fARB(z,s,t,u) |
#define MULTI_TEXCOORD4(z,s,t,u,v) glMultiTexCoord4fARB(z,s,t,u,v) |
#define EVALCOORD1(x) glEvalCoord1f(x) |
#define EVALCOORD2(x,y) glEvalCoord2f(x,y) |
#define MATERIALFV(a,b,c) glMaterialfv(a,b,c) |
#define RECTF(a,b,c,d) glRectf(a,b,c,d) |
#define ATTRIB(index, x, y, z, w) _glapi_Dispatch->VertexAttrib4fNV(index, x, y, z, w) |
#define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x) |
#define SECONDARYCOLORUB(a,b,c) _glapi_Dispatch->SecondaryColor3ubEXT(a,b,c) |
#define SECONDARYCOLORF(a,b,c) _glapi_Dispatch->SecondaryColor3fEXT(a,b,c) |
static void |
loopback_Color3b( GLbyte red, GLbyte green, GLbyte blue ) |
{ |
GLubyte col[4]; |
col[0] = BYTE_TO_UBYTE(red); |
col[1] = BYTE_TO_UBYTE(green); |
col[2] = BYTE_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3d( GLdouble red, GLdouble green, GLdouble blue ) |
{ |
GLubyte col[4]; |
GLfloat r = (GLfloat) red; |
GLfloat g = (GLfloat) green; |
GLfloat b = (GLfloat) blue; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
col[3] = 255; |
COLORUBV( col ); |
} |
static void |
loopback_Color3i( GLint red, GLint green, GLint blue ) |
{ |
GLubyte col[4]; |
col[0] = INT_TO_UBYTE(red); |
col[1] = INT_TO_UBYTE(green); |
col[2] = INT_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3s( GLshort red, GLshort green, GLshort blue ) |
{ |
GLubyte col[4]; |
col[0] = SHORT_TO_UBYTE(red); |
col[1] = SHORT_TO_UBYTE(green); |
col[2] = SHORT_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3ui( GLuint red, GLuint green, GLuint blue ) |
{ |
GLubyte col[4]; |
col[0] = UINT_TO_UBYTE(red); |
col[1] = UINT_TO_UBYTE(green); |
col[2] = UINT_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3us( GLushort red, GLushort green, GLushort blue ) |
{ |
GLubyte col[4]; |
col[0] = USHORT_TO_UBYTE(red); |
col[1] = USHORT_TO_UBYTE(green); |
col[2] = USHORT_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) |
{ |
GLubyte col[4]; |
col[0] = BYTE_TO_UBYTE(red); |
col[1] = BYTE_TO_UBYTE(green); |
col[2] = BYTE_TO_UBYTE(blue); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) |
{ |
GLubyte col[4]; |
GLfloat r = (GLfloat) red; |
GLfloat g = (GLfloat) green; |
GLfloat b = (GLfloat) blue; |
GLfloat a = (GLfloat) alpha; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
UNCLAMPED_FLOAT_TO_UBYTE(col[3], a); |
COLORUBV( col ); |
} |
static void |
loopback_Color4i( GLint red, GLint green, GLint blue, GLint alpha ) |
{ |
GLubyte col[4]; |
col[0] = INT_TO_UBYTE(red); |
col[1] = INT_TO_UBYTE(green); |
col[2] = INT_TO_UBYTE(blue); |
col[3] = INT_TO_UBYTE(alpha); |
COLORUBV(col); |
} |
static void |
loopback_Color4s( GLshort red, GLshort green, GLshort blue, |
GLshort alpha ) |
{ |
GLubyte col[4]; |
col[0] = SHORT_TO_UBYTE(red); |
col[1] = SHORT_TO_UBYTE(green); |
col[2] = SHORT_TO_UBYTE(blue); |
col[3] = SHORT_TO_UBYTE(alpha); |
COLORUBV(col); |
} |
static void |
loopback_Color4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha ) |
{ |
GLubyte col[4]; |
col[0] = UINT_TO_UBYTE(red); |
col[1] = UINT_TO_UBYTE(green); |
col[2] = UINT_TO_UBYTE(blue); |
col[3] = UINT_TO_UBYTE(alpha); |
COLORUBV(col); |
} |
static void |
loopback_Color4us( GLushort red, GLushort green, GLushort blue, |
GLushort alpha ) |
{ |
GLubyte col[4]; |
col[0] = USHORT_TO_UBYTE(red); |
col[1] = USHORT_TO_UBYTE(green); |
col[2] = USHORT_TO_UBYTE(blue); |
col[3] = USHORT_TO_UBYTE(alpha); |
COLORUBV(col); |
} |
static void |
loopback_Color3bv( const GLbyte *v ) |
{ |
GLubyte col[4]; |
col[0] = BYTE_TO_UBYTE(v[0]); |
col[1] = BYTE_TO_UBYTE(v[1]); |
col[2] = BYTE_TO_UBYTE(v[2]); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3dv( const GLdouble *v ) |
{ |
GLubyte col[4]; |
GLfloat r = (GLfloat) v[0]; |
GLfloat g = (GLfloat) v[1]; |
GLfloat b = (GLfloat) v[2]; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
col[3] = 255; |
COLORUBV( col ); |
} |
static void |
loopback_Color3iv( const GLint *v ) |
{ |
GLubyte col[4]; |
col[0] = INT_TO_UBYTE(v[0]); |
col[1] = INT_TO_UBYTE(v[1]); |
col[2] = INT_TO_UBYTE(v[2]); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3sv( const GLshort *v ) |
{ |
GLubyte col[4]; |
col[0] = SHORT_TO_UBYTE(v[0]); |
col[1] = SHORT_TO_UBYTE(v[1]); |
col[2] = SHORT_TO_UBYTE(v[2]); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3uiv( const GLuint *v ) |
{ |
GLubyte col[4]; |
col[0] = UINT_TO_UBYTE(v[0]); |
col[1] = UINT_TO_UBYTE(v[1]); |
col[2] = UINT_TO_UBYTE(v[2]); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color3usv( const GLushort *v ) |
{ |
GLubyte col[4]; |
col[0] = USHORT_TO_UBYTE(v[0]); |
col[1] = USHORT_TO_UBYTE(v[1]); |
col[2] = USHORT_TO_UBYTE(v[2]); |
col[3] = 255; |
COLORUBV(col); |
} |
static void |
loopback_Color4bv( const GLbyte *v ) |
{ |
GLubyte col[4]; |
col[0] = BYTE_TO_UBYTE(v[0]); |
col[1] = BYTE_TO_UBYTE(v[1]); |
col[2] = BYTE_TO_UBYTE(v[2]); |
col[3] = BYTE_TO_UBYTE(v[3]); |
COLORUBV(col); |
} |
static void |
loopback_Color4dv( const GLdouble *v ) |
{ |
GLubyte col[4]; |
GLfloat r = (GLfloat) v[0]; |
GLfloat g = (GLfloat) v[1]; |
GLfloat b = (GLfloat) v[2]; |
GLfloat a = (GLfloat) v[3]; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
UNCLAMPED_FLOAT_TO_UBYTE(col[3], a); |
COLORUBV( col ); |
} |
static void |
loopback_Color4iv( const GLint *v ) |
{ |
GLubyte col[4]; |
col[0] = INT_TO_UBYTE(v[0]); |
col[1] = INT_TO_UBYTE(v[1]); |
col[2] = INT_TO_UBYTE(v[2]); |
col[3] = INT_TO_UBYTE(v[3]); |
COLORUBV(col); |
} |
static void |
loopback_Color4sv( const GLshort *v) |
{ |
GLubyte col[4]; |
col[0] = SHORT_TO_UBYTE(v[0]); |
col[1] = SHORT_TO_UBYTE(v[1]); |
col[2] = SHORT_TO_UBYTE(v[2]); |
col[3] = SHORT_TO_UBYTE(v[3]); |
COLORUBV(col); |
} |
static void |
loopback_Color4uiv( const GLuint *v) |
{ |
GLubyte col[4]; |
col[0] = UINT_TO_UBYTE(v[0]); |
col[1] = UINT_TO_UBYTE(v[1]); |
col[2] = UINT_TO_UBYTE(v[2]); |
col[3] = UINT_TO_UBYTE(v[3]); |
COLORUBV(col); |
} |
static void |
loopback_Color4usv( const GLushort *v) |
{ |
GLubyte col[4]; |
col[0] = USHORT_TO_UBYTE(v[0]); |
col[1] = USHORT_TO_UBYTE(v[1]); |
col[2] = USHORT_TO_UBYTE(v[2]); |
col[3] = USHORT_TO_UBYTE(v[3]); |
COLORUBV(col); |
} |
static void |
loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) |
{ |
COLORF( BYTE_TO_FLOAT(red), |
BYTE_TO_FLOAT(green), |
BYTE_TO_FLOAT(blue), |
1.0 ); |
} |
static void |
loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) |
{ |
COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); |
} |
static void |
loopback_Color3i_f( GLint red, GLint green, GLint blue ) |
{ |
COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), |
INT_TO_FLOAT(blue), 1.0); |
} |
static void |
loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) |
{ |
COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), |
SHORT_TO_FLOAT(blue), 1.0); |
} |
static void |
loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) |
{ |
COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), |
UINT_TO_FLOAT(blue), 1.0 ); |
} |
static void |
loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) |
{ |
COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), |
USHORT_TO_FLOAT(blue), 1.0 ); |
} |
static void |
loopback_Color3bv_f( const GLbyte *v ) |
{ |
COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), |
BYTE_TO_FLOAT(v[2]), 1.0 ); |
} |
static void |
loopback_Color3dv_f( const GLdouble *v ) |
{ |
COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); |
} |
static void |
loopback_Color3iv_f( const GLint *v ) |
{ |
COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), |
INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_Color3sv_f( const GLshort *v ) |
{ |
COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), |
SHORT_TO_FLOAT(v[2]), 1.0 ); |
} |
static void |
loopback_Color3uiv_f( const GLuint *v ) |
{ |
COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), |
UINT_TO_FLOAT(v[2]), 1.0 ); |
} |
static void |
loopback_Color3usv_f( const GLushort *v ) |
{ |
COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), |
USHORT_TO_FLOAT(v[2]), 1.0 ); |
} |
static void |
loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, |
GLbyte alpha ) |
{ |
COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), |
BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); |
} |
static void |
loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, |
GLdouble alpha ) |
{ |
COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); |
} |
static void |
loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) |
{ |
COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), |
INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); |
} |
static void |
loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, |
GLshort alpha ) |
{ |
COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), |
SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); |
} |
static void |
loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) |
{ |
COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), |
UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); |
} |
static void |
loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) |
{ |
COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), |
USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); |
} |
static void |
loopback_Color4iv_f( const GLint *v ) |
{ |
COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), |
INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_Color4bv_f( const GLbyte *v ) |
{ |
COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), |
BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_Color4dv_f( const GLdouble *v ) |
{ |
COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_Color4sv_f( const GLshort *v) |
{ |
COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), |
SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_Color4uiv_f( const GLuint *v) |
{ |
COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), |
UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_Color4usv_f( const GLushort *v) |
{ |
COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), |
USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); |
} |
static void |
loopback_FogCoorddEXT( GLdouble d ) |
{ |
FOGCOORDF( (GLfloat) d ); |
} |
static void |
loopback_FogCoorddvEXT( const GLdouble *v ) |
{ |
FOGCOORDF( (GLfloat) *v ); |
} |
static void |
loopback_Indexd( GLdouble c ) |
{ |
INDEX( (GLint) c ); |
} |
static void |
loopback_Indexf( GLfloat c ) |
{ |
INDEX( (GLuint) (GLint) c ); |
} |
static void |
loopback_Indexs( GLshort c ) |
{ |
INDEX( (GLint) c ); |
} |
static void |
loopback_Indexub( GLubyte c ) |
{ |
INDEX( (GLint) c ); |
} |
static void |
loopback_Indexdv( const GLdouble *c ) |
{ |
INDEX( (GLint) (GLint) *c ); |
} |
static void |
loopback_Indexfv( const GLfloat *c ) |
{ |
INDEX( (GLint) (GLint) *c ); |
} |
static void |
loopback_Indexiv( const GLint *c ) |
{ |
INDEX( *c ); |
} |
static void |
loopback_Indexsv( const GLshort *c ) |
{ |
INDEX( (GLint) *c ); |
} |
static void |
loopback_Indexubv( const GLubyte *c ) |
{ |
INDEX( (GLint) *c ); |
} |
static void |
loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) |
{ |
NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); |
} |
static void |
loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) |
{ |
NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); |
} |
static void |
loopback_Normal3i( GLint nx, GLint ny, GLint nz ) |
{ |
NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); |
} |
static void |
loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) |
{ |
NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); |
} |
static void |
loopback_Normal3bv( const GLbyte *v ) |
{ |
NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); |
} |
static void |
loopback_Normal3dv( const GLdouble *v ) |
{ |
NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_Normal3iv( const GLint *v ) |
{ |
NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); |
} |
static void |
loopback_Normal3sv( const GLshort *v ) |
{ |
NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); |
} |
static void |
loopback_TexCoord1d( GLdouble s ) |
{ |
TEXCOORD1((GLfloat) s); |
} |
static void |
loopback_TexCoord1i( GLint s ) |
{ |
TEXCOORD1((GLfloat) s); |
} |
static void |
loopback_TexCoord1s( GLshort s ) |
{ |
TEXCOORD1((GLfloat) s); |
} |
static void |
loopback_TexCoord2d( GLdouble s, GLdouble t ) |
{ |
TEXCOORD2((GLfloat) s,(GLfloat) t); |
} |
static void |
loopback_TexCoord2s( GLshort s, GLshort t ) |
{ |
TEXCOORD2((GLfloat) s,(GLfloat) t); |
} |
static void |
loopback_TexCoord2i( GLint s, GLint t ) |
{ |
TEXCOORD2((GLfloat) s,(GLfloat) t); |
} |
static void |
loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) |
{ |
TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); |
} |
static void |
loopback_TexCoord3i( GLint s, GLint t, GLint r ) |
{ |
TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); |
} |
static void |
loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) |
{ |
TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); |
} |
static void |
loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) |
{ |
TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); |
} |
static void |
loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) |
{ |
TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); |
} |
static void |
loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) |
{ |
TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); |
} |
static void |
loopback_TexCoord1dv( const GLdouble *v ) |
{ |
TEXCOORD1((GLfloat) v[0]); |
} |
static void |
loopback_TexCoord1iv( const GLint *v ) |
{ |
TEXCOORD1((GLfloat) v[0]); |
} |
static void |
loopback_TexCoord1sv( const GLshort *v ) |
{ |
TEXCOORD1((GLfloat) v[0]); |
} |
static void |
loopback_TexCoord2dv( const GLdouble *v ) |
{ |
TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); |
} |
static void |
loopback_TexCoord2iv( const GLint *v ) |
{ |
TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); |
} |
static void |
loopback_TexCoord2sv( const GLshort *v ) |
{ |
TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); |
} |
static void |
loopback_TexCoord3dv( const GLdouble *v ) |
{ |
TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); |
} |
static void |
loopback_TexCoord3iv( const GLint *v ) |
{ |
TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); |
} |
static void |
loopback_TexCoord3sv( const GLshort *v ) |
{ |
TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); |
} |
static void |
loopback_TexCoord4dv( const GLdouble *v ) |
{ |
TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); |
} |
static void |
loopback_TexCoord4iv( const GLint *v ) |
{ |
TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); |
} |
static void |
loopback_TexCoord4sv( const GLshort *v ) |
{ |
TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); |
} |
static void |
loopback_Vertex2d( GLdouble x, GLdouble y ) |
{ |
VERTEX2( (GLfloat) x, (GLfloat) y ); |
} |
static void |
loopback_Vertex2i( GLint x, GLint y ) |
{ |
VERTEX2( (GLfloat) x, (GLfloat) y ); |
} |
static void |
loopback_Vertex2s( GLshort x, GLshort y ) |
{ |
VERTEX2( (GLfloat) x, (GLfloat) y ); |
} |
static void |
loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) |
{ |
VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); |
} |
static void |
loopback_Vertex3i( GLint x, GLint y, GLint z ) |
{ |
VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); |
} |
static void |
loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) |
{ |
VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); |
} |
static void |
loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) |
{ |
VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); |
} |
static void |
loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) |
{ |
VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); |
} |
static void |
loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) |
{ |
VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); |
} |
static void |
loopback_Vertex2dv( const GLdouble *v ) |
{ |
VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_Vertex2iv( const GLint *v ) |
{ |
VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_Vertex2sv( const GLshort *v ) |
{ |
VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_Vertex3dv( const GLdouble *v ) |
{ |
VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_Vertex3iv( const GLint *v ) |
{ |
VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_Vertex3sv( const GLshort *v ) |
{ |
VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_Vertex4dv( const GLdouble *v ) |
{ |
VERTEX4( (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_Vertex4iv( const GLint *v ) |
{ |
VERTEX4( (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_Vertex4sv( const GLshort *v ) |
{ |
VERTEX4( (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) s ); |
} |
static void |
loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) v[0] ); |
} |
static void |
loopback_MultiTexCoord1iARB(GLenum target, GLint s) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) s ); |
} |
static void |
loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) v[0] ); |
} |
static void |
loopback_MultiTexCoord1sARB(GLenum target, GLshort s) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) s ); |
} |
static void |
loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) |
{ |
MULTI_TEXCOORD1( target, (GLfloat) v[0] ); |
} |
static void |
loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); |
} |
static void |
loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); |
} |
static void |
loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); |
} |
static void |
loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) |
{ |
MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); |
} |
static void |
loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); |
} |
static void |
loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); |
} |
static void |
loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); |
} |
static void |
loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) |
{ |
MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, |
(GLfloat) r, (GLfloat) q ); |
} |
static void |
loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, |
(GLfloat) r, (GLfloat) q ); |
} |
static void |
loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, |
(GLfloat) r, (GLfloat) q ); |
} |
static void |
loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) |
{ |
MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3] ); |
} |
static void |
loopback_EvalCoord2dv( const GLdouble *u ) |
{ |
EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); |
} |
static void |
loopback_EvalCoord2fv( const GLfloat *u ) |
{ |
EVALCOORD2( u[0], u[1] ); |
} |
static void |
loopback_EvalCoord2d( GLdouble u, GLdouble v ) |
{ |
EVALCOORD2( (GLfloat) u, (GLfloat) v ); |
} |
static void |
loopback_EvalCoord1dv( const GLdouble *u ) |
{ |
EVALCOORD1( (GLfloat) *u ); |
} |
static void |
loopback_EvalCoord1fv( const GLfloat *u ) |
{ |
EVALCOORD1( (GLfloat) *u ); |
} |
static void |
loopback_EvalCoord1d( GLdouble u ) |
{ |
EVALCOORD1( (GLfloat) u ); |
} |
static void |
loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) |
{ |
GLfloat fparam[4]; |
fparam[0] = param; |
MATERIALFV( face, pname, fparam ); |
} |
static void |
loopback_Materiali(GLenum face, GLenum pname, GLint param ) |
{ |
GLfloat p = (GLfloat) param; |
MATERIALFV(face, pname, &p); |
} |
static void |
loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
switch (pname) { |
case GL_AMBIENT: |
case GL_DIFFUSE: |
case GL_SPECULAR: |
case GL_EMISSION: |
case GL_AMBIENT_AND_DIFFUSE: |
fparam[0] = INT_TO_FLOAT( params[0] ); |
fparam[1] = INT_TO_FLOAT( params[1] ); |
fparam[2] = INT_TO_FLOAT( params[2] ); |
fparam[3] = INT_TO_FLOAT( params[3] ); |
break; |
case GL_SHININESS: |
fparam[0] = (GLfloat) params[0]; |
break; |
case GL_COLOR_INDEXES: |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = (GLfloat) params[1]; |
fparam[2] = (GLfloat) params[2]; |
break; |
default: |
; |
} |
MATERIALFV(face, pname, fparam); |
} |
static void |
loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) |
{ |
RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); |
} |
static void |
loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) |
{ |
RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); |
} |
static void |
loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) |
{ |
RECTF(v1[0], v1[1], v2[0], v2[1]); |
} |
static void |
loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) |
{ |
RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); |
} |
static void |
loopback_Rectiv(const GLint *v1, const GLint *v2) |
{ |
RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); |
} |
static void |
loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) |
{ |
RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); |
} |
static void |
loopback_Rectsv(const GLshort *v1, const GLshort *v2) |
{ |
RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); |
} |
static void |
loopback_SecondaryColor3bEXT( GLbyte red, GLbyte green, GLbyte blue ) |
{ |
SECONDARYCOLORUB( BYTE_TO_UBYTE(red), |
BYTE_TO_UBYTE(green), |
BYTE_TO_UBYTE(blue) ); |
} |
static void |
loopback_SecondaryColor3dEXT( GLdouble red, GLdouble green, GLdouble blue ) |
{ |
GLubyte col[3]; |
GLfloat r = (GLfloat) red; |
GLfloat g = (GLfloat) green; |
GLfloat b = (GLfloat) blue; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
SECONDARYCOLORUB( col[0], col[1], col[2] ); |
} |
static void |
loopback_SecondaryColor3iEXT( GLint red, GLint green, GLint blue ) |
{ |
SECONDARYCOLORUB( INT_TO_UBYTE(red), |
INT_TO_UBYTE(green), |
INT_TO_UBYTE(blue)); |
} |
static void |
loopback_SecondaryColor3sEXT( GLshort red, GLshort green, GLshort blue ) |
{ |
SECONDARYCOLORUB(SHORT_TO_UBYTE(red), |
SHORT_TO_UBYTE(green), |
SHORT_TO_UBYTE(blue)); |
} |
static void |
loopback_SecondaryColor3uiEXT( GLuint red, GLuint green, GLuint blue ) |
{ |
SECONDARYCOLORUB(UINT_TO_UBYTE(red), |
UINT_TO_UBYTE(green), |
UINT_TO_UBYTE(blue)); |
} |
static void |
loopback_SecondaryColor3usEXT( GLushort red, GLushort green, GLushort blue ) |
{ |
SECONDARYCOLORUB(USHORT_TO_UBYTE(red), |
USHORT_TO_UBYTE(green), |
USHORT_TO_UBYTE(blue)); |
} |
static void |
loopback_SecondaryColor3bvEXT( const GLbyte *v ) |
{ |
const GLfloat a = BYTE_TO_FLOAT(v[0]); |
const GLfloat b = BYTE_TO_FLOAT(v[1]); |
const GLfloat c = BYTE_TO_FLOAT(v[2]); |
SECONDARYCOLORF(a,b,c); |
} |
static void |
loopback_SecondaryColor3dvEXT( const GLdouble *v ) |
{ |
GLubyte col[3]; |
GLfloat r = (GLfloat) v[0]; |
GLfloat g = (GLfloat) v[1]; |
GLfloat b = (GLfloat) v[2]; |
UNCLAMPED_FLOAT_TO_UBYTE(col[0], r); |
UNCLAMPED_FLOAT_TO_UBYTE(col[1], g); |
UNCLAMPED_FLOAT_TO_UBYTE(col[2], b); |
SECONDARYCOLORUB( col[0], col[1], col[2] ); |
} |
static void |
loopback_SecondaryColor3ivEXT( const GLint *v ) |
{ |
SECONDARYCOLORUB(INT_TO_UBYTE(v[0]), |
INT_TO_UBYTE(v[1]), |
INT_TO_UBYTE(v[2])); |
} |
static void |
loopback_SecondaryColor3svEXT( const GLshort *v ) |
{ |
SECONDARYCOLORUB(SHORT_TO_UBYTE(v[0]), |
SHORT_TO_UBYTE(v[1]), |
SHORT_TO_UBYTE(v[2])); |
} |
static void |
loopback_SecondaryColor3uivEXT( const GLuint *v ) |
{ |
SECONDARYCOLORUB(UINT_TO_UBYTE(v[0]), |
UINT_TO_UBYTE(v[1]), |
UINT_TO_UBYTE(v[2])); |
} |
static void |
loopback_SecondaryColor3usvEXT( const GLushort *v ) |
{ |
SECONDARYCOLORUB(USHORT_TO_UBYTE(v[0]), |
USHORT_TO_UBYTE(v[1]), |
USHORT_TO_UBYTE(v[2])); |
} |
static void |
loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) |
{ |
SECONDARYCOLORF( BYTE_TO_FLOAT(red), |
BYTE_TO_FLOAT(green), |
BYTE_TO_FLOAT(blue) ); |
} |
static void |
loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) |
{ |
SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); |
} |
static void |
loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) |
{ |
SECONDARYCOLORF( INT_TO_FLOAT(red), |
INT_TO_FLOAT(green), |
INT_TO_FLOAT(blue)); |
} |
static void |
loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) |
{ |
SECONDARYCOLORF(SHORT_TO_FLOAT(red), |
SHORT_TO_FLOAT(green), |
SHORT_TO_FLOAT(blue)); |
} |
static void |
loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) |
{ |
SECONDARYCOLORF(UINT_TO_FLOAT(red), |
UINT_TO_FLOAT(green), |
UINT_TO_FLOAT(blue)); |
} |
static void |
loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) |
{ |
SECONDARYCOLORF(USHORT_TO_FLOAT(red), |
USHORT_TO_FLOAT(green), |
USHORT_TO_FLOAT(blue)); |
} |
static void |
loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) |
{ |
SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), |
BYTE_TO_FLOAT(v[1]), |
BYTE_TO_FLOAT(v[2])); |
} |
static void |
loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) |
{ |
SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); |
} |
static void |
loopback_SecondaryColor3ivEXT_f( const GLint *v ) |
{ |
SECONDARYCOLORF(INT_TO_FLOAT(v[0]), |
INT_TO_FLOAT(v[1]), |
INT_TO_FLOAT(v[2])); |
} |
static void |
loopback_SecondaryColor3svEXT_f( const GLshort *v ) |
{ |
SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), |
SHORT_TO_FLOAT(v[1]), |
SHORT_TO_FLOAT(v[2])); |
} |
static void |
loopback_SecondaryColor3uivEXT_f( const GLuint *v ) |
{ |
SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), |
UINT_TO_FLOAT(v[1]), |
UINT_TO_FLOAT(v[2])); |
} |
static void |
loopback_SecondaryColor3usvEXT_f( const GLushort *v ) |
{ |
SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), |
USHORT_TO_FLOAT(v[1]), |
USHORT_TO_FLOAT(v[2])); |
} |
/* |
* GL_NV_vertex_program |
*/ |
static void |
loopback_VertexAttrib1sNV(GLuint index, GLshort x) |
{ |
ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib1fNV(GLuint index, GLfloat x) |
{ |
ATTRIB(index, x, 0.0F, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib1dNV(GLuint index, GLdouble x) |
{ |
ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) |
{ |
ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) |
{ |
ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) |
{ |
ATTRIB(index, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) |
{ |
ATTRIB(index, (GLfloat) x, y, z, 1.0F); |
} |
static void |
loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) |
{ |
ATTRIB(index, x, y, z, 1.0F); |
} |
static void |
loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) |
{ |
ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
static void |
loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void |
loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
static void |
loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) |
{ |
ATTRIB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), |
UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); |
} |
static void |
loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) |
{ |
ATTRIB(index, (GLfloat) v[0], 0.0F, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v) |
{ |
ATTRIB(index, v[0], 0.0F, 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v) |
{ |
ATTRIB(index, v[0], v[1], 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
static void |
loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void |
loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v) |
{ |
ATTRIB(index, v[0], v[1], v[2], 1.0F); |
} |
static void |
loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void |
loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
static void |
loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v) |
{ |
ATTRIB(index, v[0], v[1], v[2], v[3]); |
} |
static void |
loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) |
{ |
ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); |
} |
static void |
loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) |
{ |
ATTRIB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), |
UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); |
} |
static void |
loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib1svNV(index + i, v + i); |
} |
static void |
loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib1fvNV(index + i, v + i); |
} |
static void |
loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib1dvNV(index + i, v + i); |
} |
static void |
loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib2svNV(index + i, v + 2 * i); |
} |
static void |
loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib2fvNV(index + i, v + 2 * i); |
} |
static void |
loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib2dvNV(index + i, v + 2 * i); |
} |
static void |
loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib3svNV(index + i, v + 3 * i); |
} |
static void |
loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib3fvNV(index + i, v + 3 * i); |
} |
static void |
loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib3dvNV(index + i, v + 3 * i); |
} |
static void |
loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib4svNV(index + i, v + 4 * i); |
} |
static void |
loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib4fvNV(index + i, v + 4 * i); |
} |
static void |
loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib4dvNV(index + i, v + 4 * i); |
} |
static void |
loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) |
{ |
GLint i; |
for (i = n - 1; i >= 0; i--) |
loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); |
} |
void |
_mesa_loopback_prefer_float( struct _glapi_table *dest, |
GLboolean prefer_float_colors ) |
{ |
if (!prefer_float_colors) { |
dest->Color3b = loopback_Color3b; |
dest->Color3d = loopback_Color3d; |
dest->Color3i = loopback_Color3i; |
dest->Color3s = loopback_Color3s; |
dest->Color3ui = loopback_Color3ui; |
dest->Color3us = loopback_Color3us; |
dest->Color4b = loopback_Color4b; |
dest->Color4d = loopback_Color4d; |
dest->Color4i = loopback_Color4i; |
dest->Color4s = loopback_Color4s; |
dest->Color4ui = loopback_Color4ui; |
dest->Color4us = loopback_Color4us; |
dest->Color3bv = loopback_Color3bv; |
dest->Color3dv = loopback_Color3dv; |
dest->Color3iv = loopback_Color3iv; |
dest->Color3sv = loopback_Color3sv; |
dest->Color3uiv = loopback_Color3uiv; |
dest->Color3usv = loopback_Color3usv; |
dest->Color4bv = loopback_Color4bv; |
dest->Color4dv = loopback_Color4dv; |
dest->Color4iv = loopback_Color4iv; |
dest->Color4sv = loopback_Color4sv; |
dest->Color4uiv = loopback_Color4uiv; |
dest->Color4usv = loopback_Color4usv; |
dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT; |
dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT; |
dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT; |
dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT; |
dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT; |
dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT; |
dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT; |
dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT; |
dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT; |
dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT; |
dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT; |
dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT; |
} |
else { |
dest->Color3b = loopback_Color3b_f; |
dest->Color3d = loopback_Color3d_f; |
dest->Color3i = loopback_Color3i_f; |
dest->Color3s = loopback_Color3s_f; |
dest->Color3ui = loopback_Color3ui_f; |
dest->Color3us = loopback_Color3us_f; |
dest->Color4b = loopback_Color4b_f; |
dest->Color4d = loopback_Color4d_f; |
dest->Color4i = loopback_Color4i_f; |
dest->Color4s = loopback_Color4s_f; |
dest->Color4ui = loopback_Color4ui_f; |
dest->Color4us = loopback_Color4us_f; |
dest->Color3bv = loopback_Color3bv_f; |
dest->Color3dv = loopback_Color3dv_f; |
dest->Color3iv = loopback_Color3iv_f; |
dest->Color3sv = loopback_Color3sv_f; |
dest->Color3uiv = loopback_Color3uiv_f; |
dest->Color3usv = loopback_Color3usv_f; |
dest->Color4bv = loopback_Color4bv_f; |
dest->Color4dv = loopback_Color4dv_f; |
dest->Color4iv = loopback_Color4iv_f; |
dest->Color4sv = loopback_Color4sv_f; |
dest->Color4uiv = loopback_Color4uiv_f; |
dest->Color4usv = loopback_Color4usv_f; |
dest->SecondaryColor3bEXT = loopback_SecondaryColor3bEXT_f; |
dest->SecondaryColor3dEXT = loopback_SecondaryColor3dEXT_f; |
dest->SecondaryColor3iEXT = loopback_SecondaryColor3iEXT_f; |
dest->SecondaryColor3sEXT = loopback_SecondaryColor3sEXT_f; |
dest->SecondaryColor3uiEXT = loopback_SecondaryColor3uiEXT_f; |
dest->SecondaryColor3usEXT = loopback_SecondaryColor3usEXT_f; |
dest->SecondaryColor3bvEXT = loopback_SecondaryColor3bvEXT_f; |
dest->SecondaryColor3dvEXT = loopback_SecondaryColor3dvEXT_f; |
dest->SecondaryColor3ivEXT = loopback_SecondaryColor3ivEXT_f; |
dest->SecondaryColor3svEXT = loopback_SecondaryColor3svEXT_f; |
dest->SecondaryColor3uivEXT = loopback_SecondaryColor3uivEXT_f; |
dest->SecondaryColor3usvEXT = loopback_SecondaryColor3usvEXT_f; |
} |
} |
/* Passing prefer_float_colors as true will mean that all colors |
* *except* Color{34}ub{v} are passed as floats. Setting it false will |
* mean all colors *except* Color{34}f{v} are passed as ubytes. |
* |
* This code never registers handlers for any of the entry points |
* listed in vtxfmt.h. |
*/ |
void |
_mesa_loopback_init_api_table( struct _glapi_table *dest, |
GLboolean prefer_float_colors ) |
{ |
_mesa_loopback_prefer_float( dest, prefer_float_colors ); |
dest->Indexd = loopback_Indexd; |
dest->Indexf = loopback_Indexf; |
dest->Indexs = loopback_Indexs; |
dest->Indexub = loopback_Indexub; |
dest->Indexdv = loopback_Indexdv; |
dest->Indexfv = loopback_Indexfv; |
dest->Indexiv = loopback_Indexiv; |
dest->Indexsv = loopback_Indexsv; |
dest->Indexubv = loopback_Indexubv; |
dest->Normal3b = loopback_Normal3b; |
dest->Normal3d = loopback_Normal3d; |
dest->Normal3i = loopback_Normal3i; |
dest->Normal3s = loopback_Normal3s; |
dest->Normal3bv = loopback_Normal3bv; |
dest->Normal3dv = loopback_Normal3dv; |
dest->Normal3iv = loopback_Normal3iv; |
dest->Normal3sv = loopback_Normal3sv; |
dest->TexCoord1d = loopback_TexCoord1d; |
dest->TexCoord1i = loopback_TexCoord1i; |
dest->TexCoord1s = loopback_TexCoord1s; |
dest->TexCoord2d = loopback_TexCoord2d; |
dest->TexCoord2s = loopback_TexCoord2s; |
dest->TexCoord2i = loopback_TexCoord2i; |
dest->TexCoord3d = loopback_TexCoord3d; |
dest->TexCoord3i = loopback_TexCoord3i; |
dest->TexCoord3s = loopback_TexCoord3s; |
dest->TexCoord4d = loopback_TexCoord4d; |
dest->TexCoord4i = loopback_TexCoord4i; |
dest->TexCoord4s = loopback_TexCoord4s; |
dest->TexCoord1dv = loopback_TexCoord1dv; |
dest->TexCoord1iv = loopback_TexCoord1iv; |
dest->TexCoord1sv = loopback_TexCoord1sv; |
dest->TexCoord2dv = loopback_TexCoord2dv; |
dest->TexCoord2iv = loopback_TexCoord2iv; |
dest->TexCoord2sv = loopback_TexCoord2sv; |
dest->TexCoord3dv = loopback_TexCoord3dv; |
dest->TexCoord3iv = loopback_TexCoord3iv; |
dest->TexCoord3sv = loopback_TexCoord3sv; |
dest->TexCoord4dv = loopback_TexCoord4dv; |
dest->TexCoord4iv = loopback_TexCoord4iv; |
dest->TexCoord4sv = loopback_TexCoord4sv; |
dest->Vertex2d = loopback_Vertex2d; |
dest->Vertex2i = loopback_Vertex2i; |
dest->Vertex2s = loopback_Vertex2s; |
dest->Vertex3d = loopback_Vertex3d; |
dest->Vertex3i = loopback_Vertex3i; |
dest->Vertex3s = loopback_Vertex3s; |
dest->Vertex4d = loopback_Vertex4d; |
dest->Vertex4i = loopback_Vertex4i; |
dest->Vertex4s = loopback_Vertex4s; |
dest->Vertex2dv = loopback_Vertex2dv; |
dest->Vertex2iv = loopback_Vertex2iv; |
dest->Vertex2sv = loopback_Vertex2sv; |
dest->Vertex3dv = loopback_Vertex3dv; |
dest->Vertex3iv = loopback_Vertex3iv; |
dest->Vertex3sv = loopback_Vertex3sv; |
dest->Vertex4dv = loopback_Vertex4dv; |
dest->Vertex4iv = loopback_Vertex4iv; |
dest->Vertex4sv = loopback_Vertex4sv; |
dest->MultiTexCoord1dARB = loopback_MultiTexCoord1dARB; |
dest->MultiTexCoord1dvARB = loopback_MultiTexCoord1dvARB; |
dest->MultiTexCoord1iARB = loopback_MultiTexCoord1iARB; |
dest->MultiTexCoord1ivARB = loopback_MultiTexCoord1ivARB; |
dest->MultiTexCoord1sARB = loopback_MultiTexCoord1sARB; |
dest->MultiTexCoord1svARB = loopback_MultiTexCoord1svARB; |
dest->MultiTexCoord2dARB = loopback_MultiTexCoord2dARB; |
dest->MultiTexCoord2dvARB = loopback_MultiTexCoord2dvARB; |
dest->MultiTexCoord2iARB = loopback_MultiTexCoord2iARB; |
dest->MultiTexCoord2ivARB = loopback_MultiTexCoord2ivARB; |
dest->MultiTexCoord2sARB = loopback_MultiTexCoord2sARB; |
dest->MultiTexCoord2svARB = loopback_MultiTexCoord2svARB; |
dest->MultiTexCoord3dARB = loopback_MultiTexCoord3dARB; |
dest->MultiTexCoord3dvARB = loopback_MultiTexCoord3dvARB; |
dest->MultiTexCoord3iARB = loopback_MultiTexCoord3iARB; |
dest->MultiTexCoord3ivARB = loopback_MultiTexCoord3ivARB; |
dest->MultiTexCoord3sARB = loopback_MultiTexCoord3sARB; |
dest->MultiTexCoord3svARB = loopback_MultiTexCoord3svARB; |
dest->MultiTexCoord4dARB = loopback_MultiTexCoord4dARB; |
dest->MultiTexCoord4dvARB = loopback_MultiTexCoord4dvARB; |
dest->MultiTexCoord4iARB = loopback_MultiTexCoord4iARB; |
dest->MultiTexCoord4ivARB = loopback_MultiTexCoord4ivARB; |
dest->MultiTexCoord4sARB = loopback_MultiTexCoord4sARB; |
dest->MultiTexCoord4svARB = loopback_MultiTexCoord4svARB; |
dest->EvalCoord2dv = loopback_EvalCoord2dv; |
dest->EvalCoord2fv = loopback_EvalCoord2fv; |
dest->EvalCoord2d = loopback_EvalCoord2d; |
dest->EvalCoord1dv = loopback_EvalCoord1dv; |
dest->EvalCoord1fv = loopback_EvalCoord1fv; |
dest->EvalCoord1d = loopback_EvalCoord1d; |
dest->Materialf = loopback_Materialf; |
dest->Materiali = loopback_Materiali; |
dest->Materialiv = loopback_Materialiv; |
dest->Rectd = loopback_Rectd; |
dest->Rectdv = loopback_Rectdv; |
dest->Rectfv = loopback_Rectfv; |
dest->Recti = loopback_Recti; |
dest->Rectiv = loopback_Rectiv; |
dest->Rects = loopback_Rects; |
dest->Rectsv = loopback_Rectsv; |
dest->FogCoorddEXT = loopback_FogCoorddEXT; |
dest->FogCoorddvEXT = loopback_FogCoorddvEXT; |
dest->VertexAttrib1sNV = loopback_VertexAttrib1sNV; |
dest->VertexAttrib1fNV = loopback_VertexAttrib1fNV; |
dest->VertexAttrib1dNV = loopback_VertexAttrib1dNV; |
dest->VertexAttrib2sNV = loopback_VertexAttrib2sNV; |
dest->VertexAttrib2fNV = loopback_VertexAttrib2fNV; |
dest->VertexAttrib2dNV = loopback_VertexAttrib2dNV; |
dest->VertexAttrib3sNV = loopback_VertexAttrib3sNV; |
dest->VertexAttrib3fNV = loopback_VertexAttrib3fNV; |
dest->VertexAttrib3dNV = loopback_VertexAttrib3dNV; |
dest->VertexAttrib4sNV = loopback_VertexAttrib4sNV; |
dest->VertexAttrib4dNV = loopback_VertexAttrib4dNV; |
dest->VertexAttrib4ubNV = loopback_VertexAttrib4ubNV; |
dest->VertexAttrib1svNV = loopback_VertexAttrib1svNV; |
dest->VertexAttrib1fvNV = loopback_VertexAttrib1fvNV; |
dest->VertexAttrib1dvNV = loopback_VertexAttrib1dvNV; |
dest->VertexAttrib2svNV = loopback_VertexAttrib2svNV; |
dest->VertexAttrib2fvNV = loopback_VertexAttrib2fvNV; |
dest->VertexAttrib2dvNV = loopback_VertexAttrib2dvNV; |
dest->VertexAttrib3svNV = loopback_VertexAttrib3svNV; |
dest->VertexAttrib3fvNV = loopback_VertexAttrib3fvNV; |
dest->VertexAttrib3dvNV = loopback_VertexAttrib3dvNV; |
dest->VertexAttrib4svNV = loopback_VertexAttrib4svNV; |
dest->VertexAttrib4fvNV = loopback_VertexAttrib4fvNV; |
dest->VertexAttrib4dvNV = loopback_VertexAttrib4dvNV; |
dest->VertexAttrib4ubvNV = loopback_VertexAttrib4ubvNV; |
dest->VertexAttribs1svNV = loopback_VertexAttribs1svNV; |
dest->VertexAttribs1fvNV = loopback_VertexAttribs1fvNV; |
dest->VertexAttribs1dvNV = loopback_VertexAttribs1dvNV; |
dest->VertexAttribs2svNV = loopback_VertexAttribs2svNV; |
dest->VertexAttribs2fvNV = loopback_VertexAttribs2fvNV; |
dest->VertexAttribs2dvNV = loopback_VertexAttribs2dvNV; |
dest->VertexAttribs3svNV = loopback_VertexAttribs3svNV; |
dest->VertexAttribs3fvNV = loopback_VertexAttribs3fvNV; |
dest->VertexAttribs3dvNV = loopback_VertexAttribs3dvNV; |
dest->VertexAttribs4svNV = loopback_VertexAttribs4svNV; |
dest->VertexAttribs4fvNV = loopback_VertexAttribs4fvNV; |
dest->VertexAttribs4dvNV = loopback_VertexAttribs4dvNV; |
dest->VertexAttribs4ubvNV = loopback_VertexAttribs4ubvNV; |
} |
/shark/tags/rel_0_4/ports/mesa/src/texutil_tmp.h |
---|
0,0 → 1,479 |
/* $Id: texutil_tmp.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.2 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Author: |
* Gareth Hughes |
*/ |
/* |
* For 2D and 3D texture images, we generate functions for |
* - conversion without pixel unpacking and standard stride |
* - conversion without pixel unpacking and non-standard stride |
* - conversion with pixel unpacking and standard stride |
* - conversion with pixel unpacking and non-standard stride |
* |
* |
* Macros which need to be defined before including this file: |
* TAG(x) - the function name wrapper |
* DST_TYPE - the destination texel datatype (GLuint, GLushort, etc) |
* DST_TEXELS_PER_DWORD - number of dest texels that'll fit in 4 bytes |
* CONVERT_TEXEL - code to convert from source to dest texel |
* CONVER_TEXEL_DWORD - if multiple texels fit in 4 bytes, this macros |
* will convert/store multiple texels at once |
* CONVERT_DIRECT - if defined, just memcpy texels from src to dest |
* SRC_TEXEL_BYTES - bytes per source texel |
* PRESERVE_DST_TYPE - if defined, don't undefined these macros at end |
*/ |
#define DST_TEXEL_BYTES (4 / DST_TEXELS_PER_DWORD) |
#define DST_ROW_BYTES (convert->width * DST_TEXEL_BYTES) |
#define DST_ROW_STRIDE (convert->dstImageWidth * DST_TEXEL_BYTES) |
#define DST_IMG_STRIDE (convert->dstImageWidth * \ |
convert->dstImageHeight * DST_TEXEL_BYTES) |
/* ============================================================= |
* PRE: No pixelstore attribs, width == dstImageWidth. |
*/ |
static GLboolean |
TAG(texsubimage2d)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *)convert->srcImage; |
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + |
(convert->yoffset * convert->dstImageWidth + |
convert->xoffset) * DST_TEXEL_BYTES); |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ "\n" ); |
#endif |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, convert->height * DST_ROW_BYTES ); |
#else |
{ |
const GLint texels = convert->width * convert->height; |
const GLint dwords = texels / DST_TEXELS_PER_DWORD; |
const GLint leftover = texels - dwords * DST_TEXELS_PER_DWORD; |
GLint i; |
for ( i = 0 ; i < dwords ; i++ ) { |
CONVERT_TEXEL_DWORD( *dst++, src ); |
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; |
} |
for ( i = 0; i < leftover; i++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
} |
#endif |
return GL_TRUE; |
} |
/* PRE: As above, height == dstImageHeight also. |
*/ |
static GLboolean |
TAG(texsubimage3d)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *)convert->srcImage; |
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + |
((convert->zoffset * convert->height + |
convert->yoffset) * convert->width + |
convert->xoffset) * DST_TEXEL_BYTES); |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ "\n" ); |
#endif |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, convert->depth * convert->height * DST_ROW_BYTES ); |
#else |
{ |
const GLint texels = convert->width * convert->height * convert->depth; |
const GLint dwords = texels / DST_TEXELS_PER_DWORD; |
const GLint leftover = texels - dwords * DST_TEXELS_PER_DWORD; |
GLint i; |
for ( i = 0 ; i < dwords ; i++ ) { |
CONVERT_TEXEL_DWORD( *dst++, src ); |
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; |
} |
for ( i = 0; i < leftover; i++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
} |
#endif |
return GL_TRUE; |
} |
/* ============================================================= |
* PRE: No pixelstore attribs, width != dstImageWidth. |
*/ |
static GLboolean |
TAG(texsubimage2d_stride)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *)convert->srcImage; |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
(convert->yoffset * convert->dstImageWidth + |
convert->xoffset) * DST_TEXEL_BYTES); |
GLint adjust; |
GLint row, col; |
adjust = convert->dstImageWidth - convert->width; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ ":\n" ); |
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", |
convert->xoffset, convert->yoffset, convert->width, |
convert->height, convert->dstImageWidth ); |
_mesa_debug( NULL, " adjust=%d\n", adjust ); |
#endif |
for ( row = 0 ; row < convert->height ; row++ ) { |
for ( col = 0 ; col < convert->width ; col++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
dst += adjust; |
} |
return GL_TRUE; |
} |
/* PRE: As above, or height != dstImageHeight also. |
*/ |
static GLboolean |
TAG(texsubimage3d_stride)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *)convert->srcImage; |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
((convert->zoffset * convert->dstImageHeight + |
convert->yoffset) * convert->dstImageWidth + |
convert->xoffset) * DST_TEXEL_BYTES); |
GLint adjust; |
GLint row, col, img; |
adjust = convert->dstImageWidth - convert->width; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ ":\n" ); |
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", |
convert->xoffset, convert->yoffset, convert->width, |
convert->height, convert->dstImageWidth ); |
_mesa_debug( NULL, " adjust=%d\n", adjust ); |
#endif |
for ( img = 0 ; img < convert->depth ; img++ ) { |
for ( row = 0 ; row < convert->height ; row++ ) { |
for ( col = 0 ; col < convert->width ; col++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
dst += adjust; |
} |
/* FIXME: ... */ |
} |
return GL_TRUE; |
} |
/* ============================================================= |
* PRE: Require pixelstore attribs, width == dstImageWidth. |
*/ |
static GLboolean |
TAG(texsubimage2d_unpack)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 0, 0, 0 ); |
const GLint srcRowStride = |
_mesa_image_row_stride( convert->unpacking, convert->width, |
convert->format, convert->type ); |
GLint row, col; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ "\n" ); |
#endif |
if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { |
/* Can't use dword conversion (i.e. when width = 1 and texels/dword = 2 |
* or width = 2 and texels/dword = 4). |
*/ |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
(convert->yoffset * convert->width + |
convert->xoffset) * DST_TEXEL_BYTES); |
for ( row = 0 ; row < convert->height ; row++ ) { |
const GLubyte *srcRow = src; |
for ( col = 0; col < convert->width; col++ ) { |
CONVERT_TEXEL(*dst, src); |
src += SRC_TEXEL_BYTES; |
} |
src = srcRow + srcRowStride; |
} |
} |
else { |
/* the common case */ |
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + |
(convert->yoffset * convert->width + |
convert->xoffset) * DST_TEXEL_BYTES); |
for ( row = 0 ; row < convert->height ; row++ ) { |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, DST_ROW_STRIDE ); |
src += srcRowStride; |
dst = (GLuint *)((GLubyte *)dst + DST_ROW_STRIDE); |
#else |
const GLubyte *srcRow = src; |
for ( col = convert->width / DST_TEXELS_PER_DWORD ; col ; col-- ) { |
CONVERT_TEXEL_DWORD( *dst++, src ); |
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; |
} |
src = srcRow + srcRowStride; |
#endif |
} |
} |
return GL_TRUE; |
} |
/* PRE: as above, height == dstImageHeight also. |
*/ |
static GLboolean |
TAG(texsubimage3d_unpack)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 0, 0, 0 ); |
const GLint srcImgStride = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 1, 0, 0 ) - src; |
const GLint srcRowStride = |
_mesa_image_row_stride( convert->unpacking, convert->width, |
convert->format, convert->type ); |
GLint row, col, img; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ "\n" ); |
#endif |
if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { |
/* Can't use dword conversion (i.e. when width = 1 and texels/dword = 2 |
* or width = 2 and texels/dword = 4). |
*/ |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
((convert->zoffset * convert->height + |
convert->yoffset) * convert->width + |
convert->xoffset) * DST_TEXEL_BYTES); |
for ( img = 0 ; img < convert->depth ; img++ ) { |
const GLubyte *srcImage = src; |
for ( row = 0 ; row < convert->height ; row++ ) { |
const GLubyte *srcRow = src; |
for ( col = 0; col < convert->width; col++ ) { |
CONVERT_TEXEL(*dst, src); |
src += SRC_TEXEL_BYTES; |
} |
src = srcRow + srcRowStride; |
} |
src = srcImage + srcImgStride; |
} |
} |
else { |
/* the common case */ |
GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + |
((convert->zoffset * convert->height + |
convert->yoffset) * convert->width + |
convert->xoffset) * DST_TEXEL_BYTES); |
for ( img = 0 ; img < convert->depth ; img++ ) { |
const GLubyte *srcImage = src; |
for ( row = 0 ; row < convert->height ; row++ ) { |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, DST_ROW_STRIDE ); |
src += srcRowStride; |
dst = (GLuint *)((GLubyte *)dst + DST_ROW_STRIDE); |
#else |
const GLubyte *srcRow = src; |
for ( col = convert->width / DST_TEXELS_PER_DWORD ; col ; col-- ) { |
CONVERT_TEXEL_DWORD( *dst++, src ); |
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD; |
} |
src = srcRow + srcRowStride; |
#endif |
} |
src = srcImage + srcImgStride; |
} |
} |
return GL_TRUE; |
} |
/* ============================================================= |
* PRE: Require pixelstore attribs, width != dstImageWidth. |
*/ |
static GLboolean |
TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 0, 0, 0 ); |
const GLint srcRowStride = |
_mesa_image_row_stride( convert->unpacking, convert->width, |
convert->format, convert->type ); |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
(convert->yoffset * convert->dstImageWidth + |
convert->xoffset) * DST_TEXEL_BYTES); |
GLint adjust; |
GLint row, col; |
(void) col; |
adjust = convert->dstImageWidth - convert->width; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ ":\n" ); |
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", |
convert->xoffset, convert->yoffset, convert->width, |
convert->height, convert->dstImageWidth ); |
_mesa_debug( NULL, " adjust=%d\n", adjust ); |
#endif |
for ( row = 0 ; row < convert->height ; row++ ) { |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, DST_ROW_BYTES ); |
src += srcRowStride; |
dst += convert->dstImageWidth; |
#else |
const GLubyte *srcRow = src; |
for ( col = 0 ; col < convert->width ; col++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
src = srcRow + srcRowStride; |
dst += adjust; |
#endif |
} |
return GL_TRUE; |
} |
/* PRE: As above, or height != dstImageHeight also. |
*/ |
static GLboolean |
TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) |
{ |
const GLubyte *src = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 0, 0, 0 ); |
const GLint srcImgStride = (const GLubyte *) |
_mesa_image_address( convert->unpacking, convert->srcImage, |
convert->width, convert->height, |
convert->format, convert->type, 1, 0, 0 ) - src; |
const GLint srcRowStride = |
_mesa_image_row_stride( convert->unpacking, convert->width, |
convert->format, convert->type ); |
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + |
((convert->zoffset * convert->dstImageHeight + |
convert->yoffset) * convert->dstImageWidth + |
convert->xoffset) * DST_TEXEL_BYTES); |
GLint adjust; |
GLint row, col, img; |
(void) col; |
adjust = convert->dstImageWidth - convert->width; |
#if DEBUG_TEXUTIL |
_mesa_debug( NULL, __FUNCTION__ ":\n" ); |
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", |
convert->xoffset, convert->yoffset, convert->width, |
convert->height, convert->dstImageWidth ); |
_mesa_debug( NULL, " adjust=%d\n", adjust ); |
#endif |
for ( img = 0 ; img < convert->depth ; img++ ) { |
const GLubyte *srcImage = src; |
for ( row = 0 ; row < convert->height ; row++ ) { |
#ifdef CONVERT_DIRECT |
MEMCPY( dst, src, DST_ROW_BYTES ); |
src += srcRowStride; |
dst += convert->dstImageWidth; |
#else |
const GLubyte *srcRow = src; |
for ( col = 0 ; col < convert->width ; col++ ) { |
CONVERT_TEXEL( *dst++, src ); |
src += SRC_TEXEL_BYTES; |
} |
src = srcRow + srcRowStride; |
dst += adjust; |
#endif |
} |
src = srcImage + srcImgStride; |
} |
return GL_TRUE; |
} |
static convert_func TAG(texsubimage2d_tab)[] = { |
TAG(texsubimage2d), |
TAG(texsubimage2d_stride), |
TAG(texsubimage2d_unpack), |
TAG(texsubimage2d_stride_unpack), |
}; |
static convert_func TAG(texsubimage3d_tab)[] = { |
TAG(texsubimage3d), |
TAG(texsubimage3d_stride), |
TAG(texsubimage3d_unpack), |
TAG(texsubimage3d_stride_unpack), |
}; |
#ifndef PRESERVE_DST_TYPE |
#undef DST_TYPE |
#undef DST_TEXELS_PER_DWORD |
#endif |
#undef SRC_TEXEL_BYTES |
#undef DST_TEXEL_BYTES |
#undef DST_ROW_BYTES |
#undef DST_ROW_STRIDE |
#undef CONVERT_TEXEL |
#undef CONVERT_TEXEL_DWORD |
#undef CONVERT_DIRECT |
#undef TAG |
#undef PRESERVE_DST_TYPE |
/shark/tags/rel_0_4/ports/mesa/src/feedback.c |
---|
0,0 → 1,405 |
/* $Id: feedback.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "feedback.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
#define FB_3D 0x01 |
#define FB_4D 0x02 |
#define FB_INDEX 0x04 |
#define FB_COLOR 0x08 |
#define FB_TEXTURE 0X10 |
void |
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode==GL_FEEDBACK) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" ); |
return; |
} |
if (size<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" ); |
return; |
} |
if (!buffer) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" ); |
ctx->Feedback.BufferSize = 0; |
return; |
} |
switch (type) { |
case GL_2D: |
ctx->Feedback._Mask = 0; |
break; |
case GL_3D: |
ctx->Feedback._Mask = FB_3D; |
break; |
case GL_3D_COLOR: |
ctx->Feedback._Mask = (FB_3D | |
(ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX)); |
break; |
case GL_3D_COLOR_TEXTURE: |
ctx->Feedback._Mask = (FB_3D | |
(ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | |
FB_TEXTURE); |
break; |
case GL_4D_COLOR_TEXTURE: |
ctx->Feedback._Mask = (FB_3D | FB_4D | |
(ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | |
FB_TEXTURE); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */ |
ctx->Feedback.Type = type; |
ctx->Feedback.BufferSize = size; |
ctx->Feedback.Buffer = buffer; |
ctx->Feedback.Count = 0; /* Becaues of this. */ |
} |
void |
_mesa_PassThrough( GLfloat token ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode==GL_FEEDBACK) { |
FLUSH_VERTICES(ctx, 0); |
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); |
FEEDBACK_TOKEN( ctx, token ); |
} |
} |
/* |
* Put a vertex into the feedback buffer. |
*/ |
void _mesa_feedback_vertex( GLcontext *ctx, |
const GLfloat win[4], |
const GLfloat color[4], |
GLuint index, |
const GLfloat texcoord[4] ) |
{ |
FEEDBACK_TOKEN( ctx, win[0] ); |
FEEDBACK_TOKEN( ctx, win[1] ); |
if (ctx->Feedback._Mask & FB_3D) { |
FEEDBACK_TOKEN( ctx, win[2] ); |
} |
if (ctx->Feedback._Mask & FB_4D) { |
FEEDBACK_TOKEN( ctx, win[3] ); |
} |
if (ctx->Feedback._Mask & FB_INDEX) { |
FEEDBACK_TOKEN( ctx, (GLfloat) index ); |
} |
if (ctx->Feedback._Mask & FB_COLOR) { |
FEEDBACK_TOKEN( ctx, color[0] ); |
FEEDBACK_TOKEN( ctx, color[1] ); |
FEEDBACK_TOKEN( ctx, color[2] ); |
FEEDBACK_TOKEN( ctx, color[3] ); |
} |
if (ctx->Feedback._Mask & FB_TEXTURE) { |
FEEDBACK_TOKEN( ctx, texcoord[0] ); |
FEEDBACK_TOKEN( ctx, texcoord[1] ); |
FEEDBACK_TOKEN( ctx, texcoord[2] ); |
FEEDBACK_TOKEN( ctx, texcoord[3] ); |
} |
} |
/**********************************************************************/ |
/* Selection */ |
/**********************************************************************/ |
/* |
* NOTE: this function can't be put in a display list. |
*/ |
void |
_mesa_SelectBuffer( GLsizei size, GLuint *buffer ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode==GL_SELECT) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); |
return; /* KW: added return */ |
} |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* why bother? */ |
ctx->Select.Buffer = buffer; |
ctx->Select.BufferSize = size; |
ctx->Select.BufferCount = 0; |
ctx->Select.HitFlag = GL_FALSE; |
ctx->Select.HitMinZ = 1.0; |
ctx->Select.HitMaxZ = 0.0; |
} |
#define WRITE_RECORD( CTX, V ) \ |
if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \ |
CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \ |
} \ |
CTX->Select.BufferCount++; |
void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ) |
{ |
ctx->Select.HitFlag = GL_TRUE; |
if (z < ctx->Select.HitMinZ) { |
ctx->Select.HitMinZ = z; |
} |
if (z > ctx->Select.HitMaxZ) { |
ctx->Select.HitMaxZ = z; |
} |
} |
static void write_hit_record( GLcontext *ctx ) |
{ |
GLuint i; |
GLuint zmin, zmax, zscale = (~0u); |
/* HitMinZ and HitMaxZ are in [0,1]. Multiply these values by */ |
/* 2^32-1 and round to nearest unsigned integer. */ |
assert( ctx != NULL ); /* this line magically fixes a SunOS 5.x/gcc bug */ |
zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ); |
zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ); |
WRITE_RECORD( ctx, ctx->Select.NameStackDepth ); |
WRITE_RECORD( ctx, zmin ); |
WRITE_RECORD( ctx, zmax ); |
for (i = 0; i < ctx->Select.NameStackDepth; i++) { |
WRITE_RECORD( ctx, ctx->Select.NameStack[i] ); |
} |
ctx->Select.Hits++; |
ctx->Select.HitFlag = GL_FALSE; |
ctx->Select.HitMinZ = 1.0; |
ctx->Select.HitMaxZ = -1.0; |
} |
void |
_mesa_InitNames( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
/* Record the hit before the HitFlag is wiped out again. */ |
if (ctx->RenderMode == GL_SELECT) { |
if (ctx->Select.HitFlag) { |
write_hit_record( ctx ); |
} |
} |
ctx->Select.NameStackDepth = 0; |
ctx->Select.HitFlag = GL_FALSE; |
ctx->Select.HitMinZ = 1.0; |
ctx->Select.HitMaxZ = 0.0; |
ctx->NewState |= _NEW_RENDERMODE; |
} |
void |
_mesa_LoadName( GLuint name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode != GL_SELECT) { |
return; |
} |
if (ctx->Select.NameStackDepth == 0) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glLoadName" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); |
if (ctx->Select.HitFlag) { |
write_hit_record( ctx ); |
} |
if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) { |
ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name; |
} |
else { |
ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name; |
} |
} |
void |
_mesa_PushName( GLuint name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode != GL_SELECT) { |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); |
if (ctx->Select.HitFlag) { |
write_hit_record( ctx ); |
} |
if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) { |
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); |
} |
else |
ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; |
} |
void |
_mesa_PopName( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->RenderMode != GL_SELECT) { |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); |
if (ctx->Select.HitFlag) { |
write_hit_record( ctx ); |
} |
if (ctx->Select.NameStackDepth == 0) { |
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); |
} |
else |
ctx->Select.NameStackDepth--; |
} |
/**********************************************************************/ |
/* Render Mode */ |
/**********************************************************************/ |
/* |
* NOTE: this function can't be put in a display list. |
*/ |
GLint |
_mesa_RenderMode( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint result; |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode)); |
FLUSH_VERTICES(ctx, _NEW_RENDERMODE); |
switch (ctx->RenderMode) { |
case GL_RENDER: |
result = 0; |
break; |
case GL_SELECT: |
if (ctx->Select.HitFlag) { |
write_hit_record( ctx ); |
} |
if (ctx->Select.BufferCount > ctx->Select.BufferSize) { |
/* overflow */ |
#ifdef DEBUG |
_mesa_warning(ctx, "Feedback buffer overflow"); |
#endif |
result = -1; |
} |
else { |
result = ctx->Select.Hits; |
} |
ctx->Select.BufferCount = 0; |
ctx->Select.Hits = 0; |
ctx->Select.NameStackDepth = 0; |
break; |
case GL_FEEDBACK: |
if (ctx->Feedback.Count > ctx->Feedback.BufferSize) { |
/* overflow */ |
result = -1; |
} |
else { |
result = ctx->Feedback.Count; |
} |
ctx->Feedback.Count = 0; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); |
return 0; |
} |
switch (mode) { |
case GL_RENDER: |
break; |
case GL_SELECT: |
if (ctx->Select.BufferSize==0) { |
/* haven't called glSelectBuffer yet */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); |
} |
break; |
case GL_FEEDBACK: |
if (ctx->Feedback.BufferSize==0) { |
/* haven't called glFeedbackBuffer yet */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); |
return 0; |
} |
ctx->RenderMode = mode; |
if (ctx->Driver.RenderMode) |
ctx->Driver.RenderMode( ctx, mode ); |
return result; |
} |
/shark/tags/rel_0_4/ports/mesa/src/polygon.c |
---|
0,0 → 1,205 |
/* $Id: polygon.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "context.h" |
#include "image.h" |
#include "enums.h" |
#include "macros.h" |
#include "polygon.h" |
#include "mtypes.h" |
void |
_mesa_CullFace( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode)); |
if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" ); |
return; |
} |
if (ctx->Polygon.CullFaceMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.CullFaceMode = mode; |
if (ctx->Driver.CullFace) |
ctx->Driver.CullFace( ctx, mode ); |
} |
void |
_mesa_FrontFace( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); |
if (mode!=GL_CW && mode!=GL_CCW) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); |
return; |
} |
if (ctx->Polygon.FrontFace == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.FrontFace = mode; |
ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW); |
if (ctx->Driver.FrontFace) |
ctx->Driver.FrontFace( ctx, mode ); |
} |
void |
_mesa_PolygonMode( GLenum face, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glPolygonMode %s %s\n", |
_mesa_lookup_enum_by_nr(face), |
_mesa_lookup_enum_by_nr(mode)); |
if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" ); |
return; |
} |
switch (face) { |
case GL_FRONT: |
if (ctx->Polygon.FrontMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.FrontMode = mode; |
break; |
case GL_FRONT_AND_BACK: |
if (ctx->Polygon.FrontMode == mode && |
ctx->Polygon.BackMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.FrontMode = mode; |
ctx->Polygon.BackMode = mode; |
break; |
case GL_BACK: |
if (ctx->Polygon.BackMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.BackMode = mode; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" ); |
return; |
} |
ctx->_TriangleCaps &= ~DD_TRI_UNFILLED; |
if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) |
ctx->_TriangleCaps |= DD_TRI_UNFILLED; |
if (ctx->Driver.PolygonMode) { |
(*ctx->Driver.PolygonMode)( ctx, face, mode ); |
} |
} |
void |
_mesa_PolygonStipple( const GLubyte *pattern ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glPolygonStipple\n"); |
FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); |
_mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); |
if (ctx->Driver.PolygonStipple) |
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple ); |
} |
void |
_mesa_GetPolygonStipple( GLubyte *dest ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glGetPolygonStipple\n"); |
_mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack); |
} |
void |
_mesa_PolygonOffset( GLfloat factor, GLfloat units ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); |
if (ctx->Polygon.OffsetFactor == factor && |
ctx->Polygon.OffsetUnits == units) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.OffsetFactor = factor; |
ctx->Polygon.OffsetUnits = units; |
if (ctx->Driver.PolygonOffset) |
ctx->Driver.PolygonOffset( ctx, factor, units ); |
} |
void |
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
_mesa_PolygonOffset(factor, bias * ctx->DepthMaxF ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/clip.c |
---|
0,0 → 1,120 |
/* $Id: clip.c,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "clip.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "math/m_matrix.h" |
/**********************************************************************/ |
/* Get/Set User clip-planes. */ |
/**********************************************************************/ |
void |
_mesa_ClipPlane( GLenum plane, const GLdouble *eq ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint p; |
GLfloat equation[4]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
p = (GLint) plane - (GLint) GL_CLIP_PLANE0; |
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); |
return; |
} |
equation[0] = (GLfloat) eq[0]; |
equation[1] = (GLfloat) eq[1]; |
equation[2] = (GLfloat) eq[2]; |
equation[3] = (GLfloat) eq[3]; |
/* |
* The equation is transformed by the transpose of the inverse of the |
* current modelview matrix and stored in the resulting eye coordinates. |
* |
* KW: Eqn is then transformed to the current clip space, where user |
* clipping now takes place. The clip-space equations are recalculated |
* whenever the projection matrix changes. |
*/ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY) |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
_mesa_transform_vector( equation, equation, |
ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); |
/* Update derived state. This state also depends on the projection |
* matrix, and is recalculated on changes to the projection matrix by |
* code in _mesa_update_state(). |
*/ |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) |
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p], |
ctx->Transform.EyeUserPlane[p], |
ctx->ProjectionMatrixStack.Top->inv ); |
} |
if (ctx->Driver.ClipPlane) |
ctx->Driver.ClipPlane( ctx, plane, equation ); |
} |
void |
_mesa_GetClipPlane( GLenum plane, GLdouble *equation ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint p; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
p = (GLint) (plane - GL_CLIP_PLANE0); |
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); |
return; |
} |
equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; |
equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; |
equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; |
equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_validate.h |
---|
0,0 → 1,50 |
/* $Id: api_validate.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef API_VALIDATE_H |
#define API_VALIDATE_H |
#include "mtypes.h" |
extern GLboolean |
_mesa_validate_DrawArrays(GLcontext *ctx, |
GLenum mode, GLint start, GLsizei count); |
extern GLboolean |
_mesa_validate_DrawElements(GLcontext *ctx, |
GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices); |
extern GLboolean |
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, GLenum type, |
const GLvoid *indices); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/api_loopback.h |
---|
0,0 → 1,40 |
/* $Id: api_loopback.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef API_LOOPBACK_H |
#define API_LOOPBACK_H |
#include "glheader.h" |
struct _glapi_table; |
extern void _mesa_loopback_prefer_float( struct _glapi_table *dest, |
GLboolean prefer_float_colors ); |
extern void _mesa_loopback_init_api_table( struct _glapi_table *dest, |
GLboolean prefer_float_colors ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/feedback.h |
---|
0,0 → 1,77 |
/* $Id: feedback.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef FEEDBACK_H |
#define FEEDBACK_H |
#include "mtypes.h" |
#define FEEDBACK_TOKEN( CTX, T ) \ |
if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \ |
CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \ |
} \ |
CTX->Feedback.Count++; |
extern void _mesa_feedback_vertex( GLcontext *ctx, |
const GLfloat win[4], |
const GLfloat color[4], |
GLuint index, |
const GLfloat texcoord[4] ); |
extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); |
extern void |
_mesa_PassThrough( GLfloat token ); |
extern void |
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); |
extern void |
_mesa_SelectBuffer( GLsizei size, GLuint *buffer ); |
extern void |
_mesa_InitNames( void ); |
extern void |
_mesa_LoadName( GLuint name ); |
extern void |
_mesa_PushName( GLuint name ); |
extern void |
_mesa_PopName( void ); |
extern GLint |
_mesa_RenderMode( GLenum mode ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/macros.h |
---|
0,0 → 1,527 |
/* $Id: macros.h,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0.3 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* A collection of useful macros. |
*/ |
#ifndef MACROS_H |
#define MACROS_H |
#include "glheader.h" |
/* Do not reference mtypes.h from this file. |
*/ |
/* Limits: */ |
#define MAX_GLUSHORT 0xffff |
#define MAX_GLUINT 0xffffffff |
/* Pi */ |
#ifndef M_PI |
#define M_PI (3.1415926) |
#endif |
/* Degrees to radians conversion: */ |
#define DEG2RAD (M_PI/180.0) |
#ifndef NULL |
#define NULL 0 |
#endif |
/* Stepping a GLfloat pointer by a byte stride |
*/ |
#define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) |
#define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) |
#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) |
#define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLubyte *)p + i)) |
#define STRIDE_CHAN(p, i) (p = (GLchan *)((GLubyte *)p + i)) |
#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i)) |
#define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 |
#define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0 |
#define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 |
#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ |
(a)[1] == (b)[1] && \ |
(a)[2] == (b)[2] && \ |
(a)[3] == (b)[3]) |
#define TEST_EQ_3V(a,b) ((a)[0] == (b)[0] && \ |
(a)[1] == (b)[1] && \ |
(a)[2] == (b)[2]) |
#if defined(__i386__) |
#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC)) |
#else |
#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC) |
#endif |
/* Copy short vectors: */ |
#define COPY_2V( DST, SRC ) \ |
do { \ |
(DST)[0] = (SRC)[0]; \ |
(DST)[1] = (SRC)[1]; \ |
} while (0) |
#define COPY_3V( DST, SRC ) \ |
do { \ |
(DST)[0] = (SRC)[0]; \ |
(DST)[1] = (SRC)[1]; \ |
(DST)[2] = (SRC)[2]; \ |
} while (0) |
#define COPY_4V( DST, SRC ) \ |
do { \ |
(DST)[0] = (SRC)[0]; \ |
(DST)[1] = (SRC)[1]; \ |
(DST)[2] = (SRC)[2]; \ |
(DST)[3] = (SRC)[3]; \ |
} while (0) |
#define COPY_2V_CAST( DST, SRC, CAST ) \ |
do { \ |
(DST)[0] = (CAST)(SRC)[0]; \ |
(DST)[1] = (CAST)(SRC)[1]; \ |
} while (0) |
#define COPY_3V_CAST( DST, SRC, CAST ) \ |
do { \ |
(DST)[0] = (CAST)(SRC)[0]; \ |
(DST)[1] = (CAST)(SRC)[1]; \ |
(DST)[2] = (CAST)(SRC)[2]; \ |
} while (0) |
#define COPY_4V_CAST( DST, SRC, CAST ) \ |
do { \ |
(DST)[0] = (CAST)(SRC)[0]; \ |
(DST)[1] = (CAST)(SRC)[1]; \ |
(DST)[2] = (CAST)(SRC)[2]; \ |
(DST)[3] = (CAST)(SRC)[3]; \ |
} while (0) |
#if defined(__i386__) |
#define COPY_4UBV(DST, SRC) \ |
do { \ |
*((GLuint*)(DST)) = *((GLuint*)(SRC)); \ |
} while (0) |
#else |
/* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */ |
#define COPY_4UBV(DST, SRC) \ |
do { \ |
(DST)[0] = (SRC)[0]; \ |
(DST)[1] = (SRC)[1]; \ |
(DST)[2] = (SRC)[2]; \ |
(DST)[3] = (SRC)[3]; \ |
} while (0) |
#endif |
#define COPY_2FV( DST, SRC ) \ |
do { \ |
const GLfloat *_tmp = (SRC); \ |
(DST)[0] = _tmp[0]; \ |
(DST)[1] = _tmp[1]; \ |
} while (0) |
#define COPY_3FV( DST, SRC ) \ |
do { \ |
const GLfloat *_tmp = (SRC); \ |
(DST)[0] = _tmp[0]; \ |
(DST)[1] = _tmp[1]; \ |
(DST)[2] = _tmp[2]; \ |
} while (0) |
#define COPY_4FV( DST, SRC ) \ |
do { \ |
const GLfloat *_tmp = (SRC); \ |
(DST)[0] = _tmp[0]; \ |
(DST)[1] = _tmp[1]; \ |
(DST)[2] = _tmp[2]; \ |
(DST)[3] = _tmp[3]; \ |
} while (0) |
#define COPY_SZ_4V(DST, SZ, SRC) \ |
do { \ |
switch (SZ) { \ |
case 4: (DST)[3] = (SRC)[3]; \ |
case 3: (DST)[2] = (SRC)[2]; \ |
case 2: (DST)[1] = (SRC)[1]; \ |
case 1: (DST)[0] = (SRC)[0]; \ |
} \ |
} while(0) |
#define COPY_CLEAN_4V(DST, SZ, SRC) \ |
do { \ |
ASSIGN_4V( DST, 0, 0, 0, 1 ); \ |
COPY_SZ_4V( DST, SZ, SRC ); \ |
} while (0) |
#define SUB_4V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] - (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] - (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] - (SRCB)[2]; \ |
(DST)[3] = (SRCA)[3] - (SRCB)[3]; \ |
} while (0) |
#define ADD_4V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] + (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] + (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] + (SRCB)[2]; \ |
(DST)[3] = (SRCA)[3] + (SRCB)[3]; \ |
} while (0) |
#define SCALE_4V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] * (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] * (SRCB)[2]; \ |
(DST)[3] = (SRCA)[3] * (SRCB)[3]; \ |
} while (0) |
#define ACC_4V( DST, SRC ) \ |
do { \ |
(DST)[0] += (SRC)[0]; \ |
(DST)[1] += (SRC)[1]; \ |
(DST)[2] += (SRC)[2]; \ |
(DST)[3] += (SRC)[3]; \ |
} while (0) |
#define ACC_SCALE_4V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] += (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] += (SRCA)[1] * (SRCB)[1]; \ |
(DST)[2] += (SRCA)[2] * (SRCB)[2]; \ |
(DST)[3] += (SRCA)[3] * (SRCB)[3]; \ |
} while (0) |
#define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] += S * (SRCB)[0]; \ |
(DST)[1] += S * (SRCB)[1]; \ |
(DST)[2] += S * (SRCB)[2]; \ |
(DST)[3] += S * (SRCB)[3]; \ |
} while (0) |
#define SCALE_SCALAR_4V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] = S * (SRCB)[0]; \ |
(DST)[1] = S * (SRCB)[1]; \ |
(DST)[2] = S * (SRCB)[2]; \ |
(DST)[3] = S * (SRCB)[3]; \ |
} while (0) |
#define SELF_SCALE_SCALAR_4V( DST, S ) \ |
do { \ |
(DST)[0] *= S; \ |
(DST)[1] *= S; \ |
(DST)[2] *= S; \ |
(DST)[3] *= S; \ |
} while (0) |
/* |
* Similarly for 3-vectors. |
*/ |
#define SUB_3V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] - (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] - (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] - (SRCB)[2]; \ |
} while (0) |
#define ADD_3V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] + (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] + (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] + (SRCB)[2]; \ |
} while (0) |
#define SCALE_3V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] * (SRCB)[1]; \ |
(DST)[2] = (SRCA)[2] * (SRCB)[2]; \ |
} while (0) |
#define SELF_SCALE_3V( DST, SRC ) \ |
do { \ |
(DST)[0] *= (SRC)[0]; \ |
(DST)[1] *= (SRC)[1]; \ |
(DST)[2] *= (SRC)[2]; \ |
} while (0) |
#define ACC_3V( DST, SRC ) \ |
do { \ |
(DST)[0] += (SRC)[0]; \ |
(DST)[1] += (SRC)[1]; \ |
(DST)[2] += (SRC)[2]; \ |
} while (0) |
#define ACC_SCALE_3V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] += (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] += (SRCA)[1] * (SRCB)[1]; \ |
(DST)[2] += (SRCA)[2] * (SRCB)[2]; \ |
} while (0) |
#define SCALE_SCALAR_3V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] = S * (SRCB)[0]; \ |
(DST)[1] = S * (SRCB)[1]; \ |
(DST)[2] = S * (SRCB)[2]; \ |
} while (0) |
#define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] += S * (SRCB)[0]; \ |
(DST)[1] += S * (SRCB)[1]; \ |
(DST)[2] += S * (SRCB)[2]; \ |
} while (0) |
#define SELF_SCALE_SCALAR_3V( DST, S ) \ |
do { \ |
(DST)[0] *= S; \ |
(DST)[1] *= S; \ |
(DST)[2] *= S; \ |
} while (0) |
#define ACC_SCALAR_3V( DST, S ) \ |
do { \ |
(DST)[0] += S; \ |
(DST)[1] += S; \ |
(DST)[2] += S; \ |
} while (0) |
/* And also for 2-vectors |
*/ |
#define SUB_2V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] - (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] - (SRCB)[1]; \ |
} while (0) |
#define ADD_2V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] + (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] + (SRCB)[1]; \ |
} while (0) |
#define SCALE_2V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] = (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] = (SRCA)[1] * (SRCB)[1]; \ |
} while (0) |
#define ACC_2V( DST, SRC ) \ |
do { \ |
(DST)[0] += (SRC)[0]; \ |
(DST)[1] += (SRC)[1]; \ |
} while (0) |
#define ACC_SCALE_2V( DST, SRCA, SRCB ) \ |
do { \ |
(DST)[0] += (SRCA)[0] * (SRCB)[0]; \ |
(DST)[1] += (SRCA)[1] * (SRCB)[1]; \ |
} while (0) |
#define SCALE_SCALAR_2V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] = S * (SRCB)[0]; \ |
(DST)[1] = S * (SRCB)[1]; \ |
} while (0) |
#define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \ |
do { \ |
(DST)[0] += S * (SRCB)[0]; \ |
(DST)[1] += S * (SRCB)[1]; \ |
} while (0) |
#define SELF_SCALE_SCALAR_2V( DST, S ) \ |
do { \ |
(DST)[0] *= S; \ |
(DST)[1] *= S; \ |
} while (0) |
#define ACC_SCALAR_2V( DST, S ) \ |
do { \ |
(DST)[0] += S; \ |
(DST)[1] += S; \ |
} while (0) |
/* Assign scalers to short vectors: */ |
#define ASSIGN_2V( V, V0, V1 ) \ |
do { \ |
V[0] = V0; \ |
V[1] = V1; \ |
} while(0) |
#define ASSIGN_3V( V, V0, V1, V2 ) \ |
do { \ |
V[0] = V0; \ |
V[1] = V1; \ |
V[2] = V2; \ |
} while(0) |
#define ASSIGN_4V( V, V0, V1, V2, V3 ) \ |
do { \ |
V[0] = V0; \ |
V[1] = V1; \ |
V[2] = V2; \ |
V[3] = V3; \ |
} while(0) |
/* Absolute value (for Int, Float, Double): */ |
#define ABSI(X) ((X) < 0 ? -(X) : (X)) |
#define ABSF(X) ((X) < 0.0F ? -(X) : (X)) |
#define ABSD(X) ((X) < 0.0 ? -(X) : (X)) |
/* Round a floating-point value to the nearest integer: */ |
#define ROUNDF(X) ( (X)<0.0F ? ((GLint) ((X)-0.5F)) : ((GLint) ((X)+0.5F)) ) |
/* Compute ceiling of integer quotient of A divided by B: */ |
#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) |
/* Clamp X to [MIN,MAX]: */ |
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) |
/* Assign X to CLAMP(X, MIN, MAX) */ |
#define CLAMP_SELF(x, mn, mx) \ |
( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) ) |
/* Min of two values: */ |
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) |
/* MAX of two values: */ |
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) |
/* Dot product of two 2-element vectors */ |
#define DOT2( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] ) |
/* Dot product of two 3-element vectors */ |
#define DOT3( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2] ) |
/* Dot product of two 4-element vectors */ |
#define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \ |
(a)[2]*(b)[2] + (a)[3]*(b)[3] ) |
#define DOT4V(v,a,b,c,d) (v[0]*(a) + v[1]*(b) + v[2]*(c) + v[3]*(d)) |
#define CROSS3(n, u, v) \ |
do { \ |
(n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ |
(n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ |
(n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \ |
} while (0) |
/* Generic color packing macros |
* XXX We may move these into texutil.h at some point. |
*/ |
#define PACK_COLOR_8888( a, b, c, d ) \ |
(((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
#define PACK_COLOR_888( a, b, c ) \ |
(((a) << 16) | ((b) << 8) | (c)) |
#define PACK_COLOR_565( a, b, c ) \ |
((((a) & 0xf8) << 8) | (((b) & 0xfc) << 3) | (((c) & 0xf8) >> 3)) |
#define PACK_COLOR_1555( a, b, c, d ) \ |
((((b) & 0xf8) << 7) | (((c) & 0xf8) << 2) | (((d) & 0xf8) >> 3) | \ |
((a) ? 0x8000 : 0)) |
#define PACK_COLOR_4444( a, b, c, d ) \ |
((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((c) & 0xf0) | ((d) >> 4)) |
#define PACK_COLOR_88( a, b ) \ |
(((a) << 8) | (b)) |
#define PACK_COLOR_332( a, b, c ) \ |
(((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6)) |
#ifdef MESA_BIG_ENDIAN |
#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( d, c, b, a ) |
#define PACK_COLOR_565_LE( a, b, c ) \ |
(((a) & 0xf8) | (((b) & 0xe0) >> 5) | (((b) & 0x1c) << 11) | \ |
(((c) & 0xf8) << 5)) |
#define PACK_COLOR_1555_LE( a, b, c, d ) \ |
((((b) & 0xf8) >> 1) | (((c) & 0xc0) >> 6) | (((c) & 0x38) << 10) | \ |
(((d) & 0xf8) << 5) | ((a) ? 0x80 : 0)) |
#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( c, d, a, b ) |
#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( b, a ) |
#else /* little endian */ |
#define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( a, b, c, d ) |
#define PACK_COLOR_565_LE( a, b, c ) PACK_COLOR_565( a, b, c ) |
#define PACK_COLOR_1555_LE( a, b, c, d ) PACK_COLOR_1555( a, b, c, d ) |
#define PACK_COLOR_4444_LE( a, b, c, d ) PACK_COLOR_4444( a, b, c, d ) |
#define PACK_COLOR_88_LE( a, b ) PACK_COLOR_88( a, b ) |
#endif /* endianness */ |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/convolve.c |
---|
0,0 → 1,1422 |
/* $Id: convolve.c,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Image convolution functions. |
* |
* Notes: filter kernel elements are indexed by <n> and <m> as in |
* the GL spec. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "convolve.h" |
#include "context.h" |
#include "image.h" |
#include "mtypes.h" |
#include "state.h" |
/* |
* Given an internalFormat token passed to glConvolutionFilter |
* or glSeparableFilter, return the corresponding base format. |
* Return -1 if invalid token. |
*/ |
static GLint |
base_filter_format( GLenum format ) |
{ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return GL_ALPHA; |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return GL_LUMINANCE; |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return GL_LUMINANCE_ALPHA; |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
return GL_INTENSITY; |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return GL_RGB; |
case 4: |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return GL_RGBA; |
default: |
return -1; /* error */ |
} |
} |
void |
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) |
{ |
GLint baseFormat; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target != GL_CONVOLUTION_1D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); |
return; |
} |
baseFormat = base_filter_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); |
return; |
} |
if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)"); |
return; |
} |
if (format == GL_COLOR_INDEX || |
format == GL_STENCIL_INDEX || |
format == GL_DEPTH_COMPONENT || |
format == GL_INTENSITY || |
type == GL_BITMAP) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); |
return; |
} |
ctx->Convolution1D.Format = format; |
ctx->Convolution1D.InternalFormat = internalFormat; |
ctx->Convolution1D.Width = width; |
ctx->Convolution1D.Height = 1; |
/* unpack filter image */ |
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, |
ctx->Convolution1D.Filter, |
format, type, image, &ctx->Unpack, |
0, GL_FALSE); |
/* apply scale and bias */ |
{ |
const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[0]; |
const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[0]; |
GLint i; |
for (i = 0; i < width; i++) { |
GLfloat r = ctx->Convolution1D.Filter[i * 4 + 0]; |
GLfloat g = ctx->Convolution1D.Filter[i * 4 + 1]; |
GLfloat b = ctx->Convolution1D.Filter[i * 4 + 2]; |
GLfloat a = ctx->Convolution1D.Filter[i * 4 + 3]; |
r = r * scale[0] + bias[0]; |
g = g * scale[1] + bias[1]; |
b = b * scale[2] + bias[2]; |
a = a * scale[3] + bias[3]; |
ctx->Convolution1D.Filter[i * 4 + 0] = r; |
ctx->Convolution1D.Filter[i * 4 + 1] = g; |
ctx->Convolution1D.Filter[i * 4 + 2] = b; |
ctx->Convolution1D.Filter[i * 4 + 3] = a; |
} |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) |
{ |
GLint baseFormat; |
GLint i, components; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target != GL_CONVOLUTION_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); |
return; |
} |
baseFormat = base_filter_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); |
return; |
} |
if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); |
return; |
} |
if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)"); |
return; |
} |
if (format == GL_COLOR_INDEX || |
format == GL_STENCIL_INDEX || |
format == GL_DEPTH_COMPONENT || |
format == GL_INTENSITY || |
type == GL_BITMAP) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); |
return; |
} |
components = _mesa_components_in_format(format); |
assert(components > 0); /* this should have been caught earlier */ |
ctx->Convolution2D.Format = format; |
ctx->Convolution2D.InternalFormat = internalFormat; |
ctx->Convolution2D.Width = width; |
ctx->Convolution2D.Height = height; |
/* Unpack filter image. We always store filters in RGBA format. */ |
for (i = 0; i < height; i++) { |
const GLvoid *src = _mesa_image_address(&ctx->Unpack, image, width, |
height, format, type, 0, i, 0); |
GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4; |
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst, |
format, type, src, &ctx->Unpack, |
0, GL_FALSE); |
} |
/* apply scale and bias */ |
{ |
const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[1]; |
const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[1]; |
for (i = 0; i < width * height; i++) { |
GLfloat r = ctx->Convolution2D.Filter[i * 4 + 0]; |
GLfloat g = ctx->Convolution2D.Filter[i * 4 + 1]; |
GLfloat b = ctx->Convolution2D.Filter[i * 4 + 2]; |
GLfloat a = ctx->Convolution2D.Filter[i * 4 + 3]; |
r = r * scale[0] + bias[0]; |
g = g * scale[1] + bias[1]; |
b = b * scale[2] + bias[2]; |
a = a * scale[3] + bias[3]; |
ctx->Convolution2D.Filter[i * 4 + 0] = r; |
ctx->Convolution2D.Filter[i * 4 + 1] = g; |
ctx->Convolution2D.Filter[i * 4 + 2] = b; |
ctx->Convolution2D.Filter[i * 4 + 3] = a; |
} |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_MODE: |
if (param == (GLfloat) GL_REDUCE || |
param == (GLfloat) GL_CONSTANT_BORDER || |
param == (GLfloat) GL_REPLICATE_BORDER) { |
ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); |
return; |
} |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); |
return; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_convolution_attrib *conv; |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
conv = &ctx->Convolution1D; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
conv = &ctx->Convolution2D; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
conv = &ctx->Separable2D; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_COLOR: |
COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); |
break; |
case GL_CONVOLUTION_BORDER_MODE: |
if (params[0] == (GLfloat) GL_REDUCE || |
params[0] == (GLfloat) GL_CONSTANT_BORDER || |
params[0] == (GLfloat) GL_REPLICATE_BORDER) { |
ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); |
return; |
} |
break; |
case GL_CONVOLUTION_FILTER_SCALE: |
COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); |
break; |
case GL_CONVOLUTION_FILTER_BIAS: |
COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); |
return; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_MODE: |
if (param == (GLint) GL_REDUCE || |
param == (GLint) GL_CONSTANT_BORDER || |
param == (GLint) GL_REPLICATE_BORDER) { |
ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); |
return; |
} |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); |
return; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_convolution_attrib *conv; |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
conv = &ctx->Convolution1D; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
conv = &ctx->Convolution2D; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
conv = &ctx->Separable2D; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_COLOR: |
ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); |
ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); |
ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); |
ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); |
break; |
case GL_CONVOLUTION_BORDER_MODE: |
if (params[0] == (GLint) GL_REDUCE || |
params[0] == (GLint) GL_CONSTANT_BORDER || |
params[0] == (GLint) GL_REPLICATE_BORDER) { |
ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); |
return; |
} |
break; |
case GL_CONVOLUTION_FILTER_SCALE: |
/* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ |
/* need cast to prevent compiler warnings */ |
ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; |
ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; |
ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; |
ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; |
break; |
case GL_CONVOLUTION_FILTER_BIAS: |
/* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ |
/* need cast to prevent compiler warnings */ |
ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; |
ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; |
ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; |
ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); |
return; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) |
{ |
GLint baseFormat; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target != GL_CONVOLUTION_1D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); |
return; |
} |
baseFormat = base_filter_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); |
return; |
} |
if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); |
return; |
} |
ctx->Driver.CopyConvolutionFilter1D( ctx, target, |
internalFormat, x, y, width); |
} |
void |
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
GLint baseFormat; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target != GL_CONVOLUTION_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); |
return; |
} |
baseFormat = base_filter_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); |
return; |
} |
if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); |
return; |
} |
if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); |
return; |
} |
ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, |
width, height ); |
} |
void |
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) |
{ |
const struct gl_convolution_attrib *filter; |
GLuint row; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); |
return; |
} |
if (format == GL_COLOR_INDEX || |
format == GL_STENCIL_INDEX || |
format == GL_DEPTH_COMPONENT || |
format == GL_INTENSITY || |
type == GL_BITMAP) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); |
return; |
} |
switch (target) { |
case GL_CONVOLUTION_1D: |
filter = &(ctx->Convolution1D); |
break; |
case GL_CONVOLUTION_2D: |
filter = &(ctx->Convolution2D); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); |
return; |
} |
for (row = 0; row < filter->Height; row++) { |
GLvoid *dst = _mesa_image_address( &ctx->Pack, image, filter->Width, |
filter->Height, format, type, |
0, row, 0); |
const GLfloat *src = filter->Filter + row * filter->Width * 4; |
_mesa_pack_float_rgba_span(ctx, filter->Width, |
(const GLfloat (*)[4]) src, |
format, type, dst, &ctx->Pack, 0); |
} |
} |
void |
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const struct gl_convolution_attrib *conv; |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
conv = &ctx->Convolution1D; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
conv = &ctx->Convolution2D; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
conv = &ctx->Separable2D; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_COLOR: |
COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); |
break; |
case GL_CONVOLUTION_BORDER_MODE: |
*params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; |
break; |
case GL_CONVOLUTION_FILTER_SCALE: |
COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); |
break; |
case GL_CONVOLUTION_FILTER_BIAS: |
COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); |
break; |
case GL_CONVOLUTION_FORMAT: |
*params = (GLfloat) conv->Format; |
break; |
case GL_CONVOLUTION_WIDTH: |
*params = (GLfloat) conv->Width; |
break; |
case GL_CONVOLUTION_HEIGHT: |
*params = (GLfloat) conv->Height; |
break; |
case GL_MAX_CONVOLUTION_WIDTH: |
*params = (GLfloat) ctx->Const.MaxConvolutionWidth; |
break; |
case GL_MAX_CONVOLUTION_HEIGHT: |
*params = (GLfloat) ctx->Const.MaxConvolutionHeight; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); |
return; |
} |
} |
void |
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const struct gl_convolution_attrib *conv; |
GLuint c; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (target) { |
case GL_CONVOLUTION_1D: |
c = 0; |
conv = &ctx->Convolution1D; |
break; |
case GL_CONVOLUTION_2D: |
c = 1; |
conv = &ctx->Convolution2D; |
break; |
case GL_SEPARABLE_2D: |
c = 2; |
conv = &ctx->Separable2D; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); |
return; |
} |
switch (pname) { |
case GL_CONVOLUTION_BORDER_COLOR: |
params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); |
params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); |
params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); |
params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); |
break; |
case GL_CONVOLUTION_BORDER_MODE: |
*params = (GLint) ctx->Pixel.ConvolutionBorderMode[c]; |
break; |
case GL_CONVOLUTION_FILTER_SCALE: |
params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; |
params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; |
params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; |
params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; |
break; |
case GL_CONVOLUTION_FILTER_BIAS: |
params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; |
params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; |
params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; |
params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; |
break; |
case GL_CONVOLUTION_FORMAT: |
*params = (GLint) conv->Format; |
break; |
case GL_CONVOLUTION_WIDTH: |
*params = (GLint) conv->Width; |
break; |
case GL_CONVOLUTION_HEIGHT: |
*params = (GLint) conv->Height; |
break; |
case GL_MAX_CONVOLUTION_WIDTH: |
*params = (GLint) ctx->Const.MaxConvolutionWidth; |
break; |
case GL_MAX_CONVOLUTION_HEIGHT: |
*params = (GLint) ctx->Const.MaxConvolutionHeight; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); |
return; |
} |
} |
void |
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) |
{ |
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; |
const struct gl_convolution_attrib *filter; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
if (target != GL_SEPARABLE_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); |
return; |
} |
if (format == GL_COLOR_INDEX || |
format == GL_STENCIL_INDEX || |
format == GL_DEPTH_COMPONENT || |
format == GL_INTENSITY || |
type == GL_BITMAP) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); |
return; |
} |
filter = &ctx->Separable2D; |
/* Row filter */ |
{ |
GLvoid *dst = _mesa_image_address( &ctx->Pack, row, filter->Width, |
filter->Height, format, type, |
0, 0, 0); |
_mesa_pack_float_rgba_span(ctx, filter->Width, |
(const GLfloat (*)[4]) filter->Filter, |
format, type, dst, &ctx->Pack, 0); |
} |
/* Column filter */ |
{ |
GLvoid *dst = _mesa_image_address( &ctx->Pack, column, filter->Width, |
1, format, type, |
0, 0, 0); |
const GLfloat *src = filter->Filter + colStart; |
_mesa_pack_float_rgba_span(ctx, filter->Height, |
(const GLfloat (*)[4]) src, |
format, type, dst, &ctx->Pack, 0); |
} |
(void) span; /* unused at this time */ |
} |
void |
_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) |
{ |
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; |
GLint baseFormat; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target != GL_SEPARABLE_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); |
return; |
} |
baseFormat = base_filter_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); |
return; |
} |
if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); |
return; |
} |
if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)"); |
return; |
} |
if (format == GL_COLOR_INDEX || |
format == GL_STENCIL_INDEX || |
format == GL_DEPTH_COMPONENT || |
format == GL_INTENSITY || |
type == GL_BITMAP) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); |
return; |
} |
ctx->Separable2D.Format = format; |
ctx->Separable2D.InternalFormat = internalFormat; |
ctx->Separable2D.Width = width; |
ctx->Separable2D.Height = height; |
/* unpack row filter */ |
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, |
ctx->Separable2D.Filter, |
format, type, row, &ctx->Unpack, |
0, GL_FALSE); |
/* apply scale and bias */ |
{ |
const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; |
const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; |
GLint i; |
for (i = 0; i < width; i++) { |
GLfloat r = ctx->Separable2D.Filter[i * 4 + 0]; |
GLfloat g = ctx->Separable2D.Filter[i * 4 + 1]; |
GLfloat b = ctx->Separable2D.Filter[i * 4 + 2]; |
GLfloat a = ctx->Separable2D.Filter[i * 4 + 3]; |
r = r * scale[0] + bias[0]; |
g = g * scale[1] + bias[1]; |
b = b * scale[2] + bias[2]; |
a = a * scale[3] + bias[3]; |
ctx->Separable2D.Filter[i * 4 + 0] = r; |
ctx->Separable2D.Filter[i * 4 + 1] = g; |
ctx->Separable2D.Filter[i * 4 + 2] = b; |
ctx->Separable2D.Filter[i * 4 + 3] = a; |
} |
} |
/* unpack column filter */ |
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, |
&ctx->Separable2D.Filter[colStart], |
format, type, column, &ctx->Unpack, |
0, GL_FALSE); |
/* apply scale and bias */ |
{ |
const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; |
const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; |
GLint i; |
for (i = 0; i < width; i++) { |
GLfloat r = ctx->Separable2D.Filter[i * 4 + 0 + colStart]; |
GLfloat g = ctx->Separable2D.Filter[i * 4 + 1 + colStart]; |
GLfloat b = ctx->Separable2D.Filter[i * 4 + 2 + colStart]; |
GLfloat a = ctx->Separable2D.Filter[i * 4 + 3 + colStart]; |
r = r * scale[0] + bias[0]; |
g = g * scale[1] + bias[1]; |
b = b * scale[2] + bias[2]; |
a = a * scale[3] + bias[3]; |
ctx->Separable2D.Filter[i * 4 + 0 + colStart] = r; |
ctx->Separable2D.Filter[i * 4 + 1 + colStart] = g; |
ctx->Separable2D.Filter[i * 4 + 2 + colStart] = b; |
ctx->Separable2D.Filter[i * 4 + 3 + colStart] = a; |
} |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
/**********************************************************************/ |
/*** image convolution functions ***/ |
/**********************************************************************/ |
static void |
convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4], |
GLint filterWidth, const GLfloat filter[][4], |
GLfloat dest[][4]) |
{ |
GLint dstWidth; |
GLint i, n; |
if (filterWidth >= 1) |
dstWidth = srcWidth - (filterWidth - 1); |
else |
dstWidth = srcWidth; |
if (dstWidth <= 0) |
return; /* null result */ |
for (i = 0; i < dstWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (n = 0; n < filterWidth; n++) { |
sumR += src[i + n][RCOMP] * filter[n][RCOMP]; |
sumG += src[i + n][GCOMP] * filter[n][GCOMP]; |
sumB += src[i + n][BCOMP] * filter[n][BCOMP]; |
sumA += src[i + n][ACOMP] * filter[n][ACOMP]; |
} |
dest[i][RCOMP] = sumR; |
dest[i][GCOMP] = sumG; |
dest[i][BCOMP] = sumB; |
dest[i][ACOMP] = sumA; |
} |
} |
static void |
convolve_1d_constant(GLint srcWidth, const GLfloat src[][4], |
GLint filterWidth, const GLfloat filter[][4], |
GLfloat dest[][4], |
const GLfloat borderColor[4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
GLint i, n; |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (n = 0; n < filterWidth; n++) { |
if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) { |
sumR += borderColor[RCOMP] * filter[n][RCOMP]; |
sumG += borderColor[GCOMP] * filter[n][GCOMP]; |
sumB += borderColor[BCOMP] * filter[n][BCOMP]; |
sumA += borderColor[ACOMP] * filter[n][ACOMP]; |
} |
else { |
sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; |
sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; |
sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; |
sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; |
} |
} |
dest[i][RCOMP] = sumR; |
dest[i][GCOMP] = sumG; |
dest[i][BCOMP] = sumB; |
dest[i][ACOMP] = sumA; |
} |
} |
static void |
convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4], |
GLint filterWidth, const GLfloat filter[][4], |
GLfloat dest[][4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
GLint i, n; |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (n = 0; n < filterWidth; n++) { |
if (i + n < halfFilterWidth) { |
sumR += src[0][RCOMP] * filter[n][RCOMP]; |
sumG += src[0][GCOMP] * filter[n][GCOMP]; |
sumB += src[0][BCOMP] * filter[n][BCOMP]; |
sumA += src[0][ACOMP] * filter[n][ACOMP]; |
} |
else if (i + n - halfFilterWidth >= srcWidth) { |
sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP]; |
sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP]; |
sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP]; |
sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP]; |
} |
else { |
sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; |
sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; |
sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; |
sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; |
} |
} |
dest[i][RCOMP] = sumR; |
dest[i][GCOMP] = sumG; |
dest[i][BCOMP] = sumB; |
dest[i][ACOMP] = sumA; |
} |
} |
static void |
convolve_2d_reduce(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat filter[][4], |
GLfloat dest[][4]) |
{ |
GLint dstWidth, dstHeight; |
GLint i, j, n, m; |
if (filterWidth >= 1) |
dstWidth = srcWidth - (filterWidth - 1); |
else |
dstWidth = srcWidth; |
if (filterHeight >= 1) |
dstHeight = srcHeight - (filterHeight - 1); |
else |
dstHeight = srcHeight; |
if (dstWidth <= 0 || dstHeight <= 0) |
return; |
for (j = 0; j < dstHeight; j++) { |
for (i = 0; i < dstWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
const GLint k = (j + m) * srcWidth + i + n; |
const GLint f = m * filterWidth + n; |
sumR += src[k][RCOMP] * filter[f][RCOMP]; |
sumG += src[k][GCOMP] * filter[f][GCOMP]; |
sumB += src[k][BCOMP] * filter[f][BCOMP]; |
sumA += src[k][ACOMP] * filter[f][ACOMP]; |
} |
} |
dest[j * dstWidth + i][RCOMP] = sumR; |
dest[j * dstWidth + i][GCOMP] = sumG; |
dest[j * dstWidth + i][BCOMP] = sumB; |
dest[j * dstWidth + i][ACOMP] = sumA; |
} |
} |
} |
static void |
convolve_2d_constant(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat filter[][4], |
GLfloat dest[][4], |
const GLfloat borderColor[4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
const GLint halfFilterHeight = filterHeight / 2; |
GLint i, j, n, m; |
for (j = 0; j < srcHeight; j++) { |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
const GLint f = m * filterWidth + n; |
const GLint is = i + n - halfFilterWidth; |
const GLint js = j + m - halfFilterHeight; |
if (is < 0 || is >= srcWidth || |
js < 0 || js >= srcHeight) { |
sumR += borderColor[RCOMP] * filter[f][RCOMP]; |
sumG += borderColor[GCOMP] * filter[f][GCOMP]; |
sumB += borderColor[BCOMP] * filter[f][BCOMP]; |
sumA += borderColor[ACOMP] * filter[f][ACOMP]; |
} |
else { |
const GLint k = js * srcWidth + is; |
sumR += src[k][RCOMP] * filter[f][RCOMP]; |
sumG += src[k][GCOMP] * filter[f][GCOMP]; |
sumB += src[k][BCOMP] * filter[f][BCOMP]; |
sumA += src[k][ACOMP] * filter[f][ACOMP]; |
} |
} |
} |
dest[j * srcWidth + i][RCOMP] = sumR; |
dest[j * srcWidth + i][GCOMP] = sumG; |
dest[j * srcWidth + i][BCOMP] = sumB; |
dest[j * srcWidth + i][ACOMP] = sumA; |
} |
} |
} |
static void |
convolve_2d_replicate(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat filter[][4], |
GLfloat dest[][4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
const GLint halfFilterHeight = filterHeight / 2; |
GLint i, j, n, m; |
for (j = 0; j < srcHeight; j++) { |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
const GLint f = m * filterWidth + n; |
GLint is = i + n - halfFilterWidth; |
GLint js = j + m - halfFilterHeight; |
GLint k; |
if (is < 0) |
is = 0; |
else if (is >= srcWidth) |
is = srcWidth - 1; |
if (js < 0) |
js = 0; |
else if (js >= srcHeight) |
js = srcHeight - 1; |
k = js * srcWidth + is; |
sumR += src[k][RCOMP] * filter[f][RCOMP]; |
sumG += src[k][GCOMP] * filter[f][GCOMP]; |
sumB += src[k][BCOMP] * filter[f][BCOMP]; |
sumA += src[k][ACOMP] * filter[f][ACOMP]; |
} |
} |
dest[j * srcWidth + i][RCOMP] = sumR; |
dest[j * srcWidth + i][GCOMP] = sumG; |
dest[j * srcWidth + i][BCOMP] = sumB; |
dest[j * srcWidth + i][ACOMP] = sumA; |
} |
} |
} |
static void |
convolve_sep_reduce(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat rowFilt[][4], |
const GLfloat colFilt[][4], |
GLfloat dest[][4]) |
{ |
GLint dstWidth, dstHeight; |
GLint i, j, n, m; |
if (filterWidth >= 1) |
dstWidth = srcWidth - (filterWidth - 1); |
else |
dstWidth = srcWidth; |
if (filterHeight >= 1) |
dstHeight = srcHeight - (filterHeight - 1); |
else |
dstHeight = srcHeight; |
if (dstWidth <= 0 || dstHeight <= 0) |
return; |
for (j = 0; j < dstHeight; j++) { |
for (i = 0; i < dstWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
GLint k = (j + m) * srcWidth + i + n; |
sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; |
sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; |
sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; |
sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; |
} |
} |
dest[j * dstWidth + i][RCOMP] = sumR; |
dest[j * dstWidth + i][GCOMP] = sumG; |
dest[j * dstWidth + i][BCOMP] = sumB; |
dest[j * dstWidth + i][ACOMP] = sumA; |
} |
} |
} |
static void |
convolve_sep_constant(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat rowFilt[][4], |
const GLfloat colFilt[][4], |
GLfloat dest[][4], |
const GLfloat borderColor[4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
const GLint halfFilterHeight = filterHeight / 2; |
GLint i, j, n, m; |
for (j = 0; j < srcHeight; j++) { |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
const GLint is = i + n - halfFilterWidth; |
const GLint js = j + m - halfFilterHeight; |
if (is < 0 || is >= srcWidth || |
js < 0 || js >= srcHeight) { |
sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; |
sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; |
sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; |
sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; |
} |
else { |
GLint k = js * srcWidth + is; |
sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; |
sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; |
sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; |
sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; |
} |
} |
} |
dest[j * srcWidth + i][RCOMP] = sumR; |
dest[j * srcWidth + i][GCOMP] = sumG; |
dest[j * srcWidth + i][BCOMP] = sumB; |
dest[j * srcWidth + i][ACOMP] = sumA; |
} |
} |
} |
static void |
convolve_sep_replicate(GLint srcWidth, GLint srcHeight, |
const GLfloat src[][4], |
GLint filterWidth, GLint filterHeight, |
const GLfloat rowFilt[][4], |
const GLfloat colFilt[][4], |
GLfloat dest[][4]) |
{ |
const GLint halfFilterWidth = filterWidth / 2; |
const GLint halfFilterHeight = filterHeight / 2; |
GLint i, j, n, m; |
for (j = 0; j < srcHeight; j++) { |
for (i = 0; i < srcWidth; i++) { |
GLfloat sumR = 0.0; |
GLfloat sumG = 0.0; |
GLfloat sumB = 0.0; |
GLfloat sumA = 0.0; |
for (m = 0; m < filterHeight; m++) { |
for (n = 0; n < filterWidth; n++) { |
GLint is = i + n - halfFilterWidth; |
GLint js = j + m - halfFilterHeight; |
GLint k; |
if (is < 0) |
is = 0; |
else if (is >= srcWidth) |
is = srcWidth - 1; |
if (js < 0) |
js = 0; |
else if (js >= srcHeight) |
js = srcHeight - 1; |
k = js * srcWidth + is; |
sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; |
sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; |
sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; |
sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; |
} |
} |
dest[j * srcWidth + i][RCOMP] = sumR; |
dest[j * srcWidth + i][GCOMP] = sumG; |
dest[j * srcWidth + i][BCOMP] = sumB; |
dest[j * srcWidth + i][ACOMP] = sumA; |
} |
} |
} |
void |
_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, |
const GLfloat *srcImage, GLfloat *dstImage) |
{ |
switch (ctx->Pixel.ConvolutionBorderMode[0]) { |
case GL_REDUCE: |
convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage, |
ctx->Convolution1D.Width, |
(const GLfloat (*)[4]) ctx->Convolution1D.Filter, |
(GLfloat (*)[4]) dstImage); |
*width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); |
break; |
case GL_CONSTANT_BORDER: |
convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage, |
ctx->Convolution1D.Width, |
(const GLfloat (*)[4]) ctx->Convolution1D.Filter, |
(GLfloat (*)[4]) dstImage, |
ctx->Pixel.ConvolutionBorderColor[0]); |
break; |
case GL_REPLICATE_BORDER: |
convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage, |
ctx->Convolution1D.Width, |
(const GLfloat (*)[4]) ctx->Convolution1D.Filter, |
(GLfloat (*)[4]) dstImage); |
break; |
default: |
; |
} |
} |
void |
_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, |
const GLfloat *srcImage, GLfloat *dstImage) |
{ |
switch (ctx->Pixel.ConvolutionBorderMode[1]) { |
case GL_REDUCE: |
convolve_2d_reduce(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Convolution2D.Width, |
ctx->Convolution2D.Height, |
(const GLfloat (*)[4]) ctx->Convolution2D.Filter, |
(GLfloat (*)[4]) dstImage); |
*width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); |
*height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); |
break; |
case GL_CONSTANT_BORDER: |
convolve_2d_constant(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Convolution2D.Width, |
ctx->Convolution2D.Height, |
(const GLfloat (*)[4]) ctx->Convolution2D.Filter, |
(GLfloat (*)[4]) dstImage, |
ctx->Pixel.ConvolutionBorderColor[1]); |
break; |
case GL_REPLICATE_BORDER: |
convolve_2d_replicate(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Convolution2D.Width, |
ctx->Convolution2D.Height, |
(const GLfloat (*)[4])ctx->Convolution2D.Filter, |
(GLfloat (*)[4]) dstImage); |
break; |
default: |
; |
} |
} |
void |
_mesa_convolve_sep_image(const GLcontext *ctx, |
GLsizei *width, GLsizei *height, |
const GLfloat *srcImage, GLfloat *dstImage) |
{ |
const GLfloat *rowFilter = ctx->Separable2D.Filter; |
const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH; |
switch (ctx->Pixel.ConvolutionBorderMode[2]) { |
case GL_REDUCE: |
convolve_sep_reduce(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Separable2D.Width, |
ctx->Separable2D.Height, |
(const GLfloat (*)[4]) rowFilter, |
(const GLfloat (*)[4]) colFilter, |
(GLfloat (*)[4]) dstImage); |
*width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); |
*height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); |
break; |
case GL_CONSTANT_BORDER: |
convolve_sep_constant(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Separable2D.Width, |
ctx->Separable2D.Height, |
(const GLfloat (*)[4]) rowFilter, |
(const GLfloat (*)[4]) colFilter, |
(GLfloat (*)[4]) dstImage, |
ctx->Pixel.ConvolutionBorderColor[2]); |
break; |
case GL_REPLICATE_BORDER: |
convolve_sep_replicate(*width, *height, |
(const GLfloat (*)[4]) srcImage, |
ctx->Separable2D.Width, |
ctx->Separable2D.Height, |
(const GLfloat (*)[4]) rowFilter, |
(const GLfloat (*)[4]) colFilter, |
(GLfloat (*)[4]) dstImage); |
break; |
default: |
; |
} |
} |
/* |
* This function computes an image's size after convolution. |
* If the convolution border mode is GL_REDUCE, the post-convolution |
* image will be smaller than the original. |
*/ |
void |
_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, |
GLsizei *width, GLsizei *height) |
{ |
if (ctx->Pixel.Convolution1DEnabled |
&& dimensions == 1 |
&& ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) { |
*width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); |
} |
else if (ctx->Pixel.Convolution2DEnabled |
&& dimensions > 1 |
&& ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) { |
*width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); |
*height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); |
} |
else if (ctx->Pixel.Separable2DEnabled |
&& dimensions > 1 |
&& ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) { |
*width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); |
*height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/clip.h |
---|
0,0 → 1,40 |
/* $Id: clip.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef CLIP_H |
#define CLIP_H |
#include "mtypes.h" |
extern void _mesa_ClipPlane( GLenum plane, const GLdouble *equation ); |
extern void _mesa_GetClipPlane( GLenum plane, GLdouble *equation ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/polygon.h |
---|
0,0 → 1,57 |
/* $Id: polygon.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef POLYGON_H |
#define POLYGON_H |
#include "mtypes.h" |
extern void |
_mesa_CullFace( GLenum mode ); |
extern void |
_mesa_FrontFace( GLenum mode ); |
extern void |
_mesa_PolygonMode( GLenum face, GLenum mode ); |
extern void |
_mesa_PolygonOffset( GLfloat factor, GLfloat units ); |
extern void |
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ); |
extern void |
_mesa_PolygonStipple( const GLubyte *mask ); |
extern void |
_mesa_GetPolygonStipple( GLubyte *mask ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texutil.c |
---|
0,0 → 1,1035 |
/* $Id: texutil.c,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
/* |
* Description: |
* Functions for texture image conversion. This takes care of converting |
* typical GL_RGBA/GLubyte textures into hardware-specific formats. |
* We can handle non-standard row strides and pixel unpacking parameters. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "enums.h" |
#include "image.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "texformat.h" |
#include "texutil.h" |
#define DEBUG_TEXUTIL 0 |
#ifdef MESA_BIG_ENDIAN |
#define APPEND16( a, b ) ( (a) << 16 | (b) ) |
#else |
#define APPEND16( a, b ) ( (a) | (b) << 16 ) |
#endif |
struct convert_info { |
GLint xoffset, yoffset, zoffset; /* Subimage offset */ |
GLint width, height, depth; /* Subimage region */ |
GLint dstImageWidth, dstImageHeight; /* Dest image size */ |
/* Needed for subimage replacement */ |
GLenum format, type; /* Source (user) format and type */ |
const struct gl_pixelstore_attrib *unpacking; |
const GLvoid *srcImage; |
GLvoid *dstImage; |
GLint index; |
}; |
typedef GLboolean (*convert_func)( const struct convert_info *convert ); |
/* bitvalues for convert->index */ |
#define CONVERT_STRIDE_BIT 0x1 |
#define CONVERT_UNPACKING_BIT 0x2 |
/* ============================================================= |
* Convert to RGBA8888 textures: |
*/ |
#define DST_TYPE GLuint |
#define DST_TEXELS_PER_DWORD 1 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( src[3], src[2], src[1], src[0] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_rgba8888_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( src[0], src[1], src[2], src[3] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_rgba8888 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( src[0], src[1], src[2], 0xff ) |
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src ) |
#define SRC_TEXEL_BYTES 3 |
#define TAG(x) x##_bgr888_to_rgba8888 |
#include "texutil_tmp.h" |
#define CONVERT_RGBA8888( name ) \ |
static GLboolean \ |
convert_##name##_rgba8888( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_ABGR_EXT && \ |
convert->type == GL_UNSIGNED_INT_8_8_8_8_REV ) \ |
{ \ |
tab = name##_tab_rgba8888_direct; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
( convert->type == GL_UNSIGNED_BYTE || \ |
convert->type == GL_UNSIGNED_INT_8_8_8_8 ) ) \ |
{ \ |
tab = name##_tab_abgr8888_to_rgba8888; \ |
} \ |
else if ( convert->format == GL_RGB && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_bgr888_to_rgba8888; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_RGBA8888( texsubimage2d ) |
CONVERT_RGBA8888( texsubimage3d ) |
/* ============================================================= |
* Convert to ARGB8888 textures: |
*/ |
#define DST_TYPE GLuint |
#define DST_TEXELS_PER_DWORD 1 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( src[3], src[2], src[1], src[0] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_argb8888_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( src[3], src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_argb8888 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_8888_LE( 0xff, src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src ) |
#define SRC_TEXEL_BYTES 3 |
#define TAG(x) x##_bgr888_to_argb8888 |
#include "texutil_tmp.h" |
#define CONVERT_ARGB8888( name ) \ |
static GLboolean \ |
convert_##name##_argb8888( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_BGRA && \ |
convert->type == GL_UNSIGNED_INT_8_8_8_8_REV ) \ |
{ \ |
tab = name##_tab_argb8888_direct; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_abgr8888_to_argb8888; \ |
} \ |
else if ( convert->format == GL_RGB && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_bgr888_to_argb8888; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_ARGB8888( texsubimage2d ) |
CONVERT_ARGB8888( texsubimage3d ) |
/* ============================================================= |
* Convert to RGB888 textures: |
*/ |
static GLboolean |
convert_texsubimage2d_rgb888( const struct convert_info *convert ) |
{ |
/* This is a placeholder for now... |
*/ |
return GL_FALSE; |
} |
static GLboolean |
convert_texsubimage3d_rgb888( const struct convert_info *convert ) |
{ |
/* This is a placeholder for now... |
*/ |
return GL_FALSE; |
} |
/* ============================================================= |
* Convert to RGB565 textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_565_LE( src[0], src[1], src[2] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_rgb565_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_565_LE( src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_565_LE( src[0], src[1], src[2] ), \ |
PACK_COLOR_565_LE( src[3], src[4], src[5] ) ) |
#define SRC_TEXEL_BYTES 3 |
#define TAG(x) x##_bgr888_to_rgb565 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_565_LE( src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_565_LE( src[0], src[1], src[2] ), \ |
PACK_COLOR_565_LE( src[4], src[5], src[6] ) ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_rgb565 |
#include "texutil_tmp.h" |
#define CONVERT_RGB565( name ) \ |
static GLboolean \ |
convert_##name##_rgb565( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_RGB && \ |
convert->type == GL_UNSIGNED_SHORT_5_6_5 ) \ |
{ \ |
tab = name##_tab_rgb565_direct; \ |
} \ |
else if ( convert->format == GL_RGB && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_bgr888_to_rgb565; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_abgr8888_to_rgb565; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_RGB565( texsubimage2d ) |
CONVERT_RGB565( texsubimage3d ) |
/* ============================================================= |
* Convert to ARGB4444 textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_4444_LE( src[3], src[0], src[1], src[2] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_argb4444_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_4444_LE( src[3], src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_4444_LE( src[3], src[0], src[1], src[2] ), \ |
PACK_COLOR_4444_LE( src[7], src[4], src[5], src[6] ) ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_argb4444 |
#include "texutil_tmp.h" |
#define CONVERT_ARGB4444( name ) \ |
static GLboolean \ |
convert_##name##_argb4444( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_BGRA && \ |
convert->type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) \ |
{ \ |
tab = name##_tab_argb4444_direct; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_abgr8888_to_argb4444; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_ARGB4444( texsubimage2d ) |
CONVERT_ARGB4444( texsubimage3d ) |
/* ============================================================= |
* Convert to ARGB1555 textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_1555_LE( src[3], src[0], src[1], src[2] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_argb1555_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#ifdef MESA_BIG_ENDIAN |
#define CONVERT_TEXEL( dst, src ) \ |
{ const GLushort s = *(GLushort *)src; \ |
dst = (s >> 9) | ((s & 0x1ff) << 7); } |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
{ const GLuint s = ((fi_type *)src)->i; \ |
dst = (((s & 0xfe00fe00) >> 9) | \ |
((s & 0x01ff01ff) << 7)); } |
#else |
#define CONVERT_TEXEL( dst, src ) \ |
{ const GLushort s = *(GLushort *)src; \ |
dst = (s >> 1) | ((s & 1) << 15); } |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
{ const GLuint s = ((fi_type *)src)->i; \ |
dst = (((s & 0xfffefffe) >> 1) | \ |
((s & 0x00010001) << 15)); } |
#endif |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_rgba5551_to_argb1555 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_1555_LE( src[3], src[0], src[1], src[2] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_1555_LE( src[3], src[0], src[1], src[2] ), \ |
PACK_COLOR_1555_LE( src[7], src[4], src[5], src[6] ) ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_argb1555 |
#include "texutil_tmp.h" |
#define CONVERT_ARGB1555( name ) \ |
static GLboolean \ |
convert_##name##_argb1555( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_BGRA && \ |
convert->type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) \ |
{ \ |
tab = name##_tab_argb1555_direct; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_SHORT_5_5_5_1 ) \ |
{ \ |
tab = name##_tab_rgba5551_to_argb1555; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_abgr8888_to_argb1555; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_ARGB1555( texsubimage2d ) |
CONVERT_ARGB1555( texsubimage3d ) |
/* ============================================================= |
* AL88 textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_88_LE( src[0], src[1] ) |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_al88_direct |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_88_LE( src[0], 0x00 ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_88_LE( src[0], 0x00 ), \ |
PACK_COLOR_88_LE( src[1], 0x00 ) ) |
#define SRC_TEXEL_BYTES 1 |
#define TAG(x) x##_a8_to_al88 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_88_LE( 0xff, src[0] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_88_LE( 0xff, src[0] ), \ |
PACK_COLOR_88_LE( 0xff, src[1] ) ) |
#define SRC_TEXEL_BYTES 1 |
#define TAG(x) x##_l8_to_al88 |
#define PRESERVE_DST_TYPE |
#include "texutil_tmp.h" |
#define CONVERT_TEXEL( dst, src ) \ |
dst = PACK_COLOR_88_LE( src[3], src[0] ) |
#define CONVERT_TEXEL_DWORD( dst, src ) \ |
dst = APPEND16( PACK_COLOR_88_LE( src[3], src[0] ), \ |
PACK_COLOR_88_LE( src[7], src[4] ) ) |
#define SRC_TEXEL_BYTES 4 |
#define TAG(x) x##_abgr8888_to_al88 |
#include "texutil_tmp.h" |
#define CONVERT_AL88( name ) \ |
static GLboolean \ |
convert_##name##_al88( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( convert->format == GL_LUMINANCE_ALPHA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_al88_direct; \ |
} \ |
else if ( convert->format == GL_ALPHA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_a8_to_al88; \ |
} \ |
else if ( convert->format == GL_LUMINANCE && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_l8_to_al88; \ |
} \ |
else if ( convert->format == GL_RGBA && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_abgr8888_to_al88; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_AL88( texsubimage2d ) |
CONVERT_AL88( texsubimage3d ) |
/* ============================================================= |
* Convert to RGB332 textures: |
*/ |
static GLboolean |
convert_texsubimage2d_rgb332( const struct convert_info *convert ) |
{ |
/* This is a placeholder for now... |
*/ |
return GL_FALSE; |
} |
static GLboolean |
convert_texsubimage3d_rgb332( const struct convert_info *convert ) |
{ |
/* This is a placeholder for now... |
*/ |
return GL_FALSE; |
} |
/* ============================================================= |
* CI8 (and all other single-byte texel) textures: |
*/ |
#define DST_TYPE GLubyte |
#define DST_TEXELS_PER_DWORD 4 |
#define CONVERT_TEXEL( dst, src ) dst = src[0] |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 1 |
#define TAG(x) x##_ci8_direct |
#include "texutil_tmp.h" |
#define CONVERT_CI8( name ) \ |
static GLboolean \ |
convert_##name##_ci8( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if ( ( convert->format == GL_ALPHA || \ |
convert->format == GL_LUMINANCE || \ |
convert->format == GL_INTENSITY || \ |
convert->format == GL_COLOR_INDEX ) && \ |
convert->type == GL_UNSIGNED_BYTE ) \ |
{ \ |
tab = name##_tab_ci8_direct; \ |
} \ |
else \ |
{ \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_CI8( texsubimage2d ) |
CONVERT_CI8( texsubimage3d ) |
/* ============================================================= |
* convert to YCBCR textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = (src[0] << 8) | src[1]; |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_ycbcr_direct |
#include "texutil_tmp.h" |
#define CONVERT_YCBCR( name ) \ |
static GLboolean \ |
convert_##name##_ycbcr( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if (convert->format != GL_YCBCR_MESA) { \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
tab = name##_tab_ycbcr_direct; \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_YCBCR( texsubimage2d ) |
CONVERT_YCBCR( texsubimage3d ) |
/* ============================================================= |
* convert to YCBCR_REV textures: |
*/ |
#define DST_TYPE GLushort |
#define DST_TEXELS_PER_DWORD 2 |
#define CONVERT_TEXEL( dst, src ) \ |
dst = (src[1] << 8) | src[0]; |
#define CONVERT_DIRECT |
#define SRC_TEXEL_BYTES 2 |
#define TAG(x) x##_ycbcr_rev_direct |
#include "texutil_tmp.h" |
#define CONVERT_YCBCR_REV( name ) \ |
static GLboolean \ |
convert_##name##_ycbcr_rev( const struct convert_info *convert ) \ |
{ \ |
convert_func *tab; \ |
GLint index = convert->index; \ |
\ |
if (convert->format != GL_YCBCR_MESA) { \ |
/* Can't handle this source format/type combination */ \ |
return GL_FALSE; \ |
} \ |
tab = name##_tab_ycbcr_rev_direct; \ |
\ |
return tab[index]( convert ); \ |
} |
CONVERT_YCBCR_REV( texsubimage2d ) |
CONVERT_YCBCR_REV( texsubimage3d ) |
/* ============================================================= |
* Global entry points |
*/ |
static convert_func convert_texsubimage2d_tab[] = { |
convert_texsubimage2d_rgba8888, |
convert_texsubimage2d_argb8888, |
convert_texsubimage2d_rgb888, |
convert_texsubimage2d_rgb565, |
convert_texsubimage2d_argb4444, |
convert_texsubimage2d_argb1555, |
convert_texsubimage2d_al88, |
convert_texsubimage2d_rgb332, |
convert_texsubimage2d_ci8, /* These are all the same... */ |
convert_texsubimage2d_ci8, |
convert_texsubimage2d_ci8, |
convert_texsubimage2d_ci8, |
convert_texsubimage2d_ycbcr, |
convert_texsubimage2d_ycbcr_rev, |
}; |
static convert_func convert_texsubimage3d_tab[] = { |
convert_texsubimage3d_rgba8888, |
convert_texsubimage3d_argb8888, |
convert_texsubimage3d_rgb888, |
convert_texsubimage3d_rgb565, |
convert_texsubimage3d_argb4444, |
convert_texsubimage3d_argb1555, |
convert_texsubimage3d_al88, |
convert_texsubimage3d_rgb332, |
convert_texsubimage3d_ci8, /* These are all the same... */ |
convert_texsubimage3d_ci8, |
convert_texsubimage3d_ci8, |
convert_texsubimage3d_ci8, |
convert_texsubimage3d_ycbcr, |
convert_texsubimage3d_ycbcr_rev, |
}; |
/* See if we need to care about the pixel store attributes when we're |
* converting the texture image. This should be stored as |
* unpacking->_SomeBoolean and updated when the values change, to avoid |
* testing every time... |
*/ |
static INLINE GLboolean |
convert_needs_unpacking( const struct gl_pixelstore_attrib *unpacking, |
GLenum format, GLenum type ) |
{ |
if ( ( unpacking->Alignment == 1 || |
( unpacking->Alignment == 4 && /* Pick up the common Q3A case... */ |
format == GL_RGBA && type == GL_UNSIGNED_BYTE ) ) && |
unpacking->RowLength == 0 && |
unpacking->SkipPixels == 0 && |
unpacking->SkipRows == 0 && |
unpacking->ImageHeight == 0 && |
unpacking->SkipImages == 0 && |
unpacking->SwapBytes == GL_FALSE && |
unpacking->LsbFirst == GL_FALSE ) { |
return GL_FALSE; |
} else { |
return GL_TRUE; |
} |
} |
GLboolean |
_mesa_convert_texsubimage1d( GLint mesaFormat, |
GLint xoffset, |
GLint width, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *unpacking, |
const GLvoid *srcImage, GLvoid *dstImage ) |
{ |
struct convert_info convert; |
ASSERT( unpacking ); |
ASSERT( srcImage ); |
ASSERT( dstImage ); |
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); |
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); |
/* Make it easier to pass all the parameters around. |
*/ |
convert.xoffset = xoffset; |
convert.yoffset = 0; |
convert.width = width; |
convert.height = 1; |
convert.format = format; |
convert.type = type; |
convert.unpacking = unpacking; |
convert.srcImage = srcImage; |
convert.dstImage = dstImage; |
convert.index = 0; |
if ( convert_needs_unpacking( unpacking, format, type ) ) |
convert.index |= CONVERT_UNPACKING_BIT; |
ASSERT(convert.index < 4); |
return convert_texsubimage2d_tab[mesaFormat]( &convert ); |
} |
/* Convert a user's 2D image into a texture image. This basically |
* repacks pixel data into the special texture formats used by core Mesa |
* and the DRI drivers. This function can do full images or subimages. |
* |
* We return a boolean because this function may not accept some kinds |
* of source image formats and/or types. For example, if the incoming |
* format/type = GL_BGR, GL_UNSIGNED_INT this function probably won't |
* be able to do the conversion. |
* |
* In that case, the incoming image should first be simplified to one of |
* the "canonical" formats (GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, |
* GL_INTENSITY, GL_RGB, GL_RGBA) and types (GL_CHAN). We can do that |
* with the _mesa_transfer_teximage() function. That function will also |
* do image transfer operations such as scale/bias and convolution. |
* |
* Input: |
* mesaFormat - one of the MESA_FORMAT_* values from texformat.h |
* xoffset, yoffset - position in dest image to put data |
* width, height - incoming image size, also size of dest region. |
* dstImageWidth - width (row stride) of dest image in pixels |
* format, type - incoming image format and type |
* unpacking - describes incoming image unpacking |
* srcImage - pointer to source image |
* destImage - pointer to dest image |
*/ |
GLboolean |
_mesa_convert_texsubimage2d( GLint mesaFormat, /* dest */ |
GLint xoffset, GLint yoffset, |
GLint width, GLint height, |
GLint destImageWidth, |
GLenum format, GLenum type, /* source */ |
const struct gl_pixelstore_attrib *unpacking, |
const GLvoid *srcImage, GLvoid *dstImage ) |
{ |
struct convert_info convert; |
ASSERT( unpacking ); |
ASSERT( srcImage ); |
ASSERT( dstImage ); |
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); |
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); |
/* Make it easier to pass all the parameters around. |
*/ |
convert.xoffset = xoffset; |
convert.yoffset = yoffset; |
convert.width = width; |
convert.height = height; |
convert.dstImageWidth = destImageWidth; |
convert.format = format; |
convert.type = type; |
convert.unpacking = unpacking; |
convert.srcImage = srcImage; |
convert.dstImage = dstImage; |
convert.index = 0; |
if ( convert_needs_unpacking( unpacking, format, type ) ) |
convert.index |= CONVERT_UNPACKING_BIT; |
if ( width != destImageWidth ) |
convert.index |= CONVERT_STRIDE_BIT; |
return convert_texsubimage2d_tab[mesaFormat]( &convert ); |
} |
GLboolean |
_mesa_convert_texsubimage3d( GLint mesaFormat, /* dest */ |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint width, GLint height, GLint depth, |
GLint dstImageWidth, GLint dstImageHeight, |
GLenum format, GLenum type, /* source */ |
const struct gl_pixelstore_attrib *unpacking, |
const GLvoid *srcImage, GLvoid *dstImage ) |
{ |
struct convert_info convert; |
ASSERT( unpacking ); |
ASSERT( srcImage ); |
ASSERT( dstImage ); |
ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); |
ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); |
/* Make it easier to pass all the parameters around. |
*/ |
convert.xoffset = xoffset; |
convert.yoffset = yoffset; |
convert.zoffset = zoffset; |
convert.width = width; |
convert.height = height; |
convert.depth = depth; |
convert.dstImageWidth = dstImageWidth; |
convert.dstImageHeight = dstImageHeight; |
convert.format = format; |
convert.type = type; |
convert.unpacking = unpacking; |
convert.srcImage = srcImage; |
convert.dstImage = dstImage; |
convert.index = 0; |
if ( convert_needs_unpacking( unpacking, format, type ) ) |
convert.index |= CONVERT_UNPACKING_BIT; |
if ( width != dstImageWidth || height != dstImageHeight ) |
convert.index |= CONVERT_STRIDE_BIT; |
return convert_texsubimage3d_tab[mesaFormat]( &convert ); |
} |
/* Nearest filtering only (for broken hardware that can't support |
* all aspect ratios). This can be made a lot faster, but I don't |
* really care enough... |
*/ |
void _mesa_rescale_teximage2d( GLuint bytesPerPixel, GLuint dstRowStride, |
GLint srcWidth, GLint srcHeight, |
GLint dstWidth, GLint dstHeight, |
const GLvoid *srcImage, GLvoid *dstImage ) |
{ |
GLint row, col; |
#define INNER_LOOP( TYPE, HOP, WOP ) \ |
for ( row = 0 ; row < dstHeight ; row++ ) { \ |
GLint srcRow = row HOP hScale; \ |
for ( col = 0 ; col < dstWidth ; col++ ) { \ |
GLint srcCol = col WOP wScale; \ |
dst[col] = src[srcRow * srcWidth + srcCol]; \ |
} \ |
dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ |
} \ |
#define RESCALE_IMAGE( TYPE ) \ |
do { \ |
const TYPE *src = (const TYPE *)srcImage; \ |
TYPE *dst = (TYPE *)dstImage; \ |
\ |
if ( srcHeight <= dstHeight ) { \ |
const GLint hScale = dstHeight / srcHeight; \ |
if ( srcWidth <= dstWidth ) { \ |
const GLint wScale = dstWidth / srcWidth; \ |
INNER_LOOP( TYPE, /, / ); \ |
} \ |
else { \ |
const GLint wScale = srcWidth / dstWidth; \ |
INNER_LOOP( TYPE, /, * ); \ |
} \ |
} \ |
else { \ |
const GLint hScale = srcHeight / dstHeight; \ |
if ( srcWidth <= dstWidth ) { \ |
const GLint wScale = dstWidth / srcWidth; \ |
INNER_LOOP( TYPE, *, / ); \ |
} \ |
else { \ |
const GLint wScale = srcWidth / dstWidth; \ |
INNER_LOOP( TYPE, *, * ); \ |
} \ |
} \ |
} while (0) |
switch ( bytesPerPixel ) { |
case 4: |
RESCALE_IMAGE( GLuint ); |
break; |
case 2: |
RESCALE_IMAGE( GLushort ); |
break; |
case 1: |
RESCALE_IMAGE( GLubyte ); |
break; |
default: |
_mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d"); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/convolve.h |
---|
0,0 → 1,108 |
/* $Id: convolve.h,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef CONVOLVE_H |
#define CONVOLVE_H |
#include "mtypes.h" |
extern void |
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, |
GLenum format, GLenum type, const GLvoid *image); |
extern void |
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, |
GLsizei height, GLenum format, GLenum type, |
const GLvoid *image); |
extern void |
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); |
extern void |
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, |
const GLfloat *params); |
extern void |
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params); |
extern void |
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); |
extern void |
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width); |
extern void |
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width, GLsizei height); |
extern void |
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, |
GLvoid *image); |
extern void |
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); |
extern void |
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); |
extern void |
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, |
GLvoid *row, GLvoid *column, GLvoid *span); |
extern void |
_mesa_SeparableFilter2D(GLenum target, GLenum internalformat, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *row, const GLvoid *column); |
extern void |
_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, |
const GLfloat *srcImage, GLfloat *dstImage); |
extern void |
_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, |
const GLfloat *srcImage, GLfloat *dstImage); |
extern void |
_mesa_convolve_sep_image(const GLcontext *ctx, |
GLsizei *width, GLsizei *height, |
const GLfloat *srcImage, GLfloat *dstImage); |
extern void |
_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, |
GLsizei *width, GLsizei *height); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texstate.c |
---|
0,0 → 1,2560 |
/* $Id: texstate.c,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "enums.h" |
#include "extensions.h" |
#include "macros.h" |
#include "texobj.h" |
#include "teximage.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "math/m_xform.h" |
#include "math/m_matrix.h" |
#ifdef SPECIALCAST |
/* Needed for an Amiga compiler */ |
#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) |
#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) |
#else |
/* all other compilers */ |
#define ENUM_TO_FLOAT(X) ((GLfloat)(X)) |
#define ENUM_TO_DOUBLE(X) ((GLdouble)(X)) |
#endif |
void |
_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) |
{ |
GLuint i; |
ASSERT(src); |
ASSERT(dst); |
dst->Texture.CurrentUnit = src->Texture.CurrentUnit; |
dst->Texture._GenFlags = src->Texture._GenFlags; |
dst->Texture._TexGenEnabled = src->Texture._TexGenEnabled; |
dst->Texture._TexMatEnabled = src->Texture._TexMatEnabled; |
dst->Texture.SharedPalette = src->Texture.SharedPalette; |
/* per-unit state */ |
for (i = 0; i < src->Const.MaxTextureUnits; i++) { |
dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled; |
dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode; |
COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor); |
dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled; |
dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS; |
dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT; |
dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR; |
dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ; |
dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS; |
dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT; |
dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR; |
dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ; |
dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags; |
COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS); |
COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT); |
COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR); |
COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ); |
COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS); |
COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT); |
COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR); |
COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ); |
dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias; |
/* GL_EXT_texture_env_combine */ |
dst->Texture.Unit[i].CombineModeRGB = src->Texture.Unit[i].CombineModeRGB; |
dst->Texture.Unit[i].CombineModeA = src->Texture.Unit[i].CombineModeA; |
COPY_3V(dst->Texture.Unit[i].CombineSourceRGB, src->Texture.Unit[i].CombineSourceRGB); |
COPY_3V(dst->Texture.Unit[i].CombineSourceA, src->Texture.Unit[i].CombineSourceA); |
COPY_3V(dst->Texture.Unit[i].CombineOperandRGB, src->Texture.Unit[i].CombineOperandRGB); |
COPY_3V(dst->Texture.Unit[i].CombineOperandA, src->Texture.Unit[i].CombineOperandA); |
dst->Texture.Unit[i].CombineScaleShiftRGB = src->Texture.Unit[i].CombineScaleShiftRGB; |
dst->Texture.Unit[i].CombineScaleShiftA = src->Texture.Unit[i].CombineScaleShiftA; |
/* texture object state */ |
_mesa_copy_texture_object(dst->Texture.Unit[i].Current1D, |
src->Texture.Unit[i].Current1D); |
_mesa_copy_texture_object(dst->Texture.Unit[i].Current2D, |
src->Texture.Unit[i].Current2D); |
_mesa_copy_texture_object(dst->Texture.Unit[i].Current3D, |
src->Texture.Unit[i].Current3D); |
_mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap, |
src->Texture.Unit[i].CurrentCubeMap); |
_mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect, |
src->Texture.Unit[i].CurrentRect); |
} |
} |
/**********************************************************************/ |
/* Texture Environment */ |
/**********************************************************************/ |
void |
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
#define TE_ERROR(errCode, msg, value) \ |
_mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); |
if (target == GL_TEXTURE_ENV) { |
switch (pname) { |
case GL_TEXTURE_ENV_MODE: |
{ |
const GLenum mode = (GLenum) (GLint) *param; |
if (mode == GL_MODULATE || |
mode == GL_BLEND || |
mode == GL_DECAL || |
mode == GL_REPLACE || |
(mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || |
(mode == GL_COMBINE_EXT && |
(ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine))) { |
/* legal */ |
if (texUnit->EnvMode == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->EnvMode = mode; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
} |
break; |
case GL_TEXTURE_ENV_COLOR: |
{ |
GLfloat tmp[4]; |
tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); |
tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); |
tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); |
tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); |
if (TEST_EQ_4V(tmp, texUnit->EnvColor)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
COPY_4FV(texUnit->EnvColor, tmp); |
} |
break; |
case GL_COMBINE_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum mode = (GLenum) (GLint) *param; |
switch (mode) { |
case GL_REPLACE: |
case GL_MODULATE: |
case GL_ADD: |
case GL_ADD_SIGNED_EXT: |
case GL_INTERPOLATE_EXT: |
/* OK */ |
break; |
case GL_SUBTRACT_ARB: |
if (!ctx->Extensions.ARB_texture_env_combine) { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
break; |
case GL_DOT3_RGB_EXT: |
case GL_DOT3_RGBA_EXT: |
if (!ctx->Extensions.EXT_texture_env_dot3) { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
break; |
case GL_DOT3_RGB_ARB: |
case GL_DOT3_RGBA_ARB: |
if (!ctx->Extensions.ARB_texture_env_dot3) { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
break; |
default: |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
if (texUnit->CombineModeRGB == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineModeRGB = mode; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_COMBINE_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum mode = (GLenum) (GLint) *param; |
if (mode == GL_REPLACE || |
mode == GL_MODULATE || |
mode == GL_ADD || |
mode == GL_ADD_SIGNED_EXT || |
mode == GL_INTERPOLATE_EXT || |
(mode == GL_SUBTRACT_ARB && |
ctx->Extensions.ARB_texture_env_combine)) { |
/* legal */ |
if (texUnit->CombineModeA == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineModeA = mode; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_SOURCE0_RGB_EXT: |
case GL_SOURCE1_RGB_EXT: |
case GL_SOURCE2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum source = (GLenum) (GLint) *param; |
const GLuint s = pname - GL_SOURCE0_RGB_EXT; |
if (source == GL_TEXTURE || |
source == GL_CONSTANT_EXT || |
source == GL_PRIMARY_COLOR_EXT || |
source == GL_PREVIOUS_EXT || |
(ctx->Extensions.ARB_texture_env_crossbar && |
source >= GL_TEXTURE0_ARB && |
source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) { |
/* legal */ |
if (texUnit->CombineSourceRGB[s] == source) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineSourceRGB[s] = source; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_SOURCE0_ALPHA_EXT: |
case GL_SOURCE1_ALPHA_EXT: |
case GL_SOURCE2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum source = (GLenum) (GLint) *param; |
const GLuint s = pname - GL_SOURCE0_ALPHA_EXT; |
if (source == GL_TEXTURE || |
source == GL_CONSTANT_EXT || |
source == GL_PRIMARY_COLOR_EXT || |
source == GL_PREVIOUS_EXT || |
(ctx->Extensions.ARB_texture_env_crossbar && |
source >= GL_TEXTURE0_ARB && |
source < GL_TEXTURE0_ARB + ctx->Const.MaxTextureUnits)) { |
/* legal */ |
if (texUnit->CombineSourceA[s] == source) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineSourceA[s] = source; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_OPERAND0_RGB_EXT: |
case GL_OPERAND1_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum operand = (GLenum) (GLint) *param; |
const GLuint s = pname - GL_OPERAND0_RGB_EXT; |
switch (operand) { |
case GL_SRC_COLOR: |
case GL_ONE_MINUS_SRC_COLOR: |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
if (texUnit->CombineOperandRGB[s] == operand) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineOperandRGB[s] = operand; |
break; |
default: |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_OPERAND0_ALPHA_EXT: |
case GL_OPERAND1_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum operand = (GLenum) (GLint) *param; |
switch (operand) { |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: |
if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] == |
operand) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand; |
break; |
default: |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_OPERAND2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum operand = (GLenum) (GLint) *param; |
switch (operand) { |
case GL_SRC_COLOR: /* ARB combine only */ |
case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ |
if (texUnit->CombineOperandRGB[2] == operand) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineOperandRGB[2] = operand; |
default: |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_OPERAND2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
const GLenum operand = (GLenum) (GLint) *param; |
switch (operand) { |
case GL_SRC_ALPHA: |
case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ |
if (texUnit->CombineOperandA[2] == operand) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineOperandA[2] = operand; |
break; |
default: |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); |
return; |
} |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_RGB_SCALE_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
GLuint newshift; |
if (*param == 1.0) { |
newshift = 0; |
} |
else if (*param == 2.0) { |
newshift = 1; |
} |
else if (*param == 4.0) { |
newshift = 2; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); |
return; |
} |
if (texUnit->CombineScaleShiftRGB == newshift) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineScaleShiftRGB = newshift; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
case GL_ALPHA_SCALE: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
GLuint newshift; |
if (*param == 1.0) { |
newshift = 0; |
} |
else if (*param == 2.0) { |
newshift = 1; |
} |
else if (*param == 4.0) { |
newshift = 2; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" ); |
return; |
} |
if (texUnit->CombineScaleShiftA == newshift) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->CombineScaleShiftA = newshift; |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); |
return; |
} |
} |
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { |
/* GL_EXT_texture_lod_bias */ |
if (!ctx->Extensions.EXT_texture_lod_bias) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); |
return; |
} |
if (pname == GL_TEXTURE_LOD_BIAS_EXT) { |
if (texUnit->LodBias == param[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->LodBias = CLAMP(param[0], -ctx->Const.MaxTextureLodBias, |
ctx->Const.MaxTextureLodBias); |
} |
else { |
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); |
return; |
} |
} |
else if (target == GL_POINT_SPRITE_NV) { |
/* GL_NV_point_sprite */ |
if (!ctx->Extensions.NV_point_sprite) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); |
return; |
} |
if (pname == GL_COORD_REPLACE_NV) { |
const GLenum value = (GLenum) param[0]; |
if (value == GL_TRUE || value == GL_FALSE) { |
/* It's kind of weird to set point state via glTexEnv, |
* but that's what the spec calls for. |
*/ |
const GLboolean state = (GLboolean) value; |
if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value); |
return; |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); |
return; |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", |
_mesa_lookup_enum_by_nr(target), |
_mesa_lookup_enum_by_nr(pname), |
*param, |
_mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); |
/* Tell device driver about the new texture environment */ |
if (ctx->Driver.TexEnv) { |
(*ctx->Driver.TexEnv)( ctx, target, pname, param ); |
} |
} |
void |
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) |
{ |
_mesa_TexEnvfv( target, pname, ¶m ); |
} |
void |
_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) param; |
p[1] = p[2] = p[3] = 0.0; |
_mesa_TexEnvfv( target, pname, p ); |
} |
void |
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) |
{ |
GLfloat p[4]; |
if (pname == GL_TEXTURE_ENV_COLOR) { |
p[0] = INT_TO_FLOAT( param[0] ); |
p[1] = INT_TO_FLOAT( param[1] ); |
p[2] = INT_TO_FLOAT( param[2] ); |
p[3] = INT_TO_FLOAT( param[3] ); |
} |
else { |
p[0] = (GLfloat) param[0]; |
p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ |
} |
_mesa_TexEnvfv( target, pname, p ); |
} |
void |
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target == GL_TEXTURE_ENV) { |
switch (pname) { |
case GL_TEXTURE_ENV_MODE: |
*params = ENUM_TO_FLOAT(texUnit->EnvMode); |
break; |
case GL_TEXTURE_ENV_COLOR: |
COPY_4FV( params, texUnit->EnvColor ); |
break; |
case GL_COMBINE_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineModeRGB; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_COMBINE_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineModeA; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE0_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceRGB[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE1_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceRGB[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceRGB[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE0_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceA[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE1_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceA[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_SOURCE2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineSourceA[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND0_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandRGB[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND1_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandRGB[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandRGB[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND0_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandA[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND1_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandA[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_OPERAND2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLfloat) texUnit->CombineOperandA[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
} |
break; |
case GL_RGB_SCALE_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
if (texUnit->CombineScaleShiftRGB == 0) |
*params = 1.0; |
else if (texUnit->CombineScaleShiftRGB == 1) |
*params = 2.0; |
else |
*params = 4.0; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
return; |
} |
break; |
case GL_ALPHA_SCALE: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
if (texUnit->CombineScaleShiftA == 0) |
*params = 1.0; |
else if (texUnit->CombineScaleShiftA == 1) |
*params = 2.0; |
else |
*params = 4.0; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); |
} |
} |
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { |
/* GL_EXT_texture_lod_bias */ |
if (!ctx->Extensions.EXT_texture_lod_bias) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); |
return; |
} |
if (pname == GL_TEXTURE_LOD_BIAS_EXT) { |
*params = texUnit->LodBias; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); |
return; |
} |
} |
else if (target == GL_POINT_SPRITE_NV) { |
/* GL_NV_point_sprite */ |
if (!ctx->Extensions.NV_point_sprite) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); |
return; |
} |
if (pname == GL_COORD_REPLACE_NV) { |
*params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); |
return; |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); |
return; |
} |
} |
void |
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target == GL_TEXTURE_ENV) { |
switch (pname) { |
case GL_TEXTURE_ENV_MODE: |
*params = (GLint) texUnit->EnvMode; |
break; |
case GL_TEXTURE_ENV_COLOR: |
params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] ); |
params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] ); |
params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] ); |
params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); |
break; |
case GL_COMBINE_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineModeRGB; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_COMBINE_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineModeA; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE0_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceRGB[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE1_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceRGB[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceRGB[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE0_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceA[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE1_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceA[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_SOURCE2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineSourceA[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND0_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandRGB[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND1_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandRGB[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND2_RGB_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandRGB[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND0_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandA[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND1_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandA[1]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_OPERAND2_ALPHA_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
*params = (GLint) texUnit->CombineOperandA[2]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
} |
break; |
case GL_RGB_SCALE_EXT: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
if (texUnit->CombineScaleShiftRGB == 0) |
*params = 1; |
else if (texUnit->CombineScaleShiftRGB == 1) |
*params = 2; |
else |
*params = 4; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
return; |
} |
break; |
case GL_ALPHA_SCALE: |
if (ctx->Extensions.EXT_texture_env_combine || |
ctx->Extensions.ARB_texture_env_combine) { |
if (texUnit->CombineScaleShiftA == 0) |
*params = 1; |
else if (texUnit->CombineScaleShiftA == 1) |
*params = 2; |
else |
*params = 4; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); |
} |
} |
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { |
/* GL_EXT_texture_lod_bias */ |
if (!ctx->Extensions.EXT_texture_lod_bias) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); |
return; |
} |
if (pname == GL_TEXTURE_LOD_BIAS_EXT) { |
*params = (GLint) texUnit->LodBias; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); |
return; |
} |
} |
else if (target == GL_POINT_SPRITE_NV) { |
/* GL_NV_point_sprite */ |
if (!ctx->Extensions.NV_point_sprite) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); |
return; |
} |
if (pname == GL_COORD_REPLACE_NV) { |
*params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); |
return; |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); |
return; |
} |
} |
/**********************************************************************/ |
/* Texture Parameters */ |
/**********************************************************************/ |
void |
_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) |
{ |
_mesa_TexParameterfv(target, pname, ¶m); |
} |
void |
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
GLenum eparam = (GLenum) (GLint) params[0]; |
struct gl_texture_object *texObj; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "texPARAM %s %s %d...\n", |
_mesa_lookup_enum_by_nr(target), |
_mesa_lookup_enum_by_nr(pname), |
eparam); |
switch (target) { |
case GL_TEXTURE_1D: |
texObj = texUnit->Current1D; |
break; |
case GL_TEXTURE_2D: |
texObj = texUnit->Current2D; |
break; |
case GL_TEXTURE_3D_EXT: |
texObj = texUnit->Current3D; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); |
return; |
} |
texObj = texUnit->CurrentCubeMap; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
if (!ctx->Extensions.NV_texture_rectangle) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); |
return; |
} |
texObj = texUnit->CurrentRect; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); |
return; |
} |
switch (pname) { |
case GL_TEXTURE_MIN_FILTER: |
/* A small optimization */ |
if (texObj->MinFilter == eparam) |
return; |
if (eparam==GL_NEAREST || eparam==GL_LINEAR) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MinFilter = eparam; |
} |
else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || |
eparam==GL_LINEAR_MIPMAP_NEAREST || |
eparam==GL_NEAREST_MIPMAP_LINEAR || |
eparam==GL_LINEAR_MIPMAP_LINEAR) && |
texObj->Target != GL_TEXTURE_RECTANGLE_NV) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MinFilter = eparam; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
break; |
case GL_TEXTURE_MAG_FILTER: |
/* A small optimization */ |
if (texObj->MagFilter == eparam) |
return; |
if (eparam==GL_NEAREST || eparam==GL_LINEAR) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MagFilter = eparam; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
break; |
case GL_TEXTURE_WRAP_S: |
if (texObj->WrapS == eparam) |
return; |
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || |
(eparam == GL_CLAMP_TO_BORDER_ARB && |
ctx->Extensions.ARB_texture_border_clamp)) { |
/* any texture target */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapS = eparam; |
} |
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && |
(eparam == GL_REPEAT || |
(eparam == GL_MIRRORED_REPEAT_ARB && |
ctx->Extensions.ARB_texture_mirrored_repeat) || |
(eparam == GL_MIRROR_CLAMP_ATI && |
ctx->Extensions.ATI_texture_mirror_once) || |
(eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && |
ctx->Extensions.ATI_texture_mirror_once))) { |
/* non-rectangle texture */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapS = eparam; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
break; |
case GL_TEXTURE_WRAP_T: |
if (texObj->WrapT == eparam) |
return; |
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || |
(eparam == GL_CLAMP_TO_BORDER_ARB && |
ctx->Extensions.ARB_texture_border_clamp)) { |
/* any texture target */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapT = eparam; |
} |
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && |
(eparam == GL_REPEAT || |
(eparam == GL_MIRRORED_REPEAT_ARB && |
ctx->Extensions.ARB_texture_mirrored_repeat) || |
(eparam == GL_MIRROR_CLAMP_ATI && |
ctx->Extensions.ATI_texture_mirror_once) || |
(eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && |
ctx->Extensions.ATI_texture_mirror_once))) { |
/* non-rectangle texture */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapT = eparam; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
break; |
case GL_TEXTURE_WRAP_R_EXT: |
if (texObj->WrapR == eparam) |
return; |
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || |
(eparam == GL_CLAMP_TO_BORDER_ARB && |
ctx->Extensions.ARB_texture_border_clamp)) { |
/* any texture target */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapR = eparam; |
} |
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && |
(eparam == GL_REPEAT || |
(eparam == GL_MIRRORED_REPEAT_ARB && |
ctx->Extensions.ARB_texture_mirrored_repeat) || |
(eparam == GL_MIRROR_CLAMP_ATI && |
ctx->Extensions.ATI_texture_mirror_once) || |
(eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && |
ctx->Extensions.ATI_texture_mirror_once))) { |
/* non-rectangle texture */ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->WrapR = eparam; |
} |
else { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
} |
break; |
case GL_TEXTURE_BORDER_COLOR: |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->BorderColor[RCOMP] = params[0]; |
texObj->BorderColor[GCOMP] = params[1]; |
texObj->BorderColor[BCOMP] = params[2]; |
texObj->BorderColor[ACOMP] = params[3]; |
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); |
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); |
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); |
UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); |
break; |
case GL_TEXTURE_MIN_LOD: |
if (texObj->MinLod == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MinLod = params[0]; |
break; |
case GL_TEXTURE_MAX_LOD: |
if (texObj->MaxLod == params[0]) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MaxLod = params[0]; |
break; |
case GL_TEXTURE_BASE_LEVEL: |
if (params[0] < 0.0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->BaseLevel = (GLint) params[0]; |
break; |
case GL_TEXTURE_MAX_LEVEL: |
if (params[0] < 0.0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MaxLevel = (GLint) params[0]; |
break; |
case GL_TEXTURE_PRIORITY: |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); |
break; |
case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
if (ctx->Extensions.EXT_texture_filter_anisotropic) { |
if (params[0] < 1.0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->MaxAnisotropy = params[0]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_OPERATOR_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
GLenum op = (GLenum) params[0]; |
if (op == GL_TEXTURE_LEQUAL_R_SGIX || |
op == GL_TEXTURE_GEQUAL_R_SGIX) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->CompareOperator = op; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); |
return; |
} |
break; |
case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ |
if (ctx->Extensions.SGIX_shadow_ambient) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); |
return; |
} |
break; |
case GL_GENERATE_MIPMAP_SGIS: |
if (ctx->Extensions.SGIS_generate_mipmap) { |
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_MODE_ARB: |
if (ctx->Extensions.ARB_shadow) { |
const GLenum mode = (GLenum) params[0]; |
if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->CompareMode = mode; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB)"); |
return; |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_FUNC_ARB: |
if (ctx->Extensions.ARB_shadow) { |
const GLenum func = (GLenum) params[0]; |
if (func == GL_LEQUAL || func == GL_GEQUAL) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->CompareFunc = func; |
} |
else if (ctx->Extensions.EXT_shadow_funcs && |
(func == GL_EQUAL || |
func == GL_NOTEQUAL || |
func == GL_LESS || |
func == GL_GREATER || |
func == GL_ALWAYS || |
func == GL_NEVER)) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->CompareFunc = func; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); |
return; |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); |
return; |
} |
break; |
case GL_DEPTH_TEXTURE_MODE_ARB: |
if (ctx->Extensions.ARB_depth_texture) { |
const GLenum result = (GLenum) params[0]; |
if (result == GL_LUMINANCE || result == GL_INTENSITY |
|| result == GL_ALPHA) { |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texObj->DepthMode = result; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); |
return; |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); |
return; |
} |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexParameter(pname=0x%x)", pname); |
return; |
} |
texObj->Complete = GL_FALSE; |
if (ctx->Driver.TexParameter) { |
(*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params ); |
} |
} |
void |
_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) |
{ |
GLfloat fparam[4]; |
fparam[0] = (GLfloat) param; |
fparam[1] = fparam[2] = fparam[3] = 0.0; |
_mesa_TexParameterfv(target, pname, fparam); |
} |
void |
_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) |
{ |
GLfloat fparam[4]; |
if (pname == GL_TEXTURE_BORDER_COLOR) { |
fparam[0] = INT_TO_FLOAT(params[0]); |
fparam[1] = INT_TO_FLOAT(params[1]); |
fparam[2] = INT_TO_FLOAT(params[2]); |
fparam[3] = INT_TO_FLOAT(params[3]); |
} |
else { |
fparam[0] = (GLfloat) params[0]; |
fparam[1] = fparam[2] = fparam[3] = 0.0F; |
} |
_mesa_TexParameterfv(target, pname, fparam); |
} |
void |
_mesa_GetTexLevelParameterfv( GLenum target, GLint level, |
GLenum pname, GLfloat *params ) |
{ |
GLint iparam; |
_mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); |
*params = (GLfloat) iparam; |
} |
static GLuint |
tex_image_dimensions(GLcontext *ctx, GLenum target) |
{ |
switch (target) { |
case GL_TEXTURE_1D: |
case GL_PROXY_TEXTURE_1D: |
return 1; |
case GL_TEXTURE_2D: |
case GL_PROXY_TEXTURE_2D: |
return 2; |
case GL_TEXTURE_3D: |
case GL_PROXY_TEXTURE_3D: |
return 3; |
case GL_TEXTURE_CUBE_MAP_ARB: |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; |
case GL_TEXTURE_RECTANGLE_NV: |
case GL_PROXY_TEXTURE_RECTANGLE_NV: |
return ctx->Extensions.NV_texture_rectangle ? 2 : 0; |
default: |
_mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); |
return 0; |
} |
} |
void |
_mesa_GetTexLevelParameteriv( GLenum target, GLint level, |
GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
const struct gl_texture_image *img = NULL; |
GLuint dimensions; |
GLboolean isProxy; |
GLint maxLevels; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
/* this will catch bad target values */ |
dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ |
if (dimensions == 0) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); |
return; |
} |
switch (target) { |
case GL_TEXTURE_1D: |
case GL_PROXY_TEXTURE_1D: |
case GL_TEXTURE_2D: |
case GL_PROXY_TEXTURE_2D: |
maxLevels = ctx->Const.MaxTextureLevels; |
break; |
case GL_TEXTURE_3D: |
case GL_PROXY_TEXTURE_3D: |
maxLevels = ctx->Const.Max3DTextureLevels; |
break; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
case GL_PROXY_TEXTURE_RECTANGLE_NV: |
maxLevels = 1; |
break; |
default: |
_mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter"); |
return; |
} |
if (level < 0 || level >= maxLevels) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); |
return; |
} |
img = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!img || !img->TexFormat) { |
/* undefined texture image */ |
if (pname == GL_TEXTURE_COMPONENTS) |
*params = 1; |
else |
*params = 0; |
return; |
} |
isProxy = (target == GL_PROXY_TEXTURE_1D) || |
(target == GL_PROXY_TEXTURE_2D) || |
(target == GL_PROXY_TEXTURE_3D) || |
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) || |
(target == GL_PROXY_TEXTURE_RECTANGLE_NV); |
switch (pname) { |
case GL_TEXTURE_WIDTH: |
*params = img->Width; |
return; |
case GL_TEXTURE_HEIGHT: |
*params = img->Height; |
return; |
case GL_TEXTURE_DEPTH: |
*params = img->Depth; |
return; |
case GL_TEXTURE_INTERNAL_FORMAT: |
*params = img->IntFormat; |
return; |
case GL_TEXTURE_BORDER: |
*params = img->Border; |
return; |
case GL_TEXTURE_RED_SIZE: |
if (img->Format == GL_RGB || img->Format == GL_RGBA) |
*params = img->TexFormat->RedBits; |
else |
*params = 0; |
return; |
case GL_TEXTURE_GREEN_SIZE: |
if (img->Format == GL_RGB || img->Format == GL_RGBA) |
*params = img->TexFormat->GreenBits; |
else |
*params = 0; |
return; |
case GL_TEXTURE_BLUE_SIZE: |
if (img->Format == GL_RGB || img->Format == GL_RGBA) |
*params = img->TexFormat->BlueBits; |
else |
*params = 0; |
return; |
case GL_TEXTURE_ALPHA_SIZE: |
if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA || |
img->Format == GL_RGBA) |
*params = img->TexFormat->AlphaBits; |
else |
*params = 0; |
return; |
case GL_TEXTURE_INTENSITY_SIZE: |
if (img->Format != GL_INTENSITY) |
*params = 0; |
else if (img->TexFormat->IntensityBits > 0) |
*params = img->TexFormat->IntensityBits; |
else /* intensity probably stored as rgb texture */ |
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); |
return; |
case GL_TEXTURE_LUMINANCE_SIZE: |
if (img->Format != GL_LUMINANCE && |
img->Format != GL_LUMINANCE_ALPHA) |
*params = 0; |
else if (img->TexFormat->LuminanceBits > 0) |
*params = img->TexFormat->LuminanceBits; |
else /* luminance probably stored as rgb texture */ |
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); |
return; |
case GL_TEXTURE_INDEX_SIZE_EXT: |
if (img->Format == GL_COLOR_INDEX) |
*params = img->TexFormat->IndexBits; |
else |
*params = 0; |
return; |
case GL_DEPTH_BITS: |
/* XXX this isn't in the GL_SGIX_depth_texture spec |
* but seems appropriate. |
*/ |
if (ctx->Extensions.SGIX_depth_texture) |
*params = img->TexFormat->DepthBits; |
else |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetTexLevelParameter[if]v(pname)"); |
return; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: |
if (ctx->Extensions.ARB_texture_compression) { |
if (img->IsCompressed && !isProxy) |
*params = img->CompressedSize; |
else |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glGetTexLevelParameter[if]v(pname)"); |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetTexLevelParameter[if]v(pname)"); |
} |
return; |
case GL_TEXTURE_COMPRESSED_ARB: |
if (ctx->Extensions.ARB_texture_compression) { |
*params = (GLint) img->IsCompressed; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetTexLevelParameter[if]v(pname)"); |
} |
return; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetTexLevelParameter[if]v(pname)"); |
} |
} |
void |
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_object *obj; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
obj = _mesa_select_tex_object(ctx, texUnit, target); |
if (!obj) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); |
return; |
} |
switch (pname) { |
case GL_TEXTURE_MAG_FILTER: |
*params = ENUM_TO_FLOAT(obj->MagFilter); |
return; |
case GL_TEXTURE_MIN_FILTER: |
*params = ENUM_TO_FLOAT(obj->MinFilter); |
return; |
case GL_TEXTURE_WRAP_S: |
*params = ENUM_TO_FLOAT(obj->WrapS); |
return; |
case GL_TEXTURE_WRAP_T: |
*params = ENUM_TO_FLOAT(obj->WrapT); |
return; |
case GL_TEXTURE_WRAP_R_EXT: |
*params = ENUM_TO_FLOAT(obj->WrapR); |
return; |
case GL_TEXTURE_BORDER_COLOR: |
params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); |
params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); |
params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); |
params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); |
return; |
case GL_TEXTURE_RESIDENT: |
{ |
GLboolean resident; |
if (ctx->Driver.IsTextureResident) |
resident = ctx->Driver.IsTextureResident(ctx, obj); |
else |
resident = GL_TRUE; |
*params = ENUM_TO_FLOAT(resident); |
} |
return; |
case GL_TEXTURE_PRIORITY: |
*params = obj->Priority; |
return; |
case GL_TEXTURE_MIN_LOD: |
*params = obj->MinLod; |
return; |
case GL_TEXTURE_MAX_LOD: |
*params = obj->MaxLod; |
return; |
case GL_TEXTURE_BASE_LEVEL: |
*params = (GLfloat) obj->BaseLevel; |
return; |
case GL_TEXTURE_MAX_LEVEL: |
*params = (GLfloat) obj->MaxLevel; |
return; |
case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
if (ctx->Extensions.EXT_texture_filter_anisotropic) { |
*params = obj->MaxAnisotropy; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
*params = (GLfloat) obj->CompareFlag; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_OPERATOR_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
*params = (GLfloat) obj->CompareOperator; |
return; |
} |
break; |
case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ |
if (ctx->Extensions.SGIX_shadow_ambient) { |
*params = obj->ShadowAmbient; |
return; |
} |
break; |
case GL_GENERATE_MIPMAP_SGIS: |
if (ctx->Extensions.SGIS_generate_mipmap) { |
*params = (GLfloat) obj->GenerateMipmap; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_MODE_ARB: |
if (ctx->Extensions.ARB_shadow) { |
*params = (GLfloat) obj->CompareMode; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_FUNC_ARB: |
if (ctx->Extensions.ARB_shadow) { |
*params = (GLfloat) obj->CompareFunc; |
return; |
} |
break; |
case GL_DEPTH_TEXTURE_MODE_ARB: |
if (ctx->Extensions.ARB_depth_texture) { |
*params = (GLfloat) obj->DepthMode; |
return; |
} |
break; |
default: |
; /* silence warnings */ |
} |
/* If we get here, pname was an unrecognized enum */ |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" ); |
} |
void |
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_object *obj; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
obj = _mesa_select_tex_object(ctx, texUnit, target); |
if (!obj) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); |
return; |
} |
switch (pname) { |
case GL_TEXTURE_MAG_FILTER: |
*params = (GLint) obj->MagFilter; |
return; |
case GL_TEXTURE_MIN_FILTER: |
*params = (GLint) obj->MinFilter; |
return; |
case GL_TEXTURE_WRAP_S: |
*params = (GLint) obj->WrapS; |
return; |
case GL_TEXTURE_WRAP_T: |
*params = (GLint) obj->WrapT; |
return; |
case GL_TEXTURE_WRAP_R_EXT: |
*params = (GLint) obj->WrapR; |
return; |
case GL_TEXTURE_BORDER_COLOR: |
{ |
GLfloat b[4]; |
b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); |
b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); |
b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); |
b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); |
params[0] = FLOAT_TO_INT(b[0]); |
params[1] = FLOAT_TO_INT(b[1]); |
params[2] = FLOAT_TO_INT(b[2]); |
params[3] = FLOAT_TO_INT(b[3]); |
} |
return; |
case GL_TEXTURE_RESIDENT: |
{ |
GLboolean resident; |
if (ctx->Driver.IsTextureResident) |
resident = ctx->Driver.IsTextureResident(ctx, obj); |
else |
resident = GL_TRUE; |
*params = (GLint) resident; |
} |
return; |
case GL_TEXTURE_PRIORITY: |
*params = (GLint) obj->Priority; |
return; |
case GL_TEXTURE_MIN_LOD: |
*params = (GLint) obj->MinLod; |
return; |
case GL_TEXTURE_MAX_LOD: |
*params = (GLint) obj->MaxLod; |
return; |
case GL_TEXTURE_BASE_LEVEL: |
*params = obj->BaseLevel; |
return; |
case GL_TEXTURE_MAX_LEVEL: |
*params = obj->MaxLevel; |
return; |
case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
if (ctx->Extensions.EXT_texture_filter_anisotropic) { |
*params = (GLint) obj->MaxAnisotropy; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
*params = (GLint) obj->CompareFlag; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_OPERATOR_SGIX: |
if (ctx->Extensions.SGIX_shadow) { |
*params = (GLint) obj->CompareOperator; |
return; |
} |
break; |
case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ |
if (ctx->Extensions.SGIX_shadow_ambient) { |
*params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); |
return; |
} |
break; |
case GL_GENERATE_MIPMAP_SGIS: |
if (ctx->Extensions.SGIS_generate_mipmap) { |
*params = (GLint) obj->GenerateMipmap; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_MODE_ARB: |
if (ctx->Extensions.ARB_shadow) { |
*params = (GLint) obj->CompareMode; |
return; |
} |
break; |
case GL_TEXTURE_COMPARE_FUNC_ARB: |
if (ctx->Extensions.ARB_shadow) { |
*params = (GLint) obj->CompareFunc; |
return; |
} |
break; |
case GL_DEPTH_TEXTURE_MODE_ARB: |
if (ctx->Extensions.ARB_depth_texture) { |
*params = (GLint) obj->DepthMode; |
return; |
} |
break; |
default: |
; /* silence warnings */ |
} |
/* If we get here, pname was an unrecognized enum */ |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" ); |
} |
/**********************************************************************/ |
/* Texture Coord Generation */ |
/**********************************************************************/ |
void |
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint tUnit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "texGEN %s %s %x...\n", |
_mesa_lookup_enum_by_nr(coord), |
_mesa_lookup_enum_by_nr(pname), |
*(int *)params); |
switch (coord) { |
case GL_S: |
if (pname==GL_TEXTURE_GEN_MODE) { |
GLenum mode = (GLenum) (GLint) *params; |
GLuint bits; |
switch (mode) { |
case GL_OBJECT_LINEAR: |
bits = TEXGEN_OBJ_LINEAR; |
break; |
case GL_EYE_LINEAR: |
bits = TEXGEN_EYE_LINEAR; |
break; |
case GL_REFLECTION_MAP_NV: |
bits = TEXGEN_REFLECTION_MAP_NV; |
break; |
case GL_NORMAL_MAP_NV: |
bits = TEXGEN_NORMAL_MAP_NV; |
break; |
case GL_SPHERE_MAP: |
bits = TEXGEN_SPHERE_MAP; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); |
return; |
} |
if (texUnit->GenModeS == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->GenModeS = mode; |
texUnit->_GenBitS = bits; |
} |
else if (pname==GL_OBJECT_PLANE) { |
if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->ObjectPlaneS[0] = params[0]; |
texUnit->ObjectPlaneS[1] = params[1]; |
texUnit->ObjectPlaneS[2] = params[2]; |
texUnit->ObjectPlaneS[3] = params[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
GLfloat tmp[4]; |
/* Transform plane equation by the inverse modelview matrix */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
} |
_mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
COPY_4FV(texUnit->EyePlaneS, tmp); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_T: |
if (pname==GL_TEXTURE_GEN_MODE) { |
GLenum mode = (GLenum) (GLint) *params; |
GLuint bitt; |
switch (mode) { |
case GL_OBJECT_LINEAR: |
bitt = TEXGEN_OBJ_LINEAR; |
break; |
case GL_EYE_LINEAR: |
bitt = TEXGEN_EYE_LINEAR; |
break; |
case GL_REFLECTION_MAP_NV: |
bitt = TEXGEN_REFLECTION_MAP_NV; |
break; |
case GL_NORMAL_MAP_NV: |
bitt = TEXGEN_NORMAL_MAP_NV; |
break; |
case GL_SPHERE_MAP: |
bitt = TEXGEN_SPHERE_MAP; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); |
return; |
} |
if (texUnit->GenModeT == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->GenModeT = mode; |
texUnit->_GenBitT = bitt; |
} |
else if (pname==GL_OBJECT_PLANE) { |
if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->ObjectPlaneT[0] = params[0]; |
texUnit->ObjectPlaneT[1] = params[1]; |
texUnit->ObjectPlaneT[2] = params[2]; |
texUnit->ObjectPlaneT[3] = params[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
GLfloat tmp[4]; |
/* Transform plane equation by the inverse modelview matrix */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
} |
_mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
COPY_4FV(texUnit->EyePlaneT, tmp); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_R: |
if (pname==GL_TEXTURE_GEN_MODE) { |
GLenum mode = (GLenum) (GLint) *params; |
GLuint bitr; |
switch (mode) { |
case GL_OBJECT_LINEAR: |
bitr = TEXGEN_OBJ_LINEAR; |
break; |
case GL_REFLECTION_MAP_NV: |
bitr = TEXGEN_REFLECTION_MAP_NV; |
break; |
case GL_NORMAL_MAP_NV: |
bitr = TEXGEN_NORMAL_MAP_NV; |
break; |
case GL_EYE_LINEAR: |
bitr = TEXGEN_EYE_LINEAR; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); |
return; |
} |
if (texUnit->GenModeR == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->GenModeR = mode; |
texUnit->_GenBitR = bitr; |
} |
else if (pname==GL_OBJECT_PLANE) { |
if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->ObjectPlaneR[0] = params[0]; |
texUnit->ObjectPlaneR[1] = params[1]; |
texUnit->ObjectPlaneR[2] = params[2]; |
texUnit->ObjectPlaneR[3] = params[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
GLfloat tmp[4]; |
/* Transform plane equation by the inverse modelview matrix */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
} |
_mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
COPY_4FV(texUnit->EyePlaneR, tmp); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_Q: |
if (pname==GL_TEXTURE_GEN_MODE) { |
GLenum mode = (GLenum) (GLint) *params; |
GLuint bitq; |
switch (mode) { |
case GL_OBJECT_LINEAR: |
bitq = TEXGEN_OBJ_LINEAR; |
break; |
case GL_EYE_LINEAR: |
bitq = TEXGEN_EYE_LINEAR; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); |
return; |
} |
if (texUnit->GenModeQ == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->GenModeQ = mode; |
texUnit->_GenBitQ = bitq; |
} |
else if (pname==GL_OBJECT_PLANE) { |
if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->ObjectPlaneQ[0] = params[0]; |
texUnit->ObjectPlaneQ[1] = params[1]; |
texUnit->ObjectPlaneQ[2] = params[2]; |
texUnit->ObjectPlaneQ[3] = params[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
GLfloat tmp[4]; |
/* Transform plane equation by the inverse modelview matrix */ |
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
} |
_mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); |
if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
COPY_4FV(texUnit->EyePlaneQ, tmp); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); |
return; |
} |
if (ctx->Driver.TexGen) |
ctx->Driver.TexGen( ctx, coord, pname, params ); |
} |
void |
_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) params[0]; |
p[1] = (GLfloat) params[1]; |
p[2] = (GLfloat) params[2]; |
p[3] = (GLfloat) params[3]; |
_mesa_TexGenfv(coord, pname, p); |
} |
void |
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) |
{ |
GLfloat p = (GLfloat) param; |
_mesa_TexGenfv( coord, pname, &p ); |
} |
void |
_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) |
{ |
GLfloat p[4]; |
p[0] = (GLfloat) params[0]; |
p[1] = (GLfloat) params[1]; |
p[2] = (GLfloat) params[2]; |
p[3] = (GLfloat) params[3]; |
_mesa_TexGenfv( coord, pname, p ); |
} |
void |
_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) |
{ |
_mesa_TexGenfv(coord, pname, ¶m); |
} |
void |
_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) |
{ |
_mesa_TexGeniv( coord, pname, ¶m ); |
} |
void |
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint tUnit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (coord) { |
case GL_S: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneS ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneS ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); |
return; |
} |
break; |
case GL_T: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneT ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneT ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); |
return; |
} |
break; |
case GL_R: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneR ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneR ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); |
return; |
} |
break; |
case GL_Q: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneQ ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneQ ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" ); |
return; |
} |
} |
void |
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint tUnit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (coord) { |
case GL_S: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneS ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneS ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_T: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_FLOAT(texUnit->GenModeT); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneT ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneT ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_R: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_FLOAT(texUnit->GenModeR); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneR ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneR ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); |
return; |
} |
break; |
case GL_Q: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ); |
} |
else if (pname==GL_OBJECT_PLANE) { |
COPY_4V( params, texUnit->ObjectPlaneQ ); |
} |
else if (pname==GL_EYE_PLANE) { |
COPY_4V( params, texUnit->EyePlaneQ ); |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" ); |
return; |
} |
} |
void |
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint tUnit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (coord) { |
case GL_S: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = texUnit->GenModeS; |
} |
else if (pname==GL_OBJECT_PLANE) { |
params[0] = (GLint) texUnit->ObjectPlaneS[0]; |
params[1] = (GLint) texUnit->ObjectPlaneS[1]; |
params[2] = (GLint) texUnit->ObjectPlaneS[2]; |
params[3] = (GLint) texUnit->ObjectPlaneS[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
params[0] = (GLint) texUnit->EyePlaneS[0]; |
params[1] = (GLint) texUnit->EyePlaneS[1]; |
params[2] = (GLint) texUnit->EyePlaneS[2]; |
params[3] = (GLint) texUnit->EyePlaneS[3]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); |
return; |
} |
break; |
case GL_T: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = texUnit->GenModeT; |
} |
else if (pname==GL_OBJECT_PLANE) { |
params[0] = (GLint) texUnit->ObjectPlaneT[0]; |
params[1] = (GLint) texUnit->ObjectPlaneT[1]; |
params[2] = (GLint) texUnit->ObjectPlaneT[2]; |
params[3] = (GLint) texUnit->ObjectPlaneT[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
params[0] = (GLint) texUnit->EyePlaneT[0]; |
params[1] = (GLint) texUnit->EyePlaneT[1]; |
params[2] = (GLint) texUnit->EyePlaneT[2]; |
params[3] = (GLint) texUnit->EyePlaneT[3]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); |
return; |
} |
break; |
case GL_R: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = texUnit->GenModeR; |
} |
else if (pname==GL_OBJECT_PLANE) { |
params[0] = (GLint) texUnit->ObjectPlaneR[0]; |
params[1] = (GLint) texUnit->ObjectPlaneR[1]; |
params[2] = (GLint) texUnit->ObjectPlaneR[2]; |
params[3] = (GLint) texUnit->ObjectPlaneR[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
params[0] = (GLint) texUnit->EyePlaneR[0]; |
params[1] = (GLint) texUnit->EyePlaneR[1]; |
params[2] = (GLint) texUnit->EyePlaneR[2]; |
params[3] = (GLint) texUnit->EyePlaneR[3]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); |
return; |
} |
break; |
case GL_Q: |
if (pname==GL_TEXTURE_GEN_MODE) { |
params[0] = texUnit->GenModeQ; |
} |
else if (pname==GL_OBJECT_PLANE) { |
params[0] = (GLint) texUnit->ObjectPlaneQ[0]; |
params[1] = (GLint) texUnit->ObjectPlaneQ[1]; |
params[2] = (GLint) texUnit->ObjectPlaneQ[2]; |
params[3] = (GLint) texUnit->ObjectPlaneQ[3]; |
} |
else if (pname==GL_EYE_PLANE) { |
params[0] = (GLint) texUnit->EyePlaneQ[0]; |
params[1] = (GLint) texUnit->EyePlaneQ[1]; |
params[2] = (GLint) texUnit->EyePlaneQ[2]; |
params[3] = (GLint) texUnit->EyePlaneQ[3]; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" ); |
return; |
} |
} |
/* GL_ARB_multitexture */ |
void |
_mesa_ActiveTextureARB( GLenum target ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint texUnit = target - GL_TEXTURE0_ARB; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glActiveTexture %s\n", |
_mesa_lookup_enum_by_nr(target)); |
if (texUnit > ctx->Const.MaxTextureUnits) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glActiveTextureARB(target)"); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
ctx->Texture.CurrentUnit = texUnit; |
if (ctx->Driver.ActiveTexture) { |
(*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); |
} |
} |
/* GL_ARB_multitexture */ |
void |
_mesa_ClientActiveTextureARB( GLenum target ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint texUnit = target - GL_TEXTURE0_ARB; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (texUnit > ctx->Const.MaxTextureUnits) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTextureARB(target)"); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_ARRAY); |
ctx->Array.ActiveTexture = texUnit; |
} |
/**********************************************************************/ |
/* Pixel Texgen Extensions */ |
/**********************************************************************/ |
void |
_mesa_PixelTexGenSGIX(GLenum mode) |
{ |
GLenum newRgbSource, newAlphaSource; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (mode) { |
case GL_NONE: |
newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; |
newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; |
break; |
case GL_ALPHA: |
newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; |
newAlphaSource = GL_CURRENT_RASTER_COLOR; |
break; |
case GL_RGB: |
newRgbSource = GL_CURRENT_RASTER_COLOR; |
newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; |
break; |
case GL_RGBA: |
newRgbSource = GL_CURRENT_RASTER_COLOR; |
newAlphaSource = GL_CURRENT_RASTER_COLOR; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)"); |
return; |
} |
if (newRgbSource == ctx->Pixel.FragmentRgbSource && |
newAlphaSource == ctx->Pixel.FragmentAlphaSource) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.FragmentRgbSource = newRgbSource; |
ctx->Pixel.FragmentAlphaSource = newAlphaSource; |
} |
void |
_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) |
{ |
_mesa_PixelTexGenParameteriSGIS(target, (GLint) value); |
} |
void |
_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) |
{ |
_mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); |
} |
void |
_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)"); |
return; |
} |
switch (target) { |
case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS: |
if (ctx->Pixel.FragmentRgbSource == (GLenum) value) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.FragmentRgbSource = (GLenum) value; |
break; |
case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS: |
if (ctx->Pixel.FragmentAlphaSource == (GLenum) value) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.FragmentAlphaSource = (GLenum) value; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)"); |
return; |
} |
} |
void |
_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) |
{ |
_mesa_PixelTexGenParameteriSGIS(target, *value); |
} |
void |
_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { |
*value = (GLfloat) ctx->Pixel.FragmentRgbSource; |
} |
else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { |
*value = (GLfloat) ctx->Pixel.FragmentAlphaSource; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)"); |
} |
} |
void |
_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { |
*value = (GLint) ctx->Pixel.FragmentRgbSource; |
} |
else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { |
*value = (GLint) ctx->Pixel.FragmentAlphaSource; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/hint.c |
---|
0,0 → 1,123 |
/* $Id: hint.c,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "enums.h" |
#include "context.h" |
#include "hint.h" |
#include "imports.h" |
void |
_mesa_Hint( GLenum target, GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glHint %s %d\n", |
_mesa_lookup_enum_by_nr(target), mode); |
if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); |
return; |
} |
switch (target) { |
case GL_FOG_HINT: |
if (ctx->Hint.Fog == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.Fog = mode; |
break; |
case GL_LINE_SMOOTH_HINT: |
if (ctx->Hint.LineSmooth == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.LineSmooth = mode; |
break; |
case GL_PERSPECTIVE_CORRECTION_HINT: |
if (ctx->Hint.PerspectiveCorrection == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.PerspectiveCorrection = mode; |
break; |
case GL_POINT_SMOOTH_HINT: |
if (ctx->Hint.PointSmooth == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.PointSmooth = mode; |
break; |
case GL_POLYGON_SMOOTH_HINT: |
if (ctx->Hint.PolygonSmooth == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.PolygonSmooth = mode; |
break; |
/* GL_EXT_clip_volume_hint */ |
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: |
if (ctx->Hint.ClipVolumeClipping == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.ClipVolumeClipping = mode; |
break; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSION_HINT_ARB: |
if (!ctx->Extensions.ARB_texture_compression) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); |
return; |
} |
if (ctx->Hint.TextureCompression == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.TextureCompression = mode; |
break; |
/* GL_SGIS_generate_mipmap */ |
case GL_GENERATE_MIPMAP_HINT_SGIS: |
if (!ctx->Extensions.SGIS_generate_mipmap) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); |
return; |
} |
if (ctx->Hint.GenerateMipmap == mode) |
return; |
FLUSH_VERTICES(ctx, _NEW_HINT); |
ctx->Hint.GenerateMipmap = mode; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); |
return; |
} |
if (ctx->Driver.Hint) { |
(*ctx->Driver.Hint)( ctx, target, mode ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/texutil.h |
---|
0,0 → 1,73 |
/* $Id: texutil.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
*/ |
#ifndef TEXUTIL_H |
#define TEXUTIL_H |
#include "mtypes.h" |
#include "texformat.h" |
extern GLboolean |
_mesa_convert_texsubimage1d( GLint mesaFormat, |
GLint xoffset, |
GLint width, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *packing, |
const GLvoid *srcImage, GLvoid *dstImage ); |
extern GLboolean |
_mesa_convert_texsubimage2d( GLint mesaFormat, |
GLint xoffset, GLint yoffset, |
GLint width, GLint height, |
GLint imageWidth, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *packing, |
const GLvoid *srcImage, GLvoid *dstImage ); |
extern GLboolean |
_mesa_convert_texsubimage3d( GLint mesaFormat, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint width, GLint height, GLint depth, |
GLint imageWidth, GLint imageHeight, |
GLenum format, GLenum type, |
const struct gl_pixelstore_attrib *packing, |
const GLvoid *srcImage, GLvoid *dstImage ); |
/* Nearest filtering only (for broken hardware that can't support |
* all aspect ratios). FIXME: Make this a subimage update as well... |
*/ |
extern void |
_mesa_rescale_teximage2d( GLuint bytesPerPixel, GLuint dstRowStride, |
GLint srcWidth, GLint srcHeight, |
GLint dstWidth, GLint dstHeight, |
const GLvoid *srcImage, GLvoid *dstImage ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/varray.c |
---|
0,0 → 1,835 |
/* $Id: varray.c,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "enable.h" |
#include "enums.h" |
#include "dlist.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "state.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "varray.h" |
#include "math/m_translate.h" |
void |
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (size < 2 || size > 4) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); |
return; |
} |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) |
_mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size, |
_mesa_lookup_enum_by_nr( type ), stride); |
/* always need to check that <type> is legal */ |
switch (type) { |
case GL_SHORT: |
ctx->Array.Vertex.StrideB = size * sizeof(GLshort); |
break; |
case GL_INT: |
ctx->Array.Vertex.StrideB = size * sizeof(GLint); |
break; |
case GL_FLOAT: |
ctx->Array.Vertex.StrideB = size * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.Vertex.StrideB = size * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.Vertex.StrideB = stride; |
ctx->Array.Vertex.Size = size; |
ctx->Array.Vertex.Type = type; |
ctx->Array.Vertex.Stride = stride; |
ctx->Array.Vertex.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_VERTEX; |
if (ctx->Driver.VertexPointer) |
ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); |
} |
void |
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) |
_mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n", |
_mesa_lookup_enum_by_nr( type ), stride); |
switch (type) { |
case GL_BYTE: |
ctx->Array.Normal.StrideB = 3 * sizeof(GLbyte); |
break; |
case GL_SHORT: |
ctx->Array.Normal.StrideB = 3 * sizeof(GLshort); |
break; |
case GL_INT: |
ctx->Array.Normal.StrideB = 3 * sizeof(GLint); |
break; |
case GL_FLOAT: |
ctx->Array.Normal.StrideB = 3 * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.Normal.StrideB = 3 * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.Normal.StrideB = stride; |
ctx->Array.Normal.Size = 3; |
ctx->Array.Normal.Type = type; |
ctx->Array.Normal.Stride = stride; |
ctx->Array.Normal.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_NORMAL; |
if (ctx->Driver.NormalPointer) |
ctx->Driver.NormalPointer( ctx, type, stride, ptr ); |
} |
void |
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (size < 3 || size > 4) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); |
return; |
} |
if (stride<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) |
_mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size, |
_mesa_lookup_enum_by_nr( type ), stride); |
switch (type) { |
case GL_BYTE: |
ctx->Array.Color.StrideB = size * sizeof(GLbyte); |
break; |
case GL_UNSIGNED_BYTE: |
ctx->Array.Color.StrideB = size * sizeof(GLubyte); |
break; |
case GL_SHORT: |
ctx->Array.Color.StrideB = size * sizeof(GLshort); |
break; |
case GL_UNSIGNED_SHORT: |
ctx->Array.Color.StrideB = size * sizeof(GLushort); |
break; |
case GL_INT: |
ctx->Array.Color.StrideB = size * sizeof(GLint); |
break; |
case GL_UNSIGNED_INT: |
ctx->Array.Color.StrideB = size * sizeof(GLuint); |
break; |
case GL_FLOAT: |
ctx->Array.Color.StrideB = size * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.Color.StrideB = size * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.Color.StrideB = stride; |
ctx->Array.Color.Size = size; |
ctx->Array.Color.Type = type; |
ctx->Array.Color.Stride = stride; |
ctx->Array.Color.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_COLOR0; |
if (ctx->Driver.ColorPointer) |
ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); |
} |
void |
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); |
return; |
} |
switch (type) { |
case GL_FLOAT: |
ctx->Array.FogCoord.StrideB = sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.FogCoord.StrideB = sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.FogCoord.StrideB = stride; |
ctx->Array.FogCoord.Size = 1; |
ctx->Array.FogCoord.Type = type; |
ctx->Array.FogCoord.Stride = stride; |
ctx->Array.FogCoord.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_FOGCOORD; |
if (ctx->Driver.FogCoordPointer) |
ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); |
} |
void |
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); |
return; |
} |
switch (type) { |
case GL_UNSIGNED_BYTE: |
ctx->Array.Index.StrideB = sizeof(GLubyte); |
break; |
case GL_SHORT: |
ctx->Array.Index.StrideB = sizeof(GLshort); |
break; |
case GL_INT: |
ctx->Array.Index.StrideB = sizeof(GLint); |
break; |
case GL_FLOAT: |
ctx->Array.Index.StrideB = sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.Index.StrideB = sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.Index.StrideB = stride; |
ctx->Array.Index.Size = 1; |
ctx->Array.Index.Type = type; |
ctx->Array.Index.Stride = stride; |
ctx->Array.Index.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_INDEX; |
if (ctx->Driver.IndexPointer) |
ctx->Driver.IndexPointer( ctx, type, stride, ptr ); |
} |
void |
_mesa_SecondaryColorPointerEXT(GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (size != 3 && size != 4) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(size)" ); |
return; |
} |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(stride)" ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) |
_mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n", |
size, _mesa_lookup_enum_by_nr( type ), stride); |
switch (type) { |
case GL_BYTE: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLbyte); |
break; |
case GL_UNSIGNED_BYTE: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLubyte); |
break; |
case GL_SHORT: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLshort); |
break; |
case GL_UNSIGNED_SHORT: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLushort); |
break; |
case GL_INT: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLint); |
break; |
case GL_UNSIGNED_INT: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLuint); |
break; |
case GL_FLOAT: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.SecondaryColor.StrideB = size * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.SecondaryColor.StrideB = stride; |
ctx->Array.SecondaryColor.Size = 3; /* hardwire */ |
ctx->Array.SecondaryColor.Type = type; |
ctx->Array.SecondaryColor.Stride = stride; |
ctx->Array.SecondaryColor.Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_COLOR1; |
if (ctx->Driver.SecondaryColorPointer) |
ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); |
} |
void |
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint texUnit = ctx->Array.ActiveTexture; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (size < 1 || size > 4) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); |
return; |
} |
if (stride < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); |
return; |
} |
if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) |
_mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n", |
texUnit, size, _mesa_lookup_enum_by_nr( type ), stride); |
/* always need to check that <type> is legal */ |
switch (type) { |
case GL_SHORT: |
ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLshort); |
break; |
case GL_INT: |
ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLint); |
break; |
case GL_FLOAT: |
ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); |
return; |
} |
if (stride) |
ctx->Array.TexCoord[texUnit].StrideB = stride; |
ctx->Array.TexCoord[texUnit].Size = size; |
ctx->Array.TexCoord[texUnit].Type = type; |
ctx->Array.TexCoord[texUnit].Stride = stride; |
ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_TEXCOORD(texUnit); |
if (ctx->Driver.TexCoordPointer) |
ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); |
} |
void |
_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
const GLboolean *ptr = (GLboolean *)vptr; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (stride<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); |
return; |
} |
ctx->Array.EdgeFlag.Stride = stride; |
ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); |
ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_EDGEFLAG; |
if (ctx->Driver.EdgeFlagPointer) |
ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); |
} |
void _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (index >= VERT_ATTRIB_MAX) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); |
return; |
} |
if (size < 1 || size > 4) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size)"); |
return; |
} |
if (stride < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(stride)"); |
return; |
} |
if (type == GL_UNSIGNED_BYTE && size != 4) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)"); |
return; |
} |
/* check for valid 'type' and compute StrideB right away */ |
switch (type) { |
case GL_UNSIGNED_BYTE: |
ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLubyte); |
break; |
case GL_SHORT: |
ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLshort); |
break; |
case GL_FLOAT: |
ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLfloat); |
break; |
case GL_DOUBLE: |
ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLdouble); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" ); |
return; |
} |
if (stride) |
ctx->Array.VertexAttrib[index].StrideB = stride; |
ctx->Array.VertexAttrib[index].Stride = stride; |
ctx->Array.VertexAttrib[index].Size = size; |
ctx->Array.VertexAttrib[index].Type = type; |
ctx->Array.VertexAttrib[index].Ptr = (void *) ptr; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); |
if (ctx->Driver.VertexAttribPointer) |
ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); |
} |
void |
_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr) |
{ |
(void) count; |
_mesa_VertexPointer(size, type, stride, ptr); |
} |
void |
_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr) |
{ |
(void) count; |
_mesa_NormalPointer(type, stride, ptr); |
} |
void |
_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr) |
{ |
(void) count; |
_mesa_ColorPointer(size, type, stride, ptr); |
} |
void |
_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr) |
{ |
(void) count; |
_mesa_IndexPointer(type, stride, ptr); |
} |
void |
_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr) |
{ |
(void) count; |
_mesa_TexCoordPointer(size, type, stride, ptr); |
} |
void |
_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) |
{ |
(void) count; |
_mesa_EdgeFlagPointer(stride, ptr); |
} |
void |
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLboolean tflag, cflag, nflag; /* enable/disable flags */ |
GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ |
GLenum ctype = 0; /* color type */ |
GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */ |
GLint defstride; /* default stride */ |
GLint c, f; |
GLint coordUnitSave; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
f = sizeof(GLfloat); |
c = f * ((4*sizeof(GLubyte) + (f-1)) / f); |
if (stride<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" ); |
return; |
} |
switch (format) { |
case GL_V2F: |
tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; |
tcomps = 0; ccomps = 0; vcomps = 2; |
voffset = 0; |
defstride = 2*f; |
break; |
case GL_V3F: |
tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; |
tcomps = 0; ccomps = 0; vcomps = 3; |
voffset = 0; |
defstride = 3*f; |
break; |
case GL_C4UB_V2F: |
tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; |
tcomps = 0; ccomps = 4; vcomps = 2; |
ctype = GL_UNSIGNED_BYTE; |
coffset = 0; |
voffset = c; |
defstride = c + 2*f; |
break; |
case GL_C4UB_V3F: |
tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; |
tcomps = 0; ccomps = 4; vcomps = 3; |
ctype = GL_UNSIGNED_BYTE; |
coffset = 0; |
voffset = c; |
defstride = c + 3*f; |
break; |
case GL_C3F_V3F: |
tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; |
tcomps = 0; ccomps = 3; vcomps = 3; |
ctype = GL_FLOAT; |
coffset = 0; |
voffset = 3*f; |
defstride = 6*f; |
break; |
case GL_N3F_V3F: |
tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE; |
tcomps = 0; ccomps = 0; vcomps = 3; |
noffset = 0; |
voffset = 3*f; |
defstride = 6*f; |
break; |
case GL_C4F_N3F_V3F: |
tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE; |
tcomps = 0; ccomps = 4; vcomps = 3; |
ctype = GL_FLOAT; |
coffset = 0; |
noffset = 4*f; |
voffset = 7*f; |
defstride = 10*f; |
break; |
case GL_T2F_V3F: |
tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; |
tcomps = 2; ccomps = 0; vcomps = 3; |
voffset = 2*f; |
defstride = 5*f; |
break; |
case GL_T4F_V4F: |
tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; |
tcomps = 4; ccomps = 0; vcomps = 4; |
voffset = 4*f; |
defstride = 8*f; |
break; |
case GL_T2F_C4UB_V3F: |
tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; |
tcomps = 2; ccomps = 4; vcomps = 3; |
ctype = GL_UNSIGNED_BYTE; |
coffset = 2*f; |
voffset = c+2*f; |
defstride = c+5*f; |
break; |
case GL_T2F_C3F_V3F: |
tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; |
tcomps = 2; ccomps = 3; vcomps = 3; |
ctype = GL_FLOAT; |
coffset = 2*f; |
voffset = 5*f; |
defstride = 8*f; |
break; |
case GL_T2F_N3F_V3F: |
tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE; |
tcomps = 2; ccomps = 0; vcomps = 3; |
noffset = 2*f; |
voffset = 5*f; |
defstride = 8*f; |
break; |
case GL_T2F_C4F_N3F_V3F: |
tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; |
tcomps = 2; ccomps = 4; vcomps = 3; |
ctype = GL_FLOAT; |
coffset = 2*f; |
noffset = 6*f; |
voffset = 9*f; |
defstride = 12*f; |
break; |
case GL_T4F_C4F_N3F_V4F: |
tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; |
tcomps = 4; ccomps = 4; vcomps = 4; |
ctype = GL_FLOAT; |
coffset = 4*f; |
noffset = 8*f; |
voffset = 11*f; |
defstride = 15*f; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" ); |
return; |
} |
if (stride==0) { |
stride = defstride; |
} |
_mesa_DisableClientState( GL_EDGE_FLAG_ARRAY ); |
_mesa_DisableClientState( GL_INDEX_ARRAY ); |
/* Texcoords */ |
coordUnitSave = ctx->Array.ActiveTexture; |
if (tflag) { |
GLint i; |
GLint factor = ctx->Array.TexCoordInterleaveFactor; |
for (i = 0; i < factor; i++) { |
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); |
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY ); |
_mesa_TexCoordPointer( tcomps, GL_FLOAT, stride, |
(GLubyte *) pointer + i * coffset ); |
} |
for (i = factor; i < (GLint) ctx->Const.MaxTextureUnits; i++) { |
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); |
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY ); |
} |
} |
else { |
GLint i; |
for (i = 0; i < (GLint) ctx->Const.MaxTextureUnits; i++) { |
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); |
_mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY ); |
} |
} |
/* Restore texture coordinate unit index */ |
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + coordUnitSave) ); |
/* Color */ |
if (cflag) { |
_mesa_EnableClientState( GL_COLOR_ARRAY ); |
_mesa_ColorPointer( ccomps, ctype, stride, |
(GLubyte*) pointer + coffset ); |
} |
else { |
_mesa_DisableClientState( GL_COLOR_ARRAY ); |
} |
/* Normals */ |
if (nflag) { |
_mesa_EnableClientState( GL_NORMAL_ARRAY ); |
_mesa_NormalPointer( GL_FLOAT, stride, |
(GLubyte*) pointer + noffset ); |
} |
else { |
_mesa_DisableClientState( GL_NORMAL_ARRAY ); |
} |
_mesa_EnableClientState( GL_VERTEX_ARRAY ); |
_mesa_VertexPointer( vcomps, GL_FLOAT, stride, |
(GLubyte *) pointer + voffset ); |
} |
void |
_mesa_LockArraysEXT(GLint first, GLsizei count) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glLockArrays %d %d\n", first, count); |
if (first == 0 && count > 0 && |
count <= (GLint) ctx->Const.MaxArrayLockSize) { |
ctx->Array.LockFirst = first; |
ctx->Array.LockCount = count; |
} |
else { |
ctx->Array.LockFirst = 0; |
ctx->Array.LockCount = 0; |
} |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_ALL; |
if (ctx->Driver.LockArraysEXT) |
ctx->Driver.LockArraysEXT( ctx, first, count ); |
} |
void |
_mesa_UnlockArraysEXT( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glUnlockArrays\n"); |
ctx->Array.LockFirst = 0; |
ctx->Array.LockCount = 0; |
ctx->NewState |= _NEW_ARRAY; |
ctx->Array.NewState |= _NEW_ARRAY_ALL; |
if (ctx->Driver.UnlockArraysEXT) |
ctx->Driver.UnlockArraysEXT( ctx ); |
} |
/* GL_EXT_multi_draw_arrays */ |
/* Somebody forgot to spec the first and count parameters as const! <sigh> */ |
void |
_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, |
GLsizei *count, GLsizei primcount ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
for (i = 0; i < primcount; i++) { |
if (count[i] > 0) { |
(ctx->Exec->DrawArrays)(mode, first[i], count[i]); |
} |
} |
} |
/* GL_EXT_multi_draw_arrays */ |
void |
_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, |
const GLvoid **indices, GLsizei primcount ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
for (i = 0; i < primcount; i++) { |
if (count[i] > 0) { |
(ctx->Exec->DrawElements)(mode, count[i], type, indices[i]); |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_noop.c |
---|
0,0 → 1,631 |
/* $Id: api_noop.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "api_noop.h" |
#include "api_validate.h" |
#include "context.h" |
#include "colormac.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
/* In states where certain vertex components are required for t&l or |
* rasterization, we still need to keep track of the current values. |
* These functions provide this service by keeping uptodate the |
* 'ctx->Current' struct for all data elements not included in the |
* currently enabled hardware vertex. |
* |
*/ |
void _mesa_noop_EdgeFlag( GLboolean b ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.EdgeFlag = b; |
} |
void _mesa_noop_EdgeFlagv( const GLboolean *b ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.EdgeFlag = *b; |
} |
void _mesa_noop_FogCoordfEXT( GLfloat a ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = a; |
} |
void _mesa_noop_FogCoordfvEXT( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = *v; |
} |
void _mesa_noop_Indexi( GLint i ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.Index = i; |
} |
void _mesa_noop_Indexiv( const GLint *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ctx->Current.Index = *v; |
} |
void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
COPY_FLOAT(dest[2], c); |
} |
void _mesa_noop_Normal3fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
COPY_FLOAT(dest[2], v[2]); |
} |
void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_material mat[2]; |
GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, |
"_mesa_noop_Materialfv" ); |
if (bitmask == 0) |
return; |
if (bitmask & FRONT_AMBIENT_BIT) { |
COPY_4FV( mat[0].Ambient, params ); |
} |
if (bitmask & BACK_AMBIENT_BIT) { |
COPY_4FV( mat[1].Ambient, params ); |
} |
if (bitmask & FRONT_DIFFUSE_BIT) { |
COPY_4FV( mat[0].Diffuse, params ); |
} |
if (bitmask & BACK_DIFFUSE_BIT) { |
COPY_4FV( mat[1].Diffuse, params ); |
} |
if (bitmask & FRONT_SPECULAR_BIT) { |
COPY_4FV( mat[0].Specular, params ); |
} |
if (bitmask & BACK_SPECULAR_BIT) { |
COPY_4FV( mat[1].Specular, params ); |
} |
if (bitmask & FRONT_EMISSION_BIT) { |
COPY_4FV( mat[0].Emission, params ); |
} |
if (bitmask & BACK_EMISSION_BIT) { |
COPY_4FV( mat[1].Emission, params ); |
} |
if (bitmask & FRONT_SHININESS_BIT) { |
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); |
mat[0].Shininess = shininess; |
} |
if (bitmask & BACK_SHININESS_BIT) { |
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); |
mat[1].Shininess = shininess; |
} |
if (bitmask & FRONT_INDEXES_BIT) { |
mat[0].AmbientIndex = params[0]; |
mat[0].DiffuseIndex = params[1]; |
mat[0].SpecularIndex = params[2]; |
} |
if (bitmask & BACK_INDEXES_BIT) { |
mat[1].AmbientIndex = params[0]; |
mat[1].DiffuseIndex = params[1]; |
mat[1].SpecularIndex = params[2]; |
} |
_mesa_update_material( ctx, mat, bitmask ); |
} |
void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = UBYTE_TO_FLOAT(a); |
color[1] = UBYTE_TO_FLOAT(b); |
color[2] = UBYTE_TO_FLOAT(c); |
color[3] = UBYTE_TO_FLOAT(d); |
} |
void _mesa_noop_Color4ubv( const GLubyte *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = UBYTE_TO_FLOAT(v[0]); |
color[1] = UBYTE_TO_FLOAT(v[1]); |
color[2] = UBYTE_TO_FLOAT(v[2]); |
color[3] = UBYTE_TO_FLOAT(v[3]); |
} |
void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = a; |
color[1] = b; |
color[2] = c; |
color[3] = d; |
} |
void _mesa_noop_Color4fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = v[0]; |
color[1] = v[1]; |
color[2] = v[2]; |
color[3] = v[3]; |
} |
void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = UBYTE_TO_FLOAT(a); |
color[1] = UBYTE_TO_FLOAT(b); |
color[2] = UBYTE_TO_FLOAT(c); |
color[3] = 1.0; |
} |
void _mesa_noop_Color3ubv( const GLubyte *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = UBYTE_TO_FLOAT(v[0]); |
color[1] = UBYTE_TO_FLOAT(v[1]); |
color[2] = UBYTE_TO_FLOAT(v[2]); |
color[3] = 1.0; |
} |
void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = a; |
color[1] = b; |
color[2] = c; |
color[3] = 1.0; |
} |
void _mesa_noop_Color3fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; |
color[0] = v[0]; |
color[1] = v[1]; |
color[2] = v[2]; |
color[3] = 1.0; |
} |
void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], a); |
dest[1] = 0; |
dest[2] = 0; |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], v[0]); |
dest[1] = 0; |
dest[2] = 0; |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
dest[2] = 0; |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
dest[2] = 0; |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
COPY_FLOAT(dest[2], c); |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
COPY_FLOAT(dest[2], v[2]); |
dest[3] = 1; |
} |
} |
void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, |
GLfloat c, GLfloat d ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
COPY_FLOAT(dest[2], c); |
dest[3] = d; |
} |
} |
void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = target - GL_TEXTURE0_ARB; |
/* unit is unsigned -- cannot be less than zero. |
*/ |
if (unit < MAX_TEXTURE_UNITS) |
{ |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
COPY_FLOAT(dest[2], v[2]); |
COPY_FLOAT(dest[3], v[3]); |
} |
} |
void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; |
color[0] = UBYTE_TO_FLOAT(a); |
color[1] = UBYTE_TO_FLOAT(b); |
color[2] = UBYTE_TO_FLOAT(c); |
color[3] = 1.0; |
} |
void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; |
color[0] = UBYTE_TO_FLOAT(v[0]); |
color[1] = UBYTE_TO_FLOAT(v[1]); |
color[2] = UBYTE_TO_FLOAT(v[2]); |
color[3] = 1.0; |
} |
void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; |
color[0] = a; |
color[1] = b; |
color[2] = c; |
color[3] = 1.0; |
} |
void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; |
color[0] = v[0]; |
color[1] = v[1]; |
color[2] = v[2]; |
color[3] = 1.0; |
} |
void _mesa_noop_TexCoord1f( GLfloat a ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], a); |
dest[1] = 0; |
dest[2] = 0; |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord1fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], v[0]); |
dest[1] = 0; |
dest[2] = 0; |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
dest[2] = 0; |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord2fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
dest[2] = 0; |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
COPY_FLOAT(dest[2], c); |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord3fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
COPY_FLOAT(dest[2], v[2]); |
dest[3] = 1; |
} |
void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], a); |
COPY_FLOAT(dest[1], b); |
COPY_FLOAT(dest[2], c); |
COPY_FLOAT(dest[3], d); |
} |
void _mesa_noop_TexCoord4fv( const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; |
COPY_FLOAT(dest[0], v[0]); |
COPY_FLOAT(dest[1], v[1]); |
COPY_FLOAT(dest[2], v[2]); |
COPY_FLOAT(dest[3], v[3]); |
} |
/* Useful outside begin/end? |
*/ |
void _mesa_noop_Vertex2fv( const GLfloat *v ) |
{ |
(void) v; |
} |
void _mesa_noop_Vertex3fv( const GLfloat *v ) |
{ |
(void) v; |
} |
void _mesa_noop_Vertex4fv( const GLfloat *v ) |
{ |
(void) v; |
} |
void _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) |
{ |
(void) a; (void) b; |
} |
void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) |
{ |
(void) a; (void) b; (void) c; |
} |
void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) |
{ |
(void) a; (void) b; (void) c; (void) d; |
} |
void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, |
GLfloat y, GLfloat z, GLfloat w ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (index < 16) { |
ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); |
} |
} |
void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (index < 16) { |
ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); |
} |
} |
/* Execute a glRectf() function. This is not suitable for GL_COMPILE |
* modes (as the test for outside begin/end is not compiled), |
* but may be useful for drivers in circumstances which exclude |
* display list interactions. |
* |
* (None of the functions in this file are suitable for GL_COMPILE |
* modes). |
*/ |
void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) |
{ |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
} |
glBegin( GL_QUADS ); |
glVertex2f( x1, y1 ); |
glVertex2f( x2, y1 ); |
glVertex2f( x2, y2 ); |
glVertex2f( x1, y2 ); |
glEnd(); |
} |
/* Some very basic support for arrays. Drivers without explicit array |
* support can hook these in, but still need to supply an array-elt |
* implementation. |
*/ |
void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) |
return; |
glBegin(mode); |
for (i = start ; i <= count ; i++) |
glArrayElement( i ); |
glEnd(); |
} |
void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) |
return; |
glBegin(mode); |
switch (type) { |
case GL_UNSIGNED_BYTE: |
for (i = 0 ; i < count ; i++) |
glArrayElement( ((GLubyte *)indices)[i] ); |
break; |
case GL_UNSIGNED_SHORT: |
for (i = 0 ; i < count ; i++) |
glArrayElement( ((GLushort *)indices)[i] ); |
break; |
case GL_UNSIGNED_INT: |
for (i = 0 ; i < count ; i++) |
glArrayElement( ((GLuint *)indices)[i] ); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); |
break; |
} |
glEnd(); |
} |
void _mesa_noop_DrawRangeElements(GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, GLenum type, |
const GLvoid *indices) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (_mesa_validate_DrawRangeElements( ctx, mode, |
start, end, |
count, type, indices )) |
glDrawElements( mode, count, type, indices ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/mmath.c |
---|
0,0 → 1,178 |
/* $Id: mmath.c,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "mmath.h" |
static int in_fast_math; |
/* |
* A High Speed, Low Precision Square Root |
* by Paul Lalonde and Robert Dawson |
* from "Graphics Gems", Academic Press, 1990 |
*/ |
/* |
* SPARC implementation of a fast square root by table |
* lookup. |
* SPARC floating point format is as follows: |
* |
* BIT 31 30 23 22 0 |
* sign exponent mantissa |
*/ |
static short sqrttab[0x100]; /* declare table of square roots */ |
static void init_sqrt(void) |
{ |
#ifdef FAST_MATH |
unsigned short i; |
fi_type fi; /* to access the bits of a float in C quickly */ |
/* we use a union defined in glheader.h */ |
for(i=0; i<= 0x7f; i++) { |
fi.i = 0; |
/* |
* Build a float with the bit pattern i as mantissa |
* and an exponent of 0, stored as 127 |
*/ |
fi.i = (i << 16) | (127 << 23); |
fi.f = _mesa_sqrt(fi.f); |
/* |
* Take the square root then strip the first 7 bits of |
* the mantissa into the table |
*/ |
sqrttab[i] = (fi.i & 0x7fffff) >> 16; |
/* |
* Repeat the process, this time with an exponent of |
* 1, stored as 128 |
*/ |
fi.i = 0; |
fi.i = (i << 16) | (128 << 23); |
fi.f = sqrt(fi.f); |
sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16; |
} |
#else |
(void) sqrttab; /* silence compiler warnings */ |
#endif /*FAST_MATH*/ |
} |
float gl_sqrt( float x ) |
{ |
#ifdef FAST_MATH |
fi_type num; |
/* to access the bits of a float in C |
* we use a union from glheader.h */ |
short e; /* the exponent */ |
if (x == 0.0F) return 0.0F; /* check for square root of 0 */ |
num.f = x; |
e = (num.i >> 23) - 127; /* get the exponent - on a SPARC the */ |
/* exponent is stored with 127 added */ |
num.i &= 0x7fffff; /* leave only the mantissa */ |
if (e & 0x01) num.i |= 0x800000; |
/* the exponent is odd so we have to */ |
/* look it up in the second half of */ |
/* the lookup table, so we set the */ |
/* high bit */ |
e >>= 1; /* divide the exponent by two */ |
/* note that in C the shift */ |
/* operators are sign preserving */ |
/* for signed operands */ |
/* Do the table lookup, based on the quaternary mantissa, |
* then reconstruct the result back into a float |
*/ |
num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23); |
return num.f; |
#else |
return (GLfloat) _mesa_sqrt(x); |
#endif |
} |
/* ubyte -> float conversion */ |
float _mesa_ubyte_to_float_color_tab[256]; |
/* |
* Initialize tables, etc for fast math functions. |
*/ |
void |
_mesa_init_math(void) |
{ |
static GLboolean initialized = GL_FALSE; |
if (!initialized) { |
int i; |
for (i = 0; i < 256; i++) { |
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; |
} |
init_sqrt(); |
initialized = GL_TRUE; |
in_fast_math = 0; |
#if defined(_FPU_GETCW) && defined(_FPU_SETCW) |
{ |
const char *debug = _mesa_getenv("MESA_DEBUG"); |
if (debug && _mesa_strcmp(debug, "FP")==0) { |
/* die on FP exceptions */ |
fpu_control_t mask; |
_FPU_GETCW(mask); |
mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM |
| _FPU_MASK_OM | _FPU_MASK_UM); |
_FPU_SETCW(mask); |
} |
} |
#endif |
} |
} |
/* |
* Return number of bits set in given GLuint. |
*/ |
GLuint |
_mesa_bitcount(GLuint n) |
{ |
GLuint bits; |
for (bits = 0; n > 0; n = n >> 1) { |
if (n & 1) { |
bits++; |
} |
} |
return bits; |
} |
/shark/tags/rel_0_4/ports/mesa/src/texstate.h |
---|
0,0 → 1,167 |
/* $Id: texstate.h,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef TEXSTATE_H |
#define TEXSTATE_H |
#include "mtypes.h" |
extern void |
_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ); |
/*** Called from API ***/ |
extern void |
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); |
extern void |
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); |
extern void |
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); |
extern void |
_mesa_GetTexLevelParameterfv( GLenum target, GLint level, |
GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetTexLevelParameteriv( GLenum target, GLint level, |
GLenum pname, GLint *params ); |
extern void |
_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); |
extern void |
_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ); |
extern void |
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ); |
extern void |
_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); |
extern void |
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); |
extern void |
_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); |
extern void |
_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ); |
extern void |
_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ); |
extern void |
_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); |
extern void |
_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); |
extern void |
_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); |
extern void |
_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); |
extern void |
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); |
extern void |
_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); |
extern void |
_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); |
/* |
* GL_ARB_multitexture |
*/ |
extern void |
_mesa_ActiveTextureARB( GLenum target ); |
extern void |
_mesa_ClientActiveTextureARB( GLenum target ); |
/* |
* Pixel Texture Extensions |
*/ |
extern void |
_mesa_PixelTexGenSGIX(GLenum mode); |
extern void |
_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); |
#ifdef VMS |
#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv |
#endif |
extern void |
_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); |
extern void |
_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); |
#ifdef VMS |
#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv |
#endif |
extern void |
_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); |
#ifdef VMS |
#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv |
#endif |
extern void |
_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); |
#ifdef VMS |
#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv |
#endif |
extern void |
_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/hint.h |
---|
0,0 → 1,39 |
/* $Id: hint.h,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef HINT_H |
#define HINT_H |
#include "mtypes.h" |
extern void |
_mesa_Hint( GLenum target, GLenum mode ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/api_noop.h |
---|
0,0 → 1,155 |
/* $Id: api_noop.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _API_NOOP_H |
#define _API_NOOP_H |
#include "glheader.h" |
#include "mtypes.h" |
#include "context.h" |
/* In states where certain vertex components are required for t&l or |
* rasterization, we still need to keep track of the current values. |
* These functions provide this service by keeping uptodate the |
* 'ctx->Current' struct for all data elements not included in the |
* currently enabled hardware vertex. |
* |
*/ |
extern void _mesa_noop_EdgeFlag( GLboolean b ); |
extern void _mesa_noop_EdgeFlagv( const GLboolean *b ); |
extern void _mesa_noop_FogCoordfEXT( GLfloat a ); |
extern void _mesa_noop_FogCoordfvEXT( const GLfloat *v ); |
extern void _mesa_noop_Indexi( GLint i ); |
extern void _mesa_noop_Indexiv( const GLint *v ); |
extern void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ); |
extern void _mesa_noop_Normal3fv( const GLfloat *v ); |
extern void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param ); |
extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ); |
extern void _mesa_noop_Color4ubv( const GLubyte *v ); |
extern void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); |
extern void _mesa_noop_Color4fv( const GLfloat *v ); |
extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ); |
extern void _mesa_noop_Color3ubv( const GLubyte *v ); |
extern void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ); |
extern void _mesa_noop_Color3fv( const GLfloat *v ); |
extern void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ); |
extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ); |
extern void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, |
GLfloat b ); |
extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ); |
extern void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, |
GLfloat b, GLfloat c); |
extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ); |
extern void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, |
GLfloat b, GLfloat c, GLfloat d ); |
extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ); |
extern void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ); |
extern void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ); |
extern void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ); |
extern void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ); |
extern void _mesa_noop_TexCoord1f( GLfloat a ); |
extern void _mesa_noop_TexCoord1fv( const GLfloat *v ); |
extern void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ); |
extern void _mesa_noop_TexCoord2fv( const GLfloat *v ); |
extern void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ); |
extern void _mesa_noop_TexCoord3fv( const GLfloat *v ); |
extern void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); |
extern void _mesa_noop_TexCoord4fv( const GLfloat *v ); |
extern void _mesa_noop_Vertex2fv( const GLfloat *v ); |
extern void _mesa_noop_Vertex3fv( const GLfloat *v ); |
extern void _mesa_noop_Vertex4fv( const GLfloat *v ); |
extern void _mesa_noop_Vertex2f( GLfloat a, GLfloat b ); |
extern void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ); |
extern void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); |
extern void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, |
GLfloat y, GLfloat z, GLfloat w ); |
extern void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ); |
/* Not strictly a noop -- translate Rectf down to Begin/End and |
* vertices. Closer to the loopback operations, but doesn't meet the |
* criteria for inclusion there (cannot be used in the Save table). |
*/ |
extern void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); |
extern void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count); |
extern void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, |
const GLvoid *indices); |
extern void _mesa_noop_DrawRangeElements(GLenum mode, |
GLuint start, GLuint end, |
GLsizei count, GLenum type, |
const GLvoid *indices); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/varray.h |
---|
0,0 → 1,123 |
/* $Id: varray.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef VARRAY_H |
#define VARRAY_H |
#include "mtypes.h" |
extern void |
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr); |
extern void |
_mesa_UnlockArraysEXT( void ); |
extern void |
_mesa_LockArraysEXT(GLint first, GLsizei count); |
extern void |
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, |
const GLvoid *ptr); |
extern void |
_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr); |
extern void |
_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr); |
extern void |
_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr); |
extern void |
_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, |
const GLvoid *ptr); |
extern void |
_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, |
GLsizei count, const GLvoid *ptr); |
extern void |
_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr); |
extern void |
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_SecondaryColorPointerEXT(GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr); |
extern void |
_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, |
GLsizei stride, const GLvoid *pointer); |
extern void |
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); |
extern void |
_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, |
GLsizei *count, GLsizei primcount ); |
extern void |
_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, |
const GLvoid **indices, GLsizei primcount ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texcompress.c |
---|
0,0 → 1,155 |
/* $Id: texcompress.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "context.h" |
#include "image.h" |
#include "texcompress.h" |
#include "texformat.h" |
/** |
* Get the list of supported internal compression formats. |
* \param formats - the results list (may be NULL) |
* \return number of formats. |
*/ |
GLuint |
_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ) |
{ |
GLuint n = 0; |
if (ctx->Extensions.ARB_texture_compression) { |
if (ctx->Extensions.TDFX_texture_compression_FXT1) { |
if (formats) { |
formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX; |
formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX; |
} |
else { |
n += 4; |
} |
} |
} |
return n; |
} |
/** |
* Return bytes of storage needed for the given texture size and compressed |
* format. |
* \param width, height, depth - texture size in texels |
* \param texFormat - one of the compressed format enums |
* \return size in bytes, or zero if bad texFormat |
*/ |
GLuint |
_mesa_compressed_texture_size( GLcontext *ctx, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format ) |
{ |
GLuint size; |
switch (format) { |
case GL_COMPRESSED_RGB_FXT1_3DFX: |
case GL_COMPRESSED_RGBA_FXT1_3DFX: |
/* round up to multiple of 4 */ |
size = ((width + 7) / 8) * ((height + 3) / 4) * 16; |
return size; |
default: |
_mesa_problem(ctx, "bad texformat in compressed_texture_size"); |
return 0; |
} |
} |
/* |
* Compute the bytes per row in a compressed texture image. |
*/ |
GLint |
_mesa_compressed_row_stride(GLenum format, GLsizei width) |
{ |
GLint bytesPerTile, stride; |
switch (format) { |
default: |
return 0; |
} |
stride = ((width + 3) / 4) * bytesPerTile; |
return stride; |
} |
/* |
* Return the address of the pixel at (col, row, img) in a |
* compressed texture image. |
* \param col, row, img - image position (3D) |
* \param format - compressed image format |
* \param width - image width |
* \param image - the image address |
* \return address of pixel at (row, col) |
*/ |
GLubyte * |
_mesa_compressed_image_address(GLint col, GLint row, GLint img, |
GLenum format, |
GLsizei width, const GLubyte *image) |
{ |
GLint bytesPerTile, stride; |
GLubyte *addr; |
ASSERT((row & 3) == 0); |
ASSERT((col & 3) == 0); |
(void) img; |
switch (format) { |
default: |
return 0; |
} |
stride = ((width + 3) / 4) * bytesPerTile; |
addr = (GLubyte *) image + (row / 4) * stride + (col / 4) * bytesPerTile; |
return addr; |
} |
/* |
* \param srcRowStride - source stride, in pixels |
*/ |
void |
_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height, |
GLenum srcFormat, const GLchan *source, |
GLint srcRowStride, |
const struct gl_texture_format *dstFormat, |
GLubyte *dest, GLint dstRowStride ) |
{ |
switch (dstFormat->MesaFormat) { |
default: |
_mesa_problem(ctx, "Bad dstFormat in _mesa_compress_teximage()"); |
return; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_arrayelt.c |
---|
0,0 → 1,365 |
/* $Id: api_arrayelt.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* Author: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "api_arrayelt.h" |
#include "context.h" |
#include "glapi.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
typedef void (*texarray_func)( GLenum, const void * ); |
typedef struct { |
GLint unit; |
struct gl_client_array *array; |
texarray_func func; |
} AEtexarray; |
typedef void (*array_func)( const void * ); |
typedef struct { |
struct gl_client_array *array; |
array_func func; |
} AEarray; |
typedef struct { |
AEtexarray texarrays[MAX_TEXTURE_UNITS+1]; |
AEarray arrays[32]; |
GLuint NewState; |
} AEcontext; |
#define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) |
#define TYPE_IDX(t) ((t) & 0xf) |
static void (*colorfuncs[2][8])( const void * ) = { |
{ (array_func)glColor3bv, |
(array_func)glColor3ubv, |
(array_func)glColor3sv, |
(array_func)glColor3usv, |
(array_func)glColor3iv, |
(array_func)glColor3uiv, |
(array_func)glColor3fv, |
(array_func)glColor3dv }, |
{ (array_func)glColor4bv, |
(array_func)glColor4ubv, |
(array_func)glColor4sv, |
(array_func)glColor4usv, |
(array_func)glColor4iv, |
(array_func)glColor4uiv, |
(array_func)glColor4fv, |
(array_func)glColor4dv } |
}; |
static void (*vertexfuncs[3][8])( const void * ) = { |
{ 0, |
0, |
(array_func)glVertex2sv, |
0, |
(array_func)glVertex2iv, |
0, |
(array_func)glVertex2fv, |
(array_func)glVertex2dv }, |
{ 0, |
0, |
(array_func)glVertex3sv, |
0, |
(array_func)glVertex3iv, |
0, |
(array_func)glVertex3fv, |
(array_func)glVertex3dv }, |
{ 0, |
0, |
(array_func)glVertex4sv, |
0, |
(array_func)glVertex4iv, |
0, |
(array_func)glVertex4fv, |
(array_func)glVertex4dv } |
}; |
static void (*multitexfuncs[4][8])( GLenum, const void * ) = { |
{ 0, |
0, |
(texarray_func)glMultiTexCoord1svARB, |
0, |
(texarray_func)glMultiTexCoord1ivARB, |
0, |
(texarray_func)glMultiTexCoord1fvARB, |
(texarray_func)glMultiTexCoord1dvARB }, |
{ 0, |
0, |
(texarray_func)glMultiTexCoord2svARB, |
0, |
(texarray_func)glMultiTexCoord2ivARB, |
0, |
(texarray_func)glMultiTexCoord2fvARB, |
(texarray_func)glMultiTexCoord2dvARB }, |
{ 0, |
0, |
(texarray_func)glMultiTexCoord3svARB, |
0, |
(texarray_func)glMultiTexCoord3ivARB, |
0, |
(texarray_func)glMultiTexCoord3fvARB, |
(texarray_func)glMultiTexCoord3dvARB }, |
{ 0, |
0, |
(texarray_func)glMultiTexCoord4svARB, |
0, |
(texarray_func)glMultiTexCoord4ivARB, |
0, |
(texarray_func)glMultiTexCoord4fvARB, |
(texarray_func)glMultiTexCoord4dvARB } |
}; |
static void (*indexfuncs[8])( const void * ) = { |
0, |
(array_func)glIndexubv, |
(array_func)glIndexsv, |
0, |
(array_func)glIndexiv, |
0, |
(array_func)glIndexfv, |
(array_func)glIndexdv |
}; |
static void (*normalfuncs[8])( const void * ) = { |
(array_func)glNormal3bv, |
0, |
(array_func)glNormal3sv, |
0, |
(array_func)glNormal3iv, |
0, |
(array_func)glNormal3fv, |
(array_func)glNormal3dv, |
}; |
/* Wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
static void SecondaryColor3bvEXT(const GLbyte *c) |
{ |
_glapi_Dispatch->SecondaryColor3bvEXT(c); |
} |
static void SecondaryColor3ubvEXT(const GLubyte *c) |
{ |
_glapi_Dispatch->SecondaryColor3ubvEXT(c); |
} |
static void SecondaryColor3svEXT(const GLshort *c) |
{ |
_glapi_Dispatch->SecondaryColor3svEXT(c); |
} |
static void SecondaryColor3usvEXT(const GLushort *c) |
{ |
_glapi_Dispatch->SecondaryColor3usvEXT(c); |
} |
static void SecondaryColor3ivEXT(const GLint *c) |
{ |
_glapi_Dispatch->SecondaryColor3ivEXT(c); |
} |
static void SecondaryColor3uivEXT(const GLuint *c) |
{ |
_glapi_Dispatch->SecondaryColor3uivEXT(c); |
} |
static void SecondaryColor3fvEXT(const GLfloat *c) |
{ |
_glapi_Dispatch->SecondaryColor3fvEXT(c); |
} |
static void SecondaryColor3dvEXT(const GLdouble *c) |
{ |
_glapi_Dispatch->SecondaryColor3dvEXT(c); |
} |
static void (*secondarycolorfuncs[8])( const void * ) = { |
(array_func) SecondaryColor3bvEXT, |
(array_func) SecondaryColor3ubvEXT, |
(array_func) SecondaryColor3svEXT, |
(array_func) SecondaryColor3usvEXT, |
(array_func) SecondaryColor3ivEXT, |
(array_func) SecondaryColor3uivEXT, |
(array_func) SecondaryColor3fvEXT, |
(array_func) SecondaryColor3dvEXT, |
}; |
/* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */ |
static void FogCoordfvEXT(const GLfloat *f) |
{ |
_glapi_Dispatch->FogCoordfvEXT(f); |
} |
static void FogCoorddvEXT(const GLdouble *f) |
{ |
_glapi_Dispatch->FogCoorddvEXT(f); |
} |
static void (*fogcoordfuncs[8])( const void * ) = { |
0, |
0, |
0, |
0, |
0, |
0, |
(array_func) FogCoordfvEXT, |
(array_func) FogCoorddvEXT |
}; |
GLboolean _ae_create_context( GLcontext *ctx ) |
{ |
ctx->aelt_context = MALLOC( sizeof(AEcontext) ); |
if (!ctx->aelt_context) |
return GL_FALSE; |
AE_CONTEXT(ctx)->NewState = ~0; |
return GL_TRUE; |
} |
void _ae_destroy_context( GLcontext *ctx ) |
{ |
if ( AE_CONTEXT( ctx ) ) { |
FREE( ctx->aelt_context ); |
ctx->aelt_context = 0; |
} |
} |
static void _ae_update_state( GLcontext *ctx ) |
{ |
AEcontext *actx = AE_CONTEXT(ctx); |
AEtexarray *ta = actx->texarrays; |
AEarray *aa = actx->arrays; |
GLuint i; |
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) |
if (ctx->Array.TexCoord[i].Enabled) { |
ta->unit = i; |
ta->array = &ctx->Array.TexCoord[i]; |
ta->func = multitexfuncs[ta->array->Size-1][TYPE_IDX(ta->array->Type)]; |
ta++; |
} |
ta->func = 0; |
if (ctx->Array.Color.Enabled) { |
aa->array = &ctx->Array.Color; |
aa->func = colorfuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
if (ctx->Array.Normal.Enabled) { |
aa->array = &ctx->Array.Normal; |
aa->func = normalfuncs[TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
if (ctx->Array.Index.Enabled) { |
aa->array = &ctx->Array.Index; |
aa->func = indexfuncs[TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
if (ctx->Array.EdgeFlag.Enabled) { |
aa->array = &ctx->Array.EdgeFlag; |
aa->func = (array_func)glEdgeFlagv; |
aa++; |
} |
if (ctx->Array.FogCoord.Enabled) { |
aa->array = &ctx->Array.FogCoord; |
aa->func = fogcoordfuncs[TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
if (ctx->Array.SecondaryColor.Enabled) { |
aa->array = &ctx->Array.SecondaryColor; |
aa->func = secondarycolorfuncs[TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
/* Must be last |
*/ |
if (ctx->Array.Vertex.Enabled) { |
aa->array = &ctx->Array.Vertex; |
aa->func = vertexfuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; |
aa++; |
} |
aa->func = 0; |
actx->NewState = 0; |
} |
void _ae_loopback_array_elt( GLint elt ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
AEcontext *actx = AE_CONTEXT(ctx); |
AEtexarray *ta; |
AEarray *aa; |
if (actx->NewState) |
_ae_update_state( ctx ); |
for (ta = actx->texarrays ; ta->func ; ta++) { |
ta->func( ta->unit + GL_TEXTURE0_ARB, (char *)ta->array->Ptr + elt * ta->array->StrideB ); |
} |
/* Must be last |
*/ |
for (aa = actx->arrays ; aa->func ; aa++) { |
aa->func( (char *)aa->array->Ptr + elt * aa->array->StrideB ); |
} |
} |
void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) |
{ |
AE_CONTEXT(ctx)->NewState |= new_state; |
} |
/shark/tags/rel_0_4/ports/mesa/src/vpparse.c |
---|
0,0 → 1,1631 |
/* $Id: vpparse.c,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* -------- Regarding NV_vertex_program -------- |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are met: |
* |
* o Redistribution of the source code must contain a copyright notice |
* and this list of conditions; |
* |
* o Redistribution in binary and source code form must contain the |
* following Notice in the software and any documentation and/or other |
* materials provided with the distribution; and |
* |
* o The name of Nvidia may not be used to promote or endorse software |
* derived from the software. |
* |
* NOTICE: Nvidia hereby grants to each recipient a non-exclusive worldwide |
* royalty free patent license under patent claims that are licensable by |
* Nvidia and which are necessarily required and for which no commercially |
* viable non infringing alternative exists to make, use, sell, offer to sell, |
* import and otherwise transfer the vertex extension for the Mesa 3D Graphics |
* Library as distributed in source code and object code form. No hardware or |
* hardware implementation (including a semiconductor implementation and chips) |
* are licensed hereunder. If a recipient makes a patent claim or institutes |
* patent litigation against Nvidia or Nvidia's customers for use or sale of |
* Nvidia products, then this license grant as to such recipient shall |
* immediately terminate and recipient immediately agrees to cease use and |
* distribution of the Mesa Program and derivatives thereof. |
* |
* THE MESA 3D GRAPHICS LIBRARY IS PROVIDED ON AN "AS IS BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, |
* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-NFRINGEMENT |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
* |
* NVIDIA SHALL NOT HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION |
* LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE MESA 3D GRAPHICS |
* LIBRARY OR EVIDENCE OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDR, EVEN |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* If you do not comply with this agreement, then Nvidia may cancel the license |
* and rights granted herein. |
* --------------------------------------------- |
*/ |
/** |
* \file vpparse.c |
* \brief Vertex program parser. |
* \author Brian Paul |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "hash.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "vpparse.h" |
/************************ Symbol Table ******************************/ |
/* A simple symbol table implementation for ARB_vertex_program |
* (not used yet) |
*/ |
#if 000 |
struct symbol |
{ |
GLubyte *name; |
GLint value; |
struct symbol *next; |
}; |
static struct symbol *SymbolTable = NULL; |
static GLboolean |
IsSymbol(const GLubyte *symbol) |
{ |
struct symbol *s; |
for (s = SymbolTable; s; s = s->next) { |
if (strcmp((char *) symbol, (char *)s->name) == 0) |
return GL_TRUE; |
} |
return GL_FALSE; |
} |
static GLint |
GetSymbolValue(const GLubyte *symbol) |
{ |
struct symbol *s; |
for (s = SymbolTable; s; s = s->next) { |
if (strcmp((char *) symbol, (char *)s->name) == 0) |
return s->value; |
} |
return 0; |
} |
static void |
AddSymbol(const GLubyte *symbol, GLint value) |
{ |
struct symbol *s = MALLOC_STRUCT(symbol); |
if (s) { |
s->name = (GLubyte *) strdup((char *) symbol); |
s->value = value; |
s->next = SymbolTable; |
SymbolTable = s; |
} |
} |
static void |
ResetSymbolTable(void) |
{ |
struct symbol *s, *next; |
for (s = SymbolTable; s; s = next) { |
next = s->next; |
FREE(s->name); |
FREE(s); |
s = next; |
} |
SymbolTable = NULL; |
} |
#endif |
/***************************** Parsing ******************************/ |
static GLboolean IsLetter(GLubyte b) |
{ |
return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z'); |
} |
static GLboolean IsDigit(GLubyte b) |
{ |
return b >= '0' && b <= '9'; |
} |
static GLboolean IsWhitespace(GLubyte b) |
{ |
return b == ' ' || b == '\t' || b == '\n' || b == '\r'; |
} |
/** |
* Starting at 'str' find the next token. A token can be an integer, |
* an identifier or punctuation symbol. |
* \return <= 0 we found an error, else, return number of characters parsed. |
*/ |
static GLint |
GetToken(const GLubyte *str, GLubyte *token) |
{ |
GLint i = 0, j = 0; |
token[0] = 0; |
/* skip whitespace and comments */ |
while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) { |
if (str[i] == '#') { |
/* skip comment */ |
while (str[i] && (str[i] != '\n' && str[i] != '\r')) { |
i++; |
} |
} |
else { |
/* skip whitespace */ |
i++; |
} |
} |
if (str[i] == 0) |
return -i; |
/* try matching an integer */ |
while (str[i] && IsDigit(str[i])) { |
token[j++] = str[i++]; |
} |
if (j > 0 || !str[i]) { |
token[j] = 0; |
return i; |
} |
/* try matching an identifier */ |
if (IsLetter(str[i])) { |
while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) { |
token[j++] = str[i++]; |
} |
token[j] = 0; |
return i; |
} |
/* punctuation */ |
if (str[i]) { |
token[0] = str[i++]; |
token[1] = 0; |
return i; |
} |
/* end of input */ |
token[0] = 0; |
return i; |
} |
/** |
* Get next token from input stream and increment stream pointer past token. |
*/ |
static GLboolean |
Parse_Token(const GLubyte **s, GLubyte *token) |
{ |
GLint i; |
i = GetToken(*s, token); |
if (i <= 0) { |
*s += (-i); |
return GL_FALSE; |
} |
*s += i; |
return GL_TRUE; |
} |
/** |
* Get next token from input stream but don't increment stream pointer. |
*/ |
static GLboolean |
Peek_Token(const GLubyte **s, GLubyte *token) |
{ |
GLint i, len; |
i = GetToken(*s, token); |
if (i <= 0) { |
*s += (-i); |
return GL_FALSE; |
} |
len = _mesa_strlen((char *) token); |
*s += (i - len); |
return GL_TRUE; |
} |
/** |
* String equality test |
*/ |
static GLboolean |
StrEq(const GLubyte *a, const GLubyte *b) |
{ |
GLint i; |
for (i = 0; a[i] && b[i] && a[i] == b[i]; i++) |
; |
if (a[i] == 0 && b[i] == 0) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
/**********************************************************************/ |
static const char *InputRegisters[] = { |
"OPOS", "WGHT", "NRML", "COL0", "COL1", "FOGC", "6", "7", |
"TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL |
}; |
static const char *OutputRegisters[] = { |
"HPOS", "COL0", "COL1", "BFC0", "BFC1", "FOGC", "PSIZ", |
"TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL |
}; |
static const char *Opcodes[] = { |
"MOV", "LIT", "RCP", "RSQ", "EXP", "LOG", "MUL", "ADD", "DP3", "DP4", |
"DST", "MIN", "MAX", "SLT", "SGE", "MAD", "ARL", "DPH", "RCC", "SUB", |
"ABS", "END", NULL |
}; |
#ifdef DEBUG |
#define PARSE_ERROR \ |
do { \ |
_mesa_printf("vpparse.c error at %d: parse error\n", __LINE__); \ |
return GL_FALSE; \ |
} while(0) |
#define PARSE_ERROR1(msg) \ |
do { \ |
_mesa_printf("vpparse.c error at %d: %s\n", __LINE__, msg); \ |
return GL_FALSE; \ |
} while(0) |
#define PARSE_ERROR2(msg1, msg2) \ |
do { \ |
_mesa_printf("vpparse.c error at %d: %s %s\n", __LINE__, msg1, msg2); \ |
return GL_FALSE; \ |
} while(0) |
#else |
#define PARSE_ERROR return GL_FALSE |
#define PARSE_ERROR1(msg1) return GL_FALSE |
#define PARSE_ERROR2(msg1, msg2) return GL_FALSE |
#endif |
static GLuint |
IsProgRegister(GLuint r) |
{ |
return (GLuint) (r >= VP_PROG_REG_START && r <= VP_PROG_REG_END); |
} |
static GLuint |
IsInputRegister(GLuint r) |
{ |
return (GLuint) (r >= VP_INPUT_REG_START && r <= VP_INPUT_REG_END); |
} |
static GLuint |
IsOutputRegister(GLuint r) |
{ |
return (GLuint) (r >= VP_OUTPUT_REG_START && r <= VP_OUTPUT_REG_END); |
} |
/**********************************************************************/ |
/* XXX |
* These shouldn't be globals as that makes the parser non-reentrant. |
* We should really define a "ParserContext" class which contains these |
* and the <s> pointer into the program text. |
*/ |
static GLboolean IsStateProgram = GL_FALSE; |
static GLboolean IsPositionInvariant = GL_FALSE; |
static GLboolean IsVersion1_1 = GL_FALSE; |
/** |
* Try to match 'pattern' as the next token after any whitespace/comments. |
*/ |
static GLboolean |
Parse_String(const GLubyte **s, const char *pattern) |
{ |
GLint i; |
/* skip whitespace and comments */ |
while (IsWhitespace(**s) || **s == '#') { |
if (**s == '#') { |
while (**s && (**s != '\n' && **s != '\r')) { |
*s += 1; |
} |
} |
else { |
/* skip whitespace */ |
*s += 1; |
} |
} |
/* Try to match the pattern */ |
for (i = 0; pattern[i]; i++) { |
if (**s != pattern[i]) |
PARSE_ERROR2("failed to match", pattern); /* failure */ |
*s += 1; |
} |
return GL_TRUE; /* success */ |
} |
/** |
* Parse a temporary register: Rnn |
*/ |
static GLboolean |
Parse_TempReg(const GLubyte **s, GLint *tempRegNum) |
{ |
GLubyte token[100]; |
/* Should be 'R##' */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (token[0] != 'R') |
PARSE_ERROR1("Expected R##"); |
if (IsDigit(token[1])) { |
GLint reg = _mesa_atoi((char *) (token + 1)); |
if (reg >= VP_NUM_TEMP_REGS) |
PARSE_ERROR1("Bad temporary register name"); |
*tempRegNum = VP_TEMP_REG_START + reg; |
} |
else { |
PARSE_ERROR1("Bad temporary register name"); |
} |
return GL_TRUE; |
} |
/** |
* Parse address register "A0.x" |
*/ |
static GLboolean |
Parse_AddrReg(const GLubyte **s) |
{ |
/* match 'A0' */ |
if (!Parse_String(s, "A0")) |
PARSE_ERROR; |
/* match '.' */ |
if (!Parse_String(s, ".")) |
PARSE_ERROR; |
/* match 'x' */ |
if (!Parse_String(s, "x")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
/** |
* Parse absolute program parameter register "c[##]" |
*/ |
static GLboolean |
Parse_AbsParamReg(const GLubyte **s, GLint *regNum) |
{ |
GLubyte token[100]; |
if (!Parse_String(s, "c")) |
PARSE_ERROR; |
if (!Parse_String(s, "[")) |
PARSE_ERROR; |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (IsDigit(token[0])) { |
/* a numbered program parameter register */ |
GLint reg = _mesa_atoi((char *) token); |
if (reg >= VP_NUM_PROG_REGS) |
PARSE_ERROR1("Bad constant program number"); |
*regNum = VP_PROG_REG_START + reg; |
} |
else { |
PARSE_ERROR; |
} |
if (!Parse_String(s, "]")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
static GLboolean |
Parse_ParamReg(const GLubyte **s, struct vp_src_register *srcReg) |
{ |
GLubyte token[100]; |
if (!Parse_String(s, "c")) |
PARSE_ERROR; |
if (!Parse_String(s, "[")) |
PARSE_ERROR; |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (IsDigit(token[0])) { |
/* a numbered program parameter register */ |
GLint reg; |
(void) Parse_Token(s, token); |
reg = _mesa_atoi((char *) token); |
if (reg >= VP_NUM_PROG_REGS) |
PARSE_ERROR1("Bad constant program number"); |
srcReg->Register = VP_PROG_REG_START + reg; |
} |
else if (StrEq(token, (GLubyte *) "A0")) { |
/* address register "A0.x" */ |
if (!Parse_AddrReg(s)) |
PARSE_ERROR; |
srcReg->RelAddr = GL_TRUE; |
srcReg->Register = 0; |
/* Look for +/-N offset */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == '-' || token[0] == '+') { |
const GLubyte sign = token[0]; |
(void) Parse_Token(s, token); /* consume +/- */ |
/* an integer should be next */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (IsDigit(token[0])) { |
const GLint k = _mesa_atoi((char *) token); |
if (sign == '-') { |
if (k > 64) |
PARSE_ERROR1("Bad address offset"); |
srcReg->Register = -k; |
} |
else { |
if (k > 63) |
PARSE_ERROR1("Bad address offset"); |
srcReg->Register = k; |
} |
} |
else { |
PARSE_ERROR; |
} |
} |
else { |
/* probably got a ']', catch it below */ |
} |
} |
else { |
PARSE_ERROR; |
} |
/* Match closing ']' */ |
if (!Parse_String(s, "]")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
/** |
* Parse v[#] or v[<name>] |
*/ |
static GLboolean |
Parse_AttribReg(const GLubyte **s, GLint *tempRegNum) |
{ |
GLubyte token[100]; |
GLint j; |
/* Match 'v' */ |
if (!Parse_String(s, "v")) |
PARSE_ERROR; |
/* Match '[' */ |
if (!Parse_String(s, "[")) |
PARSE_ERROR; |
/* match number or named register */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (IsStateProgram && token[0] != '0') |
PARSE_ERROR1("Only v[0] accessible in vertex state programs"); |
if (IsDigit(token[0])) { |
GLint reg = _mesa_atoi((char *) token); |
if (reg >= VP_NUM_INPUT_REGS) |
PARSE_ERROR1("Bad vertex attribute register name"); |
*tempRegNum = VP_INPUT_REG_START + reg; |
} |
else { |
for (j = 0; InputRegisters[j]; j++) { |
if (StrEq(token, (const GLubyte *) InputRegisters[j])) { |
*tempRegNum = VP_INPUT_REG_START + j; |
break; |
} |
} |
if (!InputRegisters[j]) { |
/* unknown input register label */ |
PARSE_ERROR2("Bad register name", token); |
} |
} |
/* Match '[' */ |
if (!Parse_String(s, "]")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
static GLboolean |
Parse_OutputReg(const GLubyte **s, GLint *outputRegNum) |
{ |
GLubyte token[100]; |
GLint start, j; |
/* Match 'o' */ |
if (!Parse_String(s, "o")) |
PARSE_ERROR; |
/* Match '[' */ |
if (!Parse_String(s, "[")) |
PARSE_ERROR; |
/* Get output reg name */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (IsPositionInvariant) |
start = 1; /* skip HPOS register name */ |
else |
start = 0; |
/* try to match an output register name */ |
for (j = start; OutputRegisters[j]; j++) { |
if (StrEq(token, (const GLubyte *) OutputRegisters[j])) { |
*outputRegNum = VP_OUTPUT_REG_START + j; |
break; |
} |
} |
if (!OutputRegisters[j]) |
PARSE_ERROR1("Unrecognized output register name"); |
/* Match ']' */ |
if (!Parse_String(s, "]")) |
PARSE_ERROR1("Expected ]"); |
return GL_TRUE; |
} |
static GLboolean |
Parse_MaskedDstReg(const GLubyte **s, struct vp_dst_register *dstReg) |
{ |
GLubyte token[100]; |
/* Dst reg can be R<n> or o[n] */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == 'R') { |
/* a temporary register */ |
if (!Parse_TempReg(s, &dstReg->Register)) |
PARSE_ERROR; |
} |
else if (!IsStateProgram && token[0] == 'o') { |
/* an output register */ |
if (!Parse_OutputReg(s, &dstReg->Register)) |
PARSE_ERROR; |
} |
else if (IsStateProgram && token[0] == 'c') { |
/* absolute program parameter register */ |
if (!Parse_AbsParamReg(s, &dstReg->Register)) |
PARSE_ERROR; |
} |
else { |
PARSE_ERROR1("Bad destination register name"); |
} |
/* Parse optional write mask */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == '.') { |
/* got a mask */ |
GLint k = 0; |
if (!Parse_String(s, ".")) |
PARSE_ERROR; |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
dstReg->WriteMask[0] = GL_FALSE; |
dstReg->WriteMask[1] = GL_FALSE; |
dstReg->WriteMask[2] = GL_FALSE; |
dstReg->WriteMask[3] = GL_FALSE; |
if (token[k] == 'x') { |
dstReg->WriteMask[0] = GL_TRUE; |
k++; |
} |
if (token[k] == 'y') { |
dstReg->WriteMask[1] = GL_TRUE; |
k++; |
} |
if (token[k] == 'z') { |
dstReg->WriteMask[2] = GL_TRUE; |
k++; |
} |
if (token[k] == 'w') { |
dstReg->WriteMask[3] = GL_TRUE; |
k++; |
} |
if (k == 0) { |
PARSE_ERROR1("Bad writemask character"); |
} |
return GL_TRUE; |
} |
else { |
dstReg->WriteMask[0] = GL_TRUE; |
dstReg->WriteMask[1] = GL_TRUE; |
dstReg->WriteMask[2] = GL_TRUE; |
dstReg->WriteMask[3] = GL_TRUE; |
return GL_TRUE; |
} |
} |
static GLboolean |
Parse_SwizzleSrcReg(const GLubyte **s, struct vp_src_register *srcReg) |
{ |
GLubyte token[100]; |
srcReg->RelAddr = GL_FALSE; |
/* check for '-' */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == '-') { |
(void) Parse_String(s, "-"); |
srcReg->Negate = GL_TRUE; |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
} |
else { |
srcReg->Negate = GL_FALSE; |
} |
/* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */ |
if (token[0] == 'R') { |
if (!Parse_TempReg(s, &srcReg->Register)) |
PARSE_ERROR; |
} |
else if (token[0] == 'c') { |
if (!Parse_ParamReg(s, srcReg)) |
PARSE_ERROR; |
} |
else if (token[0] == 'v') { |
if (!Parse_AttribReg(s, &srcReg->Register)) |
PARSE_ERROR; |
} |
else { |
PARSE_ERROR2("Bad source register name", token); |
} |
/* init swizzle fields */ |
srcReg->Swizzle[0] = 0; |
srcReg->Swizzle[1] = 1; |
srcReg->Swizzle[2] = 2; |
srcReg->Swizzle[3] = 3; |
/* Look for optional swizzle suffix */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == '.') { |
(void) Parse_String(s, "."); /* consume . */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (token[1] == 0) { |
/* single letter swizzle */ |
if (token[0] == 'x') |
ASSIGN_4V(srcReg->Swizzle, 0, 0, 0, 0); |
else if (token[0] == 'y') |
ASSIGN_4V(srcReg->Swizzle, 1, 1, 1, 1); |
else if (token[0] == 'z') |
ASSIGN_4V(srcReg->Swizzle, 2, 2, 2, 2); |
else if (token[0] == 'w') |
ASSIGN_4V(srcReg->Swizzle, 3, 3, 3, 3); |
else |
PARSE_ERROR1("Expected x, y, z, or w"); |
} |
else { |
/* 2, 3 or 4-component swizzle */ |
GLint k; |
for (k = 0; token[k] && k < 5; k++) { |
if (token[k] == 'x') |
srcReg->Swizzle[k] = 0; |
else if (token[k] == 'y') |
srcReg->Swizzle[k] = 1; |
else if (token[k] == 'z') |
srcReg->Swizzle[k] = 2; |
else if (token[k] == 'w') |
srcReg->Swizzle[k] = 3; |
else |
PARSE_ERROR; |
} |
if (k >= 5) |
PARSE_ERROR; |
} |
} |
return GL_TRUE; |
} |
static GLboolean |
Parse_ScalarSrcReg(const GLubyte **s, struct vp_src_register *srcReg) |
{ |
GLubyte token[100]; |
srcReg->RelAddr = GL_FALSE; |
/* check for '-' */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == '-') { |
srcReg->Negate = GL_TRUE; |
(void) Parse_String(s, "-"); /* consume '-' */ |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
} |
else { |
srcReg->Negate = GL_FALSE; |
} |
/* Src reg can be R<n>, c[n], c[n +/- offset], or a named vertex attrib */ |
if (token[0] == 'R') { |
if (!Parse_TempReg(s, &srcReg->Register)) |
PARSE_ERROR; |
} |
else if (token[0] == 'c') { |
if (!Parse_ParamReg(s, srcReg)) |
PARSE_ERROR; |
} |
else if (token[0] == 'v') { |
if (!Parse_AttribReg(s, &srcReg->Register)) |
PARSE_ERROR; |
} |
else { |
PARSE_ERROR2("Bad source register name", token); |
} |
/* Look for .[xyzw] suffix */ |
if (!Parse_String(s, ".")) |
PARSE_ERROR; |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (token[0] == 'x' && token[1] == 0) { |
srcReg->Swizzle[0] = 0; |
} |
else if (token[0] == 'y' && token[1] == 0) { |
srcReg->Swizzle[0] = 1; |
} |
else if (token[0] == 'z' && token[1] == 0) { |
srcReg->Swizzle[0] = 2; |
} |
else if (token[0] == 'w' && token[1] == 0) { |
srcReg->Swizzle[0] = 3; |
} |
else { |
PARSE_ERROR1("Bad scalar source suffix"); |
} |
srcReg->Swizzle[1] = srcReg->Swizzle[2] = srcReg->Swizzle[3] = 0; |
return GL_TRUE; |
} |
static GLint |
Parse_UnaryOpInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
GLubyte token[100]; |
/* opcode */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (StrEq(token, (GLubyte *) "MOV")) { |
inst->Opcode = MOV; |
} |
else if (StrEq(token, (GLubyte *) "LIT")) { |
inst->Opcode = LIT; |
} |
else if (StrEq(token, (GLubyte *) "ABS") && IsVersion1_1) { |
inst->Opcode = ABS; |
} |
else { |
PARSE_ERROR; |
} |
/* dest reg */ |
if (!Parse_MaskedDstReg(s, &inst->DstReg)) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[0])) |
PARSE_ERROR; |
/* semicolon */ |
if (!Parse_String(s, ";")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
static GLboolean |
Parse_BiOpInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
GLubyte token[100]; |
/* opcode */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (StrEq(token, (GLubyte *) "MUL")) { |
inst->Opcode = MUL; |
} |
else if (StrEq(token, (GLubyte *) "ADD")) { |
inst->Opcode = ADD; |
} |
else if (StrEq(token, (GLubyte *) "DP3")) { |
inst->Opcode = DP3; |
} |
else if (StrEq(token, (GLubyte *) "DP4")) { |
inst->Opcode = DP4; |
} |
else if (StrEq(token, (GLubyte *) "DST")) { |
inst->Opcode = DST; |
} |
else if (StrEq(token, (GLubyte *) "MIN")) { |
inst->Opcode = ADD; |
} |
else if (StrEq(token, (GLubyte *) "MAX")) { |
inst->Opcode = ADD; |
} |
else if (StrEq(token, (GLubyte *) "SLT")) { |
inst->Opcode = SLT; |
} |
else if (StrEq(token, (GLubyte *) "SGE")) { |
inst->Opcode = SGE; |
} |
else if (StrEq(token, (GLubyte *) "DPH") && IsVersion1_1) { |
inst->Opcode = DPH; |
} |
else if (StrEq(token, (GLubyte *) "SUB") && IsVersion1_1) { |
inst->Opcode = SUB; |
} |
else { |
PARSE_ERROR; |
} |
/* dest reg */ |
if (!Parse_MaskedDstReg(s, &inst->DstReg)) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* first src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[0])) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* second src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[1])) |
PARSE_ERROR; |
/* semicolon */ |
if (!Parse_String(s, ";")) |
PARSE_ERROR; |
/* make sure we don't reference more than one program parameter register */ |
if (IsProgRegister(inst->SrcReg[0].Register) && |
IsProgRegister(inst->SrcReg[1].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[1].Register) |
PARSE_ERROR1("Can't reference two program parameter registers"); |
/* make sure we don't reference more than one vertex attribute register */ |
if (IsInputRegister(inst->SrcReg[0].Register) && |
IsInputRegister(inst->SrcReg[1].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[1].Register) |
PARSE_ERROR1("Can't reference two vertex attribute registers"); |
return GL_TRUE; |
} |
static GLboolean |
Parse_TriOpInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
GLubyte token[100]; |
/* opcode */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (StrEq(token, (GLubyte *) "MAD")) { |
inst->Opcode = MAD; |
} |
else { |
PARSE_ERROR; |
} |
/* dest reg */ |
if (!Parse_MaskedDstReg(s, &inst->DstReg)) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* first src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[0])) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* second src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[1])) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* third src arg */ |
if (!Parse_SwizzleSrcReg(s, &inst->SrcReg[2])) |
PARSE_ERROR; |
/* semicolon */ |
if (!Parse_String(s, ";")) |
PARSE_ERROR; |
/* make sure we don't reference more than one program parameter register */ |
if ((IsProgRegister(inst->SrcReg[0].Register) && |
IsProgRegister(inst->SrcReg[1].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[1].Register) || |
(IsProgRegister(inst->SrcReg[0].Register) && |
IsProgRegister(inst->SrcReg[2].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[2].Register) || |
(IsProgRegister(inst->SrcReg[1].Register) && |
IsProgRegister(inst->SrcReg[2].Register) && |
inst->SrcReg[1].Register != inst->SrcReg[2].Register)) |
PARSE_ERROR1("Can only reference one program register"); |
/* make sure we don't reference more than one vertex attribute register */ |
if ((IsInputRegister(inst->SrcReg[0].Register) && |
IsInputRegister(inst->SrcReg[1].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[1].Register) || |
(IsInputRegister(inst->SrcReg[0].Register) && |
IsInputRegister(inst->SrcReg[2].Register) && |
inst->SrcReg[0].Register != inst->SrcReg[2].Register) || |
(IsInputRegister(inst->SrcReg[1].Register) && |
IsInputRegister(inst->SrcReg[2].Register) && |
inst->SrcReg[1].Register != inst->SrcReg[2].Register)) |
PARSE_ERROR1("Can only reference one input register"); |
return GL_TRUE; |
} |
static GLboolean |
Parse_ScalarInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
GLubyte token[100]; |
/* opcode */ |
if (!Parse_Token(s, token)) |
PARSE_ERROR; |
if (StrEq(token, (GLubyte *) "RCP")) { |
inst->Opcode = RCP; |
} |
else if (StrEq(token, (GLubyte *) "RSQ")) { |
inst->Opcode = RSQ; |
} |
else if (StrEq(token, (GLubyte *) "EXP")) { |
inst->Opcode = EXP; |
} |
else if (StrEq(token, (GLubyte *) "LOG")) { |
inst->Opcode = LOG; |
} |
else if (StrEq(token, (GLubyte *) "RCC") && IsVersion1_1) { |
inst->Opcode = RCC; |
} |
else { |
PARSE_ERROR; |
} |
/* dest reg */ |
if (!Parse_MaskedDstReg(s, &inst->DstReg)) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* first src arg */ |
if (!Parse_ScalarSrcReg(s, &inst->SrcReg[0])) |
PARSE_ERROR; |
/* semicolon */ |
if (!Parse_String(s, ";")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
static GLboolean |
Parse_AddressInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
inst->Opcode = ARL; |
/* opcode */ |
if (!Parse_String(s, "ARL")) |
PARSE_ERROR; |
/* dest A0 reg */ |
if (!Parse_AddrReg(s)) |
PARSE_ERROR; |
/* comma */ |
if (!Parse_String(s, ",")) |
PARSE_ERROR; |
/* parse src reg */ |
if (!Parse_ScalarSrcReg(s, &inst->SrcReg[0])) |
PARSE_ERROR; |
/* semicolon */ |
if (!Parse_String(s, ";")) |
PARSE_ERROR; |
return GL_TRUE; |
} |
static GLboolean |
Parse_EndInstruction(const GLubyte **s, struct vp_instruction *inst) |
{ |
GLubyte token[100]; |
/* opcode */ |
if (!Parse_String(s, "END")) |
PARSE_ERROR; |
inst->Opcode = END; |
/* this should fail! */ |
if (Parse_Token(s, token)) |
PARSE_ERROR2("Unexpected token after END:", token); |
else |
return GL_TRUE; |
} |
static GLboolean |
Parse_OptionSequence(const GLubyte **s, struct vp_instruction program[]) |
{ |
while (1) { |
GLubyte token[100]; |
if (!Peek_Token(s, token)) { |
PARSE_ERROR1("Unexpected end of input"); |
return GL_FALSE; /* end of input */ |
} |
if (!StrEq(token, (GLubyte *) "OPTION")) |
return GL_TRUE; /* probably an instruction */ |
Parse_Token(s, token); |
if (!Parse_String(s, "NV_position_invariant")) |
return GL_FALSE; |
if (!Parse_String(s, ";")) |
return GL_FALSE; |
IsPositionInvariant = GL_TRUE; |
} |
} |
static GLboolean |
Parse_InstructionSequence(const GLubyte **s, struct vp_instruction program[]) |
{ |
GLubyte token[100]; |
GLint count = 0; |
while (1) { |
struct vp_instruction *inst = program + count; |
/* Initialize the instruction */ |
inst->SrcReg[0].Register = -1; |
inst->SrcReg[1].Register = -1; |
inst->SrcReg[2].Register = -1; |
inst->DstReg.Register = -1; |
if (!Peek_Token(s, token)) |
PARSE_ERROR; |
if (StrEq(token, (GLubyte *) "MOV") || |
StrEq(token, (GLubyte *) "LIT") || |
StrEq(token, (GLubyte *) "ABS")) { |
if (!Parse_UnaryOpInstruction(s, inst)) |
PARSE_ERROR; |
} |
else if (StrEq(token, (GLubyte *) "MUL") || |
StrEq(token, (GLubyte *) "ADD") || |
StrEq(token, (GLubyte *) "DP3") || |
StrEq(token, (GLubyte *) "DP4") || |
StrEq(token, (GLubyte *) "DST") || |
StrEq(token, (GLubyte *) "MIN") || |
StrEq(token, (GLubyte *) "MAX") || |
StrEq(token, (GLubyte *) "SLT") || |
StrEq(token, (GLubyte *) "SGE") || |
StrEq(token, (GLubyte *) "DPH") || |
StrEq(token, (GLubyte *) "SUB")) { |
if (!Parse_BiOpInstruction(s, inst)) |
PARSE_ERROR; |
} |
else if (StrEq(token, (GLubyte *) "MAD")) { |
if (!Parse_TriOpInstruction(s, inst)) |
PARSE_ERROR; |
} |
else if (StrEq(token, (GLubyte *) "RCP") || |
StrEq(token, (GLubyte *) "RSQ") || |
StrEq(token, (GLubyte *) "EXP") || |
StrEq(token, (GLubyte *) "LOG") || |
StrEq(token, (GLubyte *) "RCC")) { |
if (!Parse_ScalarInstruction(s, inst)) |
PARSE_ERROR; |
} |
else if (StrEq(token, (GLubyte *) "ARL")) { |
if (!Parse_AddressInstruction(s, inst)) |
PARSE_ERROR; |
} |
else if (StrEq(token, (GLubyte *) "END")) { |
if (!Parse_EndInstruction(s, inst)) |
PARSE_ERROR; |
else |
return GL_TRUE; /* all done */ |
} |
else { |
/* bad instruction name */ |
PARSE_ERROR2("Unexpected token: ", token); |
} |
count++; |
if (count >= VP_MAX_INSTRUCTIONS) |
PARSE_ERROR1("Program too long"); |
} |
PARSE_ERROR; |
} |
static GLboolean |
Parse_Program(const GLubyte **s, struct vp_instruction instBuffer[]) |
{ |
if (IsVersion1_1) { |
if (!Parse_OptionSequence(s, instBuffer)) { |
return GL_FALSE; |
} |
} |
return Parse_InstructionSequence(s, instBuffer); |
} |
/** |
* Parse/compile the 'str' returning the compiled 'program'. |
* ctx->VertexProgram.ErrorPos will be -1 if successful. Otherwise, ErrorPos |
* indicates the position of the error in 'str'. |
*/ |
void |
_mesa_parse_program(GLcontext *ctx, GLenum dstTarget, |
const GLubyte *str, struct vp_program *program) |
{ |
const GLubyte *s; |
struct vp_instruction instBuffer[VP_MAX_INSTRUCTIONS]; |
GLubyte *newString; |
struct vp_instruction *newInst; |
GLenum target; |
ctx->VertexProgram.ErrorPos = -1; |
IsPositionInvariant = GL_FALSE; |
IsVersion1_1 = GL_FALSE; |
/* check the program header */ |
if (_mesa_strncmp((const char *) str, "!!VP1.0", 7) == 0) { |
target = GL_VERTEX_PROGRAM_NV; |
s = str + 7; |
IsStateProgram = GL_FALSE; |
} |
else if (_mesa_strncmp((const char *) str, "!!VP1.1", 7) == 0) { |
target = GL_VERTEX_PROGRAM_NV; |
s = str + 7; |
IsStateProgram = GL_FALSE; |
IsVersion1_1 = GL_TRUE; |
} |
else if (_mesa_strncmp((const char *) str, "!!VSP1.0", 8) == 0) { |
target = GL_VERTEX_STATE_PROGRAM_NV; |
s = str + 8; |
IsStateProgram = GL_TRUE; |
} |
else { |
/* invalid header */ |
ctx->VertexProgram.ErrorPos = 0; |
_mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)"); |
return; |
} |
/* make sure target and header match */ |
if (target != dstTarget) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glLoadProgramNV(target mismatch)"); |
return; |
} |
if (Parse_Program(&s, instBuffer)) { |
GLuint numInst; |
GLuint strLen; |
GLuint inputsRead = 0; |
GLuint outputsWritten = 0; |
GLuint progRegsWritten = 0; |
/* Find length of the program and compute bitmasks to indicate which |
* vertex input registers are read, which vertex result registers are |
* written to, and which program registers are written to. |
* We could actually do this while we parse the program. |
*/ |
for (numInst = 0; instBuffer[numInst].Opcode != END; numInst++) { |
const GLint srcReg0 = instBuffer[numInst].SrcReg[0].Register; |
const GLint srcReg1 = instBuffer[numInst].SrcReg[1].Register; |
const GLint srcReg2 = instBuffer[numInst].SrcReg[2].Register; |
const GLint dstReg = instBuffer[numInst].DstReg.Register; |
if (IsOutputRegister(dstReg)) |
outputsWritten |= (1 << (dstReg - VP_OUTPUT_REG_START)); |
else if (IsProgRegister(dstReg)) |
progRegsWritten |= (1 << (dstReg - VP_PROG_REG_START)); |
if (IsInputRegister(srcReg0) |
&& !instBuffer[numInst].SrcReg[0].RelAddr) |
inputsRead |= (1 << (srcReg0 - VP_INPUT_REG_START)); |
if (IsInputRegister(srcReg1) |
&& !instBuffer[numInst].SrcReg[1].RelAddr) |
inputsRead |= (1 << (srcReg1 - VP_INPUT_REG_START)); |
if (IsInputRegister(srcReg2) |
&& !instBuffer[numInst].SrcReg[2].RelAddr) |
inputsRead |= (1 << (srcReg2 - VP_INPUT_REG_START)); |
} |
numInst++; |
if (IsStateProgram) { |
if (progRegsWritten == 0) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glLoadProgramNV(c[#] not written)"); |
return; |
} |
} |
else { |
if (!IsPositionInvariant && !(outputsWritten & 1)) { |
/* bit 1 = HPOS register */ |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glLoadProgramNV(HPOS not written)"); |
return; |
} |
} |
program->InputsRead = inputsRead; |
program->OutputsWritten = outputsWritten; |
program->IsPositionInvariant = IsPositionInvariant; |
/* make copy of the input program string */ |
strLen = _mesa_strlen((const char *) str); |
newString = (GLubyte *) MALLOC(strLen + 1); |
if (!newString) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); |
return; |
} |
MEMCPY(newString, str, strLen); |
newString[strLen] = 0; /* terminate */ |
/* copy the compiled instructions */ |
assert(numInst <= VP_MAX_INSTRUCTIONS); |
newInst = (struct vp_instruction *) MALLOC(numInst * sizeof(struct vp_instruction)); |
if (!newInst) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); |
return; /* out of memory */ |
} |
MEMCPY(newInst, instBuffer, numInst * sizeof(struct vp_instruction)); |
/* install the program */ |
program->Target = target; |
if (program->String) { |
FREE(program->String); |
} |
program->String = newString; |
if (program->Instructions) { |
FREE(program->Instructions); |
} |
program->Instructions = newInst; |
#ifdef DEBUG_foo |
_mesa_printf("--- glLoadProgramNV result ---\n"); |
_mesa_print_program(program); |
_mesa_printf("------------------------------\n"); |
#endif |
} |
else { |
/* Error! */ |
#ifdef DEBUG |
/* print a message showing the program line containing the error */ |
ctx->VertexProgram.ErrorPos = s - str; |
{ |
const GLubyte *p = str, *line = str; |
int lineNum = 1, statementNum = 1, column = 0; |
char errorLine[1000]; |
int i; |
while (*p && p < s) { /* s is the error position */ |
if (*p == '\n') { |
line = p + 1; |
lineNum++; |
column = 0; |
} |
else if (*p == ';') { |
statementNum++; |
} |
else |
column++; |
p++; |
} |
if (p) { |
/* Copy the line with the error into errorLine so we can null- |
* terminate it. |
*/ |
for (i = 0; line[i] != '\n' && line[i]; i++) |
errorLine[i] = (char) line[i]; |
errorLine[i] = 0; |
} |
/* |
_mesa_debug("Error pos = %d (%c) col %d\n", |
ctx->VertexProgram.ErrorPos, *s, column); |
*/ |
_mesa_debug(ctx, "Vertex program error on line %2d: %s\n", lineNum, errorLine); |
_mesa_debug(ctx, " (statement %2d) near column %2d: ", statementNum, column+1); |
for (i = 0; i < column; i++) |
_mesa_debug(ctx, " "); |
_mesa_debug(ctx, "^\n"); |
} |
#endif |
_mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV"); |
} |
} |
static void |
PrintSrcReg(const struct vp_src_register *src) |
{ |
static const char comps[5] = "xyzw"; |
if (src->Negate) |
_mesa_printf("-"); |
if (src->RelAddr) { |
if (src->Register > 0) |
_mesa_printf("c[A0.x + %d]", src->Register); |
else if (src->Register < 0) |
_mesa_printf("c[A0.x - %d]", -src->Register); |
else |
_mesa_printf("c[A0.x]"); |
} |
else if (src->Register >= VP_OUTPUT_REG_START |
&& src->Register <= VP_OUTPUT_REG_END) { |
_mesa_printf("o[%s]", OutputRegisters[src->Register - VP_OUTPUT_REG_START]); |
} |
else if (src->Register >= VP_INPUT_REG_START |
&& src->Register <= VP_INPUT_REG_END) { |
_mesa_printf("v[%s]", InputRegisters[src->Register - VP_INPUT_REG_START]); |
} |
else if (src->Register >= VP_PROG_REG_START |
&& src->Register <= VP_PROG_REG_END) { |
_mesa_printf("c[%d]", src->Register - VP_PROG_REG_START); |
} |
else { |
_mesa_printf("R%d", src->Register - VP_TEMP_REG_START); |
} |
if (src->Swizzle[0] == src->Swizzle[1] && |
src->Swizzle[0] == src->Swizzle[2] && |
src->Swizzle[0] == src->Swizzle[3]) { |
_mesa_printf(".%c", comps[src->Swizzle[0]]); |
} |
else if (src->Swizzle[0] != 0 || |
src->Swizzle[1] != 1 || |
src->Swizzle[2] != 2 || |
src->Swizzle[3] != 3) { |
_mesa_printf(".%c%c%c%c", |
comps[src->Swizzle[0]], |
comps[src->Swizzle[1]], |
comps[src->Swizzle[2]], |
comps[src->Swizzle[3]]); |
} |
} |
static void |
PrintDstReg(const struct vp_dst_register *dst) |
{ |
GLint w = dst->WriteMask[0] + dst->WriteMask[1] |
+ dst->WriteMask[2] + dst->WriteMask[3]; |
if (dst->Register >= VP_OUTPUT_REG_START |
&& dst->Register <= VP_OUTPUT_REG_END) { |
_mesa_printf("o[%s]", OutputRegisters[dst->Register - VP_OUTPUT_REG_START]); |
} |
else if (dst->Register >= VP_INPUT_REG_START |
&& dst->Register <= VP_INPUT_REG_END) { |
_mesa_printf("v[%s]", InputRegisters[dst->Register - VP_INPUT_REG_START]); |
} |
else if (dst->Register >= VP_PROG_REG_START |
&& dst->Register <= VP_PROG_REG_END) { |
_mesa_printf("c[%d]", dst->Register - VP_PROG_REG_START); |
} |
else { |
_mesa_printf("R%d", dst->Register - VP_TEMP_REG_START); |
} |
if (w != 0 && w != 4) { |
_mesa_printf("."); |
if (dst->WriteMask[0]) |
_mesa_printf("x"); |
if (dst->WriteMask[1]) |
_mesa_printf("y"); |
if (dst->WriteMask[2]) |
_mesa_printf("z"); |
if (dst->WriteMask[3]) |
_mesa_printf("w"); |
} |
} |
/** |
* Print (unparse) the given vertex program. Just for debugging. |
*/ |
void |
_mesa_print_program(const struct vp_program *program) |
{ |
const struct vp_instruction *inst; |
for (inst = program->Instructions; ; inst++) { |
switch (inst->Opcode) { |
case MOV: |
case LIT: |
case RCP: |
case RSQ: |
case EXP: |
case LOG: |
case RCC: |
case ABS: |
_mesa_printf("%s ", Opcodes[(int) inst->Opcode]); |
PrintDstReg(&inst->DstReg); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[0]); |
_mesa_printf(";\n"); |
break; |
case MUL: |
case ADD: |
case DP3: |
case DP4: |
case DST: |
case MIN: |
case MAX: |
case SLT: |
case SGE: |
case DPH: |
case SUB: |
_mesa_printf("%s ", Opcodes[(int) inst->Opcode]); |
PrintDstReg(&inst->DstReg); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[0]); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[1]); |
_mesa_printf(";\n"); |
break; |
case MAD: |
_mesa_printf("MAD "); |
PrintDstReg(&inst->DstReg); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[0]); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[1]); |
_mesa_printf(", "); |
PrintSrcReg(&inst->SrcReg[2]); |
_mesa_printf(";\n"); |
break; |
case ARL: |
_mesa_printf("ARL A0.x, "); |
PrintSrcReg(&inst->SrcReg[0]); |
_mesa_printf(";\n"); |
break; |
case END: |
_mesa_printf("END\n"); |
return; |
break; |
default: |
_mesa_printf("BAD INSTRUCTION\n"); |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_eval.c |
---|
0,0 → 1,324 |
/* $Id: api_eval.c,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Keith Whitwell <keith@tungstengraphics.com> |
*/ |
#include "glheader.h" |
#include "api_eval.h" |
#include "context.h" |
#include "macros.h" |
#include "mmath.h" |
#include "math/m_eval.h" |
static void do_EvalCoord1f(GLcontext* ctx, GLfloat u) |
{ |
/** Color Index **/ |
if (ctx->Eval.Map1Index) |
{ |
GLfloat findex; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Index; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, &findex, uu, 1, map->Order); |
glIndexi( (GLint) findex ); |
} |
/** Color **/ |
if (ctx->Eval.Map1Color4) { |
GLfloat fcolor[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Color4; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, fcolor, uu, 4, map->Order); |
glColor4fv( fcolor ); |
} |
/** Normal Vector **/ |
if (ctx->Eval.Map1Normal) { |
GLfloat normal[3]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Normal; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, normal, uu, 3, map->Order); |
glNormal3fv( normal ); |
} |
/** Texture Coordinates **/ |
if (ctx->Eval.Map1TextureCoord4) { |
GLfloat texcoord[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Texture4; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, texcoord, uu, 4, map->Order); |
glTexCoord4fv( texcoord ); |
} |
else if (ctx->Eval.Map1TextureCoord3) { |
GLfloat texcoord[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Texture3; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, texcoord, uu, 3, map->Order); |
glTexCoord3fv( texcoord ); |
} |
else if (ctx->Eval.Map1TextureCoord2) { |
GLfloat texcoord[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Texture2; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, texcoord, uu, 2, map->Order); |
glTexCoord2fv( texcoord ); |
} |
else if (ctx->Eval.Map1TextureCoord1) { |
GLfloat texcoord[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Texture1; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, texcoord, uu, 1, map->Order); |
glTexCoord1fv( texcoord ); |
} |
/** Vertex **/ |
if (ctx->Eval.Map1Vertex4) |
{ |
GLfloat vertex[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex4; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, vertex, uu, 4, map->Order); |
glVertex4fv( vertex ); |
} |
else if (ctx->Eval.Map1Vertex3) |
{ |
GLfloat vertex[4]; |
struct gl_1d_map *map = &ctx->EvalMap.Map1Vertex3; |
GLfloat uu = (u - map->u1) * map->du; |
_math_horner_bezier_curve(map->Points, vertex, uu, 3, map->Order); |
glVertex3fv( vertex ); |
} |
} |
#define CROSS_PROD(n, u, v) \ |
(n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ |
(n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ |
(n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0] |
static void do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ) |
{ |
/** Color Index **/ |
if (ctx->Eval.Map2Index) { |
GLfloat findex; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Index; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, &findex, uu, vv, 1, |
map->Uorder, map->Vorder); |
glIndexi( (GLuint) (GLint) findex ); |
} |
/** Color **/ |
if (ctx->Eval.Map2Color4) { |
GLfloat fcolor[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Color4; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, fcolor, uu, vv, 4, |
map->Uorder, map->Vorder); |
glColor4fv( fcolor ); |
} |
/** Normal **/ |
if (ctx->Eval.Map2Normal && |
(!ctx->Eval.AutoNormal || (!ctx->Eval.Map2Vertex3 && |
!ctx->Eval.Map2Vertex4))) { |
GLfloat normal[3]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Normal; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, normal, uu, vv, 3, |
map->Uorder, map->Vorder); |
glNormal3fv( normal ); |
} |
/** Texture Coordinates **/ |
if (ctx->Eval.Map2TextureCoord4) { |
GLfloat texcoord[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Texture4; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, texcoord, uu, vv, 4, |
map->Uorder, map->Vorder); |
glTexCoord4fv( texcoord ); |
} |
else if (ctx->Eval.Map2TextureCoord3) { |
GLfloat texcoord[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Texture3; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, texcoord, uu, vv, 3, |
map->Uorder, map->Vorder); |
glTexCoord3fv( texcoord ); |
} |
else if (ctx->Eval.Map2TextureCoord2) { |
GLfloat texcoord[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Texture2; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, texcoord, uu, vv, 2, |
map->Uorder, map->Vorder); |
glTexCoord2fv( texcoord ); |
} |
else if (ctx->Eval.Map2TextureCoord1) { |
GLfloat texcoord[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Texture1; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
_math_horner_bezier_surf(map->Points, texcoord, uu, vv, 1, |
map->Uorder, map->Vorder); |
glTexCoord1fv( texcoord ); |
} |
/** Vertex **/ |
if(ctx->Eval.Map2Vertex4) { |
GLfloat vertex[4]; |
GLfloat normal[3]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Vertex4; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
if (ctx->Eval.AutoNormal) { |
GLfloat du[4], dv[4]; |
_math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, 4, |
map->Uorder, map->Vorder); |
CROSS_PROD(normal, du, dv); |
NORMALIZE_3FV(normal); |
} |
else { |
_math_horner_bezier_surf(map->Points, vertex, uu, vv, 4, |
map->Uorder, map->Vorder); |
} |
} |
else if (ctx->Eval.Map2Vertex3) { |
GLfloat vertex[4]; |
struct gl_2d_map *map = &ctx->EvalMap.Map2Vertex3; |
GLfloat uu = (u - map->u1) * map->du; |
GLfloat vv = (v - map->v1) * map->dv; |
if (ctx->Eval.AutoNormal) { |
GLfloat du[3], dv[3]; |
GLfloat normal[3]; |
_math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, 3, |
map->Uorder, map->Vorder); |
CROSS_PROD(normal, du, dv); |
NORMALIZE_3FV(normal); |
glNormal3fv( normal ); |
glVertex3fv( vertex ); |
} |
else { |
_math_horner_bezier_surf(map->Points, vertex, uu, vv, 3, |
map->Uorder, map->Vorder); |
glVertex3fv( vertex ); |
} |
} |
} |
void _mesa_EvalPoint1( GLint i ) |
{ |
GET_CURRENT_CONTEXT( ctx ); |
GLfloat du = ((ctx->Eval.MapGrid1u2 - ctx->Eval.MapGrid1u1) / |
(GLfloat) ctx->Eval.MapGrid1un); |
GLfloat u = i * du + ctx->Eval.MapGrid1u1; |
glEvalCoord1f( u ); |
} |
void _mesa_EvalPoint2( GLint i, GLint j ) |
{ |
GET_CURRENT_CONTEXT( ctx ); |
GLfloat du = ((ctx->Eval.MapGrid2u2 - ctx->Eval.MapGrid2u1) / |
(GLfloat) ctx->Eval.MapGrid2un); |
GLfloat dv = ((ctx->Eval.MapGrid2v2 - ctx->Eval.MapGrid2v1) / |
(GLfloat) ctx->Eval.MapGrid2vn); |
GLfloat u = i * du + ctx->Eval.MapGrid2u1; |
GLfloat v = j * dv + ctx->Eval.MapGrid2v1; |
glEvalCoord2f( u, v ); |
} |
/* Wierd thing about eval is that it doesn't affect 'current' values. |
* This technique of saving and resetting current values requires |
* that: |
* |
* 1) Current values are updated immediately in the glColor, |
* etc. functions. |
* |
* 2) Hardware color values are stored seperately from ctx->Current, |
* for example in dma buffers, or direct emit to registers. |
*/ |
void _mesa_EvalCoord1f( GLfloat u ) |
{ |
GET_CURRENT_CONTEXT( ctx ); |
GLfloat normal[3], texcoord[4], color[4]; |
GLuint index; |
COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); |
COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); |
COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
index = ctx->Current.Index; |
do_EvalCoord1f( ctx, u ); |
COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); |
ctx->Current.Index = index; |
} |
void _mesa_EvalCoord2f( GLfloat u, GLfloat v ) |
{ |
GET_CURRENT_CONTEXT( ctx ); |
GLfloat normal[3], texcoord[4], color[4]; |
GLuint index; |
COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); |
COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); |
COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
index = ctx->Current.Index; |
do_EvalCoord2f( ctx, u, v ); |
COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); |
COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); |
ctx->Current.Index = index; |
} |
void _mesa_EvalCoord1fv( const GLfloat *u ) |
{ |
glEvalCoord1f( u[0] ); |
} |
void _mesa_EvalCoord2fv( const GLfloat *u ) |
{ |
glEvalCoord2f( u[0], u[1] ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/api_arrayelt.h |
---|
0,0 → 1,38 |
/* $Id: api_arrayelt.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef API_ARRAYELT_H |
#define API_ARRAYELT_H |
#include "mtypes.h" |
extern GLboolean _ae_create_context( GLcontext *ctx ); |
extern void _ae_destroy_context( GLcontext *ctx ); |
extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ); |
extern void _ae_loopback_array_elt( GLint elt ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texcompress.h |
---|
0,0 → 1,58 |
/* $Id: texcompress.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef TEXCOMPRESS_H |
#define TEXCOMPRESS_H |
#include "mtypes.h" |
extern GLuint |
_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ); |
extern GLuint |
_mesa_compressed_texture_size( GLcontext *ctx, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format ); |
extern GLint |
_mesa_compressed_row_stride(GLenum format, GLsizei width); |
extern GLubyte * |
_mesa_compressed_image_address(GLint col, GLint row, GLint img, |
GLenum format, |
GLsizei width, const GLubyte *image); |
extern void |
_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height, |
GLenum srcFormat, const GLchan *source, |
GLint srcRowStride, |
const struct gl_texture_format *dstFormat, |
GLubyte *dest, GLint dstRowStride ); |
#endif /* TEXCOMPRESS_H */ |
/shark/tags/rel_0_4/ports/mesa/src/api_eval.h |
---|
0,0 → 1,43 |
/* $Id: api_eval.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef API_EVAL_H |
#define API_EVAL_H |
#include "mtypes.h" |
extern void _mesa_EvalPoint1( GLint i ); |
extern void _mesa_EvalPoint2( GLint i, GLint j ); |
extern void _mesa_EvalCoord1f( GLfloat u ); |
extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v ); |
extern void _mesa_EvalCoord1fv( const GLfloat *u ); |
extern void _mesa_EvalCoord2fv( const GLfloat *u ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/vpparse.h |
---|
0,0 → 1,44 |
/* $Id: vpparse.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Brian Paul |
*/ |
#ifndef VPPARSE_H |
#define VPPARSE_H |
extern void |
_mesa_parse_program(GLcontext *ctx, GLenum target, |
const GLubyte *str, struct vp_program *program); |
extern void |
_mesa_print_program(const struct vp_program *program); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/vpstate.c |
---|
0,0 → 1,950 |
/* $Id: vpstate.c,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* -------- Regarding NV_vertex_program -------- |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are met: |
* |
* o Redistribution of the source code must contain a copyright notice |
* and this list of conditions; |
* |
* o Redistribution in binary and source code form must contain the |
* following Notice in the software and any documentation and/or other |
* materials provided with the distribution; and |
* |
* o The name of Nvidia may not be used to promote or endorse software |
* derived from the software. |
* |
* NOTICE: Nvidia hereby grants to each recipient a non-exclusive worldwide |
* royalty free patent license under patent claims that are licensable by |
* Nvidia and which are necessarily required and for which no commercially |
* viable non infringing alternative exists to make, use, sell, offer to sell, |
* import and otherwise transfer the vertex extension for the Mesa 3D Graphics |
* Library as distributed in source code and object code form. No hardware or |
* hardware implementation (including a semiconductor implementation and chips) |
* are licensed hereunder. If a recipient makes a patent claim or institutes |
* patent litigation against Nvidia or Nvidia's customers for use or sale of |
* Nvidia products, then this license grant as to such recipient shall |
* immediately terminate and recipient immediately agrees to cease use and |
* distribution of the Mesa Program and derivatives thereof. |
* |
* THE MESA 3D GRAPHICS LIBRARY IS PROVIDED ON AN "AS IS BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, |
* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-NFRINGEMENT |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
* |
* NVIDIA SHALL NOT HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION |
* LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE MESA 3D GRAPHICS |
* LIBRARY OR EVIDENCE OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDR, EVEN |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* If you do not comply with this agreement, then Nvidia may cancel the license |
* and rights granted herein. |
* --------------------------------------------- |
*/ |
/** |
* \file vpstate.c |
* \brief Vertex program state management functions (most map to API functions) |
* \author Brian Paul |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "hash.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "vpexec.h" |
#include "vpparse.h" |
#include "vpstate.h" |
/** |
* Delete a program and remove it from the hash table, ignoring the |
* reference count. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_delete_program(GLcontext *ctx, GLuint id) |
{ |
struct vp_program *vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (vprog) { |
if (vprog->String) |
FREE(vprog->String); |
if (vprog->Instructions) |
FREE(vprog->Instructions); |
_mesa_HashRemove(ctx->Shared->VertexPrograms, id); |
FREE(vprog); |
} |
} |
/** |
* Bind a program (make it current) |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_BindProgramNV(GLenum target, GLuint id) |
{ |
struct vp_program *vprog; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV"); |
return; |
} |
if (id == ctx->VertexProgram.CurrentID) |
return; |
/* decrement refcount on previously bound vertex program */ |
if (ctx->VertexProgram.Current) { |
ctx->VertexProgram.Current->RefCount--; |
/* and delete if refcount goes below one */ |
if (ctx->VertexProgram.Current->RefCount <= 0) |
_mesa_delete_program(ctx, ctx->VertexProgram.CurrentID); |
} |
/* NOTE: binding to a non-existant program is not an error. |
* That's supposed to be caught in glBegin. |
*/ |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (!vprog && id > 0){ |
/* new program ID */ |
vprog = CALLOC_STRUCT(vp_program); |
if (!vprog) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV"); |
return; |
} |
vprog->Target = target; |
vprog->Resident = GL_TRUE; |
vprog->RefCount = 1; |
_mesa_HashInsert(ctx->Shared->VertexPrograms, id, vprog); |
} |
ctx->VertexProgram.CurrentID = id; |
ctx->VertexProgram.Current = vprog; |
if (vprog) |
vprog->RefCount++; |
} |
/** |
* Delete a list of programs. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_DeleteProgramsNV(GLsizei n, const GLuint *ids) |
{ |
GLint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (n < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" ); |
return; |
} |
for (i = 0; i < n; i++) { |
if (ids[i] != 0) { |
struct vp_program *vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, ids[i]); |
if (ctx->VertexProgram.CurrentID == ids[i]) { |
/* unbind this currently bound program */ |
_mesa_BindProgramNV(vprog->Target, 0); |
} |
if (vprog) { |
vprog->RefCount--; |
if (vprog->RefCount <= 0) { |
_mesa_delete_program(ctx, ids[i]); |
} |
} |
} |
} |
} |
/** |
* Execute a vertex state program. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) |
{ |
struct vp_program *vprog; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_STATE_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glExecuteProgramNV"); |
return; |
} |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (!vprog || vprog->Target != GL_VERTEX_STATE_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV"); |
return; |
} |
_mesa_init_vp_registers(ctx); |
_mesa_init_tracked_matrices(ctx); |
COPY_4V(ctx->VertexProgram.Machine.Registers[VP_INPUT_REG_START], params); |
_mesa_exec_program(ctx, vprog); |
} |
/** |
* Generate a list of new program identifiers. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GenProgramsNV(GLsizei n, GLuint *ids) |
{ |
GLuint first; |
GLuint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (n < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGenProgramsNV"); |
return; |
} |
if (!ids) |
return; |
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->VertexPrograms, n); |
for (i = 0; i < (GLuint) n; i++) { |
struct vp_program *vprog = CALLOC_STRUCT(vp_program); |
if (!vprog) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenProgramsNV"); |
return; |
} |
vprog->RefCount = 1; |
_mesa_HashInsert(ctx->Shared->VertexPrograms, first + i, vprog); |
} |
/* Return the program names */ |
for (i = 0; i < (GLuint) n; i++) { |
ids[i] = first + i; |
} |
} |
/** |
* Determine if a set of programs is resident in hardware. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, |
GLboolean *residences) |
{ |
GLint i; |
GLboolean retVal; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (n < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(n)"); |
return GL_FALSE; |
} |
retVal = GL_TRUE; |
for (i = 0; i < n; i++) { |
struct vp_program *vprog; |
if (ids[i] == 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(id)"); |
return GL_FALSE; |
} |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, ids[i]); |
if (!vprog) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(id)"); |
return GL_FALSE; |
} |
*residences = vprog->Resident; |
if (!vprog->Resident) |
retVal = GL_FALSE; |
} |
return retVal; |
} |
/** |
* Request that a set of programs be resident in hardware. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids) |
{ |
GLint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (n < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(n)"); |
return; |
} |
/* just error checking for now */ |
for (i = 0; i < n; i++) { |
struct vp_program *vprog; |
if (ids[i] == 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); |
return; |
} |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, ids[i]); |
if (!vprog) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); |
return; |
} |
vprog->Resident = GL_TRUE; |
} |
} |
/** |
* Get a program parameter register. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, |
GLenum pname, GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramParameterfvNV"); |
return; |
} |
if (pname != GL_PROGRAM_PARAMETER_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV"); |
return; |
} |
index += VP_PROG_REG_START; |
COPY_4V(params, ctx->VertexProgram.Machine.Registers[index]); |
} |
/** |
* Get a program parameter register. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, |
GLenum pname, GLdouble *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramParameterfvNV"); |
return; |
} |
if (pname != GL_PROGRAM_PARAMETER_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV"); |
return; |
} |
index += VP_PROG_REG_START; |
COPY_4V(params, ctx->VertexProgram.Machine.Registers[index]); |
} |
/** |
* Get a program attribute. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) |
{ |
struct vp_program *vprog; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (!vprog) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV"); |
return; |
} |
switch (pname) { |
case GL_PROGRAM_TARGET_NV: |
*params = vprog->Target; |
return; |
case GL_PROGRAM_LENGTH_NV: |
*params = vprog->String ? _mesa_strlen((char *) vprog->String) : 0; |
return; |
case GL_PROGRAM_RESIDENT_NV: |
*params = vprog->Resident; |
return; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivNV(pname)"); |
return; |
} |
} |
/** |
* Get the program source code. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) |
{ |
struct vp_program *vprog; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (pname != GL_PROGRAM_STRING_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivNV(pname)"); |
return; |
} |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (!vprog) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV"); |
return; |
} |
if (vprog->String) { |
MEMCPY(program, vprog->String, _mesa_strlen((char *) vprog->String)); |
} |
else { |
program[0] = 0; |
} |
} |
/** |
* Get matrix tracking information. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, |
GLenum pname, GLint *params) |
{ |
GLuint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV"); |
return; |
} |
if ((address & 0x3) || address > VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetTrackMatrixivNV(address)"); |
return; |
} |
i = address / 4; |
switch (pname) { |
case GL_TRACK_MATRIX_NV: |
params[0] = (GLint) ctx->VertexProgram.TrackMatrix[i]; |
return; |
case GL_TRACK_MATRIX_TRANSFORM_NV: |
params[0] = (GLint) ctx->VertexProgram.TrackMatrixTransform[i]; |
return; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV"); |
return; |
} |
} |
/** |
* Get a vertex (or vertex array) attribute. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (index == 0 || index >= VP_NUM_INPUT_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); |
return; |
} |
switch (pname) { |
case GL_ATTRIB_ARRAY_SIZE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Size; |
break; |
case GL_ATTRIB_ARRAY_STRIDE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Stride; |
break; |
case GL_ATTRIB_ARRAY_TYPE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Type; |
break; |
case GL_CURRENT_ATTRIB_NV: |
COPY_4V(params, ctx->Current.Attrib[index]); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); |
return; |
} |
} |
/** |
* Get a vertex (or vertex array) attribute. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (index == 0 || index >= VP_NUM_INPUT_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); |
return; |
} |
switch (pname) { |
case GL_ATTRIB_ARRAY_SIZE_NV: |
params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; |
break; |
case GL_ATTRIB_ARRAY_STRIDE_NV: |
params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; |
break; |
case GL_ATTRIB_ARRAY_TYPE_NV: |
params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; |
break; |
case GL_CURRENT_ATTRIB_NV: |
COPY_4V(params, ctx->Current.Attrib[index]); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); |
return; |
} |
} |
/** |
* Get a vertex (or vertex array) attribute. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (index == 0 || index >= VP_NUM_INPUT_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); |
return; |
} |
switch (pname) { |
case GL_ATTRIB_ARRAY_SIZE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Size; |
break; |
case GL_ATTRIB_ARRAY_STRIDE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Stride; |
break; |
case GL_ATTRIB_ARRAY_TYPE_NV: |
params[0] = ctx->Array.VertexAttrib[index].Type; |
break; |
case GL_CURRENT_ATTRIB_NV: |
COPY_4V_CAST(params, ctx->Current.Attrib[index], GLint); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); |
return; |
} |
} |
/** |
* Get a vertex array attribute pointer. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerNV(index)"); |
return; |
} |
if (pname != GL_ATTRIB_ARRAY_POINTER_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerNV(pname)"); |
return; |
} |
*pointer = ctx->Array.VertexAttrib[index].Ptr;; |
} |
/** |
* Determine if id names a program. |
* \note Not compiled into display lists. |
* \note Called from the GL API dispatcher. |
* \param id is the program identifier |
* \return GL_TRUE if id is a program, else GL_FALSE. |
*/ |
GLboolean _mesa_IsProgramNV(GLuint id) |
{ |
struct vp_program *vprog; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (id == 0) |
return GL_FALSE; |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (vprog && vprog->Target) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
/** |
* Load a vertex program. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, |
const GLubyte *program) |
{ |
struct vp_program *vprog; |
GLboolean newProgram = GL_FALSE; |
GLubyte *programCopy; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (id == 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)"); |
return; |
} |
vprog = (struct vp_program *) |
_mesa_HashLookup(ctx->Shared->VertexPrograms, id); |
if (vprog && vprog->Target != 0 && vprog->Target != target) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)"); |
return; |
} |
/* make a copy of the program string so that we can null-terminate it */ |
/* if we change the parser to stop after <len> characters, instead of */ |
/* looking for '\0' we can eliminate this. */ |
programCopy = (GLubyte *) MALLOC(len + 1); |
if (!programCopy) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); |
return; |
} |
MEMCPY(programCopy, program, len); |
programCopy[len] = 0; |
if (!vprog) { |
newProgram = GL_TRUE; |
vprog = CALLOC_STRUCT(vp_program); |
if (!vprog) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); |
return; |
} |
} |
_mesa_parse_program(ctx, target, programCopy, vprog); |
if (ctx->VertexProgram.ErrorPos == -1) { |
/* loaded and parsed w/out errors */ |
if (newProgram) { |
_mesa_HashInsert(ctx->Shared->VertexPrograms, id, vprog); |
} |
vprog->RefCount = 1; |
vprog->Resident = GL_TRUE; |
} |
FREE(programCopy); |
} |
/** |
* Set a program parameter register. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameter4dNV(GLenum target, GLuint index, |
GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4dNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4dNV"); |
return; |
} |
index += VP_PROG_REG_START; |
ASSIGN_4V(ctx->VertexProgram.Machine.Registers[index], |
(GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); |
} |
/** |
* Set a program parameter register. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, |
const GLdouble *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4dvNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4dvNV"); |
return; |
} |
index += VP_PROG_REG_START; |
COPY_4V_CAST(ctx->VertexProgram.Machine.Registers[index], params, GLfloat); |
} |
/** |
* Set a program parameter register. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameter4fNV(GLenum target, GLuint index, |
GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4fNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4fNV"); |
return; |
} |
index += VP_PROG_REG_START; |
ASSIGN_4V(ctx->VertexProgram.Machine.Registers[index], x, y, z, w); |
} |
/** |
* Set a program parameter register. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, |
const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4fNV"); |
return; |
} |
if (index >= VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4fNV"); |
return; |
} |
index += VP_PROG_REG_START; |
COPY_4V(ctx->VertexProgram.Machine.Registers[index], params); |
} |
/** |
* Set a sequence of program parameter registers. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, |
GLuint num, const GLdouble *params) |
{ |
GLuint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4dvNV"); |
return; |
} |
if (index + num > VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4dvNV"); |
return; |
} |
index += VP_PROG_REG_START; |
for (i = 0; i < num; i++) { |
COPY_4V_CAST(ctx->VertexProgram.Machine.Registers[index + i], |
params, GLfloat); |
params += 4; |
}; |
} |
/** |
* Set a sequence of program parameter registers. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, |
GLuint num, const GLfloat *params) |
{ |
GLuint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4fvNV"); |
return; |
} |
if (index + num > VP_NUM_PROG_REGS) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4fvNV"); |
return; |
} |
index += VP_PROG_REG_START; |
for (i = 0; i < num; i++) { |
COPY_4V(ctx->VertexProgram.Machine.Registers[index + i], params); |
params += 4; |
}; |
} |
/** |
* Setup tracking of matrices into program parameter registers. |
* \note Called from the GL API dispatcher. |
*/ |
void _mesa_TrackMatrixNV(GLenum target, GLuint address, |
GLenum matrix, GLenum transform) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (target != GL_VERTEX_PROGRAM_NV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(target)"); |
return; |
} |
if (address & 0x3) { |
/* addr must be multiple of four */ |
_mesa_error(ctx, GL_INVALID_VALUE, "glTrackMatrixNV(address)"); |
return; |
} |
switch (matrix) { |
case GL_NONE: |
case GL_MODELVIEW: |
case GL_PROJECTION: |
case GL_TEXTURE: |
case GL_COLOR: |
case GL_MODELVIEW_PROJECTION_NV: |
case GL_MATRIX0_NV: |
case GL_MATRIX1_NV: |
case GL_MATRIX2_NV: |
case GL_MATRIX3_NV: |
case GL_MATRIX4_NV: |
case GL_MATRIX5_NV: |
case GL_MATRIX6_NV: |
case GL_MATRIX7_NV: |
/* OK, fallthrough */ |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(matrix)"); |
return; |
} |
switch (transform) { |
case GL_IDENTITY_NV: |
case GL_INVERSE_NV: |
case GL_TRANSPOSE_NV: |
case GL_INVERSE_TRANSPOSE_NV: |
/* OK, fallthrough */ |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(transform)"); |
return; |
} |
ctx->VertexProgram.TrackMatrix[address / 4] = matrix; |
ctx->VertexProgram.TrackMatrixTransform[address / 4] = transform; |
} |
/shark/tags/rel_0_4/ports/mesa/src/simple_list.h |
---|
0,0 → 1,98 |
/* $Id: simple_list.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* Simple macros for typesafe, intrusive lists. |
* (C) 1997, Keith Whitwell |
* |
* Intended to work with a list sentinal which is created as an empty |
* list. Insert & delete are O(1). |
*/ |
#ifndef _SIMPLE_LIST_H |
#define _SIMPLE_LIST_H |
#define remove_from_list(elem) \ |
do { \ |
(elem)->next->prev = (elem)->prev; \ |
(elem)->prev->next = (elem)->next; \ |
} while (0) |
#define insert_at_head(list, elem) \ |
do { \ |
(elem)->prev = list; \ |
(elem)->next = (list)->next; \ |
(list)->next->prev = elem; \ |
(list)->next = elem; \ |
} while(0) |
#define insert_at_tail(list, elem) \ |
do { \ |
(elem)->next = list; \ |
(elem)->prev = (list)->prev; \ |
(list)->prev->next = elem; \ |
(list)->prev = elem; \ |
} while(0) |
#define move_to_head(list, elem) \ |
do { \ |
remove_from_list(elem); \ |
insert_at_head(list, elem); \ |
} while (0) |
#define move_to_tail(list, elem) \ |
do { \ |
remove_from_list(elem); \ |
insert_at_tail(list, elem); \ |
} while (0) |
#define make_empty_list(sentinal) \ |
do { \ |
(sentinal)->next = sentinal; \ |
(sentinal)->prev = sentinal; \ |
} while (0) |
#define first_elem(list) ((list)->next) |
#define last_elem(list) ((list)->prev) |
#define next_elem(elem) ((elem)->next) |
#define prev_elem(elem) ((elem)->prev) |
#define at_end(list, elem) ((elem) == (list)) |
#define is_empty_list(list) ((list)->next == (list)) |
#define foreach(ptr, list) \ |
for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) |
/* Kludgey - Lets you unlink the current value during a list |
* traversal. Useful for free()-ing a list, element |
* by element. |
*/ |
#define foreach_s(ptr, t, list) \ |
for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/vpexec.c |
---|
0,0 → 1,744 |
/* $Id: vpexec.c,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* -------- Regarding NV_vertex_program -------- |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are met: |
* |
* o Redistribution of the source code must contain a copyright notice |
* and this list of conditions; |
* |
* o Redistribution in binary and source code form must contain the |
* following Notice in the software and any documentation and/or other |
* materials provided with the distribution; and |
* |
* o The name of Nvidia may not be used to promote or endorse software |
* derived from the software. |
* |
* NOTICE: Nvidia hereby grants to each recipient a non-exclusive worldwide |
* royalty free patent license under patent claims that are licensable by |
* Nvidia and which are necessarily required and for which no commercially |
* viable non infringing alternative exists to make, use, sell, offer to sell, |
* import and otherwise transfer the vertex extension for the Mesa 3D Graphics |
* Library as distributed in source code and object code form. No hardware or |
* hardware implementation (including a semiconductor implementation and chips) |
* are licensed hereunder. If a recipient makes a patent claim or institutes |
* patent litigation against Nvidia or Nvidia's customers for use or sale of |
* Nvidia products, then this license grant as to such recipient shall |
* immediately terminate and recipient immediately agrees to cease use and |
* distribution of the Mesa Program and derivatives thereof. |
* |
* THE MESA 3D GRAPHICS LIBRARY IS PROVIDED ON AN "AS IS BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, |
* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-NFRINGEMENT |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
* |
* NVIDIA SHALL NOT HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION |
* LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE MESA 3D GRAPHICS |
* LIBRARY OR EVIDENCE OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDR, EVEN |
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* |
* If you do not comply with this agreement, then Nvidia may cancel the license |
* and rights granted herein. |
* --------------------------------------------- |
*/ |
/** |
* \file vpexec.c |
* \brief Code to execute vertex programs. |
* \author Brian Paul |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "imports.h" |
#include "macros.h" |
#include "mtypes.h" |
#include "vpexec.h" |
#include "mmath.h" |
#include "math/m_matrix.h" |
/** |
* Load/initialize the vertex program registers. |
* This needs to be done per vertex. |
*/ |
void |
_mesa_init_vp_registers(GLcontext *ctx) |
{ |
struct vp_machine *machine = &(ctx->VertexProgram.Machine); |
GLuint i; |
/* Input registers get initialized from the current vertex attribs */ |
MEMCPY(machine->Registers[VP_INPUT_REG_START], |
ctx->Current.Attrib, |
16 * 4 * sizeof(GLfloat)); |
/* Output and temp regs are initialized to [0,0,0,1] */ |
for (i = VP_OUTPUT_REG_START; i <= VP_OUTPUT_REG_END; i++) { |
machine->Registers[i][0] = 0.0F; |
machine->Registers[i][1] = 0.0F; |
machine->Registers[i][2] = 0.0F; |
machine->Registers[i][3] = 1.0F; |
} |
for (i = VP_TEMP_REG_START; i <= VP_TEMP_REG_END; i++) { |
machine->Registers[i][0] = 0.0F; |
machine->Registers[i][1] = 0.0F; |
machine->Registers[i][2] = 0.0F; |
machine->Registers[i][3] = 1.0F; |
} |
/* The program regs aren't touched */ |
} |
/** |
* Copy the 16 elements of a matrix into four consecutive program |
* registers starting at 'pos'. |
*/ |
static void |
load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16]) |
{ |
GLuint i; |
pos += VP_PROG_REG_START; |
for (i = 0; i < 4; i++) { |
registers[pos + i][0] = mat[0 + i]; |
registers[pos + i][1] = mat[4 + i]; |
registers[pos + i][2] = mat[8 + i]; |
registers[pos + i][3] = mat[12 + i]; |
} |
} |
/** |
* As above, but transpose the matrix. |
*/ |
static void |
load_transpose_matrix(GLfloat registers[][4], GLuint pos, |
const GLfloat mat[16]) |
{ |
pos += VP_PROG_REG_START; |
MEMCPY(registers[pos], mat, 16 * sizeof(GLfloat)); |
} |
/** |
* Load all currently tracked matrices into the program registers. |
* This needs to be done per glBegin/glEnd. |
*/ |
void |
_mesa_init_tracked_matrices(GLcontext *ctx) |
{ |
GLuint i; |
for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) { |
/* point 'mat' at source matrix */ |
GLmatrix *mat; |
if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) { |
mat = ctx->ModelviewMatrixStack.Top; |
} |
else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) { |
mat = ctx->ProjectionMatrixStack.Top; |
} |
else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) { |
mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top; |
} |
else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) { |
mat = ctx->ColorMatrixStack.Top; |
} |
else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) { |
/* XXX verify the combined matrix is up to date */ |
mat = &ctx->_ModelProjectMatrix; |
} |
else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV && |
ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) { |
GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV; |
ASSERT(n < MAX_PROGRAM_MATRICES); |
mat = ctx->ProgramMatrixStack[n].Top; |
} |
else { |
/* no matrix is tracked, but we leave the register values as-is */ |
assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE); |
continue; |
} |
/* load the matrix */ |
if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) { |
load_matrix(ctx->VertexProgram.Machine.Registers, i*4, mat->m); |
} |
else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) { |
_math_matrix_analyse(mat); /* update the inverse */ |
assert((mat->flags & MAT_DIRTY_INVERSE) == 0); |
load_matrix(ctx->VertexProgram.Machine.Registers, i*4, mat->inv); |
} |
else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) { |
load_transpose_matrix(ctx->VertexProgram.Machine.Registers, i*4, mat->m); |
} |
else { |
assert(ctx->VertexProgram.TrackMatrixTransform[i] |
== GL_INVERSE_TRANSPOSE_NV); |
_math_matrix_analyse(mat); /* update the inverse */ |
assert((mat->flags & MAT_DIRTY_INVERSE) == 0); |
load_transpose_matrix(ctx->VertexProgram.Machine.Registers, |
i*4, mat->inv); |
} |
} |
} |
/** |
* For debugging. Dump the current vertex program machine registers. |
*/ |
void |
_mesa_dump_vp_machine( const struct vp_machine *machine ) |
{ |
int i; |
_mesa_printf("VertexIn:\n"); |
for (i = 0; i < VP_NUM_INPUT_REGS; i++) { |
_mesa_printf("%d: %f %f %f %f ", i, |
machine->Registers[i + VP_INPUT_REG_START][0], |
machine->Registers[i + VP_INPUT_REG_START][1], |
machine->Registers[i + VP_INPUT_REG_START][2], |
machine->Registers[i + VP_INPUT_REG_START][3]); |
} |
_mesa_printf("\n"); |
_mesa_printf("VertexOut:\n"); |
for (i = 0; i < VP_NUM_OUTPUT_REGS; i++) { |
_mesa_printf("%d: %f %f %f %f ", i, |
machine->Registers[i + VP_OUTPUT_REG_START][0], |
machine->Registers[i + VP_OUTPUT_REG_START][1], |
machine->Registers[i + VP_OUTPUT_REG_START][2], |
machine->Registers[i + VP_OUTPUT_REG_START][3]); |
} |
_mesa_printf("\n"); |
_mesa_printf("Registers:\n"); |
for (i = 0; i < VP_NUM_TEMP_REGS; i++) { |
_mesa_printf("%d: %f %f %f %f ", i, |
machine->Registers[i + VP_TEMP_REG_START][0], |
machine->Registers[i + VP_TEMP_REG_START][1], |
machine->Registers[i + VP_TEMP_REG_START][2], |
machine->Registers[i + VP_TEMP_REG_START][3]); |
} |
_mesa_printf("\n"); |
_mesa_printf("Parameters:\n"); |
for (i = 0; i < VP_NUM_PROG_REGS; i++) { |
_mesa_printf("%d: %f %f %f %f ", i, |
machine->Registers[i + VP_PROG_REG_START][0], |
machine->Registers[i + VP_PROG_REG_START][1], |
machine->Registers[i + VP_PROG_REG_START][2], |
machine->Registers[i + VP_PROG_REG_START][3]); |
} |
_mesa_printf("\n"); |
} |
/** |
* Fetch a 4-element float vector from the given source register. |
* Apply swizzling and negating as needed. |
*/ |
static void |
fetch_vector4( const struct vp_src_register *source, |
const struct vp_machine *machine, |
GLfloat result[4] ) |
{ |
static const GLfloat zero[4] = { 0, 0, 0, 0 }; |
const GLfloat *src; |
if (source->RelAddr) { |
GLint reg = source->Register + machine->AddressReg; |
if (reg < VP_PROG_REG_START || reg > VP_PROG_REG_END) |
src = zero; |
else |
src = machine->Registers[reg]; |
} |
else { |
src = machine->Registers[source->Register]; |
} |
if (source->Negate) { |
result[0] = -src[source->Swizzle[0]]; |
result[1] = -src[source->Swizzle[1]]; |
result[2] = -src[source->Swizzle[2]]; |
result[3] = -src[source->Swizzle[3]]; |
} |
else { |
result[0] = src[source->Swizzle[0]]; |
result[1] = src[source->Swizzle[1]]; |
result[2] = src[source->Swizzle[2]]; |
result[3] = src[source->Swizzle[3]]; |
} |
} |
/** |
* As above, but only return result[0] element. |
*/ |
static void |
fetch_vector1( const struct vp_src_register *source, |
const struct vp_machine *machine, |
GLfloat result[4] ) |
{ |
static const GLfloat zero[4] = { 0, 0, 0, 0 }; |
const GLfloat *src; |
if (source->RelAddr) { |
GLint reg = source->Register + machine->AddressReg; |
if (reg < VP_PROG_REG_START || reg > VP_PROG_REG_END) |
src = zero; |
else |
src = machine->Registers[reg]; |
} |
else { |
src = machine->Registers[source->Register]; |
} |
if (source->Negate) { |
result[0] = -src[source->Swizzle[0]]; |
} |
else { |
result[0] = src[source->Swizzle[0]]; |
} |
} |
/** |
* Store 4 floats into a register. |
*/ |
static void |
store_vector4( const struct vp_dst_register *dest, struct vp_machine *machine, |
const GLfloat value[4] ) |
{ |
GLfloat *dst = machine->Registers[dest->Register]; |
if (dest->WriteMask[0]) |
dst[0] = value[0]; |
if (dest->WriteMask[1]) |
dst[1] = value[1]; |
if (dest->WriteMask[2]) |
dst[2] = value[2]; |
if (dest->WriteMask[3]) |
dst[3] = value[3]; |
} |
/** |
* Set x to positive or negative infinity. |
*/ |
#ifdef USE_IEEE |
#define SET_POS_INFINITY(x) ( *((GLuint *) &x) = 0x7F800000 ) |
#define SET_NEG_INFINITY(x) ( *((GLuint *) &x) = 0xFF800000 ) |
#elif defined(VMS) |
#define SET_POS_INFINITY(x) x = __MAXFLOAT |
#define SET_NEG_INFINITY(x) x = -__MAXFLOAT |
#else |
#define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL |
#define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL |
#endif |
#define SET_FLOAT_BITS(x, bits) ((fi_type *) &(x))->i = bits |
/** |
* Execute the given vertex program |
*/ |
void |
_mesa_exec_program(GLcontext *ctx, const struct vp_program *program) |
{ |
struct vp_machine *machine = &ctx->VertexProgram.Machine; |
const struct vp_instruction *inst; |
/* XXX load vertex fields into input registers */ |
/* and do other initialization */ |
for (inst = program->Instructions; inst->Opcode !=END; inst++) { |
switch (inst->Opcode) { |
case MOV: |
{ |
GLfloat t[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case LIT: |
{ |
const GLfloat epsilon = 1.0e-5F; /* XXX fix? */ |
GLfloat t[4], lit[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
if (t[3] < -(128.0F - epsilon)) |
t[3] = - (128.0F - epsilon); |
else if (t[3] > 128.0F - epsilon) |
t[3] = 128.0F - epsilon; |
if (t[0] < 0.0) |
t[0] = 0.0; |
if (t[1] < 0.0) |
t[1] = 0.0; |
lit[0] = 1.0; |
lit[1] = t[0]; |
lit[2] = (t[0] > 0.0) ? (GLfloat) exp(t[3] * log(t[1])) : 0.0F; |
lit[3] = 1.0; |
store_vector4( &inst->DstReg, machine, lit ); |
} |
break; |
case RCP: |
{ |
GLfloat t[4]; |
fetch_vector1( &inst->SrcReg[0], machine, t ); |
if (t[0] != 1.0F) |
t[0] = 1.0F / t[0]; /* div by zero is infinity! */ |
t[1] = t[2] = t[3] = t[0]; |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case RSQ: |
{ |
GLfloat t[4]; |
fetch_vector1( &inst->SrcReg[0], machine, t ); |
t[0] = (float) (1.0 / sqrt(fabs(t[0]))); |
t[1] = t[2] = t[3] = t[0]; |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case EXP: |
{ |
GLfloat t[4], q[4], floor_t0; |
fetch_vector1( &inst->SrcReg[0], machine, t ); |
floor_t0 = (float) floor(t[0]); |
if (floor_t0 > FLT_MAX_EXP) { |
SET_POS_INFINITY(q[0]); |
q[1] = 0.0F; |
SET_POS_INFINITY(q[2]); |
q[3] = 1.0F; |
} |
else if (floor_t0 < FLT_MIN_EXP) { |
q[0] = 0.0F; |
q[1] = 0.0F; |
q[2] = 0.0F; |
q[3] = 0.0F; |
} |
else { |
#ifdef USE_IEEE |
GLint ii = (GLint) floor_t0; |
ii = (ii < 23) + 0x3f800000; |
SET_FLOAT_BITS(q[0], ii); |
q[0] = *((GLfloat *) &ii); |
#else |
q[0] = (GLfloat) pow(2.0, floor_t0); |
#endif |
q[1] = t[0] - floor_t0; |
q[2] = (GLfloat) (q[0] * LOG2(q[1])); |
q[3] = 1.0F; |
} |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case LOG: |
{ |
GLfloat t[4], q[4], abs_t0; |
fetch_vector1( &inst->SrcReg[0], machine, t ); |
abs_t0 = (GLfloat) fabs(t[0]); |
if (abs_t0 != 0.0F) { |
/* Since we really can't handle infinite values on VMS |
* like other OSes we'll use __MAXFLOAT to represent |
* infinity. This may need some tweaking. |
*/ |
#ifdef VMS |
if (abs_t0 == __MAXFLOAT) { |
#else |
if (IS_INF_OR_NAN(abs_t0)) { |
#endif |
SET_POS_INFINITY(q[0]); |
q[1] = 1.0F; |
SET_POS_INFINITY(q[2]); |
} |
else { |
int exponent; |
double mantissa = frexp(t[0], &exponent); |
q[0] = (GLfloat) (exponent - 1); |
q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */ |
q[2] = (GLfloat) (q[0] + LOG2(q[1])); |
} |
} |
else { |
SET_NEG_INFINITY(q[0]); |
q[1] = 1.0F; |
SET_NEG_INFINITY(q[2]); |
} |
q[3] = 1.0; |
store_vector4( &inst->DstReg, machine, q ); |
} |
break; |
case MUL: |
{ |
GLfloat t[4], u[4], prod[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
prod[0] = t[0] * u[0]; |
prod[1] = t[1] * u[1]; |
prod[2] = t[2] * u[2]; |
prod[3] = t[3] * u[3]; |
store_vector4( &inst->DstReg, machine, prod ); |
} |
break; |
case ADD: |
{ |
GLfloat t[4], u[4], sum[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
sum[0] = t[0] + u[0]; |
sum[1] = t[1] + u[1]; |
sum[2] = t[2] + u[2]; |
sum[3] = t[3] + u[3]; |
store_vector4( &inst->DstReg, machine, sum ); |
} |
break; |
case DP3: |
{ |
GLfloat t[4], u[4], dot[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2]; |
dot[1] = dot[2] = dot[3] = dot[0]; |
store_vector4( &inst->DstReg, machine, dot ); |
} |
break; |
case DP4: |
{ |
GLfloat t[4], u[4], dot[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + t[3] * u[3]; |
dot[1] = dot[2] = dot[3] = dot[0]; |
store_vector4( &inst->DstReg, machine, dot ); |
} |
break; |
case DST: |
{ |
GLfloat t[4], u[4], dst[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
dst[0] = 1.0F; |
dst[1] = t[1] * u[1]; |
dst[2] = t[2]; |
dst[3] = u[3]; |
store_vector4( &inst->DstReg, machine, dst ); |
} |
break; |
case MIN: |
{ |
GLfloat t[4], u[4], min[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
min[0] = (t[0] < u[0]) ? t[0] : u[0]; |
min[1] = (t[1] < u[1]) ? t[1] : u[1]; |
min[2] = (t[2] < u[2]) ? t[2] : u[2]; |
min[3] = (t[3] < u[3]) ? t[3] : u[3]; |
store_vector4( &inst->DstReg, machine, min ); |
} |
break; |
case MAX: |
{ |
GLfloat t[4], u[4], max[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
max[0] = (t[0] > u[0]) ? t[0] : u[0]; |
max[1] = (t[1] > u[1]) ? t[1] : u[1]; |
max[2] = (t[2] > u[2]) ? t[2] : u[2]; |
max[3] = (t[3] > u[3]) ? t[3] : u[3]; |
store_vector4( &inst->DstReg, machine, max ); |
} |
break; |
case SLT: |
{ |
GLfloat t[4], u[4], slt[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
slt[0] = (t[0] < u[0]) ? 1.0F : 0.0F; |
slt[1] = (t[1] < u[1]) ? 1.0F : 0.0F; |
slt[2] = (t[2] < u[2]) ? 1.0F : 0.0F; |
slt[3] = (t[3] < u[3]) ? 1.0F : 0.0F; |
store_vector4( &inst->DstReg, machine, slt ); |
} |
break; |
case SGE: |
{ |
GLfloat t[4], u[4], sge[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
sge[0] = (t[0] >= u[0]) ? 1.0F : 0.0F; |
sge[1] = (t[1] >= u[1]) ? 1.0F : 0.0F; |
sge[2] = (t[2] >= u[2]) ? 1.0F : 0.0F; |
sge[3] = (t[3] >= u[3]) ? 1.0F : 0.0F; |
store_vector4( &inst->DstReg, machine, sge ); |
} |
break; |
case MAD: |
{ |
GLfloat t[4], u[4], v[4], sum[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
fetch_vector4( &inst->SrcReg[2], machine, v ); |
sum[0] = t[0] * u[0] + v[0]; |
sum[1] = t[1] * u[1] + v[1]; |
sum[2] = t[2] * u[2] + v[2]; |
sum[3] = t[3] * u[3] + v[3]; |
store_vector4( &inst->DstReg, machine, sum ); |
} |
break; |
case ARL: |
{ |
GLfloat t[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
machine->AddressReg = (GLint) floor(t[0]); |
} |
break; |
case DPH: |
{ |
GLfloat t[4], u[4], dot[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + u[3]; |
dot[1] = dot[2] = dot[3] = dot[0]; |
store_vector4( &inst->DstReg, machine, dot ); |
} |
break; |
case RCC: |
{ |
GLfloat t[4], u; |
fetch_vector1( &inst->SrcReg[0], machine, t ); |
if (t[0] == 1.0F) |
u = 1.0F; |
else |
u = 1.0F / t[0]; |
if (u > 0.0F) { |
if (u > 1.884467e+019F) { |
u = 1.884467e+019F; /* IEEE 32-bit binary value 0x5F800000 */ |
} |
else if (u < 5.42101e-020F) { |
u = 5.42101e-020F; /* IEEE 32-bit binary value 0x1F800000 */ |
} |
} |
else { |
if (u < -1.884467e+019F) { |
u = -1.884467e+019F; /* IEEE 32-bit binary value 0xDF800000 */ |
} |
else if (u > -5.42101e-020F) { |
u = -5.42101e-020F; /* IEEE 32-bit binary value 0x9F800000 */ |
} |
} |
t[0] = t[1] = t[2] = t[3] = u; |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case SUB: |
{ |
GLfloat t[4], u[4], sum[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
fetch_vector4( &inst->SrcReg[1], machine, u ); |
sum[0] = t[0] - u[0]; |
sum[1] = t[1] - u[1]; |
sum[2] = t[2] - u[2]; |
sum[3] = t[3] - u[3]; |
store_vector4( &inst->DstReg, machine, sum ); |
} |
break; |
case ABS: |
{ |
GLfloat t[4]; |
fetch_vector4( &inst->SrcReg[0], machine, t ); |
if (t[0] < 0.0) t[0] = -t[0]; |
if (t[1] < 0.0) t[1] = -t[1]; |
if (t[2] < 0.0) t[2] = -t[2]; |
if (t[3] < 0.0) t[3] = -t[3]; |
store_vector4( &inst->DstReg, machine, t ); |
} |
break; |
case END: |
return; |
default: |
/* bad instruction opcode */ |
_mesa_problem(ctx, "Bad VP Opcode in _mesa_exec_program"); |
return; |
} |
} |
} |
/** |
Thoughts on vertex program optimization: |
The obvious thing to do is to compile the vertex program into X86/SSE/3DNow! |
assembly code. That will probably be a lot of work. |
Another approach might be to replace the vp_instruction->Opcode field with |
a pointer to a specialized C function which executes the instruction. |
In particular we can write functions which skip swizzling, negating, |
masking, relative addressing, etc. when they're not needed. |
For example: |
void simple_add( struct vp_instruction *inst ) |
{ |
GLfloat *sum = machine->Registers[inst->DstReg.Register]; |
GLfloat *a = machine->Registers[inst->SrcReg[0].Register]; |
GLfloat *b = machine->Registers[inst->SrcReg[1].Register]; |
sum[0] = a[0] + b[0]; |
sum[1] = a[1] + b[1]; |
sum[2] = a[2] + b[2]; |
sum[3] = a[3] + b[3]; |
} |
*/ |
/* |
KW: |
A first step would be to 'vectorize' the programs in the same way as |
the normal transformation code in the tnl module. Thus each opcode |
takes zero or more input vectors (registers) and produces one or more |
output vectors. |
These operations would intially be coded in C, with machine-specific |
assembly following, as is currently the case for matrix |
transformations in the math/ directory. The preprocessing scheme for |
selecting simpler operations Brian describes above would also work |
here. |
This should give reasonable performance without excessive effort. |
*/ |
/shark/tags/rel_0_4/ports/mesa/src/vpstate.h |
---|
0,0 → 1,125 |
/* $Id: vpstate.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Brian Paul |
*/ |
#ifndef VPSTATE_H |
#define VPSTATE_H |
extern void _mesa_delete_program(GLcontext *ctx, GLuint id); |
extern void _mesa_BindProgramNV(GLenum target, GLuint id); |
extern void _mesa_DeleteProgramsNV(GLsizei n, const GLuint *ids); |
extern void _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params); |
extern void _mesa_GenProgramsNV(GLsizei n, GLuint *ids); |
extern GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences); |
extern void _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids); |
extern void _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params); |
extern void _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params); |
extern void _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params); |
extern void _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program); |
extern void _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params); |
extern void _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params); |
extern void _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params); |
extern void _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params); |
extern void _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer); |
extern GLboolean _mesa_IsProgramNV(GLuint id); |
extern void _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, |
const GLubyte *program); |
extern void _mesa_ProgramParameter4dNV(GLenum target, GLuint index, |
GLdouble x, GLdouble y, |
GLdouble z, GLdouble w); |
extern void _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, |
const GLdouble *params); |
extern void _mesa_ProgramParameter4fNV(GLenum target, GLuint index, |
GLfloat x, GLfloat y, |
GLfloat z, GLfloat w); |
extern void _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, |
const GLfloat *params); |
extern void _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, |
GLuint num, const GLdouble *params); |
extern void _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, |
GLuint num, const GLfloat *params); |
extern void _mesa_TrackMatrixNV(GLenum target, GLuint address, |
GLenum matrix, GLenum transform); |
extern void _mesa_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v); |
extern void _mesa_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v); |
extern void _mesa_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v); |
extern void _mesa_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v); |
extern void _mesa_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v); |
extern void _mesa_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v); |
extern void _mesa_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v); |
extern void _mesa_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v); |
extern void _mesa_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v); |
extern void _mesa_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v); |
extern void _mesa_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v); |
extern void _mesa_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v); |
extern void _mesa_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/rastpos.c |
---|
0,0 → 1,788 |
/* $Id: rastpos.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "clip.h" |
#include "colormac.h" |
#include "context.h" |
#include "feedback.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "rastpos.h" |
#include "state.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
/* |
* Clip a point against the view volume. |
* Input: v - vertex-vector describing the point to clip |
* Return: 0 = outside view volume |
* 1 = inside view volume |
*/ |
static GLuint |
viewclip_point( const GLfloat v[] ) |
{ |
if ( v[0] > v[3] || v[0] < -v[3] |
|| v[1] > v[3] || v[1] < -v[3] |
|| v[2] > v[3] || v[2] < -v[3] ) { |
return 0; |
} |
else { |
return 1; |
} |
} |
/* As above, but only clip test against far/near Z planes */ |
static GLuint |
viewclip_point_z( const GLfloat v[] ) |
{ |
if (v[2] > v[3] || v[2] < -v[3] ) { |
return 0; |
} |
else { |
return 1; |
} |
} |
/* |
* Clip a point against the user clipping planes. |
* Input: v - vertex-vector describing the point to clip. |
* Return: 0 = point was clipped |
* 1 = point not clipped |
*/ |
static GLuint |
userclip_point( GLcontext* ctx, const GLfloat v[] ) |
{ |
GLuint p; |
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] |
+ v[1] * ctx->Transform._ClipUserPlane[p][1] |
+ v[2] * ctx->Transform._ClipUserPlane[p][2] |
+ v[3] * ctx->Transform._ClipUserPlane[p][3]; |
if (dot < 0.0F) { |
return 0; |
} |
} |
} |
return 1; |
} |
/* This has been split off to allow the normal shade routines to |
* get a little closer to the vertex buffer, and to use the |
* GLvector objects directly. |
* Input: ctx - the context |
* vertex - vertex location |
* normal - normal vector |
* Output: Rcolor - returned color |
* Rspec - returned specular color (if separate specular enabled) |
* Rindex - returned color index |
*/ |
static void |
shade_rastpos(GLcontext *ctx, |
const GLfloat vertex[4], |
const GLfloat normal[3], |
GLfloat Rcolor[4], |
GLfloat Rspec[4], |
GLuint *Rindex) |
{ |
GLfloat (*base)[3] = ctx->Light._BaseColor; |
struct gl_light *light; |
GLfloat diffuseColor[4], specularColor[4]; |
GLfloat diffuse = 0, specular = 0; |
if (!ctx->_ShineTable[0] || !ctx->_ShineTable[1]) |
_mesa_validate_all_lighting_tables( ctx ); |
COPY_3V(diffuseColor, base[0]); |
diffuseColor[3] = CLAMP( ctx->Light.Material[0].Diffuse[3], 0.0F, 1.0F ); |
ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0); |
foreach (light, &ctx->Light.EnabledList) { |
GLfloat n_dot_h; |
GLfloat attenuation = 1.0; |
GLfloat VP[3]; |
GLfloat n_dot_VP; |
GLfloat *h; |
GLfloat diffuseContrib[3], specularContrib[3]; |
GLboolean normalized; |
if (!(light->_Flags & LIGHT_POSITIONAL)) { |
COPY_3V(VP, light->_VP_inf_norm); |
attenuation = light->_VP_inf_spot_attenuation; |
} |
else { |
GLfloat d; |
SUB_3V(VP, light->_Position, vertex); |
d = (GLfloat) LEN_3FV( VP ); |
if ( d > 1e-6) { |
GLfloat invd = 1.0F / d; |
SELF_SCALE_SCALAR_3V(VP, invd); |
} |
attenuation = 1.0F / (light->ConstantAttenuation + d * |
(light->LinearAttenuation + d * |
light->QuadraticAttenuation)); |
if (light->_Flags & LIGHT_SPOT) { |
GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); |
if (PV_dot_dir<light->_CosCutoff) { |
continue; |
} |
else { |
double x = PV_dot_dir * (EXP_TABLE_SIZE-1); |
int k = (int) x; |
GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] |
+ (x-k)*light->_SpotExpTable[k][1]); |
attenuation *= spot; |
} |
} |
} |
if (attenuation < 1e-3) |
continue; |
n_dot_VP = DOT3( normal, VP ); |
if (n_dot_VP < 0.0F) { |
ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]); |
continue; |
} |
COPY_3V(diffuseContrib, light->_MatAmbient[0]); |
ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]); |
diffuse += n_dot_VP * light->_dli * attenuation; |
ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0); |
{ |
if (ctx->Light.Model.LocalViewer) { |
GLfloat v[3]; |
COPY_3V(v, vertex); |
NORMALIZE_3FV(v); |
SUB_3V(VP, VP, v); |
h = VP; |
normalized = 0; |
} |
else if (light->_Flags & LIGHT_POSITIONAL) { |
h = VP; |
ACC_3V(h, ctx->_EyeZDir); |
normalized = 0; |
} |
else { |
h = light->_h_inf_norm; |
normalized = 1; |
} |
n_dot_h = DOT3(normal, h); |
if (n_dot_h > 0.0F) { |
const struct gl_material *mat = &ctx->Light.Material[0]; |
GLfloat spec_coef; |
GLfloat shininess = mat->Shininess; |
if (!normalized) { |
n_dot_h *= n_dot_h; |
n_dot_h /= LEN_SQUARED_3FV( h ); |
shininess *= .5; |
} |
GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef ); |
if (spec_coef > 1.0e-10) { |
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { |
ACC_SCALE_SCALAR_3V( specularContrib, spec_coef, |
light->_MatSpecular[0]); |
} |
else { |
ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef, |
light->_MatSpecular[0]); |
} |
specular += spec_coef * light->_sli * attenuation; |
} |
} |
} |
ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib ); |
ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib ); |
} |
if (ctx->Visual.rgbMode) { |
Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F); |
Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F); |
Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F); |
Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F); |
Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F); |
Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F); |
Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F); |
Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F); |
} |
else { |
struct gl_material *mat = &ctx->Light.Material[0]; |
GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex; |
GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex; |
GLfloat ind = mat->AmbientIndex |
+ diffuse * (1.0F-specular) * d_a |
+ specular * s_a; |
if (ind > mat->SpecularIndex) { |
ind = mat->SpecularIndex; |
} |
*Rindex = (GLuint) (GLint) ind; |
} |
} |
/* |
* Caller: context->API.RasterPos4f |
*/ |
static void |
raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
GLfloat v[4], eye[4], clip[4], ndc[3], d; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
if (ctx->NewState) |
_mesa_update_state( ctx ); |
ASSIGN_4V( v, x, y, z, w ); |
TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, v ); |
/* raster color */ |
if (ctx->Light.Enabled) { |
GLfloat *norm, eyenorm[3]; |
GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; |
if (ctx->_NeedEyeCoords) { |
GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv; |
TRANSFORM_NORMAL( eyenorm, objnorm, inv ); |
norm = eyenorm; |
} |
else { |
norm = objnorm; |
} |
shade_rastpos( ctx, v, norm, |
ctx->Current.RasterColor, |
ctx->Current.RasterSecondaryColor, |
&ctx->Current.RasterIndex ); |
} |
else { |
/* use current color or index */ |
if (ctx->Visual.rgbMode) { |
COPY_4FV(ctx->Current.RasterColor, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); |
COPY_4FV(ctx->Current.RasterSecondaryColor, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); |
} |
else { |
ctx->Current.RasterIndex = ctx->Current.Index; |
} |
} |
/* compute raster distance */ |
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) |
ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
else |
ctx->Current.RasterDistance = (GLfloat) |
GL_SQRT( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); |
/* apply projection matrix: clip = Proj * eye */ |
TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); |
/* clip to view volume */ |
if (ctx->Transform.RasterPositionUnclipped) { |
/* GL_IBM_rasterpos_clip: only clip against Z */ |
if (viewclip_point_z(clip) == 0) |
ctx->Current.RasterPosValid = GL_FALSE; |
} |
else if (viewclip_point(clip) == 0) { |
/* Normal OpenGL behaviour */ |
ctx->Current.RasterPosValid = GL_FALSE; |
return; |
} |
/* clip to user clipping planes */ |
if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) { |
ctx->Current.RasterPosValid = GL_FALSE; |
return; |
} |
/* ndc = clip / W */ |
ASSERT( clip[3]!=0.0 ); |
d = 1.0F / clip[3]; |
ndc[0] = clip[0] * d; |
ndc[1] = clip[1] * d; |
ndc[2] = clip[2] * d; |
ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] + |
ctx->Viewport._WindowMap.m[MAT_TX]); |
ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] + |
ctx->Viewport._WindowMap.m[MAT_TY]); |
ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] + |
ctx->Viewport._WindowMap.m[MAT_TZ]) / ctx->DepthMaxF; |
ctx->Current.RasterPos[3] = clip[3]; |
ctx->Current.RasterPosValid = GL_TRUE; |
{ |
GLuint texSet; |
for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { |
COPY_4FV( ctx->Current.RasterTexCoords[texSet], |
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); |
} |
} |
if (ctx->RenderMode==GL_SELECT) { |
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); |
} |
} |
void |
_mesa_RasterPos2d(GLdouble x, GLdouble y) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2f(GLfloat x, GLfloat y) |
{ |
_mesa_RasterPos4f(x, y, 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2i(GLint x, GLint y) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2s(GLshort x, GLshort y) |
{ |
_mesa_RasterPos4f(x, y, 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
void |
_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) |
{ |
_mesa_RasterPos4f(x, y, z, 1.0F); |
} |
void |
_mesa_RasterPos3i(GLint x, GLint y, GLint z) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
void |
_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) |
{ |
_mesa_RasterPos4f(x, y, z, 1.0F); |
} |
void |
_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
void |
_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
GET_CURRENT_CONTEXT(ctx); |
raster_pos4f(ctx, x, y, z, w); |
} |
void |
_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) |
{ |
_mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
void |
_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
_mesa_RasterPos4f(x, y, z, w); |
} |
void |
_mesa_RasterPos2dv(const GLdouble *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2fv(const GLfloat *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2iv(const GLint *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos2sv(const GLshort *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); |
} |
void |
_mesa_RasterPos3dv(const GLdouble *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
void |
_mesa_RasterPos3fv(const GLfloat *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); |
} |
void |
_mesa_RasterPos3iv(const GLint *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
void |
_mesa_RasterPos3sv(const GLshort *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); |
} |
void |
_mesa_RasterPos4dv(const GLdouble *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
void |
_mesa_RasterPos4fv(const GLfloat *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]); |
} |
void |
_mesa_RasterPos4iv(const GLint *v) |
{ |
_mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
void |
_mesa_RasterPos4sv(const GLshort *v) |
{ |
_mesa_RasterPos4f(v[0], v[1], v[2], v[3]); |
} |
/**********************************************************************/ |
/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ |
/**********************************************************************/ |
static void |
window_pos3f(GLfloat x, GLfloat y, GLfloat z) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLfloat z2; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
FLUSH_CURRENT(ctx, 0); |
z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) |
+ ctx->Viewport.Near; |
/* set raster position */ |
ctx->Current.RasterPos[0] = x; |
ctx->Current.RasterPos[1] = y; |
ctx->Current.RasterPos[2] = z2; |
ctx->Current.RasterPos[3] = 1.0F; |
ctx->Current.RasterPosValid = GL_TRUE; |
if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) |
ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
else |
ctx->Current.RasterDistance = 0.0; |
/* raster color = current color or index */ |
if (ctx->Visual.rgbMode) { |
ctx->Current.RasterColor[0] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); |
ctx->Current.RasterColor[1] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); |
ctx->Current.RasterColor[2] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); |
ctx->Current.RasterColor[3] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); |
ctx->Current.RasterSecondaryColor[0] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); |
ctx->Current.RasterSecondaryColor[1] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); |
ctx->Current.RasterSecondaryColor[2] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); |
ctx->Current.RasterSecondaryColor[3] |
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); |
} |
else { |
ctx->Current.RasterIndex = ctx->Current.Index; |
} |
/* raster texcoord = current texcoord */ |
{ |
GLuint texSet; |
for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { |
COPY_4FV( ctx->Current.RasterTexCoords[texSet], |
ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); |
} |
} |
if (ctx->RenderMode==GL_SELECT) { |
_mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); |
} |
} |
/* This is just to support the GL_MESA_window_pos version */ |
static void |
window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
GET_CURRENT_CONTEXT(ctx); |
window_pos3f(x, y, z); |
ctx->Current.RasterPos[3] = w; |
} |
void |
_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) |
{ |
window_pos4f(x, y, 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2iMESA(GLint x, GLint y) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2sMESA(GLshort x, GLshort y) |
{ |
window_pos4f(x, y, 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
void |
_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) |
{ |
window_pos4f(x, y, z, 1.0F); |
} |
void |
_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); |
} |
void |
_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) |
{ |
window_pos4f(x, y, z, 1.0F); |
} |
void |
_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
void |
_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
window_pos4f(x, y, z, w); |
} |
void |
_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) |
{ |
window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); |
} |
void |
_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
window_pos4f(x, y, z, w); |
} |
void |
_mesa_WindowPos2dvMESA(const GLdouble *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2fvMESA(const GLfloat *v) |
{ |
window_pos4f(v[0], v[1], 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2ivMESA(const GLint *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos2svMESA(const GLshort *v) |
{ |
window_pos4f(v[0], v[1], 0.0F, 1.0F); |
} |
void |
_mesa_WindowPos3dvMESA(const GLdouble *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
void |
_mesa_WindowPos3fvMESA(const GLfloat *v) |
{ |
window_pos4f(v[0], v[1], v[2], 1.0); |
} |
void |
_mesa_WindowPos3ivMESA(const GLint *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); |
} |
void |
_mesa_WindowPos3svMESA(const GLshort *v) |
{ |
window_pos4f(v[0], v[1], v[2], 1.0F); |
} |
void |
_mesa_WindowPos4dvMESA(const GLdouble *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
void |
_mesa_WindowPos4fvMESA(const GLfloat *v) |
{ |
window_pos4f(v[0], v[1], v[2], v[3]); |
} |
void |
_mesa_WindowPos4ivMESA(const GLint *v) |
{ |
window_pos4f((GLfloat) v[0], (GLfloat) v[1], |
(GLfloat) v[2], (GLfloat) v[3]); |
} |
void |
_mesa_WindowPos4svMESA(const GLshort *v) |
{ |
window_pos4f(v[0], v[1], v[2], v[3]); |
} |
#if 0 |
/* |
* OpenGL implementation of glWindowPos*MESA() |
*/ |
void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) |
{ |
GLfloat fx, fy; |
/* Push current matrix mode and viewport attributes */ |
glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); |
/* Setup projection parameters */ |
glMatrixMode( GL_PROJECTION ); |
glPushMatrix(); |
glLoadIdentity(); |
glMatrixMode( GL_MODELVIEW ); |
glPushMatrix(); |
glLoadIdentity(); |
glDepthRange( z, z ); |
glViewport( (int) x - 1, (int) y - 1, 2, 2 ); |
/* set the raster (window) position */ |
fx = x - (int) x; |
fy = y - (int) y; |
glRasterPos4f( fx, fy, 0.0, w ); |
/* restore matrices, viewport and matrix mode */ |
glPopMatrix(); |
glMatrixMode( GL_PROJECTION ); |
glPopMatrix(); |
glPopAttrib(); |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texobj.c |
---|
0,0 → 1,864 |
/* $Id: texobj.c,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colortab.h" |
#include "context.h" |
#include "enums.h" |
#include "hash.h" |
#include "imports.h" |
#include "macros.h" |
#include "teximage.h" |
#include "texstate.h" |
#include "texobj.h" |
#include "mtypes.h" |
/* |
* Allocate a new texture object and add it to the linked list of texture |
* objects. If name>0 then also insert the new texture object into the hash |
* table. |
* Input: shared - the shared GL state structure to contain the texture object |
* name - integer name for the texture object |
* target - either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, |
* GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV |
* zero is ok for the sake of GenTextures() |
* Return: pointer to new texture object |
*/ |
struct gl_texture_object * |
_mesa_alloc_texture_object( struct gl_shared_state *shared, |
GLuint name, GLenum target ) |
{ |
struct gl_texture_object *obj; |
ASSERT(target == 0 || |
target == GL_TEXTURE_1D || |
target == GL_TEXTURE_2D || |
target == GL_TEXTURE_3D || |
target == GL_TEXTURE_CUBE_MAP_ARB || |
target == GL_TEXTURE_RECTANGLE_NV); |
obj = CALLOC_STRUCT(gl_texture_object); |
if (obj) { |
/* init the non-zero fields */ |
_glthread_INIT_MUTEX(obj->Mutex); |
obj->RefCount = 1; |
obj->Name = name; |
obj->Target = target; |
obj->Priority = 1.0F; |
if (target == GL_TEXTURE_RECTANGLE_NV) { |
obj->WrapS = GL_CLAMP_TO_EDGE; |
obj->WrapT = GL_CLAMP_TO_EDGE; |
obj->WrapR = GL_CLAMP_TO_EDGE; |
obj->MinFilter = GL_LINEAR; |
} |
else { |
obj->WrapS = GL_REPEAT; |
obj->WrapT = GL_REPEAT; |
obj->WrapR = GL_REPEAT; |
obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; |
} |
obj->MagFilter = GL_LINEAR; |
obj->MinLod = -1000.0; |
obj->MaxLod = 1000.0; |
obj->BaseLevel = 0; |
obj->MaxLevel = 1000; |
obj->MaxAnisotropy = 1.0; |
obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ |
obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ |
obj->CompareMode = GL_LUMINANCE; /* ARB_shadow */ |
obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ |
obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ |
obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ |
_mesa_init_colortable(&obj->Palette); |
/* insert into linked list */ |
if (shared) { |
_glthread_LOCK_MUTEX(shared->Mutex); |
obj->Next = shared->TexObjectList; |
shared->TexObjectList = obj; |
_glthread_UNLOCK_MUTEX(shared->Mutex); |
} |
if (name > 0) { |
/* insert into hash table */ |
_mesa_HashInsert(shared->TexObjects, name, obj); |
} |
} |
return obj; |
} |
/* |
* Deallocate a texture object struct and remove it from the given |
* shared GL state. |
* Input: shared - the shared GL state to which the object belongs |
* t - the texture object to delete |
*/ |
void _mesa_free_texture_object( struct gl_shared_state *shared, |
struct gl_texture_object *t ) |
{ |
struct gl_texture_object *tprev, *tcurr; |
assert(t); |
/* unlink t from the linked list */ |
if (shared) { |
_glthread_LOCK_MUTEX(shared->Mutex); |
tprev = NULL; |
tcurr = shared->TexObjectList; |
while (tcurr) { |
if (tcurr==t) { |
if (tprev) { |
tprev->Next = t->Next; |
} |
else { |
shared->TexObjectList = t->Next; |
} |
break; |
} |
tprev = tcurr; |
tcurr = tcurr->Next; |
} |
_glthread_UNLOCK_MUTEX(shared->Mutex); |
} |
if (t->Name) { |
/* remove from hash table */ |
_mesa_HashRemove(shared->TexObjects, t->Name); |
} |
_mesa_free_colortable_data(&t->Palette); |
/* free the texture images */ |
{ |
GLuint i; |
for (i=0;i<MAX_TEXTURE_LEVELS;i++) { |
if (t->Image[i]) { |
_mesa_free_texture_image( t->Image[i] ); |
} |
} |
} |
/* free this object */ |
FREE( t ); |
} |
/* |
* Copy texture object state from one texture object to another. |
*/ |
void |
_mesa_copy_texture_object( struct gl_texture_object *dest, |
const struct gl_texture_object *src ) |
{ |
dest->Name = src->Name; |
dest->Priority = src->Priority; |
dest->BorderColor[0] = src->BorderColor[0]; |
dest->BorderColor[1] = src->BorderColor[1]; |
dest->BorderColor[2] = src->BorderColor[2]; |
dest->BorderColor[3] = src->BorderColor[3]; |
dest->WrapS = src->WrapS; |
dest->WrapT = src->WrapT; |
dest->WrapR = src->WrapR; |
dest->MinFilter = src->MinFilter; |
dest->MagFilter = src->MagFilter; |
dest->MinLod = src->MinLod; |
dest->MaxLod = src->MaxLod; |
dest->BaseLevel = src->BaseLevel; |
dest->MaxLevel = src->MaxLevel; |
dest->MaxAnisotropy = src->MaxAnisotropy; |
dest->CompareFlag = src->CompareFlag; |
dest->CompareOperator = src->CompareOperator; |
dest->ShadowAmbient = src->ShadowAmbient; |
dest->CompareMode = src->CompareMode; |
dest->CompareFunc = src->CompareFunc; |
dest->DepthMode = src->DepthMode; |
dest->_MaxLevel = src->_MaxLevel; |
dest->_MaxLambda = src->_MaxLambda; |
dest->GenerateMipmap = src->GenerateMipmap; |
dest->Palette = src->Palette; |
dest->Complete = src->Complete; |
} |
/* |
* Report why a texture object is incomplete. (for debug only) |
*/ |
#if 0 |
static void |
incomplete(const struct gl_texture_object *t, const char *why) |
{ |
_mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why); |
} |
#else |
#define incomplete(a, b) |
#endif |
/* |
* Examine a texture object to determine if it is complete. |
* The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly. |
*/ |
void |
_mesa_test_texobj_completeness( const GLcontext *ctx, |
struct gl_texture_object *t ) |
{ |
const GLint baseLevel = t->BaseLevel; |
GLint maxLog2 = 0, maxLevels = 0; |
t->Complete = GL_TRUE; /* be optimistic */ |
/* Always need the base level image */ |
if (!t->Image[baseLevel]) { |
incomplete(t, "Image[baseLevel] == NULL"); |
t->Complete = GL_FALSE; |
return; |
} |
/* Compute _MaxLevel */ |
if (t->Target == GL_TEXTURE_1D) { |
maxLog2 = t->Image[baseLevel]->WidthLog2; |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (t->Target == GL_TEXTURE_2D) { |
maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, |
t->Image[baseLevel]->HeightLog2); |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (t->Target == GL_TEXTURE_3D) { |
GLint max = MAX2(t->Image[baseLevel]->WidthLog2, |
t->Image[baseLevel]->HeightLog2); |
maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2)); |
maxLevels = ctx->Const.Max3DTextureLevels; |
} |
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { |
maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, |
t->Image[baseLevel]->HeightLog2); |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { |
maxLog2 = 0; /* not applicable */ |
maxLevels = 1; /* no mipmapping */ |
} |
else { |
_mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness"); |
return; |
} |
ASSERT(maxLevels > 0); |
t->_MaxLevel = baseLevel + maxLog2; |
t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel); |
t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1); |
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */ |
t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel); |
if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { |
/* make sure that all six cube map level 0 images are the same size */ |
const GLuint w = t->Image[baseLevel]->Width2; |
const GLuint h = t->Image[baseLevel]->Height2; |
if (!t->NegX[baseLevel] || |
t->NegX[baseLevel]->Width2 != w || |
t->NegX[baseLevel]->Height2 != h || |
!t->PosY[baseLevel] || |
t->PosY[baseLevel]->Width2 != w || |
t->PosY[baseLevel]->Height2 != h || |
!t->NegY[baseLevel] || |
t->NegY[baseLevel]->Width2 != w || |
t->NegY[baseLevel]->Height2 != h || |
!t->PosZ[baseLevel] || |
t->PosZ[baseLevel]->Width2 != w || |
t->PosZ[baseLevel]->Height2 != h || |
!t->NegZ[baseLevel] || |
t->NegZ[baseLevel]->Width2 != w || |
t->NegZ[baseLevel]->Height2 != h) { |
t->Complete = GL_FALSE; |
incomplete(t, "Non-quare cubemap image"); |
return; |
} |
} |
if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) { |
/* |
* Mipmapping: determine if we have a complete set of mipmaps |
*/ |
GLint i; |
GLint minLevel = baseLevel; |
GLint maxLevel = t->_MaxLevel; |
if (minLevel > maxLevel) { |
t->Complete = GL_FALSE; |
incomplete(t, "minLevel > maxLevel"); |
return; |
} |
/* Test dimension-independent attributes */ |
for (i = minLevel; i <= maxLevel; i++) { |
if (t->Image[i]) { |
if (t->Image[i]->TexFormat != t->Image[baseLevel]->TexFormat) { |
t->Complete = GL_FALSE; |
incomplete(t, "Format[i] != Format[baseLevel]"); |
return; |
} |
if (t->Image[i]->Border != t->Image[baseLevel]->Border) { |
t->Complete = GL_FALSE; |
incomplete(t, "Border[i] != Border[baseLevel]"); |
return; |
} |
} |
} |
/* Test things which depend on number of texture image dimensions */ |
if (t->Target == GL_TEXTURE_1D) { |
/* Test 1-D mipmaps */ |
GLuint width = t->Image[baseLevel]->Width2; |
for (i = baseLevel + 1; i < maxLevels; i++) { |
if (width > 1) { |
width /= 2; |
} |
if (i >= minLevel && i <= maxLevel) { |
if (!t->Image[i]) { |
t->Complete = GL_FALSE; |
incomplete(t, "1D Image[i] == NULL"); |
return; |
} |
if (t->Image[i]->Width2 != width ) { |
t->Complete = GL_FALSE; |
incomplete(t, "1D Image[i] bad width"); |
return; |
} |
} |
if (width == 1) { |
return; /* found smallest needed mipmap, all done! */ |
} |
} |
} |
else if (t->Target == GL_TEXTURE_2D) { |
/* Test 2-D mipmaps */ |
GLuint width = t->Image[baseLevel]->Width2; |
GLuint height = t->Image[baseLevel]->Height2; |
for (i = baseLevel + 1; i < maxLevels; i++) { |
if (width > 1) { |
width /= 2; |
} |
if (height > 1) { |
height /= 2; |
} |
if (i >= minLevel && i <= maxLevel) { |
if (!t->Image[i]) { |
t->Complete = GL_FALSE; |
incomplete(t, "2D Image[i] == NULL"); |
return; |
} |
if (t->Image[i]->Width2 != width) { |
t->Complete = GL_FALSE; |
incomplete(t, "2D Image[i] bad width"); |
return; |
} |
if (t->Image[i]->Height2 != height) { |
t->Complete = GL_FALSE; |
incomplete(t, "2D Image[i] bad height"); |
return; |
} |
if (width==1 && height==1) { |
return; /* found smallest needed mipmap, all done! */ |
} |
} |
} |
} |
else if (t->Target == GL_TEXTURE_3D) { |
/* Test 3-D mipmaps */ |
GLuint width = t->Image[baseLevel]->Width2; |
GLuint height = t->Image[baseLevel]->Height2; |
GLuint depth = t->Image[baseLevel]->Depth2; |
for (i = baseLevel + 1; i < maxLevels; i++) { |
if (width > 1) { |
width /= 2; |
} |
if (height > 1) { |
height /= 2; |
} |
if (depth > 1) { |
depth /= 2; |
} |
if (i >= minLevel && i <= maxLevel) { |
if (!t->Image[i]) { |
incomplete(t, "3D Image[i] == NULL"); |
t->Complete = GL_FALSE; |
return; |
} |
if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { |
t->Complete = GL_FALSE; |
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); |
return; |
} |
if (t->Image[i]->Width2 != width) { |
t->Complete = GL_FALSE; |
incomplete(t, "3D Image[i] bad width"); |
return; |
} |
if (t->Image[i]->Height2 != height) { |
t->Complete = GL_FALSE; |
incomplete(t, "3D Image[i] bad height"); |
return; |
} |
if (t->Image[i]->Depth2 != depth) { |
t->Complete = GL_FALSE; |
incomplete(t, "3D Image[i] bad depth"); |
return; |
} |
} |
if (width == 1 && height == 1 && depth == 1) { |
return; /* found smallest needed mipmap, all done! */ |
} |
} |
} |
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { |
/* make sure 6 cube faces are consistant */ |
GLuint width = t->Image[baseLevel]->Width2; |
GLuint height = t->Image[baseLevel]->Height2; |
for (i = baseLevel + 1; i < maxLevels; i++) { |
if (width > 1) { |
width /= 2; |
} |
if (height > 1) { |
height /= 2; |
} |
if (i >= minLevel && i <= maxLevel) { |
/* Don't support GL_DEPTH_COMPONENT for cube maps */ |
if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { |
t->Complete = GL_FALSE; |
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); |
return; |
} |
/* check that we have images defined */ |
if (!t->Image[i] || !t->NegX[i] || |
!t->PosY[i] || !t->NegY[i] || |
!t->PosZ[i] || !t->NegZ[i]) { |
t->Complete = GL_FALSE; |
incomplete(t, "CubeMap Image[i] == NULL"); |
return; |
} |
/* check that all six images have same size */ |
if (t->NegX[i]->Width2!=width || t->NegX[i]->Height2!=height || |
t->PosY[i]->Width2!=width || t->PosY[i]->Height2!=height || |
t->NegY[i]->Width2!=width || t->NegY[i]->Height2!=height || |
t->PosZ[i]->Width2!=width || t->PosZ[i]->Height2!=height || |
t->NegZ[i]->Width2!=width || t->NegZ[i]->Height2!=height) { |
t->Complete = GL_FALSE; |
incomplete(t, "CubeMap Image[i] bad size"); |
return; |
} |
} |
if (width == 1 && height == 1) { |
return; /* found smallest needed mipmap, all done! */ |
} |
} |
} |
else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { |
/* XXX special checking? */ |
} |
else { |
/* Target = ??? */ |
_mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n"); |
} |
} |
} |
_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); |
/* |
* Execute glGenTextures |
*/ |
void |
_mesa_GenTextures( GLsizei n, GLuint *texName ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint first; |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (n < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); |
return; |
} |
if (!texName) |
return; |
/* |
* This must be atomic (generation and allocation of texture IDs) |
*/ |
_glthread_LOCK_MUTEX(GenTexturesLock); |
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); |
/* Return the texture names */ |
for (i=0;i<n;i++) { |
texName[i] = first + i; |
} |
/* Allocate new, empty texture objects */ |
for (i=0;i<n;i++) { |
GLuint name = first + i; |
GLenum target = 0; |
(void) _mesa_alloc_texture_object( ctx->Shared, name, target); |
} |
_glthread_UNLOCK_MUTEX(GenTexturesLock); |
} |
/* |
* Execute glDeleteTextures |
*/ |
void |
_mesa_DeleteTextures( GLsizei n, const GLuint *texName) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ |
if (!texName) |
return; |
for (i=0;i<n;i++) { |
if (texName[i] > 0) { |
struct gl_texture_object *delObj = (struct gl_texture_object *) |
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); |
if (delObj) { |
/* First check if this texture is currently bound. |
* If so, unbind it and decrement the reference count. |
*/ |
GLuint u; |
for (u = 0; u < MAX_TEXTURE_UNITS; u++) { |
struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; |
if (delObj == unit->Current1D) { |
unit->Current1D = ctx->Shared->Default1D; |
ctx->Shared->Default1D->RefCount++; |
delObj->RefCount--; |
if (delObj == unit->_Current) |
unit->_Current = unit->Current1D; |
} |
else if (delObj == unit->Current2D) { |
unit->Current2D = ctx->Shared->Default2D; |
ctx->Shared->Default2D->RefCount++; |
delObj->RefCount--; |
if (delObj == unit->_Current) |
unit->_Current = unit->Current2D; |
} |
else if (delObj == unit->Current3D) { |
unit->Current3D = ctx->Shared->Default3D; |
ctx->Shared->Default3D->RefCount++; |
delObj->RefCount--; |
if (delObj == unit->_Current) |
unit->_Current = unit->Current3D; |
} |
else if (delObj == unit->CurrentCubeMap) { |
unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; |
ctx->Shared->DefaultCubeMap->RefCount++; |
delObj->RefCount--; |
if (delObj == unit->_Current) |
unit->_Current = unit->CurrentCubeMap; |
} |
else if (delObj == unit->CurrentRect) { |
unit->CurrentRect = ctx->Shared->DefaultRect; |
ctx->Shared->DefaultRect->RefCount++; |
delObj->RefCount--; |
if (delObj == unit->_Current) |
unit->_Current = unit->CurrentRect; |
} |
} |
ctx->NewState |= _NEW_TEXTURE; |
/* Decrement reference count and delete if zero */ |
delObj->RefCount--; |
ASSERT(delObj->RefCount >= 0); |
if (delObj->RefCount == 0) { |
ASSERT(delObj->Name != 0); |
if (ctx->Driver.DeleteTexture) |
(*ctx->Driver.DeleteTexture)( ctx, delObj ); |
_mesa_free_texture_object(ctx->Shared, delObj); |
} |
} |
} |
} |
} |
/* |
* Execute glBindTexture |
*/ |
void |
_mesa_BindTexture( GLenum target, GLuint texName ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint unit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
struct gl_texture_object *oldTexObj; |
struct gl_texture_object *newTexObj = 0; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) |
_mesa_debug(ctx, "glBindTexture %s %d\n", |
_mesa_lookup_enum_by_nr(target), (GLint) texName); |
switch (target) { |
case GL_TEXTURE_1D: |
oldTexObj = texUnit->Current1D; |
break; |
case GL_TEXTURE_2D: |
oldTexObj = texUnit->Current2D; |
break; |
case GL_TEXTURE_3D: |
oldTexObj = texUnit->Current3D; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); |
return; |
} |
oldTexObj = texUnit->CurrentCubeMap; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
if (!ctx->Extensions.NV_texture_rectangle) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); |
return; |
} |
oldTexObj = texUnit->CurrentRect; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); |
return; |
} |
if (oldTexObj->Name == texName) |
return; /* rebinding the same texture- no change */ |
/* |
* Get pointer to new texture object (newTexObj) |
*/ |
if (texName == 0) { |
/* newTexObj = a default texture object */ |
switch (target) { |
case GL_TEXTURE_1D: |
newTexObj = ctx->Shared->Default1D; |
break; |
case GL_TEXTURE_2D: |
newTexObj = ctx->Shared->Default2D; |
break; |
case GL_TEXTURE_3D: |
newTexObj = ctx->Shared->Default3D; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
newTexObj = ctx->Shared->DefaultCubeMap; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
newTexObj = ctx->Shared->DefaultRect; |
break; |
default: |
; /* Bad targets are caught above */ |
} |
} |
else { |
/* non-default texture object */ |
const struct _mesa_HashTable *hash = ctx->Shared->TexObjects; |
newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); |
if (newTexObj) { |
/* error checking */ |
if (newTexObj->Target != 0 && newTexObj->Target != target) { |
/* the named texture object's dimensions don't match the target */ |
_mesa_error( ctx, GL_INVALID_OPERATION, |
"glBindTexture(wrong dimensionality)" ); |
return; |
} |
if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { |
/* have to init wrap and filter state here - kind of klunky */ |
newTexObj->WrapS = GL_CLAMP_TO_EDGE; |
newTexObj->WrapT = GL_CLAMP_TO_EDGE; |
newTexObj->WrapR = GL_CLAMP_TO_EDGE; |
newTexObj->MinFilter = GL_LINEAR; |
} |
} |
else { |
/* if this is a new texture id, allocate a texture object now */ |
newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName, |
target); |
if (!newTexObj) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture"); |
return; |
} |
} |
newTexObj->Target = target; |
} |
newTexObj->RefCount++; |
/* do the actual binding, but first flush outstanding vertices: |
*/ |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
switch (target) { |
case GL_TEXTURE_1D: |
texUnit->Current1D = newTexObj; |
break; |
case GL_TEXTURE_2D: |
texUnit->Current2D = newTexObj; |
break; |
case GL_TEXTURE_3D: |
texUnit->Current3D = newTexObj; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
texUnit->CurrentCubeMap = newTexObj; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
texUnit->CurrentRect = newTexObj; |
break; |
default: |
_mesa_problem(ctx, "bad target in BindTexture"); |
return; |
} |
/* Pass BindTexture call to device driver */ |
if (ctx->Driver.BindTexture) |
(*ctx->Driver.BindTexture)( ctx, target, newTexObj ); |
oldTexObj->RefCount--; |
assert(oldTexObj->RefCount >= 0); |
if (oldTexObj->RefCount == 0) { |
assert(oldTexObj->Name != 0); |
if (ctx->Driver.DeleteTexture) { |
(*ctx->Driver.DeleteTexture)( ctx, oldTexObj ); |
} |
_mesa_free_texture_object(ctx->Shared, oldTexObj); |
} |
} |
/* |
* Execute glPrioritizeTextures |
*/ |
void |
_mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, |
const GLclampf *priorities ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (n < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); |
return; |
} |
if (!priorities) |
return; |
for (i = 0; i < n; i++) { |
if (texName[i] > 0) { |
struct gl_texture_object *t = (struct gl_texture_object *) |
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); |
if (t) { |
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); |
if (ctx->Driver.PrioritizeTexture) |
ctx->Driver.PrioritizeTexture( ctx, t, t->Priority ); |
} |
} |
} |
ctx->NewState |= _NEW_TEXTURE; |
} |
/* |
* Execute glAreTexturesResident |
*/ |
GLboolean |
_mesa_AreTexturesResident(GLsizei n, const GLuint *texName, |
GLboolean *residences) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLboolean allResident = GL_TRUE; |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
if (n < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)"); |
return GL_FALSE; |
} |
if (!texName || !residences) |
return GL_FALSE; |
for (i = 0; i < n; i++) { |
struct gl_texture_object *t; |
if (texName[i] == 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)"); |
return GL_FALSE; |
} |
t = (struct gl_texture_object *) |
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); |
if (t) { |
if (ctx->Driver.IsTextureResident) { |
residences[i] = ctx->Driver.IsTextureResident(ctx, t); |
if (!residences[i]) |
allResident = GL_FALSE; |
} |
else { |
residences[i] = GL_TRUE; |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)"); |
return GL_FALSE; |
} |
} |
return allResident; |
} |
/* |
* Execute glIsTexture |
*/ |
GLboolean |
_mesa_IsTexture( GLuint texture ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); |
return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture); |
} |
/shark/tags/rel_0_4/ports/mesa/src/glapi.c |
---|
0,0 → 1,920 |
/* $Id: glapi.c,v 1.1 2003-02-28 11:42:01 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* This file manages the OpenGL API dispatch layer. |
* The dispatch table (struct _glapi_table) is basically just a list |
* of function pointers. |
* There are functions to set/get the current dispatch table for the |
* current thread and to manage registration/dispatch of dynamically |
* added extension functions. |
* |
* It's intended that this file and the other glapi*.[ch] files are |
* flexible enough to be reused in several places: XFree86, DRI- |
* based libGL.so, and perhaps the SGI SI. |
* |
* NOTE: There are no dependencies on Mesa in this code. |
* |
* Versions (API changes): |
* 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 |
* 2001/01/16 - added dispatch override feature for Mesa 3.5 |
* 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. |
* 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints |
* itself (using offset ~0). _glapi_add_entrypoint() can be |
* called afterward and it'll fill in the correct dispatch |
* offset. This allows DRI libGL to avoid probing for DRI |
* drivers! No changes to the public glapi interface. |
*/ |
#include "glheader.h" |
#include "glapi.h" |
#include "glapioffsets.h" |
#include "glapitable.h" |
#include "glthread.h" |
/***** BEGIN NO-OP DISPATCH *****/ |
static GLboolean WarnFlag = GL_FALSE; |
static _glapi_warning_func warning_func; |
/* |
* Enable/disable printing of warning messages. |
*/ |
void |
_glapi_noop_enable_warnings(GLboolean enable) |
{ |
WarnFlag = enable; |
} |
/* |
* Register a callback function for reporting errors. |
*/ |
void |
_glapi_set_warning_func( _glapi_warning_func func ) |
{ |
warning_func = func; |
} |
static GLboolean |
warn(void) |
{ |
if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) |
&& warning_func) { |
return GL_TRUE; |
} |
else { |
return GL_FALSE; |
} |
} |
#define KEYWORD1 static |
#define KEYWORD2 |
#define NAME(func) NoOp##func |
#define F NULL |
#define DISPATCH(func, args, msg) \ |
if (warn()) { \ |
warning_func(NULL, "GL User Error: called without context:"); \ |
warning_func msg; \ |
} |
#define RETURN_DISPATCH(func, args, msg) \ |
if (warn()) { \ |
warning_func(NULL, "GL User Error: called without context:"); \ |
warning_func msg; \ |
} \ |
return 0 |
#define DISPATCH_TABLE_NAME __glapi_noop_table |
#define UNUSED_TABLE_NAME __usused_noop_functions |
#define TABLE_ENTRY(name) (void *) NoOp##name |
static int NoOpUnused(void) |
{ |
if (warn()) { |
warning_func(NULL, "GL User Error: calling extension function without a current context\n"); |
} |
return 0; |
} |
#include "glapitemp.h" |
/***** END NO-OP DISPATCH *****/ |
/***** BEGIN THREAD-SAFE DISPATCH *****/ |
/* if we support thread-safety, build a special dispatch table for use |
* in thread-safety mode (ThreadSafe == GL_TRUE). Each entry in the |
* dispatch table will call _glthread_GetTSD() to get the actual dispatch |
* table bound to the current thread, then jump through that table. |
*/ |
#if defined(THREADS) |
static GLboolean ThreadSafe = GL_FALSE; /* In thread-safe mode? */ |
static _glthread_TSD DispatchTSD; /* Per-thread dispatch pointer */ |
static _glthread_TSD RealDispatchTSD; /* only when using override */ |
static _glthread_TSD ContextTSD; /* Per-thread context pointer */ |
#define KEYWORD1 static |
#define KEYWORD2 GLAPIENTRY |
#define NAME(func) _ts_##func |
#define DISPATCH(FUNC, ARGS, MESSAGE) \ |
struct _glapi_table *dispatch; \ |
dispatch = (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); \ |
if (!dispatch) \ |
dispatch = (struct _glapi_table *) __glapi_noop_table; \ |
(dispatch->FUNC) ARGS |
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ |
struct _glapi_table *dispatch; \ |
dispatch = (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); \ |
if (!dispatch) \ |
dispatch = (struct _glapi_table *) __glapi_noop_table; \ |
return (dispatch->FUNC) ARGS |
#define DISPATCH_TABLE_NAME __glapi_threadsafe_table |
#define UNUSED_TABLE_NAME __usused_threadsafe_functions |
#define TABLE_ENTRY(name) (void *) _ts_##name |
static int _ts_Unused(void) |
{ |
return 0; |
} |
#include "glapitemp.h" |
#endif |
/***** END THREAD-SAFE DISPATCH *****/ |
struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table; |
struct _glapi_table *_glapi_RealDispatch = (struct _glapi_table *) __glapi_noop_table; |
/* Used when thread safety disabled */ |
void *_glapi_Context = NULL; |
static GLboolean DispatchOverride = GL_FALSE; |
/* strdup() is actually not a standard ANSI C or POSIX routine. |
* Irix will not define it if ANSI mode is in effect. |
*/ |
static char * |
str_dup(const char *str) |
{ |
char *copy; |
copy = (char*) malloc(strlen(str) + 1); |
if (!copy) |
return NULL; |
strcpy(copy, str); |
return copy; |
} |
/* |
* We should call this periodically from a function such as glXMakeCurrent |
* in order to test if multiple threads are being used. |
*/ |
void |
_glapi_check_multithread(void) |
{ |
#if defined(THREADS) |
if (!ThreadSafe) { |
static unsigned long knownID; |
static GLboolean firstCall = GL_TRUE; |
if (firstCall) { |
knownID = _glthread_GetID(); |
firstCall = GL_FALSE; |
} |
else if (knownID != _glthread_GetID()) { |
ThreadSafe = GL_TRUE; |
} |
} |
if (ThreadSafe) { |
/* make sure that this thread's dispatch pointer isn't null */ |
if (!_glapi_get_dispatch()) { |
_glapi_set_dispatch(NULL); |
} |
} |
#endif |
} |
/* |
* Set the current context pointer for this thread. |
* The context pointer is an opaque type which should be cast to |
* void from the real context pointer type. |
*/ |
void |
_glapi_set_context(void *context) |
{ |
#if defined(THREADS) |
_glthread_SetTSD(&ContextTSD, context); |
if (ThreadSafe) |
_glapi_Context = NULL; |
else |
_glapi_Context = context; |
#else |
_glapi_Context = context; |
#endif |
} |
/* |
* Get the current context pointer for this thread. |
* The context pointer is an opaque type which should be cast from |
* void to the real context pointer type. |
*/ |
void * |
_glapi_get_context(void) |
{ |
#if defined(THREADS) |
if (ThreadSafe) { |
return _glthread_GetTSD(&ContextTSD); |
} |
else { |
return _glapi_Context; |
} |
#else |
return _glapi_Context; |
#endif |
} |
/* |
* Set the global or per-thread dispatch table pointer. |
*/ |
void |
_glapi_set_dispatch(struct _glapi_table *dispatch) |
{ |
if (!dispatch) { |
/* use the no-op functions */ |
dispatch = (struct _glapi_table *) __glapi_noop_table; |
} |
#ifdef DEBUG |
else { |
_glapi_check_table(dispatch); |
} |
#endif |
#if defined(THREADS) |
if (DispatchOverride) { |
_glthread_SetTSD(&RealDispatchTSD, (void *) dispatch); |
if (ThreadSafe) |
_glapi_RealDispatch = (struct _glapi_table*) __glapi_threadsafe_table; |
else |
_glapi_RealDispatch = dispatch; |
} |
else { |
/* normal operation */ |
_glthread_SetTSD(&DispatchTSD, (void *) dispatch); |
if (ThreadSafe) |
_glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table; |
else |
_glapi_Dispatch = dispatch; |
} |
#else /*THREADS*/ |
if (DispatchOverride) { |
_glapi_RealDispatch = dispatch; |
} |
else { |
_glapi_Dispatch = dispatch; |
} |
#endif /*THREADS*/ |
} |
/* |
* Return pointer to current dispatch table for calling thread. |
*/ |
struct _glapi_table * |
_glapi_get_dispatch(void) |
{ |
#if defined(THREADS) |
if (ThreadSafe) { |
if (DispatchOverride) { |
return (struct _glapi_table *) _glthread_GetTSD(&RealDispatchTSD); |
} |
else { |
return (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); |
} |
} |
else { |
if (DispatchOverride) { |
assert(_glapi_RealDispatch); |
return _glapi_RealDispatch; |
} |
else { |
assert(_glapi_Dispatch); |
return _glapi_Dispatch; |
} |
} |
#else |
return _glapi_Dispatch; |
#endif |
} |
/* |
* Notes on dispatch overrride: |
* |
* Dispatch override allows an external agent to hook into the GL dispatch |
* mechanism before execution goes into the core rendering library. For |
* example, a trace mechanism would insert itself as an overrider, print |
* logging info for each GL function, then dispatch to the real GL function. |
* |
* libGLS (GL Stream library) is another agent that might use override. |
* |
* We don't allow more than one layer of overriding at this time. |
* In the future we may allow nested/layered override. In that case |
* _glapi_begin_dispatch_override() will return an override layer, |
* _glapi_end_dispatch_override(layer) will remove an override layer |
* and _glapi_get_override_dispatch(layer) will return the dispatch |
* table for a given override layer. layer = 0 will be the "real" |
* dispatch table. |
*/ |
/* |
* Return: dispatch override layer number. |
*/ |
int |
_glapi_begin_dispatch_override(struct _glapi_table *override) |
{ |
struct _glapi_table *real = _glapi_get_dispatch(); |
assert(!DispatchOverride); /* can't nest at this time */ |
DispatchOverride = GL_TRUE; |
_glapi_set_dispatch(real); |
#if defined(THREADS) |
_glthread_SetTSD(&DispatchTSD, (void *) override); |
if (ThreadSafe) |
_glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table; |
else |
_glapi_Dispatch = override; |
#else |
_glapi_Dispatch = override; |
#endif |
return 1; |
} |
void |
_glapi_end_dispatch_override(int layer) |
{ |
struct _glapi_table *real = _glapi_get_dispatch(); |
(void) layer; |
DispatchOverride = GL_FALSE; |
_glapi_set_dispatch(real); |
/* the rest of this isn't needed, just play it safe */ |
#if defined(THREADS) |
_glthread_SetTSD(&RealDispatchTSD, NULL); |
#endif |
_glapi_RealDispatch = NULL; |
} |
struct _glapi_table * |
_glapi_get_override_dispatch(int layer) |
{ |
if (layer == 0) { |
return _glapi_get_dispatch(); |
} |
else { |
if (DispatchOverride) { |
#if defined(THREADS) |
return (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); |
#else |
return _glapi_Dispatch; |
#endif |
} |
else { |
return NULL; |
} |
} |
} |
struct name_address_offset { |
const char *Name; |
GLvoid *Address; |
GLuint Offset; |
}; |
/* The code in this file is auto-generated with Python */ |
#include "glprocs.h" |
/* |
* Return dispatch table offset of the named static (built-in) function. |
* Return -1 if function not found. |
*/ |
static GLint |
get_static_proc_offset(const char *funcName) |
{ |
GLuint i; |
for (i = 0; static_functions[i].Name; i++) { |
if (strcmp(static_functions[i].Name, funcName) == 0) { |
return static_functions[i].Offset; |
} |
} |
return -1; |
} |
/* |
* Return dispatch function address the named static (built-in) function. |
* Return NULL if function not found. |
*/ |
static GLvoid * |
get_static_proc_address(const char *funcName) |
{ |
GLint i; |
for (i = 0; static_functions[i].Name; i++) { |
if (strcmp(static_functions[i].Name, funcName) == 0) { |
return static_functions[i].Address; |
} |
} |
return NULL; |
} |
/********************************************************************** |
* Extension function management. |
*/ |
/* |
* Number of extension functions which we can dynamically add at runtime. |
*/ |
#define MAX_EXTENSION_FUNCS 300 |
/* |
* The disptach table size (number of entries) is the sizeof the |
* _glapi_table struct plus the number of dynamic entries we can add. |
* The extra slots can be filled in by DRI drivers that register new extension |
* functions. |
*/ |
#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) |
static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; |
static GLuint NumExtEntryPoints = 0; |
#ifdef USE_SPARC_ASM |
extern void __glapi_sparc_icache_flush(unsigned int *); |
#endif |
/* |
* Generate a dispatch function (entrypoint) which jumps through |
* the given slot number (offset) in the current dispatch table. |
* We need assembly language in order to accomplish this. |
*/ |
static void * |
generate_entrypoint(GLuint functionOffset) |
{ |
#if defined(USE_X86_ASM) |
/* |
* This x86 code contributed by Josh Vanderhoof. |
* |
* 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax |
* 00 01 02 03 04 |
* 5: 85 c0 testl %eax,%eax |
* 05 06 |
* 7: 74 06 je f <entrypoint+0xf> |
* 07 08 |
* 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) |
* 09 0a 0b 0c 0d 0e |
* f: e8 fc ff ff ff call __glapi_get_dispatch |
* 0f 10 11 12 13 |
* 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) |
* 14 15 16 17 18 19 |
*/ |
static const unsigned char insn_template[] = { |
0xa1, 0x00, 0x00, 0x00, 0x00, |
0x85, 0xc0, |
0x74, 0x06, |
0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, |
0xe8, 0x00, 0x00, 0x00, 0x00, |
0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 |
}; |
unsigned char *code = (unsigned char *) malloc(sizeof(insn_template)); |
unsigned int next_insn; |
if (code) { |
memcpy(code, insn_template, sizeof(insn_template)); |
*(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; |
*(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; |
next_insn = (unsigned int)(code + 0x14); |
*(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; |
*(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; |
} |
return code; |
#elif defined(USE_SPARC_ASM) |
#ifdef __sparc_v9__ |
static const unsigned int insn_template[] = { |
0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */ |
0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ |
0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */ |
0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */ |
0x8528b020, /* sllx %g2, 32, %g2 */ |
0xc2584002, /* ldx [%g1 + %g2], %g1 */ |
0x05000000, /* sethi %hi(8 * glapioffset), %g2 */ |
0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */ |
0xc6584002, /* ldx [%g1 + %g2], %g3 */ |
0x81c0c000, /* jmpl %g3, %g0 */ |
0x01000000 /* nop */ |
}; |
#else |
static const unsigned int insn_template[] = { |
0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ |
0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ |
0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */ |
0x81c0c000, /* jmpl %g3, %g0 */ |
0x01000000 /* nop */ |
}; |
#endif |
unsigned int *code = (unsigned int *) malloc(sizeof(insn_template)); |
unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch; |
if (code) { |
memcpy(code, insn_template, sizeof(insn_template)); |
#ifdef __sparc_v9__ |
code[0] |= (glapi_addr >> (32 + 10)); |
code[1] |= ((glapi_addr & 0xffffffff) >> 10); |
__glapi_sparc_icache_flush(&code[0]); |
code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1)); |
code[3] |= (glapi_addr & ((1 << 10) - 1)); |
__glapi_sparc_icache_flush(&code[2]); |
code[6] |= ((functionOffset * 8) >> 10); |
code[7] |= ((functionOffset * 8) & ((1 << 10) - 1)); |
__glapi_sparc_icache_flush(&code[6]); |
#else |
code[0] |= (glapi_addr >> 10); |
code[1] |= (glapi_addr & ((1 << 10) - 1)); |
__glapi_sparc_icache_flush(&code[0]); |
code[2] |= (functionOffset * 4); |
__glapi_sparc_icache_flush(&code[2]); |
#endif |
} |
return code; |
#else |
return NULL; |
#endif /* USE_*_ASM */ |
} |
/* |
* This function inserts a new dispatch offset into the assembly language |
* stub that was generated with the preceeding function. |
*/ |
static void |
fill_in_entrypoint_offset(void *entrypoint, GLuint offset) |
{ |
#if defined(USE_X86_ASM) |
unsigned char *code = (unsigned char *) entrypoint; |
*(unsigned int *)(code + 0x0b) = offset * 4; |
*(unsigned int *)(code + 0x16) = offset * 4; |
#elif defined(USE_SPARC_ASM) |
/* XXX this hasn't been tested! */ |
unsigned int *code = (unsigned int *) entrypoint; |
#ifdef __sparc_v9__ |
code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */ |
code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */ |
code[6] |= ((offset * 8) >> 10); |
code[7] |= ((offset * 8) & ((1 << 10) - 1)); |
__glapi_sparc_icache_flush(&code[6]); |
#else /* __sparc_v9__ */ |
code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */ |
code[2] |= (offset * 4); |
__glapi_sparc_icache_flush(&code[2]); |
#endif /* __sparc_v9__ */ |
#endif /* USE_*_ASM */ |
} |
/* |
* Add a new extension function entrypoint. |
* Return: GL_TRUE = success or GL_FALSE = failure |
*/ |
GLboolean |
_glapi_add_entrypoint(const char *funcName, GLuint offset) |
{ |
/* trivial rejection test */ |
if (!funcName || funcName[0] != 'g' || funcName[1] != 'l') |
return GL_FALSE; |
/* first check if the named function is already statically present */ |
{ |
GLint index = get_static_proc_offset(funcName); |
if (index >= 0) { |
return (GLboolean) ((GLuint) index == offset); /* bad offset! */ |
} |
} |
/* See if this function has already been dynamically added */ |
{ |
GLuint i; |
for (i = 0; i < NumExtEntryPoints; i++) { |
if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { |
/* function already registered */ |
if (ExtEntryTable[i].Offset == offset) { |
return GL_TRUE; /* offsets match */ |
} |
else if (ExtEntryTable[i].Offset == ~0 |
&& offset < DISPATCH_TABLE_SIZE) { |
/* need to patch-up the dispatch code */ |
if (offset != ~0) { |
fill_in_entrypoint_offset(ExtEntryTable[i].Address, offset); |
ExtEntryTable[i].Offset = offset; |
} |
return GL_TRUE; |
} |
else { |
return GL_FALSE; /* bad offset! */ |
} |
} |
} |
} |
/* This is a new function, try to add it. */ |
if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS || |
offset >= DISPATCH_TABLE_SIZE) { |
/* No space left */ |
return GL_FALSE; |
} |
else { |
void *entrypoint = generate_entrypoint(offset); |
if (!entrypoint) |
return GL_FALSE; /* couldn't generate assembly */ |
/* OK! */ |
ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); |
ExtEntryTable[NumExtEntryPoints].Offset = offset; |
ExtEntryTable[NumExtEntryPoints].Address = entrypoint; |
NumExtEntryPoints++; |
return GL_TRUE; /* success */ |
} |
/* should never get here, silence compiler warnings */ |
return GL_FALSE; |
} |
/* |
* Return offset of entrypoint for named function within dispatch table. |
*/ |
GLint |
_glapi_get_proc_offset(const char *funcName) |
{ |
/* search extension functions first */ |
GLuint i; |
for (i = 0; i < NumExtEntryPoints; i++) { |
if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { |
return ExtEntryTable[i].Offset; |
} |
} |
/* search static functions */ |
return get_static_proc_offset(funcName); |
} |
/* |
* Return entrypoint for named function. |
*/ |
const GLvoid * |
_glapi_get_proc_address(const char *funcName) |
{ |
/* search extension functions first */ |
GLuint i; |
for (i = 0; i < NumExtEntryPoints; i++) { |
if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { |
return ExtEntryTable[i].Address; |
} |
} |
/* search static functions */ |
{ |
const GLvoid *func = get_static_proc_address(funcName); |
if (func) |
return func; |
} |
/* generate new entrypoint - use a temporary dispatch offset of |
* ~0 (i.e. -1). Later, when the driver calls _glapi_add_entrypoint() |
* we'll put in the proper offset. If that never happens, and the |
* user calls this function, he'll segfault. That's what you get |
* when you try calling a GL function that doesn't really exist. |
*/ |
if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) { |
GLvoid *entrypoint = generate_entrypoint(~0); |
if (!entrypoint) |
return GL_FALSE; |
ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); |
ExtEntryTable[NumExtEntryPoints].Offset = ~0; |
ExtEntryTable[NumExtEntryPoints].Address = entrypoint; |
NumExtEntryPoints++; |
return entrypoint; |
} |
else { |
/* no space for new functions! */ |
return NULL; |
} |
} |
/* |
* Return the name of the function at the given dispatch offset. |
* This is only intended for debugging. |
*/ |
const char * |
_glapi_get_proc_name(GLuint offset) |
{ |
const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); |
GLuint i; |
/* search built-in functions */ |
for (i = 0; i < n; i++) { |
if (static_functions[i].Offset == offset) |
return static_functions[i].Name; |
} |
/* search added extension functions */ |
for (i = 0; i < NumExtEntryPoints; i++) { |
if (ExtEntryTable[i].Offset == offset) { |
return ExtEntryTable[i].Name; |
} |
} |
return NULL; |
} |
/* |
* Return size of dispatch table struct as number of functions (or |
* slots). |
*/ |
GLuint |
_glapi_get_dispatch_table_size(void) |
{ |
return DISPATCH_TABLE_SIZE; |
} |
/* |
* Get API dispatcher version string. |
*/ |
const char * |
_glapi_get_version(void) |
{ |
return "20021001"; /* YYYYMMDD */ |
} |
/* |
* Make sure there are no NULL pointers in the given dispatch table. |
* Intended for debugging purposes. |
*/ |
void |
_glapi_check_table(const struct _glapi_table *table) |
{ |
#ifdef DEBUG |
const GLuint entries = _glapi_get_dispatch_table_size(); |
const void **tab = (const void **) table; |
GLuint i; |
for (i = 1; i < entries; i++) { |
assert(tab[i]); |
} |
/* Do some spot checks to be sure that the dispatch table |
* slots are assigned correctly. |
*/ |
{ |
GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); |
char *BeginFunc = (char*) &table->Begin; |
GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); |
assert(BeginOffset == _gloffset_Begin); |
assert(BeginOffset == offset); |
} |
{ |
GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); |
char *viewportFunc = (char*) &table->Viewport; |
GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); |
assert(viewportOffset == _gloffset_Viewport); |
assert(viewportOffset == offset); |
} |
{ |
GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); |
char *VertexPointerFunc = (char*) &table->VertexPointer; |
GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); |
assert(VertexPointerOffset == _gloffset_VertexPointer); |
assert(VertexPointerOffset == offset); |
} |
{ |
GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); |
char *ResetMinMaxFunc = (char*) &table->ResetMinmax; |
GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); |
assert(ResetMinMaxOffset == _gloffset_ResetMinmax); |
assert(ResetMinMaxOffset == offset); |
} |
{ |
GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); |
char *blendColorFunc = (char*) &table->BlendColor; |
GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); |
assert(blendColorOffset == _gloffset_BlendColor); |
assert(blendColorOffset == offset); |
} |
{ |
GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); |
char *istextureFunc = (char*) &table->IsTextureEXT; |
GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); |
assert(istextureOffset == _gloffset_IsTextureEXT); |
assert(istextureOffset == offset); |
} |
{ |
GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT"); |
char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT; |
GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); |
assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT); |
assert(secondaryColor3fOffset == offset); |
assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (void *) &glSecondaryColor3fEXT); |
} |
{ |
GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); |
char *pointParameterivFunc = (char*) &table->PointParameterivNV; |
GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); |
assert(pointParameterivOffset == _gloffset_PointParameterivNV); |
assert(pointParameterivOffset == offset); |
assert(_glapi_get_proc_address("glPointParameterivNV") == (void *) &glPointParameterivNV); |
} |
{ |
GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); |
char *setFenceFunc = (char*) &table->SetFenceNV; |
GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); |
assert(setFenceOffset == _gloffset_SetFenceNV); |
assert(setFenceOffset == offset); |
assert(_glapi_get_proc_address("glSetFenceNV") == (void *) &glSetFenceNV); |
} |
#endif |
} |
/shark/tags/rel_0_4/ports/mesa/src/buffers.c |
---|
0,0 → 1,476 |
/* $Id: buffers.c,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "accum.h" |
#include "buffers.h" |
#include "colormac.h" |
#include "context.h" |
#include "depth.h" |
#include "enums.h" |
#include "macros.h" |
#include "stencil.h" |
#include "state.h" |
#include "mtypes.h" |
void |
_mesa_ClearIndex( GLfloat c ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Color.ClearIndex == (GLuint) c) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.ClearIndex = (GLuint) c; |
if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { |
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ |
(*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); |
} |
} |
void |
_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) |
{ |
GLfloat tmp[4]; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
tmp[0] = CLAMP(red, 0.0F, 1.0F); |
tmp[1] = CLAMP(green, 0.0F, 1.0F); |
tmp[2] = CLAMP(blue, 0.0F, 1.0F); |
tmp[3] = CLAMP(alpha, 0.0F, 1.0F); |
if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) |
return; /* no change */ |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
COPY_4V(ctx->Color.ClearColor, tmp); |
if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { |
/* it's OK to call glClearColor in CI mode but it should be a NOP */ |
(*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); |
} |
} |
void |
_mesa_Clear( GLbitfield mask ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glClear 0x%x\n", mask); |
if (mask & ~(GL_COLOR_BUFFER_BIT | |
GL_DEPTH_BUFFER_BIT | |
GL_STENCIL_BUFFER_BIT | |
GL_ACCUM_BUFFER_BIT)) { |
/* invalid bit set */ |
_mesa_error( ctx, GL_INVALID_VALUE, "glClear(mask)"); |
return; |
} |
if (ctx->NewState) { |
_mesa_update_state( ctx ); /* update _Xmin, etc */ |
} |
if (ctx->RenderMode==GL_RENDER) { |
const GLint x = ctx->DrawBuffer->_Xmin; |
const GLint y = ctx->DrawBuffer->_Ymin; |
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; |
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; |
GLbitfield ddMask; |
/* don't clear depth buffer if depth writing disabled */ |
if (!ctx->Depth.Mask) |
mask &= ~GL_DEPTH_BUFFER_BIT; |
/* Build bitmask to send to driver Clear function */ |
ddMask = mask & (GL_DEPTH_BUFFER_BIT | |
GL_STENCIL_BUFFER_BIT | |
GL_ACCUM_BUFFER_BIT); |
if (mask & GL_COLOR_BUFFER_BIT) { |
ddMask |= ctx->Color._DrawDestMask; |
} |
ASSERT(ctx->Driver.Clear); |
ctx->Driver.Clear( ctx, ddMask, (GLboolean) !ctx->Scissor.Enabled, |
x, y, width, height ); |
} |
} |
void |
_mesa_DrawBuffer( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); |
/* |
* Do error checking and compute the _DrawDestMask bitfield. |
*/ |
switch (mode) { |
case GL_RIGHT: |
if (!ctx->Visual.stereoMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return;} |
if (ctx->Visual.doubleBufferMode) |
ctx->Color._DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; |
else |
ctx->Color._DrawDestMask = FRONT_RIGHT_BIT; |
break; |
case GL_FRONT_RIGHT: |
if (!ctx->Visual.stereoMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return; |
} |
ctx->Color._DrawDestMask = FRONT_RIGHT_BIT; |
break; |
case GL_BACK_RIGHT: |
if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return; |
} |
ctx->Color._DrawDestMask = BACK_RIGHT_BIT; |
break; |
case GL_BACK_LEFT: |
if (!ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return; |
} |
ctx->Color._DrawDestMask = BACK_LEFT_BIT; |
break; |
case GL_FRONT_AND_BACK: |
if (!ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return; |
} |
if (ctx->Visual.stereoMode) |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT |
| FRONT_RIGHT_BIT | BACK_RIGHT_BIT; |
else |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; |
break; |
case GL_BACK: |
if (!ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); |
return; |
} |
if (ctx->Visual.stereoMode) |
ctx->Color._DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; |
else |
ctx->Color._DrawDestMask = BACK_LEFT_BIT; |
break; |
case GL_LEFT: |
/* never an error */ |
if (ctx->Visual.doubleBufferMode) |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; |
else |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT; |
break; |
case GL_FRONT_LEFT: |
/* never an error */ |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT; |
break; |
case GL_FRONT: |
/* never an error */ |
if (ctx->Visual.stereoMode) |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; |
else |
ctx->Color._DrawDestMask = FRONT_LEFT_BIT; |
break; |
case GL_NONE: |
/* never an error */ |
ctx->Color._DrawDestMask = 0; |
break; |
case GL_AUX0: |
if (ctx->Const.NumAuxBuffers >= 1) { |
ctx->Color._DrawDestMask = AUX0_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX0)" ); |
return; |
} |
break; |
case GL_AUX1: |
if (ctx->Const.NumAuxBuffers >= 2) { |
ctx->Color._DrawDestMask = AUX1_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX1)" ); |
return; |
} |
break; |
case GL_AUX2: |
if (ctx->Const.NumAuxBuffers >= 3) { |
ctx->Color._DrawDestMask = AUX2_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX2)" ); |
return; |
} |
break; |
case GL_AUX3: |
if (ctx->Const.NumAuxBuffers >= 4) { |
ctx->Color._DrawDestMask = AUX3_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX3)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); |
return; |
} |
ctx->Color.DrawBuffer = mode; |
ctx->NewState |= _NEW_COLOR; |
/* |
* Call device driver function. |
*/ |
if (ctx->Driver.DrawBuffer) |
(*ctx->Driver.DrawBuffer)(ctx, mode); |
} |
void |
_mesa_ReadBuffer( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); |
/* |
* Do error checking and compute ctx->Pixel._ReadSrcMask. |
*/ |
switch (mode) { |
case GL_LEFT: |
case GL_FRONT: |
case GL_FRONT_LEFT: |
/* Front-Left buffer, always exists */ |
ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; |
break; |
case GL_BACK: |
case GL_BACK_LEFT: |
/* Back-Left buffer, requires double buffering */ |
if (!ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); |
return; |
} |
ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; |
break; |
case GL_FRONT_RIGHT: |
case GL_RIGHT: |
if (!ctx->Visual.stereoMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); |
return; |
} |
ctx->Pixel._ReadSrcMask = FRONT_RIGHT_BIT; |
break; |
case GL_BACK_RIGHT: |
if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); |
return; |
} |
ctx->Pixel._ReadSrcMask = BACK_RIGHT_BIT; |
break; |
case GL_AUX0: |
if (ctx->Const.NumAuxBuffers >= 1) { |
ctx->Pixel._ReadSrcMask = AUX0_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX0)" ); |
return; |
} |
break; |
case GL_AUX1: |
if (ctx->Const.NumAuxBuffers >= 2) { |
ctx->Pixel._ReadSrcMask = AUX1_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX1)" ); |
return; |
} |
break; |
case GL_AUX2: |
if (ctx->Const.NumAuxBuffers >= 3) { |
ctx->Pixel._ReadSrcMask = AUX2_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX2)" ); |
return; |
} |
break; |
case GL_AUX3: |
if (ctx->Const.NumAuxBuffers >= 4) { |
ctx->Pixel._ReadSrcMask = AUX3_BIT; |
} |
else { |
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX3)" ); |
return; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); |
return; |
} |
ctx->Pixel.ReadBuffer = mode; |
ctx->NewState |= _NEW_PIXEL; |
/* |
* Call device driver function. |
*/ |
if (ctx->Driver.ReadBuffer) |
(*ctx->Driver.ReadBuffer)(ctx, mode); |
} |
/* |
* GL_MESA_resize_buffers extension |
* When this function is called, we'll ask the window system how large |
* the current window is. If it's not what we expect, we'll have to |
* resize/reallocate the software accum/stencil/depth/alpha buffers. |
*/ |
void |
_mesa_ResizeBuffersMESA( void ) |
{ |
GLcontext *ctx = _mesa_get_current_context(); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glResizeBuffersMESA\n"); |
if (ctx) { |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); |
if (ctx->DrawBuffer) { |
GLuint buf_width, buf_height; |
GLframebuffer *buffer = ctx->DrawBuffer; |
/* ask device driver for size of output buffer */ |
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height ); |
/* see if size of device driver's color buffer (window) has changed */ |
if (buffer->Width == buf_width && buffer->Height == buf_height) |
return; /* size is as expected */ |
buffer->Width = buf_width; |
buffer->Height = buf_height; |
ctx->Driver.ResizeBuffers( buffer ); |
} |
if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer) { |
GLuint buf_width, buf_height; |
GLframebuffer *buffer = ctx->DrawBuffer; |
/* ask device driver for size of output buffer */ |
(*ctx->Driver.GetBufferSize)( buffer, &buf_width, &buf_height ); |
/* see if size of device driver's color buffer (window) has changed */ |
if (buffer->Width == buf_width && buffer->Height == buf_height) |
return; /* size is as expected */ |
buffer->Width = buf_width; |
buffer->Height = buf_height; |
ctx->Driver.ResizeBuffers( buffer ); |
} |
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ |
} |
} |
void |
_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); |
return; |
} |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); |
if (x == ctx->Scissor.X && |
y == ctx->Scissor.Y && |
width == ctx->Scissor.Width && |
height == ctx->Scissor.Height) |
return; |
FLUSH_VERTICES(ctx, _NEW_SCISSOR); |
ctx->Scissor.X = x; |
ctx->Scissor.Y = y; |
ctx->Scissor.Width = width; |
ctx->Scissor.Height = height; |
if (ctx->Driver.Scissor) |
ctx->Driver.Scissor( ctx, x, y, width, height ); |
} |
/* |
* XXX move somewhere else someday? |
*/ |
void |
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) |
{ |
GLcontext *ctx = _mesa_get_current_context(); |
if (!ctx->Extensions.ARB_multisample) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); |
return; |
} |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); |
ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); |
ctx->Multisample.SampleCoverageInvert = invert; |
ctx->NewState |= _NEW_MULTISAMPLE; |
} |
/shark/tags/rel_0_4/ports/mesa/src/texformat_tmp.h |
---|
0,0 → 1,461 |
/* $Id: texformat_tmp.h,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Gareth Hughes |
* Brian Paul |
*/ |
/* |
* This template file generates texel fetch functions for 1-D, 2-D and 3-D |
* texture images. |
*/ |
#if DIM == 1 |
#define CHAN_SRC( t, i, j, k, sz ) \ |
((GLchan *)(t)->Data + (i) * (sz)) |
#define UBYTE_SRC( t, i, j, k, sz ) \ |
((GLubyte *)(t)->Data + (i) * (sz)) |
#define USHORT_SRC( t, i, j, k ) \ |
((GLushort *)(t)->Data + (i)) |
#define FLOAT_SRC( t, i, j, k ) \ |
((GLfloat *)(t)->Data + (i)) |
#define FETCH(x) fetch_1d_texel_##x |
#elif DIM == 2 |
#define CHAN_SRC( t, i, j, k, sz ) \ |
((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) |
#define UBYTE_SRC( t, i, j, k, sz ) \ |
((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) |
#define USHORT_SRC( t, i, j, k ) \ |
((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))) |
#define FLOAT_SRC( t, i, j, k ) \ |
((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i))) |
#define FETCH(x) fetch_2d_texel_##x |
#elif DIM == 3 |
#define CHAN_SRC( t, i, j, k, sz ) \ |
(GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ |
(t)->RowStride + (i)) * (sz) |
#define UBYTE_SRC( t, i, j, k, sz ) \ |
((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ |
(t)->RowStride + (i)) * (sz)) |
#define USHORT_SRC( t, i, j, k ) \ |
((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ |
(t)->RowStride + (i))) |
#define FLOAT_SRC( t, i, j, k ) \ |
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ |
(t)->RowStride + (i))) |
#define FETCH(x) fetch_3d_texel_##x |
#else |
#error illegal number of texture dimensions |
#endif |
static void FETCH(rgba)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 ); |
GLchan *rgba = (GLchan *) texel; |
COPY_CHAN4( rgba, src ); |
} |
static void FETCH(rgb)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 3 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = src[0]; |
rgba[GCOMP] = src[1]; |
rgba[BCOMP] = src[2]; |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(alpha)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = 0; |
rgba[GCOMP] = 0; |
rgba[BCOMP] = 0; |
rgba[ACOMP] = src[0]; |
} |
static void FETCH(luminance)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = src[0]; |
rgba[GCOMP] = src[0]; |
rgba[BCOMP] = src[0]; |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 2 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = src[0]; |
rgba[GCOMP] = src[0]; |
rgba[BCOMP] = src[0]; |
rgba[ACOMP] = src[1]; |
} |
static void FETCH(intensity)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = src[0]; |
rgba[GCOMP] = src[0]; |
rgba[BCOMP] = src[0]; |
rgba[ACOMP] = src[0]; |
} |
static void FETCH(color_index)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLchan *src = CHAN_SRC( texImage, i, j, k, 1 ); |
GLchan *index = (GLchan *) texel; |
*index = *src; |
} |
static void FETCH(depth_component)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLfloat *src = FLOAT_SRC( texImage, i, j, k ); |
GLfloat *depth = (GLfloat *) texel; |
*depth = *src; |
} |
static void FETCH(rgba8888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[3] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[0] ); |
} |
static void FETCH(argb8888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[3] ); |
} |
static void FETCH(rgb888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(rgb565)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(argb4444)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); |
rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf ); |
} |
static void FETCH(argb1555)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f ); |
rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); |
} |
static void FETCH(al88)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[1] ); |
} |
static void FETCH(rgb332)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
const GLubyte s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(a8)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = 0; |
rgba[GCOMP] = 0; |
rgba[BCOMP] = 0; |
rgba[ACOMP] = UBYTE_TO_CHAN( src[0] ); |
} |
static void FETCH(l8)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(i8)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[0] ); |
} |
static void FETCH(ci8)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
GLchan *index = (GLchan *) texel; |
*index = UBYTE_TO_CHAN( *src ); |
} |
/* XXX this may break if GLchan != GLubyte */ |
static void FETCH(ycbcr)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ |
const GLushort *src1 = src0 + 1; /* odd */ |
const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ |
const GLubyte cb = *src0 & 0xff; /* chroma U */ |
const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ |
const GLubyte cr = *src1 & 0xff; /* chroma V */ |
GLchan *rgba = (GLchan *) texel; |
GLint r, g, b; |
if (i & 1) { |
/* odd pixel: use y1,cr,cb */ |
r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); |
g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); |
b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); |
} |
else { |
/* even pixel: use y0,cr,cb */ |
r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); |
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); |
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); |
} |
rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); |
rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); |
rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); |
rgba[ACOMP] = CHAN_MAX; |
} |
/* XXX this may break if GLchan != GLubyte */ |
static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ |
const GLushort *src1 = src0 + 1; /* odd */ |
const GLubyte y0 = *src0 & 0xff; /* luminance */ |
const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma U */ |
const GLubyte y1 = *src1 & 0xff; /* luminance */ |
const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma V */ |
GLchan *rgba = (GLchan *) texel; |
GLint r, g, b; |
if (i & 1) { |
/* odd pixel: use y1,cr,cb */ |
r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); |
g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); |
b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); |
} |
else { |
/* even pixel: use y0,cr,cb */ |
r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); |
g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); |
b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); |
} |
rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); |
rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); |
rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); |
rgba[ACOMP] = CHAN_MAX; |
} |
/* big-endian */ |
#if 0 |
static void FETCH(abgr8888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[3] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[0] ); |
} |
static void FETCH(bgra8888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[3] ); |
} |
static void FETCH(bgr888)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(bgr565)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 ); |
rgba[ACOMP] = CHAN_MAX; |
} |
static void FETCH(bgra4444)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); |
rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf ); |
} |
static void FETCH(bgra5551)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLushort *src = USHORT_SRC( texImage, i, j, k ); |
const GLushort s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f ); |
rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); |
} |
static void FETCH(la88)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 ); |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[GCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); |
rgba[ACOMP] = UBYTE_TO_CHAN( src[1] ); |
} |
static void FETCH(bgr233)( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); |
const GLubyte s = *src; |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 ); |
rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 ); |
rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 ); |
rgba[ACOMP] = CHAN_MAX; |
} |
#endif |
#undef CHAN_SRC |
#undef UBYTE_SRC |
#undef USHORT_SRC |
#undef FLOAT_SRC |
#undef FETCH |
#undef DIM |
/shark/tags/rel_0_4/ports/mesa/src/vpexec.h |
---|
0,0 → 1,45 |
/* $Id: vpexec.h,v 1.1 2003-02-28 11:42:06 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Authors: |
* Brian Paul |
*/ |
#ifndef VPEXEC_H |
#define VPEXEC_H |
extern void |
_mesa_init_vp_registers(GLcontext *ctx); |
extern void |
_mesa_init_tracked_matrices(GLcontext *ctx); |
extern void |
_mesa_exec_program(GLcontext *ctx, const struct vp_program *program); |
extern void |
_mesa_dump_vp_machine( const struct vp_machine *machine ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/rastpos.h |
---|
0,0 → 1,185 |
/* $Id: rastpos.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef RASTPOS_H |
#define RASTPOS_H |
#include "glheader.h" |
extern void |
_mesa_RasterPos2d(GLdouble x, GLdouble y); |
extern void |
_mesa_RasterPos2f(GLfloat x, GLfloat y); |
extern void |
_mesa_RasterPos2i(GLint x, GLint y); |
extern void |
_mesa_RasterPos2s(GLshort x, GLshort y); |
extern void |
_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z); |
extern void |
_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z); |
extern void |
_mesa_RasterPos3i(GLint x, GLint y, GLint z); |
extern void |
_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z); |
extern void |
_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
extern void |
_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
extern void |
_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w); |
extern void |
_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); |
extern void |
_mesa_RasterPos2dv(const GLdouble *v); |
extern void |
_mesa_RasterPos2fv(const GLfloat *v); |
extern void |
_mesa_RasterPos2iv(const GLint *v); |
extern void |
_mesa_RasterPos2sv(const GLshort *v); |
extern void |
_mesa_RasterPos3dv(const GLdouble *v); |
extern void |
_mesa_RasterPos3fv(const GLfloat *v); |
extern void |
_mesa_RasterPos3iv(const GLint *v); |
extern void |
_mesa_RasterPos3sv(const GLshort *v); |
extern void |
_mesa_RasterPos4dv(const GLdouble *v); |
extern void |
_mesa_RasterPos4fv(const GLfloat *v); |
extern void |
_mesa_RasterPos4iv(const GLint *v); |
extern void |
_mesa_RasterPos4sv(const GLshort *v); |
/**********************************************************************/ |
/*** GL_MESA_window_pos ***/ |
/**********************************************************************/ |
extern void |
_mesa_WindowPos2dMESA(GLdouble x, GLdouble y); |
extern void |
_mesa_WindowPos2fMESA(GLfloat x, GLfloat y); |
extern void |
_mesa_WindowPos2iMESA(GLint x, GLint y); |
extern void |
_mesa_WindowPos2sMESA(GLshort x, GLshort y); |
extern void |
_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); |
extern void |
_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); |
extern void |
_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); |
extern void |
_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); |
extern void |
_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
extern void |
_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
extern void |
_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); |
extern void |
_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); |
extern void |
_mesa_WindowPos2dvMESA(const GLdouble *v); |
extern void |
_mesa_WindowPos2fvMESA(const GLfloat *v); |
extern void |
_mesa_WindowPos2ivMESA(const GLint *v); |
extern void |
_mesa_WindowPos2svMESA(const GLshort *v); |
extern void |
_mesa_WindowPos3dvMESA(const GLdouble *v); |
extern void |
_mesa_WindowPos3fvMESA(const GLfloat *v); |
extern void |
_mesa_WindowPos3ivMESA(const GLint *v); |
extern void |
_mesa_WindowPos3svMESA(const GLshort *v); |
extern void |
_mesa_WindowPos4dvMESA(const GLdouble *v); |
extern void |
_mesa_WindowPos4fvMESA(const GLfloat *v); |
extern void |
_mesa_WindowPos4ivMESA(const GLint *v); |
extern void |
_mesa_WindowPos4svMESA(const GLshort *v); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texobj.h |
---|
0,0 → 1,90 |
/* $Id: texobj.h,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef TEXTOBJ_H |
#define TEXTOBJ_H |
#include "mtypes.h" |
/* |
* Internal functions |
*/ |
extern struct gl_texture_object * |
_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name, |
GLenum target ); |
extern void |
_mesa_free_texture_object( struct gl_shared_state *shared, |
struct gl_texture_object *t ); |
extern void |
_mesa_copy_texture_object( struct gl_texture_object *dest, |
const struct gl_texture_object *src ); |
extern void |
_mesa_test_texobj_completeness( const GLcontext *ctx, |
struct gl_texture_object *t ); |
/* |
* API functions |
*/ |
extern void |
_mesa_GenTextures( GLsizei n, GLuint *textures ); |
extern void |
_mesa_DeleteTextures( GLsizei n, const GLuint *textures ); |
extern void |
_mesa_BindTexture( GLenum target, GLuint texture ); |
extern void |
_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures, |
const GLclampf *priorities ); |
extern GLboolean |
_mesa_AreTexturesResident( GLsizei n, const GLuint *textures, |
GLboolean *residences ); |
extern GLboolean |
_mesa_IsTexture( GLuint texture ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/buffers.h |
---|
0,0 → 1,61 |
/* $Id: buffers.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef BUFFERS_H |
#define BUFFERS_H |
#include "mtypes.h" |
extern void |
_mesa_ClearIndex( GLfloat c ); |
extern void |
_mesa_ClearColor( GLclampf red, GLclampf green, |
GLclampf blue, GLclampf alpha ); |
extern void |
_mesa_Clear( GLbitfield mask ); |
extern void |
_mesa_DrawBuffer( GLenum mode ); |
extern void |
_mesa_ReadBuffer( GLenum mode ); |
extern void |
_mesa_ResizeBuffersMESA( void ); |
extern void |
_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); |
extern void |
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glapi.h |
---|
0,0 → 1,110 |
/* $Id: glapi.h,v 1.1 2003-02-28 11:42:01 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef _GLAPI_H |
#define _GLAPI_H |
#include "GL/gl.h" |
struct _glapi_table; |
typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); |
extern void *_glapi_Context; |
extern struct _glapi_table *_glapi_Dispatch; |
extern void |
_glapi_noop_enable_warnings(GLboolean enable); |
extern void |
_glapi_set_warning_func(_glapi_warning_func func); |
extern void |
_glapi_check_multithread(void); |
extern void |
_glapi_set_context(void *context); |
extern void * |
_glapi_get_context(void); |
extern void |
_glapi_set_dispatch(struct _glapi_table *dispatch); |
extern struct _glapi_table * |
_glapi_get_dispatch(void); |
extern int |
_glapi_begin_dispatch_override(struct _glapi_table *override); |
extern void |
_glapi_end_dispatch_override(int layer); |
struct _glapi_table * |
_glapi_get_override_dispatch(int layer); |
extern GLuint |
_glapi_get_dispatch_table_size(void); |
extern const char * |
_glapi_get_version(void); |
extern void |
_glapi_check_table(const struct _glapi_table *table); |
extern GLboolean |
_glapi_add_entrypoint(const char *funcName, GLuint offset); |
extern GLint |
_glapi_get_proc_offset(const char *funcName); |
extern const GLvoid * |
_glapi_get_proc_address(const char *funcName); |
extern const char * |
_glapi_get_proc_name(GLuint offset); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/teximage.c |
---|
0,0 → 1,2938 |
/* $Id: teximage.c,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "convolve.h" |
#include "image.h" |
#include "imports.h" |
#include "macros.h" |
#include "mmath.h" |
#include "state.h" |
#include "texcompress.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "texstate.h" |
#include "texstore.h" |
#include "mtypes.h" |
/* |
* NOTES: |
* |
* Mesa's native texture datatype is GLchan. Native formats are |
* GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, GL_RGBA, |
* and GL_COLOR_INDEX. |
* Device drivers are free to implement any internal format they want. |
*/ |
#if 0 |
static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) |
{ |
#if CHAN_TYPE == GL_FLOAT |
_mesa_problem(NULL, "PrintTexture doesn't support float channels"); |
#else |
GLuint i, j, c; |
const GLchan *data = (const GLchan *) img->Data; |
if (!data) { |
_mesa_printf("No texture data\n"); |
return; |
} |
switch (img->Format) { |
case GL_ALPHA: |
case GL_LUMINANCE: |
case GL_INTENSITY: |
case GL_COLOR_INDEX: |
c = 1; |
break; |
case GL_LUMINANCE_ALPHA: |
c = 2; |
break; |
case GL_RGB: |
c = 3; |
break; |
case GL_RGBA: |
c = 4; |
break; |
default: |
_mesa_problem(NULL, "error in PrintTexture\n"); |
return; |
} |
for (i = 0; i < img->Height; i++) { |
for (j = 0; j < img->Width; j++) { |
if (c==1) |
_mesa_printf("%02x ", data[0]); |
else if (c==2) |
_mesa_printf("%02x%02x ", data[0], data[1]); |
else if (c==3) |
_mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); |
else if (c==4) |
_mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); |
data += (img->RowStride - img->Width) * c; |
} |
_mesa_printf("\n"); |
} |
#endif |
} |
#endif |
/* |
* Compute log base 2 of n. |
* If n isn't an exact power of two return -1. |
* If n < 0 return -1. |
*/ |
static int |
logbase2( int n ) |
{ |
GLint i = 1; |
GLint log2 = 0; |
if (n < 0) { |
return -1; |
} |
while ( n > i ) { |
i *= 2; |
log2++; |
} |
if (i != n) { |
return -1; |
} |
else { |
return log2; |
} |
} |
/* |
* Given an internal texture format enum or 1, 2, 3, 4 return the |
* corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, |
* GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. |
* |
* This is the format which is used during texture application (i.e. the |
* texture format and env mode determine the arithmetic used. |
* |
* Return -1 if invalid enum. |
*/ |
GLint |
_mesa_base_tex_format( GLcontext *ctx, GLint format ) |
{ |
/* |
* Ask the driver for the base format, if it doesn't |
* know, it will return -1; |
*/ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return GL_ALPHA; |
case 1: |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return GL_LUMINANCE; |
case 2: |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return GL_LUMINANCE_ALPHA; |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
return GL_INTENSITY; |
case 3: |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return GL_RGB; |
case 4: |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return GL_RGBA; |
case GL_COLOR_INDEX: |
case GL_COLOR_INDEX1_EXT: |
case GL_COLOR_INDEX2_EXT: |
case GL_COLOR_INDEX4_EXT: |
case GL_COLOR_INDEX8_EXT: |
case GL_COLOR_INDEX12_EXT: |
case GL_COLOR_INDEX16_EXT: |
if (ctx->Extensions.EXT_paletted_texture) |
return GL_COLOR_INDEX; |
else |
return -1; |
case GL_DEPTH_COMPONENT: |
case GL_DEPTH_COMPONENT16_SGIX: |
case GL_DEPTH_COMPONENT24_SGIX: |
case GL_DEPTH_COMPONENT32_SGIX: |
if (ctx->Extensions.SGIX_depth_texture) |
return GL_DEPTH_COMPONENT; |
else |
return -1; |
/* GL_ARB_texture_compression */ |
case GL_COMPRESSED_ALPHA: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_ALPHA; |
else |
return -1; |
case GL_COMPRESSED_LUMINANCE: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_LUMINANCE; |
else |
return -1; |
case GL_COMPRESSED_LUMINANCE_ALPHA: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_LUMINANCE_ALPHA; |
else |
return -1; |
case GL_COMPRESSED_INTENSITY: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_INTENSITY; |
else |
return -1; |
case GL_COMPRESSED_RGB: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_RGB; |
else |
return -1; |
case GL_COMPRESSED_RGBA: |
if (ctx->Extensions.ARB_texture_compression) |
return GL_RGBA; |
else |
return -1; |
case GL_COMPRESSED_RGB_FXT1_3DFX: |
if (ctx->Extensions.TDFX_texture_compression_FXT1) |
return GL_RGB; |
else |
return -1; |
case GL_COMPRESSED_RGBA_FXT1_3DFX: |
if (ctx->Extensions.TDFX_texture_compression_FXT1) |
return GL_RGBA; |
else |
return -1; |
case GL_YCBCR_MESA: |
if (ctx->Extensions.MESA_ycbcr_texture) |
return GL_YCBCR_MESA; |
else |
return -1; |
default: |
return -1; /* error */ |
} |
} |
/* |
* Test if the given image format is a color/rgba format. That is, |
* not color index, depth, stencil, etc. |
*/ |
static GLboolean |
is_color_format(GLenum format) |
{ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
case 1: |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
case 2: |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
case 3: |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
case 4: |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return GL_TRUE; |
case GL_YCBCR_MESA: /* not considered to be RGB */ |
default: |
return GL_FALSE; |
} |
} |
static GLboolean |
is_index_format(GLenum format) |
{ |
switch (format) { |
case GL_COLOR_INDEX: |
case GL_COLOR_INDEX1_EXT: |
case GL_COLOR_INDEX2_EXT: |
case GL_COLOR_INDEX4_EXT: |
case GL_COLOR_INDEX8_EXT: |
case GL_COLOR_INDEX12_EXT: |
case GL_COLOR_INDEX16_EXT: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
} |
/** |
* Return GL_TRUE if internalFormat is a supported compressed format, |
* return GL_FALSE otherwise. |
* \param - internalFormat - the internal format token provided by the user |
*/ |
static GLboolean |
is_compressed_format(GLenum internalFormat) |
{ |
switch (internalFormat) { |
case GL_COMPRESSED_RGB_FXT1_3DFX: |
case GL_COMPRESSED_RGBA_FXT1_3DFX: |
return GL_TRUE; |
default: |
return GL_FALSE; |
} |
} |
/* |
* Store a gl_texture_image pointer in a gl_texture_object structure |
* according to the target and level parameters. |
* This was basically prompted by the introduction of cube maps. |
*/ |
void |
_mesa_set_tex_image(struct gl_texture_object *tObj, |
GLenum target, GLint level, |
struct gl_texture_image *texImage) |
{ |
ASSERT(tObj); |
ASSERT(texImage); |
switch (target) { |
case GL_TEXTURE_1D: |
case GL_TEXTURE_2D: |
case GL_TEXTURE_3D: |
tObj->Image[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
tObj->Image[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
tObj->NegX[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
tObj->PosY[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
tObj->NegY[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
tObj->PosZ[level] = texImage; |
return; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
tObj->NegZ[level] = texImage; |
return; |
case GL_TEXTURE_RECTANGLE_NV: |
ASSERT(level == 0); |
tObj->Image[level] = texImage; |
return; |
default: |
_mesa_problem(NULL, "bad target in _mesa_set_tex_image()"); |
return; |
} |
} |
/* |
* Return new gl_texture_image struct with all fields initialized to zero. |
*/ |
struct gl_texture_image * |
_mesa_alloc_texture_image( void ) |
{ |
return CALLOC_STRUCT(gl_texture_image); |
} |
void |
_mesa_free_texture_image( struct gl_texture_image *teximage ) |
{ |
if (teximage->Data && !teximage->IsClientData) { |
MESA_PBUFFER_FREE( teximage->Data ); |
teximage->Data = NULL; |
} |
FREE( teximage ); |
} |
/* |
* Return GL_TRUE if the target is a proxy target. |
*/ |
static GLboolean |
is_proxy_target(GLenum target) |
{ |
return (target == GL_PROXY_TEXTURE_1D || |
target == GL_PROXY_TEXTURE_2D || |
target == GL_PROXY_TEXTURE_3D || |
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); |
} |
/* |
* Given a texture unit and a texture target, return the corresponding |
* texture object. |
*/ |
struct gl_texture_object * |
_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, |
GLenum target) |
{ |
switch (target) { |
case GL_TEXTURE_1D: |
return texUnit->Current1D; |
case GL_PROXY_TEXTURE_1D: |
return ctx->Texture.Proxy1D; |
case GL_TEXTURE_2D: |
return texUnit->Current2D; |
case GL_PROXY_TEXTURE_2D: |
return ctx->Texture.Proxy2D; |
case GL_TEXTURE_3D: |
return texUnit->Current3D; |
case GL_PROXY_TEXTURE_3D: |
return ctx->Texture.Proxy3D; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_ARB: |
return ctx->Extensions.ARB_texture_cube_map |
? texUnit->CurrentCubeMap : NULL; |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
return ctx->Extensions.ARB_texture_cube_map |
? ctx->Texture.ProxyCubeMap : NULL; |
case GL_TEXTURE_RECTANGLE_NV: |
return ctx->Extensions.NV_texture_rectangle |
? texUnit->CurrentRect : NULL; |
case GL_PROXY_TEXTURE_RECTANGLE_NV: |
return ctx->Extensions.NV_texture_rectangle |
? ctx->Texture.ProxyRect : NULL; |
default: |
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); |
return NULL; |
} |
} |
/* |
* Return the texture image struct which corresponds to target and level |
* for the given texture unit. |
*/ |
struct gl_texture_image * |
_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, |
GLenum target, GLint level) |
{ |
ASSERT(texUnit); |
ASSERT(level < MAX_TEXTURE_LEVELS); |
switch (target) { |
case GL_TEXTURE_1D: |
return texUnit->Current1D->Image[level]; |
case GL_PROXY_TEXTURE_1D: |
return ctx->Texture.Proxy1D->Image[level]; |
case GL_TEXTURE_2D: |
return texUnit->Current2D->Image[level]; |
case GL_PROXY_TEXTURE_2D: |
return ctx->Texture.Proxy2D->Image[level]; |
case GL_TEXTURE_3D: |
return texUnit->Current3D->Image[level]; |
case GL_PROXY_TEXTURE_3D: |
return ctx->Texture.Proxy3D->Image[level]; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->Image[level]; |
else |
return NULL; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->NegX[level]; |
else |
return NULL; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->PosY[level]; |
else |
return NULL; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->NegY[level]; |
else |
return NULL; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->PosZ[level]; |
else |
return NULL; |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return texUnit->CurrentCubeMap->NegZ[level]; |
else |
return NULL; |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
if (ctx->Extensions.ARB_texture_cube_map) |
return ctx->Texture.ProxyCubeMap->Image[level]; |
else |
return NULL; |
case GL_TEXTURE_RECTANGLE_NV: |
if (ctx->Extensions.NV_texture_rectangle) { |
ASSERT(level == 0); |
return texUnit->CurrentRect->Image[level]; |
} |
else { |
return NULL; |
} |
case GL_PROXY_TEXTURE_RECTANGLE_NV: |
if (ctx->Extensions.NV_texture_rectangle) { |
ASSERT(level == 0); |
return ctx->Texture.ProxyRect->Image[level]; |
} |
else { |
return NULL; |
} |
default: |
_mesa_problem(ctx, "bad target in _mesa_select_tex_image()"); |
return NULL; |
} |
} |
/* |
* Return the maximum number of allows mipmap levels for the given |
* texture target. |
*/ |
GLint |
_mesa_max_texture_levels(GLcontext *ctx, GLenum target) |
{ |
switch (target) { |
case GL_TEXTURE_1D: |
case GL_PROXY_TEXTURE_1D: |
case GL_TEXTURE_2D: |
case GL_PROXY_TEXTURE_2D: |
return ctx->Const.MaxTextureLevels; |
case GL_TEXTURE_3D: |
case GL_PROXY_TEXTURE_3D: |
return ctx->Const.Max3DTextureLevels; |
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: |
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: |
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
return ctx->Const.MaxCubeTextureLevels; |
break; |
case GL_TEXTURE_RECTANGLE_NV: |
case GL_PROXY_TEXTURE_RECTANGLE_NV: |
return 1; |
break; |
default: |
return 0; /* bad target */ |
} |
} |
#if 000 /* not used anymore */ |
/* |
* glTexImage[123]D can accept a NULL image pointer. In this case we |
* create a texture image with unspecified image contents per the OpenGL |
* spec. |
*/ |
static GLubyte * |
make_null_texture(GLint width, GLint height, GLint depth, GLenum format) |
{ |
const GLint components = _mesa_components_in_format(format); |
const GLint numPixels = width * height * depth; |
GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte)); |
#ifdef DEBUG |
/* |
* Let's see if anyone finds this. If glTexImage2D() is called with |
* a NULL image pointer then load the texture image with something |
* interesting instead of leaving it indeterminate. |
*/ |
if (data) { |
static const char message[8][32] = { |
" X X XXXXX XXX X ", |
" XX XX X X X X X ", |
" X X X X X X X ", |
" X X XXXX XXX XXXXX ", |
" X X X X X X ", |
" X X X X X X X ", |
" X X XXXXX XXX X X ", |
" " |
}; |
GLubyte *imgPtr = data; |
GLint h, i, j, k; |
for (h = 0; h < depth; h++) { |
for (i = 0; i < height; i++) { |
GLint srcRow = 7 - (i % 8); |
for (j = 0; j < width; j++) { |
GLint srcCol = j % 32; |
GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70; |
for (k = 0; k < components; k++) { |
*imgPtr++ = texel; |
} |
} |
} |
} |
} |
#endif |
return data; |
} |
#endif |
/* |
* Reset the fields of a gl_texture_image struct to zero. |
* This is called when a proxy texture test fails, we set all the |
* image members (except DriverData) to zero. |
* It's also used in glTexImage[123]D as a safeguard to be sure all |
* required fields get initialized properly by the Driver.TexImage[123]D |
* functions. |
*/ |
static void |
clear_teximage_fields(struct gl_texture_image *img) |
{ |
ASSERT(img); |
img->Format = 0; |
img->IntFormat = 0; |
img->Border = 0; |
img->Width = 0; |
img->Height = 0; |
img->Depth = 0; |
img->RowStride = 0; |
img->Width2 = 0; |
img->Height2 = 0; |
img->Depth2 = 0; |
img->WidthLog2 = 0; |
img->HeightLog2 = 0; |
img->DepthLog2 = 0; |
img->Data = NULL; |
img->TexFormat = &_mesa_null_texformat; |
img->FetchTexel = NULL; |
img->IsCompressed = 0; |
img->CompressedSize = 0; |
} |
/* |
* Initialize basic fields of the gl_texture_image struct. |
*/ |
void |
_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, |
struct gl_texture_image *img, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, GLenum internalFormat) |
{ |
ASSERT(img); |
img->Format = _mesa_base_tex_format( ctx, internalFormat ); |
ASSERT(img->Format > 0); |
img->IntFormat = internalFormat; |
img->Border = border; |
img->Width = width; |
img->Height = height; |
img->Depth = depth; |
img->RowStride = width; |
img->WidthLog2 = logbase2(width - 2 * border); |
if (height == 1) /* 1-D texture */ |
img->HeightLog2 = 0; |
else |
img->HeightLog2 = logbase2(height - 2 * border); |
if (depth == 1) /* 2-D texture */ |
img->DepthLog2 = 0; |
else |
img->DepthLog2 = logbase2(depth - 2 * border); |
img->Width2 = 1 << img->WidthLog2; |
img->Height2 = 1 << img->HeightLog2; |
img->Depth2 = 1 << img->DepthLog2; |
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); |
img->IsCompressed = is_compressed_format(internalFormat); |
if (img->IsCompressed) |
img->CompressedSize = _mesa_compressed_texture_size(ctx, width, height, |
depth, internalFormat); |
else |
img->CompressedSize = 0; |
/* Compute Width/Height/DepthScale for mipmap lod computation */ |
if (target == GL_TEXTURE_RECTANGLE_NV) { |
/* scale = 1.0 since texture coords directly map to texels */ |
img->WidthScale = 1.0; |
img->HeightScale = 1.0; |
img->DepthScale = 1.0; |
} |
else { |
img->WidthScale = (GLfloat) img->Width; |
img->HeightScale = (GLfloat) img->Height; |
img->DepthScale = (GLfloat) img->Depth; |
} |
} |
/* |
* Test glTexImage[123]D() parameters for errors. |
* Input: |
* dimensions - must be 1 or 2 or 3 |
* Return: GL_TRUE = an error was detected, GL_FALSE = no errors |
*/ |
static GLboolean |
texture_error_check( GLcontext *ctx, GLenum target, |
GLint level, GLint internalFormat, |
GLenum format, GLenum type, |
GLuint dimensions, |
GLint width, GLint height, |
GLint depth, GLint border ) |
{ |
GLboolean isProxy; |
GLint maxLevels = 0, maxTextureSize; |
if (dimensions == 1) { |
if (target == GL_PROXY_TEXTURE_1D) { |
isProxy = GL_TRUE; |
} |
else if (target == GL_TEXTURE_1D) { |
isProxy = GL_FALSE; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); |
return GL_TRUE; |
} |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (dimensions == 2) { |
if (target == GL_PROXY_TEXTURE_2D) { |
isProxy = GL_TRUE; |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (target == GL_TEXTURE_2D) { |
isProxy = GL_FALSE; |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); |
return GL_TRUE; |
} |
isProxy = GL_TRUE; |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); |
return GL_TRUE; |
} |
isProxy = GL_FALSE; |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV) { |
if (!ctx->Extensions.NV_texture_rectangle) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); |
return GL_TRUE; |
} |
isProxy = GL_TRUE; |
maxLevels = 1; |
} |
else if (target == GL_TEXTURE_RECTANGLE_NV) { |
if (!ctx->Extensions.NV_texture_rectangle) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); |
return GL_TRUE; |
} |
isProxy = GL_FALSE; |
maxLevels = 1; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); |
return GL_TRUE; |
} |
} |
else if (dimensions == 3) { |
if (target == GL_PROXY_TEXTURE_3D) { |
isProxy = GL_TRUE; |
} |
else if (target == GL_TEXTURE_3D) { |
isProxy = GL_FALSE; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); |
return GL_TRUE; |
} |
maxLevels = ctx->Const.Max3DTextureLevels; |
} |
else { |
_mesa_problem( ctx, "bad dims in texture_error_check" ); |
return GL_TRUE; |
} |
ASSERT(maxLevels > 0); |
maxTextureSize = 1 << (maxLevels - 1); |
/* Border */ |
if (border != 0 && border != 1) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(border=%d)", dimensions, border); |
} |
return GL_TRUE; |
} |
if ((target == GL_TEXTURE_RECTANGLE_NV || |
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0) { |
return GL_TRUE; |
} |
/* Width */ |
if (target == GL_TEXTURE_RECTANGLE_NV || |
target == GL_PROXY_TEXTURE_RECTANGLE_NV) { |
if (width < 1 || width > ctx->Const.MaxTextureRectSize) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(width=%d)", dimensions, width); |
} |
return GL_TRUE; |
} |
} |
else if (width < 2 * border || width > 2 + maxTextureSize |
|| logbase2( width - 2 * border ) < 0) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(width=%d)", dimensions, width); |
} |
return GL_TRUE; |
} |
/* Height */ |
if (target == GL_TEXTURE_RECTANGLE_NV || |
target == GL_PROXY_TEXTURE_RECTANGLE_NV) { |
if (height < 1 || height > ctx->Const.MaxTextureRectSize) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(height=%d)", dimensions, height); |
} |
return GL_TRUE; |
} |
} |
else if (dimensions >= 2) { |
if (height < 2 * border || height > 2 + maxTextureSize |
|| logbase2( height - 2 * border ) < 0) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(height=%d)", dimensions, height); |
} |
return GL_TRUE; |
} |
} |
/* For cube map, width must equal height */ |
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (width != height) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexImage2D(width != height)"); |
} |
return GL_TRUE; |
} |
} |
/* Depth */ |
if (dimensions >= 3) { |
if (depth < 2 * border || depth > 2 + maxTextureSize |
|| logbase2( depth - 2 * border ) < 0) { |
if (!isProxy) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glTexImage3D(depth=%d)", depth ); |
} |
return GL_TRUE; |
} |
} |
/* Level */ |
if (target == GL_TEXTURE_RECTANGLE_NV || |
target == GL_PROXY_TEXTURE_RECTANGLE_NV) { |
if (level != 0) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage2D(level=%d)", level); |
} |
return GL_TRUE; |
} |
} |
else if (level < 0 || level >= maxLevels) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(level=%d)", dimensions, level); |
} |
return GL_TRUE; |
} |
/* For cube map, width must equal height */ |
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (width != height) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexImage2D(width != height)"); |
return GL_TRUE; |
} |
} |
if (_mesa_base_tex_format(ctx, internalFormat) < 0) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexImage%dD(internalFormat=0x%x)", |
dimensions, internalFormat); |
} |
return GL_TRUE; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
/* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there |
* is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. |
*/ |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glTexImage%dD(format or type)", dimensions); |
} |
return GL_TRUE; |
} |
if (format == GL_YCBCR_MESA || internalFormat == GL_YCBCR_MESA) { |
ASSERT(ctx->Extensions.MESA_ycbcr_texture); |
if (format != GL_YCBCR_MESA || |
internalFormat != GL_YCBCR_MESA || |
(type != GL_UNSIGNED_SHORT_8_8_MESA && |
type != GL_UNSIGNED_SHORT_8_8_REV_MESA)) { |
char message[100]; |
_mesa_sprintf(message, |
"glTexImage%d(format/type/internalFormat YCBCR mismatch", |
dimensions); |
_mesa_error(ctx, GL_INVALID_ENUM, message); |
return GL_TRUE; /* error */ |
} |
if (target != GL_TEXTURE_2D && |
target != GL_PROXY_TEXTURE_2D && |
target != GL_TEXTURE_RECTANGLE_NV && |
target != GL_PROXY_TEXTURE_RECTANGLE_NV) { |
if (!isProxy) |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)"); |
return GL_TRUE; |
} |
if (border != 0) { |
if (!isProxy) { |
char message[100]; |
_mesa_sprintf(message, |
"glTexImage%d(format=GL_YCBCR_MESA and border=%d)", |
dimensions, border); |
_mesa_error(ctx, GL_INVALID_VALUE, message); |
} |
return GL_TRUE; |
} |
} |
if (is_compressed_format(internalFormat)) { |
if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { |
/* OK */ |
} |
else if (ctx->Extensions.ARB_texture_cube_map && |
(target == GL_PROXY_TEXTURE_CUBE_MAP || |
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { |
/* OK */ |
} |
else { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexImage%d(target)", dimensions); |
return GL_TRUE; |
} |
} |
if (border != 0) { |
if (!isProxy) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glTexImage%D(border!=0)", dimensions); |
} |
return GL_TRUE; |
} |
} |
/* if we get here, the parameters are OK */ |
return GL_FALSE; |
} |
/* |
* Test glTexSubImage[123]D() parameters for errors. |
* Input: |
* dimensions - must be 1 or 2 or 3 |
* Return: GL_TRUE = an error was detected, GL_FALSE = no errors |
*/ |
static GLboolean |
subtexture_error_check( GLcontext *ctx, GLuint dimensions, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint width, GLint height, GLint depth, |
GLenum format, GLenum type ) |
{ |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_image *destTex; |
GLint maxLevels = 0; |
if (dimensions == 1) { |
if (target == GL_TEXTURE_1D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" ); |
return GL_TRUE; |
} |
} |
else if (dimensions == 2) { |
if (ctx->Extensions.ARB_texture_cube_map && |
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else if (ctx->Extensions.NV_texture_rectangle && |
target == GL_TEXTURE_RECTANGLE_NV) { |
maxLevels = 1; |
} |
else if (target == GL_TEXTURE_2D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); |
return GL_TRUE; |
} |
} |
else if (dimensions == 3) { |
if (target == GL_TEXTURE_3D) { |
maxLevels = ctx->Const.Max3DTextureLevels; |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" ); |
return GL_TRUE; |
} |
} |
else { |
_mesa_problem( ctx, "bad dims in texture_error_check" ); |
return GL_TRUE; |
} |
ASSERT(maxLevels > 0); |
if (level < 0 || level >= maxLevels) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); |
return GL_TRUE; |
} |
if (width < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexSubImage%dD(width=%d)", dimensions, width); |
return GL_TRUE; |
} |
if (height < 0 && dimensions > 1) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glTexSubImage%dD(height=%d)", dimensions, height); |
return GL_TRUE; |
} |
if (depth < 0 && dimensions > 2) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(depth=%d)", dimensions, depth); |
return GL_TRUE; |
} |
destTex = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!destTex) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage2D"); |
return GL_TRUE; |
} |
if (xoffset < -((GLint)destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage1/2/3D(xoffset)"); |
return GL_TRUE; |
} |
if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage1/2/3D(xoffset+width)"); |
return GL_TRUE; |
} |
if (dimensions > 1) { |
if (yoffset < -((GLint)destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage2/3D(yoffset)"); |
return GL_TRUE; |
} |
if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage2/3D(yoffset+height)"); |
return GL_TRUE; |
} |
} |
if (dimensions > 2) { |
if (zoffset < -((GLint)destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)"); |
return GL_TRUE; |
} |
if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)"); |
return GL_TRUE; |
} |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexSubImage%dD(format or type)", dimensions); |
return GL_TRUE; |
} |
if (destTex->IsCompressed) { |
const struct gl_texture_unit *texUnit; |
const struct gl_texture_object *texObj; |
const struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { |
/* OK */ |
} |
else if (ctx->Extensions.ARB_texture_cube_map && |
(target == GL_PROXY_TEXTURE_CUBE_MAP || |
(target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { |
/* OK */ |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glTexSubImage%D(target)", dimensions); |
return GL_TRUE; |
} |
/* offset must be multiple of 4 */ |
if ((xoffset & 3) || (yoffset & 3)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glTexSubImage%D(xoffset or yoffset)", dimensions); |
return GL_TRUE; |
} |
/* size must be multiple of 4 or equal to whole texture size */ |
if ((width & 3) && (GLuint) width != texImage->Width) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glTexSubImage%D(width)", dimensions); |
return GL_TRUE; |
} |
if ((height & 3) && (GLuint) height != texImage->Height) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glTexSubImage%D(width)", dimensions); |
return GL_TRUE; |
} |
} |
return GL_FALSE; |
} |
/* |
* Test glCopyTexImage[12]D() parameters for errors. |
* Input: dimensions - must be 1 or 2 or 3 |
* Return: GL_TRUE = an error was detected, GL_FALSE = no errors |
*/ |
static GLboolean |
copytexture_error_check( GLcontext *ctx, GLuint dimensions, |
GLenum target, GLint level, GLint internalFormat, |
GLint width, GLint height, GLint border ) |
{ |
GLint maxLevels = 0, maxTextureSize; |
if (dimensions == 1) { |
if (target != GL_TEXTURE_1D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); |
return GL_TRUE; |
} |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (dimensions == 2) { |
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); |
return GL_TRUE; |
} |
} |
else if (target == GL_TEXTURE_RECTANGLE_NV) { |
if (!ctx->Extensions.NV_texture_rectangle) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); |
return GL_TRUE; |
} |
} |
else if (target != GL_TEXTURE_2D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); |
return GL_TRUE; |
} |
if (target == GL_TEXTURE_2D) |
maxLevels = ctx->Const.MaxTextureLevels; |
else if (target == GL_TEXTURE_RECTANGLE_NV) |
maxLevels = 1; |
else |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
ASSERT(maxLevels > 0); |
maxTextureSize = 1 << (maxLevels - 1); |
/* Border */ |
if (border != 0 && border != 1) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexImage%dD(border)", dimensions); |
return GL_TRUE; |
} |
/* Width */ |
if (width < 2 * border || width > 2 + maxTextureSize |
|| logbase2( width - 2 * border ) < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexImage%dD(width=%d)", dimensions, width); |
return GL_TRUE; |
} |
/* Height */ |
if (dimensions >= 2) { |
if (height < 2 * border || height > 2 + maxTextureSize |
|| logbase2( height - 2 * border ) < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexImage%dD(height=%d)", dimensions, height); |
return GL_TRUE; |
} |
} |
/* For cube map, width must equal height */ |
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (width != height) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexImage2D(width != height)"); |
return GL_TRUE; |
} |
} |
/* Level */ |
if (level < 0 || level >= maxLevels) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexImage%dD(level=%d)", dimensions, level); |
return GL_TRUE; |
} |
if (_mesa_base_tex_format(ctx, internalFormat) < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexImage%dD(internalFormat)", dimensions); |
return GL_TRUE; |
} |
if (is_compressed_format(internalFormat)) { |
if (target != GL_TEXTURE_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glCopyTexImage%d(target)", dimensions); |
return GL_TRUE; |
} |
if (border != 0) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glCopyTexImage%D(border!=0)", dimensions); |
return GL_TRUE; |
} |
} |
/* if we get here, the parameters are OK */ |
return GL_FALSE; |
} |
static GLboolean |
copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height ) |
{ |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_image *teximage; |
GLint maxLevels = 0; |
if (dimensions == 1) { |
if (target != GL_TEXTURE_1D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); |
return GL_TRUE; |
} |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (dimensions == 2) { |
if (ctx->Extensions.ARB_texture_cube_map) { |
if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || |
target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && |
target != GL_TEXTURE_2D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); |
return GL_TRUE; |
} |
} |
else if (target != GL_TEXTURE_2D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); |
return GL_TRUE; |
} |
if (target == GL_PROXY_TEXTURE_2D && target == GL_TEXTURE_2D) |
maxLevels = ctx->Const.MaxTextureLevels; |
else |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else if (dimensions == 3) { |
if (target != GL_TEXTURE_3D) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); |
return GL_TRUE; |
} |
maxLevels = ctx->Const.Max3DTextureLevels; |
} |
ASSERT(maxLevels > 0); |
if (level < 0 || level >= maxLevels) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(level=%d)", dimensions, level); |
return GL_TRUE; |
} |
if (width < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(width=%d)", dimensions, width); |
return GL_TRUE; |
} |
if (dimensions > 1 && height < 0) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(height=%d)", dimensions, height); |
return GL_TRUE; |
} |
teximage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!teximage) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glCopyTexSubImage%dD(undefined texture level: %d)", |
dimensions, level); |
return GL_TRUE; |
} |
if (xoffset < -((GLint)teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); |
return GL_TRUE; |
} |
if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(xoffset+width)", dimensions); |
return GL_TRUE; |
} |
if (dimensions > 1) { |
if (yoffset < -((GLint)teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); |
return GL_TRUE; |
} |
/* NOTE: we're adding the border here, not subtracting! */ |
if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(yoffset+height)", dimensions); |
return GL_TRUE; |
} |
} |
if (dimensions > 2) { |
if (zoffset < -((GLint)teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(zoffset)", dimensions); |
return GL_TRUE; |
} |
if (zoffset > (GLint) (teximage->Depth + teximage->Border)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%dD(zoffset+depth)", dimensions); |
return GL_TRUE; |
} |
} |
if (teximage->IsCompressed) { |
if (target != GL_TEXTURE_2D) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glCopyTexSubImage%d(target)", dimensions); |
return GL_TRUE; |
} |
/* offset must be multiple of 4 */ |
if ((xoffset & 3) || (yoffset & 3)) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%D(xoffset or yoffset)", dimensions); |
return GL_TRUE; |
} |
/* size must be multiple of 4 */ |
if ((width & 3) != 0 && (GLuint) width != teximage->Width) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%D(width)", dimensions); |
return GL_TRUE; |
} |
if ((height & 3) != 0 && (GLuint) height != teximage->Height) { |
_mesa_error(ctx, GL_INVALID_VALUE, |
"glCopyTexSubImage%D(height)", dimensions); |
return GL_TRUE; |
} |
} |
if (teximage->IntFormat == GL_YCBCR_MESA) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); |
return GL_TRUE; |
} |
/* if we get here, the parameters are OK */ |
return GL_FALSE; |
} |
void |
_mesa_GetTexImage( GLenum target, GLint level, GLenum format, |
GLenum type, GLvoid *pixels ) |
{ |
const struct gl_texture_unit *texUnit; |
const struct gl_texture_object *texObj; |
const struct gl_texture_image *texImage; |
GLint maxLevels = 0; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
texUnit = &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]); |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
if (!texObj || is_proxy_target(target)) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)"); |
return; |
} |
maxLevels = _mesa_max_texture_levels(ctx, target); |
ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ |
if (level < 0 || level >= maxLevels) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); |
return; |
} |
if (_mesa_sizeof_packed_type(type) <= 0) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); |
return; |
} |
if (_mesa_components_in_format(format) <= 0 || |
format == GL_STENCIL_INDEX) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); |
return; |
} |
if (!ctx->Extensions.EXT_paletted_texture && is_index_format(format)) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); |
} |
if (!ctx->Extensions.SGIX_depth_texture && format == GL_DEPTH_COMPONENT) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); |
} |
if (!ctx->Extensions.MESA_ycbcr_texture && format == GL_YCBCR_MESA) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); |
} |
/* XXX what if format/type doesn't match texture format/type? */ |
if (!pixels) |
return; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
/* invalid mipmap level, not an error */ |
return; |
} |
if (!texImage->Data) { |
/* no image data, not an error */ |
return; |
} |
{ |
const GLint width = texImage->Width; |
const GLint height = texImage->Height; |
const GLint depth = texImage->Depth; |
GLint img, row; |
for (img = 0; img < depth; img++) { |
for (row = 0; row < height; row++) { |
/* compute destination address in client memory */ |
GLvoid *dest = _mesa_image_address( &ctx->Pack, pixels, |
width, height, format, type, |
img, row, 0); |
assert(dest); |
if (format == GL_COLOR_INDEX) { |
GLuint indexRow[MAX_WIDTH]; |
GLint col; |
for (col = 0; col < width; col++) { |
(*texImage->FetchTexel)(texImage, col, row, img, |
(GLvoid *) &indexRow[col]); |
} |
_mesa_pack_index_span(ctx, width, type, dest, |
indexRow, &ctx->Pack, |
0 /* no image transfer */); |
} |
else if (format == GL_DEPTH_COMPONENT) { |
GLfloat depthRow[MAX_WIDTH]; |
GLint col; |
for (col = 0; col < width; col++) { |
(*texImage->FetchTexel)(texImage, col, row, img, |
(GLvoid *) &depthRow[col]); |
} |
_mesa_pack_depth_span(ctx, width, dest, type, |
depthRow, &ctx->Pack); |
} |
else if (format == GL_YCBCR_MESA) { |
/* No pixel transfer */ |
const GLint rowstride = texImage->RowStride; |
MEMCPY(dest, |
(const GLushort *) texImage->Data + row * rowstride, |
width * sizeof(GLushort)); |
/* check for byte swapping */ |
if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR |
&& type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || |
(texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV |
&& type == GL_UNSIGNED_SHORT_8_8_MESA)) { |
if (!ctx->Pack.SwapBytes) |
_mesa_swap2((GLushort *) dest, width); |
} |
else if (ctx->Pack.SwapBytes) { |
_mesa_swap2((GLushort *) dest, width); |
} |
} |
else { |
/* general case: convert row to RGBA format */ |
GLchan rgba[MAX_WIDTH][4]; |
GLint col; |
for (col = 0; col < width; col++) { |
(*texImage->FetchTexel)(texImage, col, row, img, |
(GLvoid *) rgba[col]); |
} |
_mesa_pack_rgba_span(ctx, width, (const GLchan (*)[4])rgba, |
format, type, dest, &ctx->Pack, |
0 /* no image transfer */); |
} /* format */ |
} /* row */ |
} /* img */ |
} |
} |
/* |
* Called from the API. Note that width includes the border. |
*/ |
void |
_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, |
GLsizei width, GLint border, GLenum format, |
GLenum type, const GLvoid *pixels ) |
{ |
GLsizei postConvWidth = width; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (is_color_format(internalFormat)) { |
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
} |
if (target == GL_TEXTURE_1D) { |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
if (texture_error_check(ctx, target, level, internalFormat, |
format, type, 1, postConvWidth, 1, 1, border)) { |
return; /* error was recorded */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
texObj->Image[level] = texImage; |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
/* free the old texture data */ |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
clear_teximage_fields(texImage); /* not really needed, but helpful */ |
_mesa_init_teximage_fields(ctx, target, texImage, |
postConvWidth, 1, 1, |
border, internalFormat); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
ASSERT(ctx->Driver.TexImage1D); |
/* Give the texture to the driver! <pixels> may be null! */ |
(*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, |
width, border, format, type, pixels, |
&ctx->Unpack, texObj, texImage); |
ASSERT(texImage->TexFormat); |
if (!texImage->FetchTexel) { |
/* If driver didn't explicitly set this, use the default */ |
texImage->FetchTexel = texImage->TexFormat->FetchTexel1D; |
} |
ASSERT(texImage->FetchTexel); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_1D) { |
/* Proxy texture: check for errors and update proxy state */ |
GLboolean error = texture_error_check(ctx, target, level, internalFormat, |
format, type, 1, postConvWidth, 1, 1, border); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, format, type, |
postConvWidth, 1, 1, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
if (level >= 0 && level < ctx->Const.MaxTextureLevels) { |
clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]); |
} |
} |
else { |
/* no error, set the tex image parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, |
postConvWidth, 1, 1, |
border, internalFormat); |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); |
return; |
} |
} |
void |
_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, |
GLsizei width, GLsizei height, GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GLsizei postConvWidth = width, postConvHeight = height; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (is_color_format(internalFormat)) { |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
&postConvHeight); |
} |
if (target == GL_TEXTURE_2D || |
(ctx->Extensions.ARB_texture_cube_map && |
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || |
(ctx->Extensions.NV_texture_rectangle && |
target == GL_TEXTURE_RECTANGLE_NV)) { |
/* non-proxy target */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
if (texture_error_check(ctx, target, level, internalFormat, |
format, type, 2, postConvWidth, postConvHeight, |
1, border)) { |
return; /* error was recorded */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
_mesa_set_tex_image(texObj, target, level, texImage); |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
/* free the old texture data */ |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
clear_teximage_fields(texImage); /* not really needed, but helpful */ |
_mesa_init_teximage_fields(ctx, target, texImage, |
postConvWidth, postConvHeight, 1, |
border, internalFormat); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
ASSERT(ctx->Driver.TexImage2D); |
/* Give the texture to the driver! <pixels> may be null! */ |
(*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, |
width, height, border, format, type, pixels, |
&ctx->Unpack, texObj, texImage); |
ASSERT(texImage->TexFormat); |
if (!texImage->FetchTexel) { |
/* If driver didn't explicitly set this, use the default */ |
texImage->FetchTexel = texImage->TexFormat->FetchTexel2D; |
} |
ASSERT(texImage->FetchTexel); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_2D || |
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && |
ctx->Extensions.ARB_texture_cube_map) || |
(target == GL_PROXY_TEXTURE_RECTANGLE_NV && |
ctx->Extensions.NV_texture_rectangle)) { |
/* Proxy texture: check for errors and update proxy state */ |
GLboolean error = texture_error_check(ctx, target, level, internalFormat, |
format, type, 2, postConvWidth, postConvHeight, 1, border); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, format, type, |
postConvWidth, postConvHeight, 1, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
const GLint maxLevels = (target == GL_PROXY_TEXTURE_2D) ? |
ctx->Const.MaxTextureLevels : ctx->Const.MaxCubeTextureLevels; |
if (level >= 0 && level < maxLevels) { |
clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]); |
} |
} |
else { |
/* no error, set the tex image parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, |
postConvWidth, postConvHeight, 1, |
border, internalFormat); |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); |
return; |
} |
} |
/* |
* Called by the API or display list executor. |
* Note that width and height include the border. |
*/ |
void |
_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target == GL_TEXTURE_3D) { |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
if (texture_error_check(ctx, target, level, (GLint) internalFormat, |
format, type, 3, width, height, depth, border)) { |
return; /* error was recorded */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
texObj->Image[level] = texImage; |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
clear_teximage_fields(texImage); /* not really needed, but helpful */ |
_mesa_init_teximage_fields(ctx, target, texImage, |
width, height, depth, |
border, internalFormat); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
ASSERT(ctx->Driver.TexImage3D); |
/* Give the texture to the driver! <pixels> may be null! */ |
(*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, |
width, height, depth, border, format, type, |
pixels, &ctx->Unpack, texObj, texImage); |
ASSERT(texImage->TexFormat); |
if (!texImage->FetchTexel) { |
/* If driver didn't explicitly set this, use the default */ |
texImage->FetchTexel = texImage->TexFormat->FetchTexel3D; |
} |
ASSERT(texImage->FetchTexel); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_3D) { |
/* Proxy texture: check for errors and update proxy state */ |
GLboolean error = texture_error_check(ctx, target, level, internalFormat, |
format, type, 3, width, height, depth, border); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, format, type, |
width, height, depth, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
if (level >= 0 && level < ctx->Const.Max3DTextureLevels) { |
clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]); |
} |
} |
else { |
/* no error, set the tex image parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, |
border, internalFormat); |
} |
} |
else { |
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); |
return; |
} |
} |
void |
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
_mesa_TexImage3D(target, level, (GLint) internalFormat, width, height, |
depth, border, format, type, pixels); |
} |
void |
_mesa_TexSubImage1D( GLenum target, GLint level, |
GLint xoffset, GLsizei width, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GLsizei postConvWidth = width; |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
/* XXX should test internal format */ |
if (is_color_format(format)) { |
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
} |
if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, |
postConvWidth, 1, 1, format, type)) { |
return; /* error was detected */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if (width == 0 || !pixels) |
return; /* no-op, not an error */ |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
ASSERT(ctx->Driver.TexSubImage1D); |
(*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, |
format, type, pixels, &ctx->Unpack, |
texObj, texImage); |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_TexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
GLsizei postConvWidth = width, postConvHeight = height; |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
/* XXX should test internal format */ |
if (is_color_format(format)) { |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
&postConvHeight); |
} |
if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, |
postConvWidth, postConvHeight, 1, format, type)) { |
return; /* error was detected */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if (width == 0 || height == 0 || !pixels) |
return; /* no-op, not an error */ |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
yoffset += texImage->Border; |
ASSERT(ctx->Driver.TexSubImage2D); |
(*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, |
width, height, format, type, pixels, |
&ctx->Unpack, texObj, texImage); |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_TexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLenum type, |
const GLvoid *pixels ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, |
width, height, depth, format, type)) { |
return; /* error was detected */ |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if (width == 0 || height == 0 || height == 0 || !pixels) |
return; /* no-op, not an error */ |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
yoffset += texImage->Border; |
zoffset += texImage->Border; |
ASSERT(ctx->Driver.TexSubImage3D); |
(*ctx->Driver.TexSubImage3D)(ctx, target, level, |
xoffset, yoffset, zoffset, |
width, height, depth, |
format, type, pixels, |
&ctx->Unpack, texObj, texImage ); |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CopyTexImage1D( GLenum target, GLint level, |
GLenum internalFormat, |
GLint x, GLint y, |
GLsizei width, GLint border ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLsizei postConvWidth = width; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
if (is_color_format(internalFormat)) { |
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
} |
if (copytexture_error_check(ctx, 1, target, level, internalFormat, |
postConvWidth, 1, border)) |
return; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
_mesa_set_tex_image(texObj, target, level, texImage); |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
/* free the old texture data */ |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
clear_teximage_fields(texImage); /* not really needed, but helpful */ |
_mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, |
border, internalFormat); |
ASSERT(ctx->Driver.CopyTexImage1D); |
(*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, |
x, y, width, border); |
ASSERT(texImage->TexFormat); |
if (!texImage->FetchTexel) { |
/* If driver didn't explicitly set this, use the default */ |
texImage->FetchTexel = texImage->TexFormat->FetchTexel1D; |
} |
ASSERT(texImage->FetchTexel); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, |
GLint x, GLint y, GLsizei width, GLsizei height, |
GLint border ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLsizei postConvWidth = width, postConvHeight = height; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
if (is_color_format(internalFormat)) { |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, |
&postConvHeight); |
} |
if (copytexture_error_check(ctx, 2, target, level, internalFormat, |
postConvWidth, postConvHeight, border)) |
return; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
_mesa_set_tex_image(texObj, target, level, texImage); |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
/* free the old texture data */ |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
clear_teximage_fields(texImage); /* not really needed, but helpful */ |
_mesa_init_teximage_fields(ctx, target, texImage, |
postConvWidth, postConvHeight, 1, |
border, internalFormat); |
ASSERT(ctx->Driver.CopyTexImage2D); |
(*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, |
x, y, width, height, border); |
ASSERT(texImage->TexFormat); |
if (!texImage->FetchTexel) { |
/* If driver didn't explicitly set this, use the default */ |
texImage->FetchTexel = texImage->TexFormat->FetchTexel2D; |
} |
ASSERT(texImage->FetchTexel); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CopyTexSubImage1D( GLenum target, GLint level, |
GLint xoffset, GLint x, GLint y, GLsizei width ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLsizei postConvWidth = width; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
/* XXX should test internal format */ |
_mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); |
if (copytexsubimage_error_check(ctx, 1, target, level, |
xoffset, 0, 0, postConvWidth, 1)) |
return; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
ASSERT(ctx->Driver.CopyTexSubImage1D); |
(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CopyTexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLsizei postConvWidth = width, postConvHeight = height; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
/* XXX should test internal format */ |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); |
if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0, |
postConvWidth, postConvHeight)) |
return; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
yoffset += texImage->Border; |
ASSERT(ctx->Driver.CopyTexSubImage2D); |
(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, |
xoffset, yoffset, x, y, width, height); |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CopyTexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLsizei postConvWidth = width, postConvHeight = height; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) |
_mesa_update_state(ctx); |
/* XXX should test internal format */ |
_mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); |
if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset, |
zoffset, postConvWidth, postConvHeight)) |
return; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
/* If we have a border, xoffset=-1 is legal. Bias by border width */ |
xoffset += texImage->Border; |
yoffset += texImage->Border; |
zoffset += texImage->Border; |
ASSERT(ctx->Driver.CopyTexSubImage3D); |
(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, |
xoffset, yoffset, zoffset, |
x, y, width, height); |
ctx->NewState |= _NEW_TEXTURE; |
} |
/**********************************************************************/ |
/****** Compressed Textures ******/ |
/**********************************************************************/ |
/** |
* Error checking for glCompressedTexImage[123]D(). |
* \return error code or GL_NO_ERROR. |
*/ |
static GLenum |
compressed_texture_error_check(GLcontext *ctx, GLint dimensions, |
GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLsizei height, GLsizei depth, GLint border, |
GLsizei imageSize) |
{ |
GLboolean isProxy = GL_FALSE; |
GLint expectedSize, maxLevels = 0, maxTextureSize; |
if (dimensions == 1) { |
/* 1D compressed textures not allowed */ |
return GL_INVALID_ENUM; |
} |
else if (dimensions == 2) { |
if (target == GL_PROXY_TEXTURE_2D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
isProxy = GL_TRUE; |
} |
else if (target == GL_TEXTURE_2D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) |
return GL_INVALID_ENUM; /*target*/ |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
isProxy = GL_TRUE; |
} |
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) |
return GL_INVALID_ENUM; /*target*/ |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else { |
return GL_INVALID_ENUM; /*target*/ |
} |
} |
else if (dimensions == 3) { |
/* 3D compressed textures not allowed */ |
return GL_INVALID_ENUM; |
} |
maxTextureSize = 1 << (maxLevels - 1); |
if (!is_compressed_format(internalFormat)) |
return GL_INVALID_ENUM; |
if (border != 0) |
return GL_INVALID_VALUE; |
if (width < 1 || width > maxTextureSize || logbase2(width) < 0) |
return GL_INVALID_VALUE; |
if ((height < 1 || height > maxTextureSize || logbase2(height) < 0) |
&& dimensions > 1) |
return GL_INVALID_VALUE; |
if ((depth < 1 || depth > maxTextureSize || logbase2(depth) < 0) |
&& dimensions > 2) |
return GL_INVALID_VALUE; |
/* For cube map, width must equal height */ |
if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height) |
return GL_INVALID_VALUE; |
if (level < 0 || level >= maxLevels) |
return GL_INVALID_VALUE; |
expectedSize = _mesa_compressed_texture_size(ctx, width, height, depth, |
internalFormat); |
if (expectedSize != imageSize) |
return GL_INVALID_VALUE; |
return GL_NO_ERROR; |
} |
/** |
* Error checking for glCompressedTexSubImage[123]D(). |
* \return error code or GL_NO_ERROR. |
*/ |
static GLenum |
compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, |
GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLsizei imageSize) |
{ |
GLboolean isProxy = GL_FALSE; |
GLint expectedSize, maxLevels = 0, maxTextureSize; |
if (dimensions == 1) { |
/* 1D compressed textures not allowed */ |
return GL_INVALID_ENUM; |
} |
else if (dimensions == 2) { |
if (target == GL_PROXY_TEXTURE_2D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
isProxy = GL_TRUE; |
} |
else if (target == GL_TEXTURE_2D) { |
maxLevels = ctx->Const.MaxTextureLevels; |
} |
else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) |
return GL_INVALID_ENUM; /*target*/ |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
isProxy = GL_TRUE; |
} |
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { |
if (!ctx->Extensions.ARB_texture_cube_map) |
return GL_INVALID_ENUM; /*target*/ |
maxLevels = ctx->Const.MaxCubeTextureLevels; |
} |
else { |
return GL_INVALID_ENUM; /*target*/ |
} |
} |
else if (dimensions == 3) { |
/* 3D compressed textures not allowed */ |
return GL_INVALID_ENUM; |
} |
maxTextureSize = 1 << (maxLevels - 1); |
if (!is_compressed_format(format)) |
return GL_INVALID_ENUM; |
if (width < 1 || width > maxTextureSize || logbase2(width) < 0) |
return GL_INVALID_VALUE; |
if ((height < 1 || height > maxTextureSize || logbase2(height) < 0) |
&& dimensions > 1) |
return GL_INVALID_VALUE; |
if (level < 0 || level >= maxLevels) |
return GL_INVALID_VALUE; |
if ((xoffset & 3) != 0 || (yoffset & 3) != 0) |
return GL_INVALID_VALUE; |
if ((width & 3) != 0 && width != 2 && width != 1) |
return GL_INVALID_VALUE; |
if ((height & 3) != 0 && height != 2 && height != 1) |
return GL_INVALID_VALUE; |
expectedSize = _mesa_compressed_texture_size(ctx, width, height, depth, |
format); |
if (expectedSize != imageSize) |
return GL_INVALID_VALUE; |
return GL_NO_ERROR; |
} |
void |
_mesa_CompressedTexImage1DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLint border, GLsizei imageSize, |
const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target == GL_TEXTURE_1D) { |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error = compressed_texture_error_check(ctx, 1, target, level, |
internalFormat, width, 1, 1, border, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexImage1D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
texObj->Image[level] = texImage; |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
_mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, |
border, internalFormat); |
ASSERT(ctx->Driver.CompressedTexImage1D); |
(*ctx->Driver.CompressedTexImage1D)(ctx, target, level, |
internalFormat, width, border, |
imageSize, data, |
texObj, texImage); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_1D) { |
/* Proxy texture: check for errors and update proxy state */ |
GLenum error = compressed_texture_error_check(ctx, 1, target, level, |
internalFormat, width, 1, 1, border, imageSize); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, GL_NONE, GL_NONE, |
width, 1, 1, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
if (level >= 0 && level < ctx->Const.MaxTextureLevels) { |
clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]); |
} |
} |
else { |
/* store the teximage parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, |
border, internalFormat); |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)"); |
return; |
} |
} |
void |
_mesa_CompressedTexImage2DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLsizei height, GLint border, GLsizei imageSize, |
const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target == GL_TEXTURE_2D || |
(ctx->Extensions.ARB_texture_cube_map && |
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && |
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error = compressed_texture_error_check(ctx, 2, target, level, |
internalFormat, width, height, 1, border, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexImage2D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
texObj->Image[level] = texImage; |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, |
border, internalFormat); |
ASSERT(ctx->Driver.CompressedTexImage2D); |
(*ctx->Driver.CompressedTexImage2D)(ctx, target, level, |
internalFormat, width, height, |
border, imageSize, data, |
texObj, texImage); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_2D || |
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && |
ctx->Extensions.ARB_texture_cube_map)) { |
/* Proxy texture: check for errors and update proxy state */ |
GLenum error = compressed_texture_error_check(ctx, 2, target, level, |
internalFormat, width, height, 1, border, imageSize); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, GL_NONE, GL_NONE, |
width, height, 1, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
const GLint maxLevels = (target == GL_PROXY_TEXTURE_2D) ? |
ctx->Const.MaxTextureLevels : ctx->Const.MaxCubeTextureLevels; |
if (level >= 0 && level < maxLevels) { |
clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]); |
} |
} |
else { |
/* store the teximage parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, |
border, internalFormat); |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)"); |
return; |
} |
} |
void |
_mesa_CompressedTexImage3DARB(GLenum target, GLint level, |
GLenum internalFormat, GLsizei width, |
GLsizei height, GLsizei depth, GLint border, |
GLsizei imageSize, const GLvoid *data) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (target == GL_TEXTURE_3D) { |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error = compressed_texture_error_check(ctx, 3, target, level, |
internalFormat, width, height, depth, border, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexImage3D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
texImage = _mesa_alloc_texture_image(); |
texObj->Image[level] = texImage; |
if (!texImage) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); |
return; |
} |
} |
else if (texImage->Data && !texImage->IsClientData) { |
MESA_PBUFFER_FREE(texImage->Data); |
} |
texImage->Data = NULL; |
_mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, |
border, internalFormat); |
ASSERT(ctx->Driver.CompressedTexImage3D); |
(*ctx->Driver.CompressedTexImage3D)(ctx, target, level, |
internalFormat, |
width, height, depth, |
border, imageSize, data, |
texObj, texImage); |
/* state update */ |
texObj->Complete = GL_FALSE; |
ctx->NewState |= _NEW_TEXTURE; |
} |
else if (target == GL_PROXY_TEXTURE_3D) { |
/* Proxy texture: check for errors and update proxy state */ |
GLenum error = compressed_texture_error_check(ctx, 3, target, level, |
internalFormat, width, height, depth, border, imageSize); |
if (!error) { |
ASSERT(ctx->Driver.TestProxyTexImage); |
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, |
internalFormat, GL_NONE, GL_NONE, |
width, height, depth, border); |
} |
if (error) { |
/* if error, clear all proxy texture image parameters */ |
if (level >= 0 && level < ctx->Const.Max3DTextureLevels) { |
clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]); |
} |
} |
else { |
/* store the teximage parameters */ |
struct gl_texture_unit *texUnit; |
struct gl_texture_image *texImage; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
_mesa_init_teximage_fields(ctx, target, texImage, width, height, |
depth, border, internalFormat); |
} |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)"); |
return; |
} |
} |
void |
_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, |
GLsizei width, GLenum format, |
GLsizei imageSize, const GLvoid *data) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
error = compressed_subtexture_error_check(ctx, 1, target, level, |
xoffset, 0, 0, width, 1, 1, format, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexSubImage1D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if ((GLint) format != texImage->IntFormat) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glCompressedTexSubImage1D(format)"); |
return; |
} |
if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); |
return; |
} |
if (width == 0 || !data) |
return; /* no-op, not an error */ |
if (ctx->Driver.CompressedTexSubImage1D) { |
(*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, |
xoffset, width, |
format, imageSize, data, |
texObj, texImage); |
} |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLsizei width, GLsizei height, |
GLenum format, GLsizei imageSize, |
const GLvoid *data) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
error = compressed_subtexture_error_check(ctx, 2, target, level, |
xoffset, yoffset, 0, width, height, 1, format, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexSubImage2D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if ((GLint) format != texImage->IntFormat) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glCompressedTexSubImage2D(format)"); |
return; |
} |
if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || |
((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); |
return; |
} |
if (width == 0 || height == 0 || !data) |
return; /* no-op, not an error */ |
if (ctx->Driver.CompressedTexSubImage2D) { |
(*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, |
xoffset, yoffset, width, height, |
format, imageSize, data, |
texObj, texImage); |
} |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLint zoffset, GLsizei width, |
GLsizei height, GLsizei depth, GLenum format, |
GLsizei imageSize, const GLvoid *data) |
{ |
struct gl_texture_unit *texUnit; |
struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLenum error; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
error = compressed_subtexture_error_check(ctx, 3, target, level, |
xoffset, yoffset, zoffset, width, height, depth, format, imageSize); |
if (error) { |
_mesa_error(ctx, error, "glCompressedTexSubImage2D"); |
return; |
} |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
assert(texImage); |
if ((GLint) format != texImage->IntFormat) { |
_mesa_error(ctx, GL_INVALID_OPERATION, |
"glCompressedTexSubImage3D(format)"); |
return; |
} |
if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || |
((height == 1 || height == 2) && (GLuint) height != texImage->Height) || |
((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); |
return; |
} |
if (width == 0 || height == 0 || depth == 0 || !data) |
return; /* no-op, not an error */ |
if (ctx->Driver.CompressedTexSubImage3D) { |
(*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, |
xoffset, yoffset, zoffset, |
width, height, depth, |
format, imageSize, data, |
texObj, texImage); |
} |
ctx->NewState |= _NEW_TEXTURE; |
} |
void |
_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) |
{ |
const struct gl_texture_unit *texUnit; |
const struct gl_texture_object *texObj; |
struct gl_texture_image *texImage; |
GLint maxLevels; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
texObj = _mesa_select_tex_object(ctx, texUnit, target); |
if (!texObj) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB"); |
return; |
} |
maxLevels = _mesa_max_texture_levels(ctx, target); |
ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ |
if (level < 0 || level >= maxLevels) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); |
return; |
} |
if (is_proxy_target(target)) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); |
return; |
} |
texImage = _mesa_select_tex_image(ctx, texUnit, target, level); |
if (!texImage) { |
/* probably invalid mipmap level */ |
_mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); |
return; |
} |
if (!texImage->IsCompressed) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); |
return; |
} |
if (!img) |
return; |
/* just memcpy, no pixelstore or pixel transfer */ |
MEMCPY(img, texImage->Data, texImage->CompressedSize); |
} |
/shark/tags/rel_0_4/ports/mesa/src/matrix.c |
---|
0,0 → 1,483 |
/* $Id: matrix.c,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* 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" |
#include "buffers.h" |
#include "context.h" |
#include "enums.h" |
#include "macros.h" |
#include "matrix.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "math/m_matrix.h" |
void |
_mesa_Frustum( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (nearval <= 0.0 || |
farval <= 0.0 || |
nearval == farval || |
left == right || |
top == bottom) |
{ |
_mesa_error( ctx, GL_INVALID_VALUE, "glFrustum" ); |
return; |
} |
_math_matrix_frustum( ctx->CurrentStack->Top, |
(GLfloat) left, (GLfloat) right, |
(GLfloat) bottom, (GLfloat) top, |
(GLfloat) nearval, (GLfloat) farval ); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_Ortho( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glFrustum(%f, %f, %f, %f, %f, %f)\n", |
left, right, bottom, top, nearval, farval); |
if (left == right || |
bottom == top || |
nearval == farval) |
{ |
_mesa_error( ctx, GL_INVALID_VALUE, "glOrtho" ); |
return; |
} |
_math_matrix_ortho( ctx->CurrentStack->Top, |
(GLfloat) left, (GLfloat) right, |
(GLfloat) bottom, (GLfloat) top, |
(GLfloat) nearval, (GLfloat) farval ); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_MatrixMode( GLenum mode ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
switch (mode) { |
case GL_MODELVIEW: |
ctx->CurrentStack = &ctx->ModelviewMatrixStack; |
break; |
case GL_PROJECTION: |
ctx->CurrentStack = &ctx->ProjectionMatrixStack; |
break; |
case GL_TEXTURE: |
ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; |
break; |
case GL_COLOR: |
ctx->CurrentStack = &ctx->ColorMatrixStack; |
break; |
case GL_MATRIX0_NV: |
case GL_MATRIX1_NV: |
case GL_MATRIX2_NV: |
case GL_MATRIX3_NV: |
case GL_MATRIX4_NV: |
case GL_MATRIX5_NV: |
case GL_MATRIX6_NV: |
case GL_MATRIX7_NV: |
if (!ctx->Extensions.NV_vertex_program) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); |
return; |
} |
ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV]; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); |
return; |
} |
ctx->Transform.MatrixMode = mode; |
} |
void |
_mesa_PushMatrix( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct matrix_stack *stack = ctx->CurrentStack; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glPushMatrix %s\n", |
_mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); |
if (stack->Depth + 1 >= stack->MaxDepth) { |
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix" ); |
return; |
} |
_math_matrix_copy( &stack->Stack[stack->Depth + 1], |
&stack->Stack[stack->Depth] ); |
stack->Depth++; |
stack->Top = &(stack->Stack[stack->Depth]); |
ctx->NewState |= stack->DirtyFlag; |
} |
void |
_mesa_PopMatrix( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct matrix_stack *stack = ctx->CurrentStack; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glPopMatrix %s\n", |
_mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); |
if (stack->Depth == 0) { |
_mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix" ); |
return; |
} |
stack->Depth--; |
stack->Top = &(stack->Stack[stack->Depth]); |
ctx->NewState |= stack->DirtyFlag; |
} |
void |
_mesa_LoadIdentity( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glLoadIdentity()"); |
_math_matrix_set_identity( ctx->CurrentStack->Top ); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_LoadMatrixf( const GLfloat *m ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (!m) return; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, |
"glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", |
m[0], m[4], m[8], m[12], |
m[1], m[5], m[9], m[13], |
m[2], m[6], m[10], m[14], |
m[3], m[7], m[11], m[15]); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
_math_matrix_loadf( ctx->CurrentStack->Top, m ); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_LoadMatrixd( const GLdouble *m ) |
{ |
GLint i; |
GLfloat f[16]; |
if (!m) return; |
for (i = 0; i < 16; i++) |
f[i] = (GLfloat) m[i]; |
_mesa_LoadMatrixf(f); |
} |
/* |
* Multiply the active matrix by an arbitary matrix. |
*/ |
void |
_mesa_MultMatrixf( const GLfloat *m ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (!m) return; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, |
"glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", |
m[0], m[4], m[8], m[12], |
m[1], m[5], m[9], m[13], |
m[2], m[6], m[10], m[14], |
m[3], m[7], m[11], m[15]); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
_math_matrix_mul_floats( ctx->CurrentStack->Top, m ); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
/* |
* Multiply the active matrix by an arbitary matrix. |
*/ |
void |
_mesa_MultMatrixd( const GLdouble *m ) |
{ |
GLint i; |
GLfloat f[16]; |
if (!m) return; |
for (i = 0; i < 16; i++) |
f[i] = (GLfloat) m[i]; |
_mesa_MultMatrixf( f ); |
} |
/* |
* Execute a glRotate call |
*/ |
void |
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (angle != 0.0F) { |
_math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
} |
void |
_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) |
{ |
_mesa_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
/* |
* Execute a glScale call |
*/ |
void |
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
_math_matrix_scale( ctx->CurrentStack->Top, x, y, z); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ) |
{ |
_mesa_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
/* |
* Execute a glTranslate call |
*/ |
void |
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
_math_matrix_translate( ctx->CurrentStack->Top, x, y, z); |
ctx->NewState |= ctx->CurrentStack->DirtyFlag; |
} |
void |
_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ) |
{ |
_mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); |
} |
void |
_mesa_LoadTransposeMatrixfARB( const GLfloat *m ) |
{ |
GLfloat tm[16]; |
if (!m) return; |
_math_transposef(tm, m); |
_mesa_LoadMatrixf(tm); |
} |
void |
_mesa_LoadTransposeMatrixdARB( const GLdouble *m ) |
{ |
GLfloat tm[16]; |
if (!m) return; |
_math_transposefd(tm, m); |
_mesa_LoadMatrixf(tm); |
} |
void |
_mesa_MultTransposeMatrixfARB( const GLfloat *m ) |
{ |
GLfloat tm[16]; |
if (!m) return; |
_math_transposef(tm, m); |
_mesa_MultMatrixf(tm); |
} |
void |
_mesa_MultTransposeMatrixdARB( const GLdouble *m ) |
{ |
GLfloat tm[16]; |
if (!m) return; |
_math_transposefd(tm, m); |
_mesa_MultMatrixf(tm); |
} |
/* |
* Called via glViewport or display list execution. |
*/ |
void |
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
_mesa_set_viewport(ctx, x, y, width, height); |
} |
/* |
* Define a new viewport and reallocate auxillary buffers if the size of |
* the window (color buffer) has changed. |
*/ |
void |
_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, |
GLsizei width, GLsizei height ) |
{ |
const GLfloat n = ctx->Viewport.Near; |
const GLfloat f = ctx->Viewport.Far; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); |
if (width < 0 || height < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, |
"glViewport(%d, %d, %d, %d)", x, y, width, height ); |
return; |
} |
/* clamp width, and height to implementation dependent range */ |
width = CLAMP( width, 1, MAX_WIDTH ); |
height = CLAMP( height, 1, MAX_HEIGHT ); |
/* Save viewport */ |
ctx->Viewport.X = x; |
ctx->Viewport.Width = width; |
ctx->Viewport.Y = y; |
ctx->Viewport.Height = height; |
/* compute scale and bias values :: This is really driver-specific |
* and should be maintained elsewhere if at all. |
*/ |
ctx->Viewport._WindowMap.m[MAT_SX] = (GLfloat) width / 2.0F; |
ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x; |
ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; |
ctx->Viewport._WindowMap.m[MAT_TY] = ctx->Viewport._WindowMap.m[MAT_SY] + y; |
ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F); |
ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n); |
ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; |
ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT; |
ctx->NewState |= _NEW_VIEWPORT; |
/* Check if window/buffer has been resized and if so, reallocate the |
* ancillary buffers. |
*/ |
_mesa_ResizeBuffersMESA(); |
if (ctx->Driver.Viewport) { |
(*ctx->Driver.Viewport)( ctx, x, y, width, height ); |
} |
} |
void |
_mesa_DepthRange( GLclampd nearval, GLclampd farval ) |
{ |
/* |
* nearval - specifies mapping of the near clipping plane to window |
* coordinates, default is 0 |
* farval - specifies mapping of the far clipping plane to window |
* coordinates, default is 1 |
* |
* After clipping and div by w, z coords are in -1.0 to 1.0, |
* corresponding to near and far clipping planes. glDepthRange |
* specifies a linear mapping of the normalized z coords in |
* this range to window z coords. |
*/ |
GLfloat n, f; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (MESA_VERBOSE&VERBOSE_API) |
_mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); |
n = (GLfloat) CLAMP( nearval, 0.0, 1.0 ); |
f = (GLfloat) CLAMP( farval, 0.0, 1.0 ); |
ctx->Viewport.Near = n; |
ctx->Viewport.Far = f; |
ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0F); |
ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0F + n); |
ctx->NewState |= _NEW_VIEWPORT; |
if (ctx->Driver.DepthRange) { |
(*ctx->Driver.DepthRange)( ctx, nearval, farval ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/colortab.c |
---|
0,0 → 1,1224 |
/* $Id: colortab.c,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "colortab.h" |
#include "context.h" |
#include "image.h" |
#include "macros.h" |
#include "mmath.h" |
#include "state.h" |
/* |
* Given an internalFormat token passed to glColorTable, |
* return the corresponding base format. |
* Return -1 if invalid token. |
*/ |
static GLint |
base_colortab_format( GLenum format ) |
{ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return GL_ALPHA; |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return GL_LUMINANCE; |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return GL_LUMINANCE_ALPHA; |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
return GL_INTENSITY; |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return GL_RGB; |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return GL_RGBA; |
default: |
return -1; /* error */ |
} |
} |
void |
_mesa_init_colortable( struct gl_color_table *p ) |
{ |
p->FloatTable = GL_FALSE; |
p->Table = NULL; |
p->Size = 0; |
p->IntFormat = GL_RGBA; |
} |
void |
_mesa_free_colortable_data( struct gl_color_table *p ) |
{ |
if (p->Table) { |
FREE(p->Table); |
p->Table = NULL; |
} |
} |
/* |
* Examine table's format and set the component sizes accordingly. |
*/ |
static void |
set_component_sizes( struct gl_color_table *table ) |
{ |
switch (table->Format) { |
case GL_ALPHA: |
table->RedSize = 0; |
table->GreenSize = 0; |
table->BlueSize = 0; |
table->AlphaSize = CHAN_BITS; |
table->IntensitySize = 0; |
table->LuminanceSize = 0; |
break; |
case GL_LUMINANCE: |
table->RedSize = 0; |
table->GreenSize = 0; |
table->BlueSize = 0; |
table->AlphaSize = 0; |
table->IntensitySize = 0; |
table->LuminanceSize = CHAN_BITS; |
break; |
case GL_LUMINANCE_ALPHA: |
table->RedSize = 0; |
table->GreenSize = 0; |
table->BlueSize = 0; |
table->AlphaSize = CHAN_BITS; |
table->IntensitySize = 0; |
table->LuminanceSize = CHAN_BITS; |
break; |
case GL_INTENSITY: |
table->RedSize = 0; |
table->GreenSize = 0; |
table->BlueSize = 0; |
table->AlphaSize = 0; |
table->IntensitySize = CHAN_BITS; |
table->LuminanceSize = 0; |
break; |
case GL_RGB: |
table->RedSize = CHAN_BITS; |
table->GreenSize = CHAN_BITS; |
table->BlueSize = CHAN_BITS; |
table->AlphaSize = 0; |
table->IntensitySize = 0; |
table->LuminanceSize = 0; |
break; |
case GL_RGBA: |
table->RedSize = CHAN_BITS; |
table->GreenSize = CHAN_BITS; |
table->BlueSize = CHAN_BITS; |
table->AlphaSize = CHAN_BITS; |
table->IntensitySize = 0; |
table->LuminanceSize = 0; |
break; |
default: |
_mesa_problem(NULL, "unexpected format in set_component_sizes"); |
} |
} |
void |
_mesa_ColorTable( GLenum target, GLenum internalFormat, |
GLsizei width, GLenum format, GLenum type, |
const GLvoid *data ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_object *texObj = NULL; |
struct gl_color_table *table = NULL; |
GLboolean proxy = GL_FALSE; |
GLint baseFormat; |
GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; |
GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; |
GLboolean floatTable = GL_FALSE; |
GLint comps; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ |
switch (target) { |
case GL_TEXTURE_1D: |
texObj = texUnit->Current1D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_2D: |
texObj = texUnit->Current2D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_3D: |
texObj = texUnit->Current3D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); |
return; |
} |
texObj = texUnit->CurrentCubeMap; |
table = &texObj->Palette; |
break; |
case GL_PROXY_TEXTURE_1D: |
texObj = ctx->Texture.Proxy1D; |
table = &texObj->Palette; |
proxy = GL_TRUE; |
break; |
case GL_PROXY_TEXTURE_2D: |
texObj = ctx->Texture.Proxy2D; |
table = &texObj->Palette; |
proxy = GL_TRUE; |
break; |
case GL_PROXY_TEXTURE_3D: |
texObj = ctx->Texture.Proxy3D; |
table = &texObj->Palette; |
proxy = GL_TRUE; |
break; |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); |
return; |
} |
texObj = ctx->Texture.ProxyCubeMap; |
table = &texObj->Palette; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
table = &ctx->Texture.Palette; |
break; |
case GL_COLOR_TABLE: |
table = &ctx->ColorTable; |
floatTable = GL_TRUE; |
rScale = ctx->Pixel.ColorTableScale[0]; |
gScale = ctx->Pixel.ColorTableScale[1]; |
bScale = ctx->Pixel.ColorTableScale[2]; |
aScale = ctx->Pixel.ColorTableScale[3]; |
rBias = ctx->Pixel.ColorTableBias[0]; |
gBias = ctx->Pixel.ColorTableBias[1]; |
bBias = ctx->Pixel.ColorTableBias[2]; |
aBias = ctx->Pixel.ColorTableBias[3]; |
break; |
case GL_PROXY_COLOR_TABLE: |
table = &ctx->ProxyColorTable; |
proxy = GL_TRUE; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->PostConvolutionColorTable; |
floatTable = GL_TRUE; |
rScale = ctx->Pixel.PCCTscale[0]; |
gScale = ctx->Pixel.PCCTscale[1]; |
bScale = ctx->Pixel.PCCTscale[2]; |
aScale = ctx->Pixel.PCCTscale[3]; |
rBias = ctx->Pixel.PCCTbias[0]; |
gBias = ctx->Pixel.PCCTbias[1]; |
bBias = ctx->Pixel.PCCTbias[2]; |
aBias = ctx->Pixel.PCCTbias[3]; |
break; |
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->ProxyPostConvolutionColorTable; |
proxy = GL_TRUE; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->PostColorMatrixColorTable; |
floatTable = GL_TRUE; |
rScale = ctx->Pixel.PCMCTscale[0]; |
gScale = ctx->Pixel.PCMCTscale[1]; |
bScale = ctx->Pixel.PCMCTscale[2]; |
aScale = ctx->Pixel.PCMCTscale[3]; |
rBias = ctx->Pixel.PCMCTbias[0]; |
gBias = ctx->Pixel.PCMCTbias[1]; |
bBias = ctx->Pixel.PCMCTbias[2]; |
aBias = ctx->Pixel.PCMCTbias[3]; |
break; |
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->ProxyPostColorMatrixColorTable; |
proxy = GL_TRUE; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); |
return; |
} |
assert(table); |
if (!_mesa_is_legal_format_and_type(format, type) || |
format == GL_INTENSITY) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)"); |
return; |
} |
baseFormat = base_colortab_format(internalFormat); |
if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); |
return; |
} |
if (width < 0 || (width != 0 && _mesa_bitcount(width) != 1)) { |
/* error */ |
if (proxy) { |
table->Size = 0; |
table->IntFormat = (GLenum) 0; |
table->Format = (GLenum) 0; |
} |
else { |
_mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width); |
} |
return; |
} |
if (width > (GLsizei) ctx->Const.MaxColorTableSize) { |
if (proxy) { |
table->Size = 0; |
table->IntFormat = (GLenum) 0; |
table->Format = (GLenum) 0; |
} |
else { |
_mesa_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); |
} |
return; |
} |
table->Size = width; |
table->IntFormat = internalFormat; |
table->Format = (GLenum) baseFormat; |
set_component_sizes(table); |
comps = _mesa_components_in_format(table->Format); |
assert(comps > 0); /* error should have been caught sooner */ |
if (!proxy) { |
/* free old table, if any */ |
if (table->Table) { |
FREE(table->Table); |
table->Table = NULL; |
} |
if (width > 0) { |
if (floatTable) { |
GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4]; |
GLfloat *tableF; |
GLint i; |
_mesa_unpack_float_color_span(ctx, width, table->Format, |
tempTab, /* dest */ |
format, type, data, &ctx->Unpack, |
0, GL_FALSE); |
table->FloatTable = GL_TRUE; |
table->Table = MALLOC(comps * width * sizeof(GLfloat)); |
if (!table->Table) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); |
return; |
} |
tableF = (GLfloat *) table->Table; |
switch (table->Format) { |
case GL_INTENSITY: |
for (i = 0; i < width; i++) { |
tableF[i] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); |
} |
break; |
case GL_LUMINANCE: |
for (i = 0; i < width; i++) { |
tableF[i] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); |
} |
break; |
case GL_ALPHA: |
for (i = 0; i < width; i++) { |
tableF[i] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i = 0; i < width; i++) { |
tableF[i*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[i*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
case GL_RGB: |
for (i = 0; i < width; i++) { |
tableF[i*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[i*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F); |
tableF[i*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F); |
} |
break; |
case GL_RGBA: |
for (i = 0; i < width; i++) { |
tableF[i*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[i*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F); |
tableF[i*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F); |
tableF[i*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format in _mesa_ColorTable"); |
return; |
} |
} |
else { |
/* store GLchan table */ |
table->FloatTable = GL_FALSE; |
table->Table = MALLOC(comps * width * sizeof(GLchan)); |
if (!table->Table) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); |
return; |
} |
_mesa_unpack_chan_color_span(ctx, width, table->Format, |
(GLchan *) table->Table, /* dest */ |
format, type, data, |
&ctx->Unpack, 0); |
} /* floatTable */ |
} /* width > 0 */ |
} /* proxy */ |
if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { |
/* texture object palette, texObj==NULL means the shared palette */ |
if (ctx->Driver.UpdateTexturePalette) { |
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); |
} |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ColorSubTable( GLenum target, GLsizei start, |
GLsizei count, GLenum format, GLenum type, |
const GLvoid *data ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_texture_object *texObj = NULL; |
struct gl_color_table *table = NULL; |
GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; |
GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; |
GLint comps; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_TEXTURE_1D: |
texObj = texUnit->Current1D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_2D: |
texObj = texUnit->Current2D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_3D: |
texObj = texUnit->Current3D; |
table = &texObj->Palette; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); |
return; |
} |
texObj = texUnit->CurrentCubeMap; |
table = &texObj->Palette; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
table = &ctx->Texture.Palette; |
break; |
case GL_COLOR_TABLE: |
table = &ctx->ColorTable; |
rScale = ctx->Pixel.ColorTableScale[0]; |
gScale = ctx->Pixel.ColorTableScale[1]; |
bScale = ctx->Pixel.ColorTableScale[2]; |
aScale = ctx->Pixel.ColorTableScale[3]; |
rBias = ctx->Pixel.ColorTableBias[0]; |
gBias = ctx->Pixel.ColorTableBias[1]; |
bBias = ctx->Pixel.ColorTableBias[2]; |
aBias = ctx->Pixel.ColorTableBias[3]; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->PostConvolutionColorTable; |
rScale = ctx->Pixel.PCCTscale[0]; |
gScale = ctx->Pixel.PCCTscale[1]; |
bScale = ctx->Pixel.PCCTscale[2]; |
aScale = ctx->Pixel.PCCTscale[3]; |
rBias = ctx->Pixel.PCCTbias[0]; |
gBias = ctx->Pixel.PCCTbias[1]; |
bBias = ctx->Pixel.PCCTbias[2]; |
aBias = ctx->Pixel.PCCTbias[3]; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->PostColorMatrixColorTable; |
rScale = ctx->Pixel.PCMCTscale[0]; |
gScale = ctx->Pixel.PCMCTscale[1]; |
bScale = ctx->Pixel.PCMCTscale[2]; |
aScale = ctx->Pixel.PCMCTscale[3]; |
rBias = ctx->Pixel.PCMCTbias[0]; |
gBias = ctx->Pixel.PCMCTbias[1]; |
bBias = ctx->Pixel.PCMCTbias[2]; |
aBias = ctx->Pixel.PCMCTbias[3]; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); |
return; |
} |
assert(table); |
if (!_mesa_is_legal_format_and_type(format, type) || |
format == GL_INTENSITY) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)"); |
return; |
} |
if (count < 1) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); |
return; |
} |
comps = _mesa_components_in_format(table->Format); |
assert(comps > 0); /* error should have been caught sooner */ |
if (start + count > (GLint) table->Size) { |
_mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); |
return; |
} |
if (!table->Table) { |
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); |
return; |
} |
if (!table->FloatTable) { |
GLchan *dest = (GLchan *) table->Table + start * comps * sizeof(GLchan); |
_mesa_unpack_chan_color_span(ctx, count, table->Format, dest, |
format, type, data, &ctx->Unpack, 0); |
} |
else { |
GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4]; |
GLfloat *tableF; |
GLint i; |
ASSERT(table->FloatTable); |
_mesa_unpack_float_color_span(ctx, count, table->Format, |
tempTab, /* dest */ |
format, type, data, &ctx->Unpack, |
0, GL_FALSE); |
tableF = (GLfloat *) table->Table; |
switch (table->Format) { |
case GL_INTENSITY: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); |
} |
break; |
case GL_LUMINANCE: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); |
} |
break; |
case GL_ALPHA: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
case GL_LUMINANCE_ALPHA: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[j*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
case GL_RGB: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[j*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F); |
tableF[j*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F); |
} |
break; |
case GL_RGBA: |
for (i = 0; i < count; i++) { |
GLuint j = start + i; |
tableF[j*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F); |
tableF[j*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F); |
tableF[j*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F); |
tableF[j*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F); |
} |
break; |
default: |
_mesa_problem(ctx, "Bad format in _mesa_ColorSubTable"); |
return; |
} |
} |
if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { |
/* per-texture object palette */ |
if (ctx->Driver.UpdateTexturePalette) { |
(*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); |
} |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
/* XXX not tested */ |
void |
_mesa_CopyColorTable(GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
/* Select buffer to read from */ |
ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width ); |
} |
/* XXX not tested */ |
void |
_mesa_CopyColorSubTable(GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width ); |
} |
void |
_mesa_GetColorTable( GLenum target, GLenum format, |
GLenum type, GLvoid *data ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_color_table *table = NULL; |
GLchan rgba[MAX_COLOR_TABLE_SIZE][4]; |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (ctx->NewState) { |
_mesa_update_state(ctx); |
} |
switch (target) { |
case GL_TEXTURE_1D: |
table = &texUnit->Current1D->Palette; |
break; |
case GL_TEXTURE_2D: |
table = &texUnit->Current2D->Palette; |
break; |
case GL_TEXTURE_3D: |
table = &texUnit->Current3D->Palette; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); |
return; |
} |
table = &texUnit->CurrentCubeMap->Palette; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
table = &ctx->Texture.Palette; |
break; |
case GL_COLOR_TABLE: |
table = &ctx->ColorTable; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->PostConvolutionColorTable; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->PostColorMatrixColorTable; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); |
return; |
} |
assert(table); |
switch (table->Format) { |
case GL_ALPHA: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = 0; |
rgba[i][GCOMP] = 0; |
rgba[i][BCOMP] = 0; |
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = 0; |
rgba[i][GCOMP] = 0; |
rgba[i][BCOMP] = 0; |
rgba[i][ACOMP] = tableUB[i]; |
} |
} |
break; |
case GL_LUMINANCE: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = tableUB[i]; |
rgba[i][GCOMP] = tableUB[i]; |
rgba[i][BCOMP] = tableUB[i]; |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
break; |
case GL_LUMINANCE_ALPHA: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); |
rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); |
rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); |
rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF); |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = tableUB[i*2+0]; |
rgba[i][GCOMP] = tableUB[i*2+0]; |
rgba[i][BCOMP] = tableUB[i*2+0]; |
rgba[i][ACOMP] = tableUB[i*2+1]; |
} |
} |
break; |
case GL_INTENSITY: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = tableUB[i]; |
rgba[i][GCOMP] = tableUB[i]; |
rgba[i][BCOMP] = tableUB[i]; |
rgba[i][ACOMP] = tableUB[i]; |
} |
} |
break; |
case GL_RGB: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF); |
rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF); |
rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF); |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = tableUB[i*3+0]; |
rgba[i][GCOMP] = tableUB[i*3+1]; |
rgba[i][BCOMP] = tableUB[i*3+2]; |
rgba[i][ACOMP] = CHAN_MAX; |
} |
} |
break; |
case GL_RGBA: |
if (table->FloatTable) { |
const GLfloat *tableF = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF); |
rgba[i][GCOMP] = IROUND_POS(tableF[i*4+1] * CHAN_MAXF); |
rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF); |
rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF); |
} |
} |
else { |
const GLchan *tableUB = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < table->Size; i++) { |
rgba[i][RCOMP] = tableUB[i*4+0]; |
rgba[i][GCOMP] = tableUB[i*4+1]; |
rgba[i][BCOMP] = tableUB[i*4+2]; |
rgba[i][ACOMP] = tableUB[i*4+3]; |
} |
} |
break; |
default: |
_mesa_problem(ctx, "bad table format in glGetColorTable"); |
return; |
} |
_mesa_pack_rgba_span(ctx, table->Size, (const GLchan (*)[4]) rgba, |
format, type, data, &ctx->Pack, GL_FALSE); |
} |
void |
_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
switch (target) { |
case GL_COLOR_TABLE_SGI: |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
ctx->Pixel.ColorTableScale[0] = params[0]; |
ctx->Pixel.ColorTableScale[1] = params[1]; |
ctx->Pixel.ColorTableScale[2] = params[2]; |
ctx->Pixel.ColorTableScale[3] = params[3]; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
ctx->Pixel.ColorTableBias[0] = params[0]; |
ctx->Pixel.ColorTableBias[1] = params[1]; |
ctx->Pixel.ColorTableBias[2] = params[2]; |
ctx->Pixel.ColorTableBias[3] = params[3]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); |
return; |
} |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
ctx->Pixel.PCCTscale[0] = params[0]; |
ctx->Pixel.PCCTscale[1] = params[1]; |
ctx->Pixel.PCCTscale[2] = params[2]; |
ctx->Pixel.PCCTscale[3] = params[3]; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
ctx->Pixel.PCCTbias[0] = params[0]; |
ctx->Pixel.PCCTbias[1] = params[1]; |
ctx->Pixel.PCCTbias[2] = params[2]; |
ctx->Pixel.PCCTbias[3] = params[3]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); |
return; |
} |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
ctx->Pixel.PCMCTscale[0] = params[0]; |
ctx->Pixel.PCMCTscale[1] = params[1]; |
ctx->Pixel.PCMCTscale[2] = params[2]; |
ctx->Pixel.PCMCTscale[3] = params[3]; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
ctx->Pixel.PCMCTbias[0] = params[0]; |
ctx->Pixel.PCMCTbias[1] = params[1]; |
ctx->Pixel.PCMCTbias[2] = params[2]; |
ctx->Pixel.PCMCTbias[3] = params[3]; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); |
return; |
} |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); |
return; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) |
{ |
GLfloat fparams[4]; |
if (pname == GL_COLOR_TABLE_SGI || |
pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || |
pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { |
/* four values */ |
fparams[0] = (GLfloat) params[0]; |
fparams[1] = (GLfloat) params[1]; |
fparams[2] = (GLfloat) params[2]; |
fparams[3] = (GLfloat) params[3]; |
} |
else { |
/* one values */ |
fparams[0] = (GLfloat) params[0]; |
} |
_mesa_ColorTableParameterfv(target, pname, fparams); |
} |
void |
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_color_table *table = NULL; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (target) { |
case GL_TEXTURE_1D: |
table = &texUnit->Current1D->Palette; |
break; |
case GL_TEXTURE_2D: |
table = &texUnit->Current2D->Palette; |
break; |
case GL_TEXTURE_3D: |
table = &texUnit->Current3D->Palette; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetColorTableParameterfv(target)"); |
return; |
} |
table = &texUnit->CurrentCubeMap->Palette; |
break; |
case GL_PROXY_TEXTURE_1D: |
table = &ctx->Texture.Proxy1D->Palette; |
break; |
case GL_PROXY_TEXTURE_2D: |
table = &ctx->Texture.Proxy2D->Palette; |
break; |
case GL_PROXY_TEXTURE_3D: |
table = &ctx->Texture.Proxy3D->Palette; |
break; |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetColorTableParameterfv(target)"); |
return; |
} |
table = &ctx->Texture.ProxyCubeMap->Palette; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
table = &ctx->Texture.Palette; |
break; |
case GL_COLOR_TABLE: |
table = &ctx->ColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = ctx->Pixel.ColorTableScale[0]; |
params[1] = ctx->Pixel.ColorTableScale[1]; |
params[2] = ctx->Pixel.ColorTableScale[2]; |
params[3] = ctx->Pixel.ColorTableScale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = ctx->Pixel.ColorTableBias[0]; |
params[1] = ctx->Pixel.ColorTableBias[1]; |
params[2] = ctx->Pixel.ColorTableBias[2]; |
params[3] = ctx->Pixel.ColorTableBias[3]; |
return; |
} |
break; |
case GL_PROXY_COLOR_TABLE: |
table = &ctx->ProxyColorTable; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->PostConvolutionColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = ctx->Pixel.PCCTscale[0]; |
params[1] = ctx->Pixel.PCCTscale[1]; |
params[2] = ctx->Pixel.PCCTscale[2]; |
params[3] = ctx->Pixel.PCCTscale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = ctx->Pixel.PCCTbias[0]; |
params[1] = ctx->Pixel.PCCTbias[1]; |
params[2] = ctx->Pixel.PCCTbias[2]; |
params[3] = ctx->Pixel.PCCTbias[3]; |
return; |
} |
break; |
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->ProxyPostConvolutionColorTable; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->PostColorMatrixColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = ctx->Pixel.PCMCTscale[0]; |
params[1] = ctx->Pixel.PCMCTscale[1]; |
params[2] = ctx->Pixel.PCMCTscale[2]; |
params[3] = ctx->Pixel.PCMCTscale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = ctx->Pixel.PCMCTbias[0]; |
params[1] = ctx->Pixel.PCMCTbias[1]; |
params[2] = ctx->Pixel.PCMCTbias[2]; |
params[3] = ctx->Pixel.PCMCTbias[3]; |
return; |
} |
break; |
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->ProxyPostColorMatrixColorTable; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); |
return; |
} |
assert(table); |
switch (pname) { |
case GL_COLOR_TABLE_FORMAT: |
*params = (GLfloat) table->IntFormat; |
break; |
case GL_COLOR_TABLE_WIDTH: |
*params = (GLfloat) table->Size; |
break; |
case GL_COLOR_TABLE_RED_SIZE: |
*params = table->RedSize; |
break; |
case GL_COLOR_TABLE_GREEN_SIZE: |
*params = table->GreenSize; |
break; |
case GL_COLOR_TABLE_BLUE_SIZE: |
*params = table->BlueSize; |
break; |
case GL_COLOR_TABLE_ALPHA_SIZE: |
*params = table->AlphaSize; |
break; |
case GL_COLOR_TABLE_LUMINANCE_SIZE: |
*params = table->LuminanceSize; |
break; |
case GL_COLOR_TABLE_INTENSITY_SIZE: |
*params = table->IntensitySize; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); |
return; |
} |
} |
void |
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
struct gl_color_table *table = NULL; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (target) { |
case GL_TEXTURE_1D: |
table = &texUnit->Current1D->Palette; |
break; |
case GL_TEXTURE_2D: |
table = &texUnit->Current2D->Palette; |
break; |
case GL_TEXTURE_3D: |
table = &texUnit->Current3D->Palette; |
break; |
case GL_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetColorTableParameteriv(target)"); |
return; |
} |
table = &texUnit->CurrentCubeMap->Palette; |
break; |
case GL_PROXY_TEXTURE_1D: |
table = &ctx->Texture.Proxy1D->Palette; |
break; |
case GL_PROXY_TEXTURE_2D: |
table = &ctx->Texture.Proxy2D->Palette; |
break; |
case GL_PROXY_TEXTURE_3D: |
table = &ctx->Texture.Proxy3D->Palette; |
break; |
case GL_PROXY_TEXTURE_CUBE_MAP_ARB: |
if (!ctx->Extensions.ARB_texture_cube_map) { |
_mesa_error(ctx, GL_INVALID_ENUM, |
"glGetColorTableParameteriv(target)"); |
return; |
} |
table = &ctx->Texture.ProxyCubeMap->Palette; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
table = &ctx->Texture.Palette; |
break; |
case GL_COLOR_TABLE: |
table = &ctx->ColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; |
params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; |
params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; |
params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; |
params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; |
params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; |
params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; |
return; |
} |
break; |
case GL_PROXY_COLOR_TABLE: |
table = &ctx->ProxyColorTable; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->PostConvolutionColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = (GLint) ctx->Pixel.PCCTscale[0]; |
params[1] = (GLint) ctx->Pixel.PCCTscale[1]; |
params[2] = (GLint) ctx->Pixel.PCCTscale[2]; |
params[3] = (GLint) ctx->Pixel.PCCTscale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = (GLint) ctx->Pixel.PCCTbias[0]; |
params[1] = (GLint) ctx->Pixel.PCCTbias[1]; |
params[2] = (GLint) ctx->Pixel.PCCTbias[2]; |
params[3] = (GLint) ctx->Pixel.PCCTbias[3]; |
return; |
} |
break; |
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: |
table = &ctx->ProxyPostConvolutionColorTable; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->PostColorMatrixColorTable; |
if (pname == GL_COLOR_TABLE_SCALE_SGI) { |
params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; |
params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; |
params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; |
params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; |
return; |
} |
else if (pname == GL_COLOR_TABLE_BIAS_SGI) { |
params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; |
params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; |
params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; |
params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; |
return; |
} |
break; |
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: |
table = &ctx->ProxyPostColorMatrixColorTable; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); |
return; |
} |
assert(table); |
switch (pname) { |
case GL_COLOR_TABLE_FORMAT: |
*params = table->IntFormat; |
break; |
case GL_COLOR_TABLE_WIDTH: |
*params = table->Size; |
break; |
case GL_COLOR_TABLE_RED_SIZE: |
*params = table->RedSize; |
break; |
case GL_COLOR_TABLE_GREEN_SIZE: |
*params = table->GreenSize; |
break; |
case GL_COLOR_TABLE_BLUE_SIZE: |
*params = table->BlueSize; |
break; |
case GL_COLOR_TABLE_ALPHA_SIZE: |
*params = table->AlphaSize; |
break; |
case GL_COLOR_TABLE_LUMINANCE_SIZE: |
*params = table->LuminanceSize; |
break; |
case GL_COLOR_TABLE_INTENSITY_SIZE: |
*params = table->IntensitySize; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); |
return; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/teximage.h |
---|
0,0 → 1,206 |
/* $Id: teximage.h,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef TEXIMAGE_H |
#define TEXIMAGE_H |
#include "mtypes.h" |
/*** Internal functions ***/ |
extern GLint |
_mesa_base_tex_format( GLcontext *ctx, GLint format ); |
extern struct gl_texture_image * |
_mesa_alloc_texture_image( void ); |
extern void |
_mesa_free_texture_image( struct gl_texture_image *teximage ); |
extern void |
_mesa_init_teximage_fields(GLcontext *ctx, GLenum target, |
struct gl_texture_image *img, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, GLenum internalFormat); |
extern void |
_mesa_set_tex_image(struct gl_texture_object *tObj, |
GLenum target, GLint level, |
struct gl_texture_image *texImage); |
extern struct gl_texture_object * |
_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, |
GLenum target); |
extern struct gl_texture_image * |
_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, |
GLenum target, GLint level); |
extern GLint |
_mesa_max_texture_levels(GLcontext *ctx, GLenum target); |
/*** API entry point functions ***/ |
extern void |
_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, |
GLsizei width, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels ); |
extern void |
_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, |
GLsizei width, GLsizei height, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels ); |
extern void |
_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, |
GLsizei width, GLsizei height, GLsizei depth, GLint border, |
GLenum format, GLenum type, const GLvoid *pixels ); |
extern void |
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, |
GLsizei width, GLsizei height, GLsizei depth, |
GLint border, GLenum format, GLenum type, |
const GLvoid *pixels ); |
extern void |
_mesa_GetTexImage( GLenum target, GLint level, |
GLenum format, GLenum type, GLvoid *pixels ); |
extern void |
_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset, |
GLsizei width, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
extern void |
_mesa_TexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
extern void |
_mesa_TexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLsizei width, GLsizei height, GLsizei depth, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
extern void |
_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, |
GLint x, GLint y, GLsizei width, GLint border ); |
extern void |
_mesa_CopyTexImage2D( GLenum target, GLint level, |
GLenum internalformat, GLint x, GLint y, |
GLsizei width, GLsizei height, GLint border ); |
extern void |
_mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, |
GLint x, GLint y, GLsizei width ); |
extern void |
_mesa_CopyTexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ); |
extern void |
_mesa_CopyTexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, GLint zoffset, |
GLint x, GLint y, GLsizei width, GLsizei height ); |
extern void |
_mesa_CompressedTexImage1DARB(GLenum target, GLint level, |
GLenum internalformat, GLsizei width, |
GLint border, GLsizei imageSize, |
const GLvoid *data); |
extern void |
_mesa_CompressedTexImage2DARB(GLenum target, GLint level, |
GLenum internalformat, GLsizei width, |
GLsizei height, GLint border, GLsizei imageSize, |
const GLvoid *data); |
extern void |
_mesa_CompressedTexImage3DARB(GLenum target, GLint level, |
GLenum internalformat, GLsizei width, |
GLsizei height, GLsizei depth, GLint border, |
GLsizei imageSize, const GLvoid *data); |
#ifdef VMS |
#define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR |
#define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR |
#define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR |
#endif |
extern void |
_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, |
GLsizei width, GLenum format, |
GLsizei imageSize, const GLvoid *data); |
extern void |
_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLsizei width, GLsizei height, |
GLenum format, GLsizei imageSize, |
const GLvoid *data); |
extern void |
_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, |
GLint yoffset, GLint zoffset, GLsizei width, |
GLsizei height, GLsizei depth, GLenum format, |
GLsizei imageSize, const GLvoid *data); |
extern void |
_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/matrix.h |
---|
0,0 → 1,109 |
/* $Id: matrix.h,v 1.1 2003-02-28 11:42:03 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef MATRIX_H |
#define MATRIX_H |
#include "mtypes.h" |
extern void |
_mesa_Frustum( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ); |
extern void |
_mesa_Ortho( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval ); |
extern void |
_mesa_PushMatrix( void ); |
extern void |
_mesa_PopMatrix( void ); |
extern void |
_mesa_LoadIdentity( void ); |
extern void |
_mesa_LoadMatrixf( const GLfloat *m ); |
extern void |
_mesa_LoadMatrixd( const GLdouble *m ); |
extern void |
_mesa_MatrixMode( GLenum mode ); |
extern void |
_mesa_MultMatrixf( const GLfloat *m ); |
extern void |
_mesa_MultMatrixd( const GLdouble *m ); |
extern void |
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); |
extern void |
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); |
extern void |
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); |
extern void |
_mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); |
extern void |
_mesa_LoadTransposeMatrixfARB( const GLfloat *m ); |
extern void |
_mesa_LoadTransposeMatrixdARB( const GLdouble *m ); |
extern void |
_mesa_MultTransposeMatrixfARB( const GLfloat *m ); |
extern void |
_mesa_MultTransposeMatrixdARB( const GLdouble *m ); |
extern void |
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ); |
extern void |
_mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ); |
extern void |
_mesa_DepthRange( GLclampd nearval, GLclampd farval ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glapitable.h |
---|
0,0 → 1,665 |
/* DO NOT EDIT - This file generated automatically with gltable.py script */ |
#ifndef _GLAPI_TABLE_H_ |
#define _GLAPI_TABLE_H_ |
#include <GL/gl.h> |
struct _glapi_table |
{ |
void (*NewList)(GLuint list, GLenum mode); /* 0 */ |
void (*EndList)(void); /* 1 */ |
void (*CallList)(GLuint list); /* 2 */ |
void (*CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */ |
void (*DeleteLists)(GLuint list, GLsizei range); /* 4 */ |
GLuint (*GenLists)(GLsizei range); /* 5 */ |
void (*ListBase)(GLuint base); /* 6 */ |
void (*Begin)(GLenum mode); /* 7 */ |
void (*Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */ |
void (*Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */ |
void (*Color3bv)(const GLbyte * v); /* 10 */ |
void (*Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */ |
void (*Color3dv)(const GLdouble * v); /* 12 */ |
void (*Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */ |
void (*Color3fv)(const GLfloat * v); /* 14 */ |
void (*Color3i)(GLint red, GLint green, GLint blue); /* 15 */ |
void (*Color3iv)(const GLint * v); /* 16 */ |
void (*Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */ |
void (*Color3sv)(const GLshort * v); /* 18 */ |
void (*Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */ |
void (*Color3ubv)(const GLubyte * v); /* 20 */ |
void (*Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */ |
void (*Color3uiv)(const GLuint * v); /* 22 */ |
void (*Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */ |
void (*Color3usv)(const GLushort * v); /* 24 */ |
void (*Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */ |
void (*Color4bv)(const GLbyte * v); /* 26 */ |
void (*Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */ |
void (*Color4dv)(const GLdouble * v); /* 28 */ |
void (*Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */ |
void (*Color4fv)(const GLfloat * v); /* 30 */ |
void (*Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */ |
void (*Color4iv)(const GLint * v); /* 32 */ |
void (*Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */ |
void (*Color4sv)(const GLshort * v); /* 34 */ |
void (*Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */ |
void (*Color4ubv)(const GLubyte * v); /* 36 */ |
void (*Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */ |
void (*Color4uiv)(const GLuint * v); /* 38 */ |
void (*Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */ |
void (*Color4usv)(const GLushort * v); /* 40 */ |
void (*EdgeFlag)(GLboolean flag); /* 41 */ |
void (*EdgeFlagv)(const GLboolean * flag); /* 42 */ |
void (*End)(void); /* 43 */ |
void (*Indexd)(GLdouble c); /* 44 */ |
void (*Indexdv)(const GLdouble * c); /* 45 */ |
void (*Indexf)(GLfloat c); /* 46 */ |
void (*Indexfv)(const GLfloat * c); /* 47 */ |
void (*Indexi)(GLint c); /* 48 */ |
void (*Indexiv)(const GLint * c); /* 49 */ |
void (*Indexs)(GLshort c); /* 50 */ |
void (*Indexsv)(const GLshort * c); /* 51 */ |
void (*Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */ |
void (*Normal3bv)(const GLbyte * v); /* 53 */ |
void (*Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */ |
void (*Normal3dv)(const GLdouble * v); /* 55 */ |
void (*Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */ |
void (*Normal3fv)(const GLfloat * v); /* 57 */ |
void (*Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */ |
void (*Normal3iv)(const GLint * v); /* 59 */ |
void (*Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */ |
void (*Normal3sv)(const GLshort * v); /* 61 */ |
void (*RasterPos2d)(GLdouble x, GLdouble y); /* 62 */ |
void (*RasterPos2dv)(const GLdouble * v); /* 63 */ |
void (*RasterPos2f)(GLfloat x, GLfloat y); /* 64 */ |
void (*RasterPos2fv)(const GLfloat * v); /* 65 */ |
void (*RasterPos2i)(GLint x, GLint y); /* 66 */ |
void (*RasterPos2iv)(const GLint * v); /* 67 */ |
void (*RasterPos2s)(GLshort x, GLshort y); /* 68 */ |
void (*RasterPos2sv)(const GLshort * v); /* 69 */ |
void (*RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */ |
void (*RasterPos3dv)(const GLdouble * v); /* 71 */ |
void (*RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */ |
void (*RasterPos3fv)(const GLfloat * v); /* 73 */ |
void (*RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */ |
void (*RasterPos3iv)(const GLint * v); /* 75 */ |
void (*RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */ |
void (*RasterPos3sv)(const GLshort * v); /* 77 */ |
void (*RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */ |
void (*RasterPos4dv)(const GLdouble * v); /* 79 */ |
void (*RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */ |
void (*RasterPos4fv)(const GLfloat * v); /* 81 */ |
void (*RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */ |
void (*RasterPos4iv)(const GLint * v); /* 83 */ |
void (*RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */ |
void (*RasterPos4sv)(const GLshort * v); /* 85 */ |
void (*Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */ |
void (*Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */ |
void (*Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */ |
void (*Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */ |
void (*Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */ |
void (*Rectiv)(const GLint * v1, const GLint * v2); /* 91 */ |
void (*Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */ |
void (*Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */ |
void (*TexCoord1d)(GLdouble s); /* 94 */ |
void (*TexCoord1dv)(const GLdouble * v); /* 95 */ |
void (*TexCoord1f)(GLfloat s); /* 96 */ |
void (*TexCoord1fv)(const GLfloat * v); /* 97 */ |
void (*TexCoord1i)(GLint s); /* 98 */ |
void (*TexCoord1iv)(const GLint * v); /* 99 */ |
void (*TexCoord1s)(GLshort s); /* 100 */ |
void (*TexCoord1sv)(const GLshort * v); /* 101 */ |
void (*TexCoord2d)(GLdouble s, GLdouble t); /* 102 */ |
void (*TexCoord2dv)(const GLdouble * v); /* 103 */ |
void (*TexCoord2f)(GLfloat s, GLfloat t); /* 104 */ |
void (*TexCoord2fv)(const GLfloat * v); /* 105 */ |
void (*TexCoord2i)(GLint s, GLint t); /* 106 */ |
void (*TexCoord2iv)(const GLint * v); /* 107 */ |
void (*TexCoord2s)(GLshort s, GLshort t); /* 108 */ |
void (*TexCoord2sv)(const GLshort * v); /* 109 */ |
void (*TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */ |
void (*TexCoord3dv)(const GLdouble * v); /* 111 */ |
void (*TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */ |
void (*TexCoord3fv)(const GLfloat * v); /* 113 */ |
void (*TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */ |
void (*TexCoord3iv)(const GLint * v); /* 115 */ |
void (*TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */ |
void (*TexCoord3sv)(const GLshort * v); /* 117 */ |
void (*TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */ |
void (*TexCoord4dv)(const GLdouble * v); /* 119 */ |
void (*TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */ |
void (*TexCoord4fv)(const GLfloat * v); /* 121 */ |
void (*TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */ |
void (*TexCoord4iv)(const GLint * v); /* 123 */ |
void (*TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */ |
void (*TexCoord4sv)(const GLshort * v); /* 125 */ |
void (*Vertex2d)(GLdouble x, GLdouble y); /* 126 */ |
void (*Vertex2dv)(const GLdouble * v); /* 127 */ |
void (*Vertex2f)(GLfloat x, GLfloat y); /* 128 */ |
void (*Vertex2fv)(const GLfloat * v); /* 129 */ |
void (*Vertex2i)(GLint x, GLint y); /* 130 */ |
void (*Vertex2iv)(const GLint * v); /* 131 */ |
void (*Vertex2s)(GLshort x, GLshort y); /* 132 */ |
void (*Vertex2sv)(const GLshort * v); /* 133 */ |
void (*Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */ |
void (*Vertex3dv)(const GLdouble * v); /* 135 */ |
void (*Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */ |
void (*Vertex3fv)(const GLfloat * v); /* 137 */ |
void (*Vertex3i)(GLint x, GLint y, GLint z); /* 138 */ |
void (*Vertex3iv)(const GLint * v); /* 139 */ |
void (*Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */ |
void (*Vertex3sv)(const GLshort * v); /* 141 */ |
void (*Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */ |
void (*Vertex4dv)(const GLdouble * v); /* 143 */ |
void (*Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */ |
void (*Vertex4fv)(const GLfloat * v); /* 145 */ |
void (*Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */ |
void (*Vertex4iv)(const GLint * v); /* 147 */ |
void (*Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */ |
void (*Vertex4sv)(const GLshort * v); /* 149 */ |
void (*ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */ |
void (*ColorMaterial)(GLenum face, GLenum mode); /* 151 */ |
void (*CullFace)(GLenum mode); /* 152 */ |
void (*Fogf)(GLenum pname, GLfloat param); /* 153 */ |
void (*Fogfv)(GLenum pname, const GLfloat * params); /* 154 */ |
void (*Fogi)(GLenum pname, GLint param); /* 155 */ |
void (*Fogiv)(GLenum pname, const GLint * params); /* 156 */ |
void (*FrontFace)(GLenum mode); /* 157 */ |
void (*Hint)(GLenum target, GLenum mode); /* 158 */ |
void (*Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */ |
void (*Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */ |
void (*Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */ |
void (*Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */ |
void (*LightModelf)(GLenum pname, GLfloat param); /* 163 */ |
void (*LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */ |
void (*LightModeli)(GLenum pname, GLint param); /* 165 */ |
void (*LightModeliv)(GLenum pname, const GLint * params); /* 166 */ |
void (*LineStipple)(GLint factor, GLushort pattern); /* 167 */ |
void (*LineWidth)(GLfloat width); /* 168 */ |
void (*Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */ |
void (*Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */ |
void (*Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */ |
void (*Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */ |
void (*PointSize)(GLfloat size); /* 173 */ |
void (*PolygonMode)(GLenum face, GLenum mode); /* 174 */ |
void (*PolygonStipple)(const GLubyte * mask); /* 175 */ |
void (*Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */ |
void (*ShadeModel)(GLenum mode); /* 177 */ |
void (*TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */ |
void (*TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */ |
void (*TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */ |
void (*TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */ |
void (*TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */ |
void (*TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */ |
void (*TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */ |
void (*TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */ |
void (*TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */ |
void (*TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */ |
void (*TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */ |
void (*TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */ |
void (*TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */ |
void (*TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */ |
void (*TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */ |
void (*TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */ |
void (*FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */ |
void (*SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */ |
GLint (*RenderMode)(GLenum mode); /* 196 */ |
void (*InitNames)(void); /* 197 */ |
void (*LoadName)(GLuint name); /* 198 */ |
void (*PassThrough)(GLfloat token); /* 199 */ |
void (*PopName)(void); /* 200 */ |
void (*PushName)(GLuint name); /* 201 */ |
void (*DrawBuffer)(GLenum mode); /* 202 */ |
void (*Clear)(GLbitfield mask); /* 203 */ |
void (*ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */ |
void (*ClearIndex)(GLfloat c); /* 205 */ |
void (*ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */ |
void (*ClearStencil)(GLint s); /* 207 */ |
void (*ClearDepth)(GLclampd depth); /* 208 */ |
void (*StencilMask)(GLuint mask); /* 209 */ |
void (*ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */ |
void (*DepthMask)(GLboolean flag); /* 211 */ |
void (*IndexMask)(GLuint mask); /* 212 */ |
void (*Accum)(GLenum op, GLfloat value); /* 213 */ |
void (*Disable)(GLenum cap); /* 214 */ |
void (*Enable)(GLenum cap); /* 215 */ |
void (*Finish)(void); /* 216 */ |
void (*Flush)(void); /* 217 */ |
void (*PopAttrib)(void); /* 218 */ |
void (*PushAttrib)(GLbitfield mask); /* 219 */ |
void (*Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */ |
void (*Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */ |
void (*Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */ |
void (*Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */ |
void (*MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */ |
void (*MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */ |
void (*MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */ |
void (*MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */ |
void (*EvalCoord1d)(GLdouble u); /* 228 */ |
void (*EvalCoord1dv)(const GLdouble * u); /* 229 */ |
void (*EvalCoord1f)(GLfloat u); /* 230 */ |
void (*EvalCoord1fv)(const GLfloat * u); /* 231 */ |
void (*EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */ |
void (*EvalCoord2dv)(const GLdouble * u); /* 233 */ |
void (*EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */ |
void (*EvalCoord2fv)(const GLfloat * u); /* 235 */ |
void (*EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */ |
void (*EvalPoint1)(GLint i); /* 237 */ |
void (*EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */ |
void (*EvalPoint2)(GLint i, GLint j); /* 239 */ |
void (*AlphaFunc)(GLenum func, GLclampf ref); /* 240 */ |
void (*BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */ |
void (*LogicOp)(GLenum opcode); /* 242 */ |
void (*StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */ |
void (*StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */ |
void (*DepthFunc)(GLenum func); /* 245 */ |
void (*PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */ |
void (*PixelTransferf)(GLenum pname, GLfloat param); /* 247 */ |
void (*PixelTransferi)(GLenum pname, GLint param); /* 248 */ |
void (*PixelStoref)(GLenum pname, GLfloat param); /* 249 */ |
void (*PixelStorei)(GLenum pname, GLint param); /* 250 */ |
void (*PixelMapfv)(GLenum map, GLint mapsize, const GLfloat * values); /* 251 */ |
void (*PixelMapuiv)(GLenum map, GLint mapsize, const GLuint * values); /* 252 */ |
void (*PixelMapusv)(GLenum map, GLint mapsize, const GLushort * values); /* 253 */ |
void (*ReadBuffer)(GLenum mode); /* 254 */ |
void (*CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */ |
void (*ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */ |
void (*DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */ |
void (*GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */ |
void (*GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */ |
void (*GetDoublev)(GLenum pname, GLdouble * params); /* 260 */ |
GLenum (*GetError)(void); /* 261 */ |
void (*GetFloatv)(GLenum pname, GLfloat * params); /* 262 */ |
void (*GetIntegerv)(GLenum pname, GLint * params); /* 263 */ |
void (*GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */ |
void (*GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */ |
void (*GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */ |
void (*GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */ |
void (*GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */ |
void (*GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */ |
void (*GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */ |
void (*GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */ |
void (*GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */ |
void (*GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */ |
void (*GetPolygonStipple)(GLubyte * mask); /* 274 */ |
const GLubyte * (*GetString)(GLenum name); /* 275 */ |
void (*GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */ |
void (*GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */ |
void (*GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */ |
void (*GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */ |
void (*GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */ |
void (*GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */ |
void (*GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */ |
void (*GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */ |
void (*GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */ |
void (*GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ |
GLboolean (*IsEnabled)(GLenum cap); /* 286 */ |
GLboolean (*IsList)(GLuint list); /* 287 */ |
void (*DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ |
void (*Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ |
void (*LoadIdentity)(void); /* 290 */ |
void (*LoadMatrixf)(const GLfloat * m); /* 291 */ |
void (*LoadMatrixd)(const GLdouble * m); /* 292 */ |
void (*MatrixMode)(GLenum mode); /* 293 */ |
void (*MultMatrixf)(const GLfloat * m); /* 294 */ |
void (*MultMatrixd)(const GLdouble * m); /* 295 */ |
void (*Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */ |
void (*PopMatrix)(void); /* 297 */ |
void (*PushMatrix)(void); /* 298 */ |
void (*Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */ |
void (*Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */ |
void (*Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */ |
void (*Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */ |
void (*Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */ |
void (*Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */ |
void (*Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */ |
void (*ArrayElement)(GLint i); /* 306 */ |
void (*BindTexture)(GLenum target, GLuint texture); /* 307 */ |
void (*ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */ |
void (*DisableClientState)(GLenum array); /* 309 */ |
void (*DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */ |
void (*DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */ |
void (*EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */ |
void (*EnableClientState)(GLenum array); /* 313 */ |
void (*IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */ |
void (*Indexub)(GLubyte c); /* 315 */ |
void (*Indexubv)(const GLubyte * c); /* 316 */ |
void (*InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */ |
void (*NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */ |
void (*PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */ |
void (*TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */ |
void (*VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */ |
GLboolean (*AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */ |
void (*CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */ |
void (*CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */ |
void (*CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */ |
void (*CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ |
void (*DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ |
void (*GenTextures)(GLsizei n, GLuint * textures); /* 328 */ |
void (*GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ |
GLboolean (*IsTexture)(GLuint texture); /* 330 */ |
void (*PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ |
void (*TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ |
void (*TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */ |
void (*PopClientAttrib)(void); /* 334 */ |
void (*PushClientAttrib)(GLbitfield mask); /* 335 */ |
void (*BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */ |
void (*BlendEquation)(GLenum mode); /* 337 */ |
void (*DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */ |
void (*ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */ |
void (*ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */ |
void (*ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */ |
void (*CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */ |
void (*GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */ |
void (*GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */ |
void (*GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */ |
void (*ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */ |
void (*CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */ |
void (*ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */ |
void (*ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */ |
void (*ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */ |
void (*ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */ |
void (*ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */ |
void (*ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */ |
void (*CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */ |
void (*CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */ |
void (*GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */ |
void (*GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */ |
void (*GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */ |
void (*GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */ |
void (*SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */ |
void (*GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */ |
void (*GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */ |
void (*GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */ |
void (*GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */ |
void (*GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */ |
void (*GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */ |
void (*Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */ |
void (*Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ |
void (*ResetHistogram)(GLenum target); /* 369 */ |
void (*ResetMinmax)(GLenum target); /* 370 */ |
void (*TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ |
void (*TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ |
void (*CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ |
void (*ActiveTextureARB)(GLenum texture); /* 374 */ |
void (*ClientActiveTextureARB)(GLenum texture); /* 375 */ |
void (*MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */ |
void (*MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */ |
void (*MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */ |
void (*MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */ |
void (*MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */ |
void (*MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */ |
void (*MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */ |
void (*MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */ |
void (*MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */ |
void (*MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */ |
void (*MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */ |
void (*MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */ |
void (*MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */ |
void (*MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */ |
void (*MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */ |
void (*MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */ |
void (*MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */ |
void (*MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */ |
void (*MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */ |
void (*MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */ |
void (*MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */ |
void (*MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */ |
void (*MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */ |
void (*MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */ |
void (*MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */ |
void (*MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */ |
void (*MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */ |
void (*MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */ |
void (*MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */ |
void (*MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */ |
void (*MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */ |
void (*MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */ |
void (*LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */ |
void (*LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */ |
void (*MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ |
void (*MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ |
void (*SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ |
void (*__unused413)(void); /* 413 */ |
void (*PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ |
void (*GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ |
void (*TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ |
void (*GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */ |
void (*GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */ |
void (*GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */ |
void (*GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */ |
void (*GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */ |
void (*GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */ |
void (*GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */ |
void (*GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */ |
void (*GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */ |
void (*GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */ |
void (*GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */ |
void (*GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */ |
void (*GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */ |
void (*PixelTexGenSGIX)(GLenum mode); /* 430 */ |
void (*PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */ |
void (*PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */ |
void (*PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */ |
void (*PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ |
void (*GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ |
void (*GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ |
void (*TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ |
void (*TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ |
GLboolean (*AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */ |
void (*GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */ |
GLboolean (*IsTextureEXT)(GLuint texture); /* 441 */ |
void (*DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */ |
void (*GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */ |
void (*SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */ |
void (*GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */ |
void (*SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */ |
void (*SamplePatternSGIS)(GLenum pattern); /* 447 */ |
void (*ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */ |
void (*EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */ |
void (*IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */ |
void (*NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */ |
void (*TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */ |
void (*VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */ |
void (*SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */ |
void (*SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */ |
void (*SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */ |
void (*SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */ |
void (*PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */ |
void (*PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */ |
GLint (*GetInstrumentsSGIX)(void); /* 460 */ |
void (*InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */ |
GLint (*PollInstrumentsSGIX)(GLint * marker_p); /* 462 */ |
void (*ReadInstrumentsSGIX)(GLint marker); /* 463 */ |
void (*StartInstrumentsSGIX)(void); /* 464 */ |
void (*StopInstrumentsSGIX)(GLint marker); /* 465 */ |
void (*FrameZoomSGIX)(GLint factor); /* 466 */ |
void (*TagSampleBufferSGIX)(void); /* 467 */ |
void (*ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */ |
void (*FlushRasterSGIX)(void); /* 469 */ |
void (*GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */ |
void (*GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */ |
void (*ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */ |
void (*ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */ |
void (*ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */ |
void (*ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */ |
void (*FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */ |
void (*FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */ |
void (*FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */ |
void (*FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */ |
void (*FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */ |
void (*FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */ |
void (*FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */ |
void (*FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */ |
void (*FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */ |
void (*FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */ |
void (*FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */ |
void (*FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */ |
void (*FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */ |
void (*GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */ |
void (*GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */ |
void (*GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */ |
void (*GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */ |
void (*LightEnviSGIX)(GLenum pname, GLint param); /* 493 */ |
void (*VertexWeightfEXT)(GLfloat weight); /* 494 */ |
void (*VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ |
void (*VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ |
void (*FlushVertexArrayRangeNV)(void); /* 497 */ |
void (*VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ |
void (*CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ |
void (*CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ |
void (*CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ |
void (*CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */ |
void (*CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */ |
void (*CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */ |
void (*FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */ |
void (*GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */ |
void (*GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */ |
void (*GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */ |
void (*GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */ |
void (*GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */ |
void (*GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */ |
void (*ResizeBuffersMESA)(void); /* 512 */ |
void (*WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */ |
void (*WindowPos2dvMESA)(const GLdouble * v); /* 514 */ |
void (*WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */ |
void (*WindowPos2fvMESA)(const GLfloat * v); /* 516 */ |
void (*WindowPos2iMESA)(GLint x, GLint y); /* 517 */ |
void (*WindowPos2ivMESA)(const GLint * v); /* 518 */ |
void (*WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */ |
void (*WindowPos2svMESA)(const GLshort * v); /* 520 */ |
void (*WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */ |
void (*WindowPos3dvMESA)(const GLdouble * v); /* 522 */ |
void (*WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */ |
void (*WindowPos3fvMESA)(const GLfloat * v); /* 524 */ |
void (*WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */ |
void (*WindowPos3ivMESA)(const GLint * v); /* 526 */ |
void (*WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */ |
void (*WindowPos3svMESA)(const GLshort * v); /* 528 */ |
void (*WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */ |
void (*WindowPos4dvMESA)(const GLdouble * v); /* 530 */ |
void (*WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */ |
void (*WindowPos4fvMESA)(const GLfloat * v); /* 532 */ |
void (*WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */ |
void (*WindowPos4ivMESA)(const GLint * v); /* 534 */ |
void (*WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */ |
void (*WindowPos4svMESA)(const GLshort * v); /* 536 */ |
void (*BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */ |
void (*IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */ |
void (*IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */ |
void (*LockArraysEXT)(GLint first, GLsizei count); /* 540 */ |
void (*UnlockArraysEXT)(void); /* 541 */ |
void (*CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */ |
void (*CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */ |
void (*HintPGI)(GLenum target, GLint mode); /* 544 */ |
void (*FogCoordfEXT)(GLfloat coord); /* 545 */ |
void (*FogCoordfvEXT)(const GLfloat * coord); /* 546 */ |
void (*FogCoorddEXT)(GLdouble coord); /* 547 */ |
void (*FogCoorddvEXT)(const GLdouble * coord); /* 548 */ |
void (*FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */ |
void (*GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ |
void (*GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ |
void (*GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ |
void (*TbufferMask3DFX)(GLuint mask); /* 553 */ |
void (*CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ |
void (*CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ |
void (*CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ |
void (*CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ |
void (*CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ |
void (*CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ |
void (*GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */ |
void (*SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */ |
void (*SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */ |
void (*SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */ |
void (*SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */ |
void (*SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */ |
void (*SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */ |
void (*SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */ |
void (*SecondaryColor3ivEXT)(const GLint * v); /* 568 */ |
void (*SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */ |
void (*SecondaryColor3svEXT)(const GLshort * v); /* 570 */ |
void (*SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */ |
void (*SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */ |
void (*SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */ |
void (*SecondaryColor3uivEXT)(const GLuint * v); /* 574 */ |
void (*SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ |
void (*SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ |
void (*SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ |
GLboolean (*AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ |
void (*BindProgramNV)(GLenum target, GLuint id); /* 579 */ |
void (*DeleteProgramsNV)(GLsizei n, const GLuint * ids); /* 580 */ |
void (*ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ |
void (*GenProgramsNV)(GLsizei n, GLuint * ids); /* 582 */ |
void (*GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ |
void (*GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ |
void (*GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ |
void (*GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ |
void (*GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ |
void (*GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ |
void (*GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ |
void (*GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 590 */ |
void (*GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 591 */ |
GLboolean (*IsProgramNV)(GLuint id); /* 592 */ |
void (*LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ |
void (*ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ |
void (*ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ |
void (*ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ |
void (*ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ |
void (*ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ |
void (*ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ |
void (*RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ |
void (*TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ |
void (*VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ |
void (*VertexAttrib1dNV)(GLuint index, GLdouble x); /* 603 */ |
void (*VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 604 */ |
void (*VertexAttrib1fNV)(GLuint index, GLfloat x); /* 605 */ |
void (*VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 606 */ |
void (*VertexAttrib1sNV)(GLuint index, GLshort x); /* 607 */ |
void (*VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 608 */ |
void (*VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 609 */ |
void (*VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 610 */ |
void (*VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 611 */ |
void (*VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 612 */ |
void (*VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 613 */ |
void (*VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 614 */ |
void (*VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ |
void (*VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 616 */ |
void (*VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ |
void (*VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 618 */ |
void (*VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ |
void (*VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 620 */ |
void (*VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ |
void (*VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 622 */ |
void (*VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ |
void (*VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 624 */ |
void (*VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ |
void (*VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 626 */ |
void (*VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ |
void (*VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 628 */ |
void (*VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ |
void (*VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ |
void (*VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ |
void (*VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ |
void (*VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ |
void (*VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ |
void (*VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ |
void (*VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ |
void (*VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ |
void (*VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ |
void (*VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ |
void (*VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ |
void (*VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ |
void (*PointParameteriNV)(GLenum pname, GLint params); /* 642 */ |
void (*PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ |
void (*MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ |
void (*MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ |
void (*ActiveStencilFaceEXT)(GLenum face); /* 646 */ |
void (*DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ |
void (*GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ |
GLboolean (*IsFenceNV)(GLuint fence); /* 649 */ |
GLboolean (*TestFenceNV)(GLuint fence); /* 650 */ |
void (*GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ |
void (*FinishFenceNV)(GLuint fence); /* 652 */ |
void (*SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ |
}; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/texformat.c |
---|
0,0 → 1,790 |
/* $Id: texformat.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Author: |
* Gareth Hughes |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "image.h" |
#include "imports.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "texformat.h" |
#include "teximage.h" |
#include "texstate.h" |
/* Texel fetch routines for all supported formats: |
*/ |
#define DIM 1 |
#include "texformat_tmp.h" |
#define DIM 2 |
#include "texformat_tmp.h" |
#define DIM 3 |
#include "texformat_tmp.h" |
/* Have to have this so the FetchTexel function pointer is never NULL. |
*/ |
static void fetch_null_texel( const struct gl_texture_image *texImage, |
GLint i, GLint j, GLint k, GLvoid *texel ) |
{ |
GLchan *rgba = (GLchan *) texel; |
rgba[RCOMP] = 0; |
rgba[GCOMP] = 0; |
rgba[BCOMP] = 0; |
rgba[ACOMP] = 0; |
} |
/* ============================================================= |
* Default GLchan-based formats: |
*/ |
const struct gl_texture_format _mesa_texformat_rgba = { |
MESA_FORMAT_RGBA, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
CHAN_BITS, /* RedBits */ |
CHAN_BITS, /* GreenBits */ |
CHAN_BITS, /* BlueBits */ |
CHAN_BITS, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
4 * CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_rgba, /* FetchTexel1D */ |
fetch_2d_texel_rgba, /* FetchTexel2D */ |
fetch_3d_texel_rgba, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_rgb = { |
MESA_FORMAT_RGB, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
CHAN_BITS, /* RedBits */ |
CHAN_BITS, /* GreenBits */ |
CHAN_BITS, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
3 * CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_rgb, /* FetchTexel1D */ |
fetch_2d_texel_rgb, /* FetchTexel2D */ |
fetch_3d_texel_rgb, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_alpha = { |
MESA_FORMAT_ALPHA, /* MesaFormat */ |
GL_ALPHA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
CHAN_BITS, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_alpha, /* FetchTexel1D */ |
fetch_2d_texel_alpha, /* FetchTexel2D */ |
fetch_3d_texel_alpha, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_luminance = { |
MESA_FORMAT_LUMINANCE, /* MesaFormat */ |
GL_LUMINANCE, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
CHAN_BITS, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_luminance, /* FetchTexel1D */ |
fetch_2d_texel_luminance, /* FetchTexel2D */ |
fetch_3d_texel_luminance, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_luminance_alpha = { |
MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ |
GL_LUMINANCE_ALPHA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
CHAN_BITS, /* AlphaBits */ |
CHAN_BITS, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2 * CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_luminance_alpha, /* FetchTexel1D */ |
fetch_2d_texel_luminance_alpha, /* FetchTexel2D */ |
fetch_3d_texel_luminance_alpha, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_intensity = { |
MESA_FORMAT_INTENSITY, /* MesaFormat */ |
GL_INTENSITY, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
CHAN_BITS, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_intensity, /* FetchTexel1D */ |
fetch_2d_texel_intensity, /* FetchTexel2D */ |
fetch_3d_texel_intensity, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_color_index = { |
MESA_FORMAT_COLOR_INDEX, /* MesaFormat */ |
GL_COLOR_INDEX, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
CHAN_BITS, /* IndexBits */ |
0, /* DepthBits */ |
CHAN_BITS / 8, /* TexelBytes */ |
fetch_1d_texel_color_index, /* FetchTexel1D */ |
fetch_2d_texel_color_index, /* FetchTexel2D */ |
fetch_3d_texel_color_index, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_depth_component = { |
MESA_FORMAT_DEPTH_COMPONENT, /* MesaFormat */ |
GL_DEPTH_COMPONENT, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
sizeof(GLfloat) * 8, /* DepthBits */ |
sizeof(GLfloat), /* TexelBytes */ |
fetch_1d_texel_depth_component, /* FetchTexel1D */ |
fetch_2d_texel_depth_component, /* FetchTexel2D */ |
fetch_3d_texel_depth_component, /* FetchTexel3D */ |
}; |
/* ============================================================= |
* Hardware formats: |
*/ |
const struct gl_texture_format _mesa_texformat_rgba8888 = { |
MESA_FORMAT_RGBA8888, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
8, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
4, /* TexelBytes */ |
fetch_1d_texel_rgba8888, /* FetchTexel1D */ |
fetch_2d_texel_rgba8888, /* FetchTexel2D */ |
fetch_3d_texel_rgba8888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_argb8888 = { |
MESA_FORMAT_ARGB8888, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
8, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
4, /* TexelBytes */ |
fetch_1d_texel_argb8888, /* FetchTexel1D */ |
fetch_2d_texel_argb8888, /* FetchTexel2D */ |
fetch_3d_texel_argb8888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_rgb888 = { |
MESA_FORMAT_RGB888, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
3, /* TexelBytes */ |
fetch_1d_texel_rgb888, /* FetchTexel1D */ |
fetch_2d_texel_rgb888, /* FetchTexel2D */ |
fetch_3d_texel_rgb888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_rgb565 = { |
MESA_FORMAT_RGB565, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
5, /* RedBits */ |
6, /* GreenBits */ |
5, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_rgb565, /* FetchTexel1D */ |
fetch_2d_texel_rgb565, /* FetchTexel2D */ |
fetch_3d_texel_rgb565, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_argb4444 = { |
MESA_FORMAT_ARGB4444, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
4, /* RedBits */ |
4, /* GreenBits */ |
4, /* BlueBits */ |
4, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_argb4444, /* FetchTexel1D */ |
fetch_2d_texel_argb4444, /* FetchTexel2D */ |
fetch_3d_texel_argb4444, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_argb1555 = { |
MESA_FORMAT_ARGB1555, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
5, /* RedBits */ |
5, /* GreenBits */ |
5, /* BlueBits */ |
1, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_argb1555, /* FetchTexel1D */ |
fetch_2d_texel_argb1555, /* FetchTexel2D */ |
fetch_3d_texel_argb1555, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_al88 = { |
MESA_FORMAT_AL88, /* MesaFormat */ |
GL_LUMINANCE_ALPHA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
8, /* AlphaBits */ |
8, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_al88, /* FetchTexel1D */ |
fetch_2d_texel_al88, /* FetchTexel2D */ |
fetch_3d_texel_al88, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_rgb332 = { |
MESA_FORMAT_RGB332, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
3, /* RedBits */ |
3, /* GreenBits */ |
2, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_rgb332, /* FetchTexel1D */ |
fetch_2d_texel_rgb332, /* FetchTexel2D */ |
fetch_3d_texel_rgb332, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_a8 = { |
MESA_FORMAT_A8, /* MesaFormat */ |
GL_ALPHA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
8, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_a8, /* FetchTexel1D */ |
fetch_2d_texel_a8, /* FetchTexel2D */ |
fetch_3d_texel_a8, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_l8 = { |
MESA_FORMAT_L8, /* MesaFormat */ |
GL_LUMINANCE, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
8, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_l8, /* FetchTexel1D */ |
fetch_2d_texel_l8, /* FetchTexel2D */ |
fetch_3d_texel_l8, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_i8 = { |
MESA_FORMAT_I8, /* MesaFormat */ |
GL_INTENSITY, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
8, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_i8, /* FetchTexel1D */ |
fetch_2d_texel_i8, /* FetchTexel2D */ |
fetch_3d_texel_i8, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_ci8 = { |
MESA_FORMAT_CI8, /* MesaFormat */ |
GL_COLOR_INDEX, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
8, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_ci8, /* FetchTexel1D */ |
fetch_2d_texel_ci8, /* FetchTexel2D */ |
fetch_3d_texel_ci8, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_ycbcr = { |
MESA_FORMAT_YCBCR, /* MesaFormat */ |
GL_YCBCR_MESA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_ycbcr, /* FetchTexel1D */ |
fetch_2d_texel_ycbcr, /* FetchTexel2D */ |
fetch_3d_texel_ycbcr, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_ycbcr_rev = { |
MESA_FORMAT_YCBCR_REV, /* MesaFormat */ |
GL_YCBCR_MESA, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_ycbcr_rev, /* FetchTexel1D */ |
fetch_2d_texel_ycbcr_rev, /* FetchTexel2D */ |
fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */ |
}; |
/* Big-endian */ |
#if 0 |
const struct gl_texture_format _mesa_texformat_abgr8888 = { |
MESA_FORMAT_ABGR8888, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
GL_UNSIGNED_INT_8_8_8_8, /* Type */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
8, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
4, /* TexelBytes */ |
fetch_1d_texel_abgr8888, /* FetchTexel1D */ |
fetch_2d_texel_abgr8888, /* FetchTexel2D */ |
fetch_3d_texel_abgr8888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgra8888 = { |
MESA_FORMAT_BGRA8888, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
GL_UNSIGNED_INT_8_8_8_8, /* Type */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
8, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
4, /* TexelBytes */ |
fetch_1d_texel_bgra8888, /* FetchTexel1D */ |
fetch_2d_texel_bgra8888, /* FetchTexel2D */ |
fetch_3d_texel_bgra8888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgr888 = { |
MESA_FORMAT_BGR888, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
GL_UNSIGNED_BYTE, /* Type */ |
8, /* RedBits */ |
8, /* GreenBits */ |
8, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
3, /* TexelBytes */ |
fetch_1d_texel_bgr888, /* FetchTexel1D */ |
fetch_2d_texel_bgr888, /* FetchTexel2D */ |
fetch_3d_texel_bgr888, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgr565 = { |
MESA_FORMAT_BGR565, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
GL_UNSIGNED_SHORT_5_6_5, /* Type */ |
5, /* RedBits */ |
6, /* GreenBits */ |
5, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_bgr565, /* FetchTexel1D */ |
fetch_2d_texel_bgr565, /* FetchTexel2D */ |
fetch_3d_texel_bgr565, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgra4444 = { |
MESA_FORMAT_BGRA4444, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */ |
4, /* RedBits */ |
4, /* GreenBits */ |
4, /* BlueBits */ |
4, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_bgra4444, /* FetchTexel1D */ |
fetch_2d_texel_bgra4444, /* FetchTexel2D */ |
fetch_3d_texel_bgra4444, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgra5551 = { |
MESA_FORMAT_BGRA5551, /* MesaFormat */ |
GL_RGBA, /* BaseFormat */ |
GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */ |
5, /* RedBits */ |
5, /* GreenBits */ |
5, /* BlueBits */ |
1, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_bgra1555, /* FetchTexel1D */ |
fetch_2d_texel_bgra1555, /* FetchTexel2D */ |
fetch_3d_texel_bgra1555, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_la88 = { |
MESA_FORMAT_LA88, /* MesaFormat */ |
GL_LUMINANCE_ALPHA, /* BaseFormat */ |
GL_UNSIGNED_BYTE, /* Type */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
8, /* AlphaBits */ |
8, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
2, /* TexelBytes */ |
fetch_1d_texel_la88, /* FetchTexel1D */ |
fetch_2d_texel_la88, /* FetchTexel2D */ |
fetch_3d_texel_la88, /* FetchTexel3D */ |
}; |
const struct gl_texture_format _mesa_texformat_bgr233 = { |
MESA_FORMAT_BGR233, /* MesaFormat */ |
GL_RGB, /* BaseFormat */ |
GL_UNSIGNED_BYTE_3_3_2, /* Type */ |
3, /* RedBits */ |
3, /* GreenBits */ |
2, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
1, /* TexelBytes */ |
fetch_1d_texel_bgr233, /* FetchTexel1D */ |
fetch_2d_texel_bgr233, /* FetchTexel2D */ |
fetch_3d_texel_bgr233, /* FetchTexel3D */ |
}; |
#endif |
/* ============================================================= |
* Null format (useful for proxy textures): |
*/ |
const struct gl_texture_format _mesa_null_texformat = { |
-1, /* MesaFormat */ |
0, /* BaseFormat */ |
0, /* RedBits */ |
0, /* GreenBits */ |
0, /* BlueBits */ |
0, /* AlphaBits */ |
0, /* LuminanceBits */ |
0, /* IntensityBits */ |
0, /* IndexBits */ |
0, /* DepthBits */ |
0, /* TexelBytes */ |
fetch_null_texel, /* FetchTexel1D */ |
fetch_null_texel, /* FetchTexel2D */ |
fetch_null_texel, /* FetchTexel3D */ |
}; |
GLboolean |
_mesa_is_hardware_tex_format( const struct gl_texture_format *format ) |
{ |
return (format->MesaFormat < MESA_FORMAT_RGBA); |
} |
/* Given an internal texture format (or 1, 2, 3, 4) return a pointer |
* to a gl_texture_format which which to store the texture. |
* This is called via ctx->Driver.ChooseTextureFormat(). |
* Hardware drivers typically override this function with a specialized |
* version. |
*/ |
const struct gl_texture_format * |
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, |
GLenum format, GLenum type ) |
{ |
(void) format; |
(void) type; |
switch ( internalFormat ) { |
/* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has |
* got to be better than sticking them way down the end of this |
* huge list. |
*/ |
case 4: /* Quake3 uses this... */ |
case GL_RGBA: |
return &_mesa_texformat_rgba; |
case 3: /* ... and this. */ |
case GL_RGB: |
return &_mesa_texformat_rgb; |
/* GH: Okay, keep checking as normal. Still test for GL_RGB, |
* GL_RGBA formats first. |
*/ |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return &_mesa_texformat_rgba; |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return &_mesa_texformat_rgb; |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return &_mesa_texformat_alpha; |
case 1: |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return &_mesa_texformat_luminance; |
case 2: |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return &_mesa_texformat_luminance_alpha; |
case GL_INTENSITY: |
case GL_INTENSITY4: |
case GL_INTENSITY8: |
case GL_INTENSITY12: |
case GL_INTENSITY16: |
return &_mesa_texformat_intensity; |
case GL_COLOR_INDEX: |
case GL_COLOR_INDEX1_EXT: |
case GL_COLOR_INDEX2_EXT: |
case GL_COLOR_INDEX4_EXT: |
case GL_COLOR_INDEX8_EXT: |
case GL_COLOR_INDEX12_EXT: |
case GL_COLOR_INDEX16_EXT: |
return &_mesa_texformat_color_index; |
case GL_DEPTH_COMPONENT: |
case GL_DEPTH_COMPONENT16_SGIX: |
case GL_DEPTH_COMPONENT24_SGIX: |
case GL_DEPTH_COMPONENT32_SGIX: |
if (!ctx->Extensions.SGIX_depth_texture) |
_mesa_problem(ctx, "depth format without GL_SGIX_depth_texture"); |
return &_mesa_texformat_depth_component; |
case GL_COMPRESSED_ALPHA_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_alpha; |
case GL_COMPRESSED_LUMINANCE_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_luminance; |
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_luminance_alpha; |
case GL_COMPRESSED_INTENSITY_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_intensity; |
case GL_COMPRESSED_RGB_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_rgb; |
case GL_COMPRESSED_RGBA_ARB: |
if (!ctx->Extensions.ARB_texture_compression) |
_mesa_problem(ctx, "texture compression extension not enabled"); |
return &_mesa_texformat_rgba; |
/* GL_MESA_ycrcr_texture */ |
case GL_YCBCR_MESA: |
if (type == GL_UNSIGNED_SHORT_8_8_MESA) |
return &_mesa_texformat_ycbcr; |
else |
return &_mesa_texformat_ycbcr_rev; |
default: |
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); |
return NULL; |
} |
} |
/* |
* Return the base texture format for the given compressed format |
* Called via ctx->Driver.BaseCompressedTexFormat(). |
* This function is used by software rasterizers. Hardware drivers |
* which support texture compression should not use this function but |
* a specialized function instead. |
*/ |
GLint |
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat) |
{ |
switch (intFormat) { |
case GL_COMPRESSED_ALPHA_ARB: |
return GL_ALPHA; |
case GL_COMPRESSED_LUMINANCE_ARB: |
return GL_LUMINANCE; |
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: |
return GL_LUMINANCE_ALPHA; |
case GL_COMPRESSED_INTENSITY_ARB: |
return GL_INTENSITY; |
case GL_COMPRESSED_RGB_ARB: |
return GL_RGB; |
case GL_COMPRESSED_RGBA_ARB: |
return GL_RGBA; |
default: |
return -1; /* not a recognized compressed format */ |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/colortab.h |
---|
0,0 → 1,87 |
/* $Id: colortab.h,v 1.1 2003-02-28 11:41:58 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef COLORTAB_H |
#define COLORTAB_H |
#include "mtypes.h" |
extern void |
_mesa_init_colortable( struct gl_color_table *p ); |
extern void |
_mesa_free_colortable_data( struct gl_color_table *p ); |
extern void |
_mesa_ColorTable( GLenum target, GLenum internalformat, |
GLsizei width, GLenum format, GLenum type, |
const GLvoid *table ); |
extern void |
_mesa_ColorSubTable( GLenum target, GLsizei start, |
GLsizei count, GLenum format, GLenum type, |
const GLvoid *table ); |
extern void |
_mesa_CopyColorSubTable(GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width); |
extern void |
_mesa_CopyColorTable(GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width); |
extern void |
_mesa_GetColorTable( GLenum target, GLenum format, |
GLenum type, GLvoid *table ); |
extern void |
_mesa_ColorTableParameterfv(GLenum target, GLenum pname, |
const GLfloat *params); |
extern void |
_mesa_ColorTableParameteriv(GLenum target, GLenum pname, |
const GLint *params); |
extern void |
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/fog.c |
---|
0,0 → 1,160 |
/* $Id: fog.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "fog.h" |
#include "mtypes.h" |
void |
_mesa_Fogf(GLenum pname, GLfloat param) |
{ |
_mesa_Fogfv(pname, ¶m); |
} |
void |
_mesa_Fogi(GLenum pname, GLint param ) |
{ |
GLfloat fparam = (GLfloat) param; |
_mesa_Fogfv(pname, &fparam); |
} |
void |
_mesa_Fogiv(GLenum pname, const GLint *params ) |
{ |
GLfloat p[4]; |
switch (pname) { |
case GL_FOG_MODE: |
case GL_FOG_DENSITY: |
case GL_FOG_START: |
case GL_FOG_END: |
case GL_FOG_INDEX: |
case GL_FOG_COORDINATE_SOURCE_EXT: |
p[0] = (GLfloat) *params; |
break; |
case GL_FOG_COLOR: |
p[0] = INT_TO_FLOAT( params[0] ); |
p[1] = INT_TO_FLOAT( params[1] ); |
p[2] = INT_TO_FLOAT( params[2] ); |
p[3] = INT_TO_FLOAT( params[3] ); |
break; |
default: |
/* Error will be caught later in _mesa_Fogfv */ |
; |
} |
_mesa_Fogfv(pname, p); |
} |
void |
_mesa_Fogfv( GLenum pname, const GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLenum m; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (pname) { |
case GL_FOG_MODE: |
m = (GLenum) (GLint) *params; |
switch (m) { |
case GL_LINEAR: |
case GL_EXP: |
case GL_EXP2: |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); |
return; |
} |
if (ctx->Fog.Mode == m) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Mode = m; |
break; |
case GL_FOG_DENSITY: |
if (*params<0.0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glFog" ); |
return; |
} |
if (ctx->Fog.Density == *params) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Density = *params; |
break; |
case GL_FOG_START: |
if (ctx->Fog.Start == *params) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Start = *params; |
break; |
case GL_FOG_END: |
if (ctx->Fog.End == *params) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.End = *params; |
break; |
case GL_FOG_INDEX: |
if (ctx->Fog.Index == *params) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Index = *params; |
break; |
case GL_FOG_COLOR: |
if (TEST_EQ_4V(ctx->Fog.Color, params)) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Color[0] = params[0]; |
ctx->Fog.Color[1] = params[1]; |
ctx->Fog.Color[2] = params[2]; |
ctx->Fog.Color[3] = params[3]; |
break; |
case GL_FOG_COORDINATE_SOURCE_EXT: { |
GLenum p = (GLenum) (GLint) *params; |
if (!ctx->Extensions.EXT_fog_coord || |
(p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glFog"); |
return; |
} |
if (ctx->Fog.FogCoordinateSource == p) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.FogCoordinateSource = p; |
break; |
} |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); |
return; |
} |
if (ctx->Driver.Fogfv) { |
(*ctx->Driver.Fogfv)( ctx, pname, params ); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/glprocs.h |
---|
0,0 → 1,814 |
/* DO NOT EDIT - This file generated automatically by glprocs.py script */ |
/* This file is only included by glapi.c and is used for |
* the GetProcAddress() function |
*/ |
static struct name_address_offset static_functions[] = { |
{ "glNewList", (GLvoid *) glNewList, _gloffset_NewList }, |
{ "glEndList", (GLvoid *) glEndList, _gloffset_EndList }, |
{ "glCallList", (GLvoid *) glCallList, _gloffset_CallList }, |
{ "glCallLists", (GLvoid *) glCallLists, _gloffset_CallLists }, |
{ "glDeleteLists", (GLvoid *) glDeleteLists, _gloffset_DeleteLists }, |
{ "glGenLists", (GLvoid *) glGenLists, _gloffset_GenLists }, |
{ "glListBase", (GLvoid *) glListBase, _gloffset_ListBase }, |
{ "glBegin", (GLvoid *) glBegin, _gloffset_Begin }, |
{ "glBitmap", (GLvoid *) glBitmap, _gloffset_Bitmap }, |
{ "glColor3b", (GLvoid *) glColor3b, _gloffset_Color3b }, |
{ "glColor3bv", (GLvoid *) glColor3bv, _gloffset_Color3bv }, |
{ "glColor3d", (GLvoid *) glColor3d, _gloffset_Color3d }, |
{ "glColor3dv", (GLvoid *) glColor3dv, _gloffset_Color3dv }, |
{ "glColor3f", (GLvoid *) glColor3f, _gloffset_Color3f }, |
{ "glColor3fv", (GLvoid *) glColor3fv, _gloffset_Color3fv }, |
{ "glColor3i", (GLvoid *) glColor3i, _gloffset_Color3i }, |
{ "glColor3iv", (GLvoid *) glColor3iv, _gloffset_Color3iv }, |
{ "glColor3s", (GLvoid *) glColor3s, _gloffset_Color3s }, |
{ "glColor3sv", (GLvoid *) glColor3sv, _gloffset_Color3sv }, |
{ "glColor3ub", (GLvoid *) glColor3ub, _gloffset_Color3ub }, |
{ "glColor3ubv", (GLvoid *) glColor3ubv, _gloffset_Color3ubv }, |
{ "glColor3ui", (GLvoid *) glColor3ui, _gloffset_Color3ui }, |
{ "glColor3uiv", (GLvoid *) glColor3uiv, _gloffset_Color3uiv }, |
{ "glColor3us", (GLvoid *) glColor3us, _gloffset_Color3us }, |
{ "glColor3usv", (GLvoid *) glColor3usv, _gloffset_Color3usv }, |
{ "glColor4b", (GLvoid *) glColor4b, _gloffset_Color4b }, |
{ "glColor4bv", (GLvoid *) glColor4bv, _gloffset_Color4bv }, |
{ "glColor4d", (GLvoid *) glColor4d, _gloffset_Color4d }, |
{ "glColor4dv", (GLvoid *) glColor4dv, _gloffset_Color4dv }, |
{ "glColor4f", (GLvoid *) glColor4f, _gloffset_Color4f }, |
{ "glColor4fv", (GLvoid *) glColor4fv, _gloffset_Color4fv }, |
{ "glColor4i", (GLvoid *) glColor4i, _gloffset_Color4i }, |
{ "glColor4iv", (GLvoid *) glColor4iv, _gloffset_Color4iv }, |
{ "glColor4s", (GLvoid *) glColor4s, _gloffset_Color4s }, |
{ "glColor4sv", (GLvoid *) glColor4sv, _gloffset_Color4sv }, |
{ "glColor4ub", (GLvoid *) glColor4ub, _gloffset_Color4ub }, |
{ "glColor4ubv", (GLvoid *) glColor4ubv, _gloffset_Color4ubv }, |
{ "glColor4ui", (GLvoid *) glColor4ui, _gloffset_Color4ui }, |
{ "glColor4uiv", (GLvoid *) glColor4uiv, _gloffset_Color4uiv }, |
{ "glColor4us", (GLvoid *) glColor4us, _gloffset_Color4us }, |
{ "glColor4usv", (GLvoid *) glColor4usv, _gloffset_Color4usv }, |
{ "glEdgeFlag", (GLvoid *) glEdgeFlag, _gloffset_EdgeFlag }, |
{ "glEdgeFlagv", (GLvoid *) glEdgeFlagv, _gloffset_EdgeFlagv }, |
{ "glEnd", (GLvoid *) glEnd, _gloffset_End }, |
{ "glIndexd", (GLvoid *) glIndexd, _gloffset_Indexd }, |
{ "glIndexdv", (GLvoid *) glIndexdv, _gloffset_Indexdv }, |
{ "glIndexf", (GLvoid *) glIndexf, _gloffset_Indexf }, |
{ "glIndexfv", (GLvoid *) glIndexfv, _gloffset_Indexfv }, |
{ "glIndexi", (GLvoid *) glIndexi, _gloffset_Indexi }, |
{ "glIndexiv", (GLvoid *) glIndexiv, _gloffset_Indexiv }, |
{ "glIndexs", (GLvoid *) glIndexs, _gloffset_Indexs }, |
{ "glIndexsv", (GLvoid *) glIndexsv, _gloffset_Indexsv }, |
{ "glNormal3b", (GLvoid *) glNormal3b, _gloffset_Normal3b }, |
{ "glNormal3bv", (GLvoid *) glNormal3bv, _gloffset_Normal3bv }, |
{ "glNormal3d", (GLvoid *) glNormal3d, _gloffset_Normal3d }, |
{ "glNormal3dv", (GLvoid *) glNormal3dv, _gloffset_Normal3dv }, |
{ "glNormal3f", (GLvoid *) glNormal3f, _gloffset_Normal3f }, |
{ "glNormal3fv", (GLvoid *) glNormal3fv, _gloffset_Normal3fv }, |
{ "glNormal3i", (GLvoid *) glNormal3i, _gloffset_Normal3i }, |
{ "glNormal3iv", (GLvoid *) glNormal3iv, _gloffset_Normal3iv }, |
{ "glNormal3s", (GLvoid *) glNormal3s, _gloffset_Normal3s }, |
{ "glNormal3sv", (GLvoid *) glNormal3sv, _gloffset_Normal3sv }, |
{ "glRasterPos2d", (GLvoid *) glRasterPos2d, _gloffset_RasterPos2d }, |
{ "glRasterPos2dv", (GLvoid *) glRasterPos2dv, _gloffset_RasterPos2dv }, |
{ "glRasterPos2f", (GLvoid *) glRasterPos2f, _gloffset_RasterPos2f }, |
{ "glRasterPos2fv", (GLvoid *) glRasterPos2fv, _gloffset_RasterPos2fv }, |
{ "glRasterPos2i", (GLvoid *) glRasterPos2i, _gloffset_RasterPos2i }, |
{ "glRasterPos2iv", (GLvoid *) glRasterPos2iv, _gloffset_RasterPos2iv }, |
{ "glRasterPos2s", (GLvoid *) glRasterPos2s, _gloffset_RasterPos2s }, |
{ "glRasterPos2sv", (GLvoid *) glRasterPos2sv, _gloffset_RasterPos2sv }, |
{ "glRasterPos3d", (GLvoid *) glRasterPos3d, _gloffset_RasterPos3d }, |
{ "glRasterPos3dv", (GLvoid *) glRasterPos3dv, _gloffset_RasterPos3dv }, |
{ "glRasterPos3f", (GLvoid *) glRasterPos3f, _gloffset_RasterPos3f }, |
{ "glRasterPos3fv", (GLvoid *) glRasterPos3fv, _gloffset_RasterPos3fv }, |
{ "glRasterPos3i", (GLvoid *) glRasterPos3i, _gloffset_RasterPos3i }, |
{ "glRasterPos3iv", (GLvoid *) glRasterPos3iv, _gloffset_RasterPos3iv }, |
{ "glRasterPos3s", (GLvoid *) glRasterPos3s, _gloffset_RasterPos3s }, |
{ "glRasterPos3sv", (GLvoid *) glRasterPos3sv, _gloffset_RasterPos3sv }, |
{ "glRasterPos4d", (GLvoid *) glRasterPos4d, _gloffset_RasterPos4d }, |
{ "glRasterPos4dv", (GLvoid *) glRasterPos4dv, _gloffset_RasterPos4dv }, |
{ "glRasterPos4f", (GLvoid *) glRasterPos4f, _gloffset_RasterPos4f }, |
{ "glRasterPos4fv", (GLvoid *) glRasterPos4fv, _gloffset_RasterPos4fv }, |
{ "glRasterPos4i", (GLvoid *) glRasterPos4i, _gloffset_RasterPos4i }, |
{ "glRasterPos4iv", (GLvoid *) glRasterPos4iv, _gloffset_RasterPos4iv }, |
{ "glRasterPos4s", (GLvoid *) glRasterPos4s, _gloffset_RasterPos4s }, |
{ "glRasterPos4sv", (GLvoid *) glRasterPos4sv, _gloffset_RasterPos4sv }, |
{ "glRectd", (GLvoid *) glRectd, _gloffset_Rectd }, |
{ "glRectdv", (GLvoid *) glRectdv, _gloffset_Rectdv }, |
{ "glRectf", (GLvoid *) glRectf, _gloffset_Rectf }, |
{ "glRectfv", (GLvoid *) glRectfv, _gloffset_Rectfv }, |
{ "glRecti", (GLvoid *) glRecti, _gloffset_Recti }, |
{ "glRectiv", (GLvoid *) glRectiv, _gloffset_Rectiv }, |
{ "glRects", (GLvoid *) glRects, _gloffset_Rects }, |
{ "glRectsv", (GLvoid *) glRectsv, _gloffset_Rectsv }, |
{ "glTexCoord1d", (GLvoid *) glTexCoord1d, _gloffset_TexCoord1d }, |
{ "glTexCoord1dv", (GLvoid *) glTexCoord1dv, _gloffset_TexCoord1dv }, |
{ "glTexCoord1f", (GLvoid *) glTexCoord1f, _gloffset_TexCoord1f }, |
{ "glTexCoord1fv", (GLvoid *) glTexCoord1fv, _gloffset_TexCoord1fv }, |
{ "glTexCoord1i", (GLvoid *) glTexCoord1i, _gloffset_TexCoord1i }, |
{ "glTexCoord1iv", (GLvoid *) glTexCoord1iv, _gloffset_TexCoord1iv }, |
{ "glTexCoord1s", (GLvoid *) glTexCoord1s, _gloffset_TexCoord1s }, |
{ "glTexCoord1sv", (GLvoid *) glTexCoord1sv, _gloffset_TexCoord1sv }, |
{ "glTexCoord2d", (GLvoid *) glTexCoord2d, _gloffset_TexCoord2d }, |
{ "glTexCoord2dv", (GLvoid *) glTexCoord2dv, _gloffset_TexCoord2dv }, |
{ "glTexCoord2f", (GLvoid *) glTexCoord2f, _gloffset_TexCoord2f }, |
{ "glTexCoord2fv", (GLvoid *) glTexCoord2fv, _gloffset_TexCoord2fv }, |
{ "glTexCoord2i", (GLvoid *) glTexCoord2i, _gloffset_TexCoord2i }, |
{ "glTexCoord2iv", (GLvoid *) glTexCoord2iv, _gloffset_TexCoord2iv }, |
{ "glTexCoord2s", (GLvoid *) glTexCoord2s, _gloffset_TexCoord2s }, |
{ "glTexCoord2sv", (GLvoid *) glTexCoord2sv, _gloffset_TexCoord2sv }, |
{ "glTexCoord3d", (GLvoid *) glTexCoord3d, _gloffset_TexCoord3d }, |
{ "glTexCoord3dv", (GLvoid *) glTexCoord3dv, _gloffset_TexCoord3dv }, |
{ "glTexCoord3f", (GLvoid *) glTexCoord3f, _gloffset_TexCoord3f }, |
{ "glTexCoord3fv", (GLvoid *) glTexCoord3fv, _gloffset_TexCoord3fv }, |
{ "glTexCoord3i", (GLvoid *) glTexCoord3i, _gloffset_TexCoord3i }, |
{ "glTexCoord3iv", (GLvoid *) glTexCoord3iv, _gloffset_TexCoord3iv }, |
{ "glTexCoord3s", (GLvoid *) glTexCoord3s, _gloffset_TexCoord3s }, |
{ "glTexCoord3sv", (GLvoid *) glTexCoord3sv, _gloffset_TexCoord3sv }, |
{ "glTexCoord4d", (GLvoid *) glTexCoord4d, _gloffset_TexCoord4d }, |
{ "glTexCoord4dv", (GLvoid *) glTexCoord4dv, _gloffset_TexCoord4dv }, |
{ "glTexCoord4f", (GLvoid *) glTexCoord4f, _gloffset_TexCoord4f }, |
{ "glTexCoord4fv", (GLvoid *) glTexCoord4fv, _gloffset_TexCoord4fv }, |
{ "glTexCoord4i", (GLvoid *) glTexCoord4i, _gloffset_TexCoord4i }, |
{ "glTexCoord4iv", (GLvoid *) glTexCoord4iv, _gloffset_TexCoord4iv }, |
{ "glTexCoord4s", (GLvoid *) glTexCoord4s, _gloffset_TexCoord4s }, |
{ "glTexCoord4sv", (GLvoid *) glTexCoord4sv, _gloffset_TexCoord4sv }, |
{ "glVertex2d", (GLvoid *) glVertex2d, _gloffset_Vertex2d }, |
{ "glVertex2dv", (GLvoid *) glVertex2dv, _gloffset_Vertex2dv }, |
{ "glVertex2f", (GLvoid *) glVertex2f, _gloffset_Vertex2f }, |
{ "glVertex2fv", (GLvoid *) glVertex2fv, _gloffset_Vertex2fv }, |
{ "glVertex2i", (GLvoid *) glVertex2i, _gloffset_Vertex2i }, |
{ "glVertex2iv", (GLvoid *) glVertex2iv, _gloffset_Vertex2iv }, |
{ "glVertex2s", (GLvoid *) glVertex2s, _gloffset_Vertex2s }, |
{ "glVertex2sv", (GLvoid *) glVertex2sv, _gloffset_Vertex2sv }, |
{ "glVertex3d", (GLvoid *) glVertex3d, _gloffset_Vertex3d }, |
{ "glVertex3dv", (GLvoid *) glVertex3dv, _gloffset_Vertex3dv }, |
{ "glVertex3f", (GLvoid *) glVertex3f, _gloffset_Vertex3f }, |
{ "glVertex3fv", (GLvoid *) glVertex3fv, _gloffset_Vertex3fv }, |
{ "glVertex3i", (GLvoid *) glVertex3i, _gloffset_Vertex3i }, |
{ "glVertex3iv", (GLvoid *) glVertex3iv, _gloffset_Vertex3iv }, |
{ "glVertex3s", (GLvoid *) glVertex3s, _gloffset_Vertex3s }, |
{ "glVertex3sv", (GLvoid *) glVertex3sv, _gloffset_Vertex3sv }, |
{ "glVertex4d", (GLvoid *) glVertex4d, _gloffset_Vertex4d }, |
{ "glVertex4dv", (GLvoid *) glVertex4dv, _gloffset_Vertex4dv }, |
{ "glVertex4f", (GLvoid *) glVertex4f, _gloffset_Vertex4f }, |
{ "glVertex4fv", (GLvoid *) glVertex4fv, _gloffset_Vertex4fv }, |
{ "glVertex4i", (GLvoid *) glVertex4i, _gloffset_Vertex4i }, |
{ "glVertex4iv", (GLvoid *) glVertex4iv, _gloffset_Vertex4iv }, |
{ "glVertex4s", (GLvoid *) glVertex4s, _gloffset_Vertex4s }, |
{ "glVertex4sv", (GLvoid *) glVertex4sv, _gloffset_Vertex4sv }, |
{ "glClipPlane", (GLvoid *) glClipPlane, _gloffset_ClipPlane }, |
{ "glColorMaterial", (GLvoid *) glColorMaterial, _gloffset_ColorMaterial }, |
{ "glCullFace", (GLvoid *) glCullFace, _gloffset_CullFace }, |
{ "glFogf", (GLvoid *) glFogf, _gloffset_Fogf }, |
{ "glFogfv", (GLvoid *) glFogfv, _gloffset_Fogfv }, |
{ "glFogi", (GLvoid *) glFogi, _gloffset_Fogi }, |
{ "glFogiv", (GLvoid *) glFogiv, _gloffset_Fogiv }, |
{ "glFrontFace", (GLvoid *) glFrontFace, _gloffset_FrontFace }, |
{ "glHint", (GLvoid *) glHint, _gloffset_Hint }, |
{ "glLightf", (GLvoid *) glLightf, _gloffset_Lightf }, |
{ "glLightfv", (GLvoid *) glLightfv, _gloffset_Lightfv }, |
{ "glLighti", (GLvoid *) glLighti, _gloffset_Lighti }, |
{ "glLightiv", (GLvoid *) glLightiv, _gloffset_Lightiv }, |
{ "glLightModelf", (GLvoid *) glLightModelf, _gloffset_LightModelf }, |
{ "glLightModelfv", (GLvoid *) glLightModelfv, _gloffset_LightModelfv }, |
{ "glLightModeli", (GLvoid *) glLightModeli, _gloffset_LightModeli }, |
{ "glLightModeliv", (GLvoid *) glLightModeliv, _gloffset_LightModeliv }, |
{ "glLineStipple", (GLvoid *) glLineStipple, _gloffset_LineStipple }, |
{ "glLineWidth", (GLvoid *) glLineWidth, _gloffset_LineWidth }, |
{ "glMaterialf", (GLvoid *) glMaterialf, _gloffset_Materialf }, |
{ "glMaterialfv", (GLvoid *) glMaterialfv, _gloffset_Materialfv }, |
{ "glMateriali", (GLvoid *) glMateriali, _gloffset_Materiali }, |
{ "glMaterialiv", (GLvoid *) glMaterialiv, _gloffset_Materialiv }, |
{ "glPointSize", (GLvoid *) glPointSize, _gloffset_PointSize }, |
{ "glPolygonMode", (GLvoid *) glPolygonMode, _gloffset_PolygonMode }, |
{ "glPolygonStipple", (GLvoid *) glPolygonStipple, _gloffset_PolygonStipple }, |
{ "glScissor", (GLvoid *) glScissor, _gloffset_Scissor }, |
{ "glShadeModel", (GLvoid *) glShadeModel, _gloffset_ShadeModel }, |
{ "glTexParameterf", (GLvoid *) glTexParameterf, _gloffset_TexParameterf }, |
{ "glTexParameterfv", (GLvoid *) glTexParameterfv, _gloffset_TexParameterfv }, |
{ "glTexParameteri", (GLvoid *) glTexParameteri, _gloffset_TexParameteri }, |
{ "glTexParameteriv", (GLvoid *) glTexParameteriv, _gloffset_TexParameteriv }, |
{ "glTexImage1D", (GLvoid *) glTexImage1D, _gloffset_TexImage1D }, |
{ "glTexImage2D", (GLvoid *) glTexImage2D, _gloffset_TexImage2D }, |
{ "glTexEnvf", (GLvoid *) glTexEnvf, _gloffset_TexEnvf }, |
{ "glTexEnvfv", (GLvoid *) glTexEnvfv, _gloffset_TexEnvfv }, |
{ "glTexEnvi", (GLvoid *) glTexEnvi, _gloffset_TexEnvi }, |
{ "glTexEnviv", (GLvoid *) glTexEnviv, _gloffset_TexEnviv }, |
{ "glTexGend", (GLvoid *) glTexGend, _gloffset_TexGend }, |
{ "glTexGendv", (GLvoid *) glTexGendv, _gloffset_TexGendv }, |
{ "glTexGenf", (GLvoid *) glTexGenf, _gloffset_TexGenf }, |
{ "glTexGenfv", (GLvoid *) glTexGenfv, _gloffset_TexGenfv }, |
{ "glTexGeni", (GLvoid *) glTexGeni, _gloffset_TexGeni }, |
{ "glTexGeniv", (GLvoid *) glTexGeniv, _gloffset_TexGeniv }, |
{ "glFeedbackBuffer", (GLvoid *) glFeedbackBuffer, _gloffset_FeedbackBuffer }, |
{ "glSelectBuffer", (GLvoid *) glSelectBuffer, _gloffset_SelectBuffer }, |
{ "glRenderMode", (GLvoid *) glRenderMode, _gloffset_RenderMode }, |
{ "glInitNames", (GLvoid *) glInitNames, _gloffset_InitNames }, |
{ "glLoadName", (GLvoid *) glLoadName, _gloffset_LoadName }, |
{ "glPassThrough", (GLvoid *) glPassThrough, _gloffset_PassThrough }, |
{ "glPopName", (GLvoid *) glPopName, _gloffset_PopName }, |
{ "glPushName", (GLvoid *) glPushName, _gloffset_PushName }, |
{ "glDrawBuffer", (GLvoid *) glDrawBuffer, _gloffset_DrawBuffer }, |
{ "glClear", (GLvoid *) glClear, _gloffset_Clear }, |
{ "glClearAccum", (GLvoid *) glClearAccum, _gloffset_ClearAccum }, |
{ "glClearIndex", (GLvoid *) glClearIndex, _gloffset_ClearIndex }, |
{ "glClearColor", (GLvoid *) glClearColor, _gloffset_ClearColor }, |
{ "glClearStencil", (GLvoid *) glClearStencil, _gloffset_ClearStencil }, |
{ "glClearDepth", (GLvoid *) glClearDepth, _gloffset_ClearDepth }, |
{ "glStencilMask", (GLvoid *) glStencilMask, _gloffset_StencilMask }, |
{ "glColorMask", (GLvoid *) glColorMask, _gloffset_ColorMask }, |
{ "glDepthMask", (GLvoid *) glDepthMask, _gloffset_DepthMask }, |
{ "glIndexMask", (GLvoid *) glIndexMask, _gloffset_IndexMask }, |
{ "glAccum", (GLvoid *) glAccum, _gloffset_Accum }, |
{ "glDisable", (GLvoid *) glDisable, _gloffset_Disable }, |
{ "glEnable", (GLvoid *) glEnable, _gloffset_Enable }, |
{ "glFinish", (GLvoid *) glFinish, _gloffset_Finish }, |
{ "glFlush", (GLvoid *) glFlush, _gloffset_Flush }, |
{ "glPopAttrib", (GLvoid *) glPopAttrib, _gloffset_PopAttrib }, |
{ "glPushAttrib", (GLvoid *) glPushAttrib, _gloffset_PushAttrib }, |
{ "glMap1d", (GLvoid *) glMap1d, _gloffset_Map1d }, |
{ "glMap1f", (GLvoid *) glMap1f, _gloffset_Map1f }, |
{ "glMap2d", (GLvoid *) glMap2d, _gloffset_Map2d }, |
{ "glMap2f", (GLvoid *) glMap2f, _gloffset_Map2f }, |
{ "glMapGrid1d", (GLvoid *) glMapGrid1d, _gloffset_MapGrid1d }, |
{ "glMapGrid1f", (GLvoid *) glMapGrid1f, _gloffset_MapGrid1f }, |
{ "glMapGrid2d", (GLvoid *) glMapGrid2d, _gloffset_MapGrid2d }, |
{ "glMapGrid2f", (GLvoid *) glMapGrid2f, _gloffset_MapGrid2f }, |
{ "glEvalCoord1d", (GLvoid *) glEvalCoord1d, _gloffset_EvalCoord1d }, |
{ "glEvalCoord1dv", (GLvoid *) glEvalCoord1dv, _gloffset_EvalCoord1dv }, |
{ "glEvalCoord1f", (GLvoid *) glEvalCoord1f, _gloffset_EvalCoord1f }, |
{ "glEvalCoord1fv", (GLvoid *) glEvalCoord1fv, _gloffset_EvalCoord1fv }, |
{ "glEvalCoord2d", (GLvoid *) glEvalCoord2d, _gloffset_EvalCoord2d }, |
{ "glEvalCoord2dv", (GLvoid *) glEvalCoord2dv, _gloffset_EvalCoord2dv }, |
{ "glEvalCoord2f", (GLvoid *) glEvalCoord2f, _gloffset_EvalCoord2f }, |
{ "glEvalCoord2fv", (GLvoid *) glEvalCoord2fv, _gloffset_EvalCoord2fv }, |
{ "glEvalMesh1", (GLvoid *) glEvalMesh1, _gloffset_EvalMesh1 }, |
{ "glEvalPoint1", (GLvoid *) glEvalPoint1, _gloffset_EvalPoint1 }, |
{ "glEvalMesh2", (GLvoid *) glEvalMesh2, _gloffset_EvalMesh2 }, |
{ "glEvalPoint2", (GLvoid *) glEvalPoint2, _gloffset_EvalPoint2 }, |
{ "glAlphaFunc", (GLvoid *) glAlphaFunc, _gloffset_AlphaFunc }, |
{ "glBlendFunc", (GLvoid *) glBlendFunc, _gloffset_BlendFunc }, |
{ "glLogicOp", (GLvoid *) glLogicOp, _gloffset_LogicOp }, |
{ "glStencilFunc", (GLvoid *) glStencilFunc, _gloffset_StencilFunc }, |
{ "glStencilOp", (GLvoid *) glStencilOp, _gloffset_StencilOp }, |
{ "glDepthFunc", (GLvoid *) glDepthFunc, _gloffset_DepthFunc }, |
{ "glPixelZoom", (GLvoid *) glPixelZoom, _gloffset_PixelZoom }, |
{ "glPixelTransferf", (GLvoid *) glPixelTransferf, _gloffset_PixelTransferf }, |
{ "glPixelTransferi", (GLvoid *) glPixelTransferi, _gloffset_PixelTransferi }, |
{ "glPixelStoref", (GLvoid *) glPixelStoref, _gloffset_PixelStoref }, |
{ "glPixelStorei", (GLvoid *) glPixelStorei, _gloffset_PixelStorei }, |
{ "glPixelMapfv", (GLvoid *) glPixelMapfv, _gloffset_PixelMapfv }, |
{ "glPixelMapuiv", (GLvoid *) glPixelMapuiv, _gloffset_PixelMapuiv }, |
{ "glPixelMapusv", (GLvoid *) glPixelMapusv, _gloffset_PixelMapusv }, |
{ "glReadBuffer", (GLvoid *) glReadBuffer, _gloffset_ReadBuffer }, |
{ "glCopyPixels", (GLvoid *) glCopyPixels, _gloffset_CopyPixels }, |
{ "glReadPixels", (GLvoid *) glReadPixels, _gloffset_ReadPixels }, |
{ "glDrawPixels", (GLvoid *) glDrawPixels, _gloffset_DrawPixels }, |
{ "glGetBooleanv", (GLvoid *) glGetBooleanv, _gloffset_GetBooleanv }, |
{ "glGetClipPlane", (GLvoid *) glGetClipPlane, _gloffset_GetClipPlane }, |
{ "glGetDoublev", (GLvoid *) glGetDoublev, _gloffset_GetDoublev }, |
{ "glGetError", (GLvoid *) glGetError, _gloffset_GetError }, |
{ "glGetFloatv", (GLvoid *) glGetFloatv, _gloffset_GetFloatv }, |
{ "glGetIntegerv", (GLvoid *) glGetIntegerv, _gloffset_GetIntegerv }, |
{ "glGetLightfv", (GLvoid *) glGetLightfv, _gloffset_GetLightfv }, |
{ "glGetLightiv", (GLvoid *) glGetLightiv, _gloffset_GetLightiv }, |
{ "glGetMapdv", (GLvoid *) glGetMapdv, _gloffset_GetMapdv }, |
{ "glGetMapfv", (GLvoid *) glGetMapfv, _gloffset_GetMapfv }, |
{ "glGetMapiv", (GLvoid *) glGetMapiv, _gloffset_GetMapiv }, |
{ "glGetMaterialfv", (GLvoid *) glGetMaterialfv, _gloffset_GetMaterialfv }, |
{ "glGetMaterialiv", (GLvoid *) glGetMaterialiv, _gloffset_GetMaterialiv }, |
{ "glGetPixelMapfv", (GLvoid *) glGetPixelMapfv, _gloffset_GetPixelMapfv }, |
{ "glGetPixelMapuiv", (GLvoid *) glGetPixelMapuiv, _gloffset_GetPixelMapuiv }, |
{ "glGetPixelMapusv", (GLvoid *) glGetPixelMapusv, _gloffset_GetPixelMapusv }, |
{ "glGetPolygonStipple", (GLvoid *) glGetPolygonStipple, _gloffset_GetPolygonStipple }, |
{ "glGetString", (GLvoid *) glGetString, _gloffset_GetString }, |
{ "glGetTexEnvfv", (GLvoid *) glGetTexEnvfv, _gloffset_GetTexEnvfv }, |
{ "glGetTexEnviv", (GLvoid *) glGetTexEnviv, _gloffset_GetTexEnviv }, |
{ "glGetTexGendv", (GLvoid *) glGetTexGendv, _gloffset_GetTexGendv }, |
{ "glGetTexGenfv", (GLvoid *) glGetTexGenfv, _gloffset_GetTexGenfv }, |
{ "glGetTexGeniv", (GLvoid *) glGetTexGeniv, _gloffset_GetTexGeniv }, |
{ "glGetTexImage", (GLvoid *) glGetTexImage, _gloffset_GetTexImage }, |
{ "glGetTexParameterfv", (GLvoid *) glGetTexParameterfv, _gloffset_GetTexParameterfv }, |
{ "glGetTexParameteriv", (GLvoid *) glGetTexParameteriv, _gloffset_GetTexParameteriv }, |
{ "glGetTexLevelParameterfv", (GLvoid *) glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv }, |
{ "glGetTexLevelParameteriv", (GLvoid *) glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv }, |
{ "glIsEnabled", (GLvoid *) glIsEnabled, _gloffset_IsEnabled }, |
{ "glIsList", (GLvoid *) glIsList, _gloffset_IsList }, |
{ "glDepthRange", (GLvoid *) glDepthRange, _gloffset_DepthRange }, |
{ "glFrustum", (GLvoid *) glFrustum, _gloffset_Frustum }, |
{ "glLoadIdentity", (GLvoid *) glLoadIdentity, _gloffset_LoadIdentity }, |
{ "glLoadMatrixf", (GLvoid *) glLoadMatrixf, _gloffset_LoadMatrixf }, |
{ "glLoadMatrixd", (GLvoid *) glLoadMatrixd, _gloffset_LoadMatrixd }, |
{ "glMatrixMode", (GLvoid *) glMatrixMode, _gloffset_MatrixMode }, |
{ "glMultMatrixf", (GLvoid *) glMultMatrixf, _gloffset_MultMatrixf }, |
{ "glMultMatrixd", (GLvoid *) glMultMatrixd, _gloffset_MultMatrixd }, |
{ "glOrtho", (GLvoid *) glOrtho, _gloffset_Ortho }, |
{ "glPopMatrix", (GLvoid *) glPopMatrix, _gloffset_PopMatrix }, |
{ "glPushMatrix", (GLvoid *) glPushMatrix, _gloffset_PushMatrix }, |
{ "glRotated", (GLvoid *) glRotated, _gloffset_Rotated }, |
{ "glRotatef", (GLvoid *) glRotatef, _gloffset_Rotatef }, |
{ "glScaled", (GLvoid *) glScaled, _gloffset_Scaled }, |
{ "glScalef", (GLvoid *) glScalef, _gloffset_Scalef }, |
{ "glTranslated", (GLvoid *) glTranslated, _gloffset_Translated }, |
{ "glTranslatef", (GLvoid *) glTranslatef, _gloffset_Translatef }, |
{ "glViewport", (GLvoid *) glViewport, _gloffset_Viewport }, |
{ "glArrayElement", (GLvoid *) glArrayElement, _gloffset_ArrayElement }, |
{ "glColorPointer", (GLvoid *) glColorPointer, _gloffset_ColorPointer }, |
{ "glDisableClientState", (GLvoid *) glDisableClientState, _gloffset_DisableClientState }, |
{ "glDrawArrays", (GLvoid *) glDrawArrays, _gloffset_DrawArrays }, |
{ "glDrawElements", (GLvoid *) glDrawElements, _gloffset_DrawElements }, |
{ "glEdgeFlagPointer", (GLvoid *) glEdgeFlagPointer, _gloffset_EdgeFlagPointer }, |
{ "glEnableClientState", (GLvoid *) glEnableClientState, _gloffset_EnableClientState }, |
{ "glGetPointerv", (GLvoid *) glGetPointerv, _gloffset_GetPointerv }, |
{ "glIndexPointer", (GLvoid *) glIndexPointer, _gloffset_IndexPointer }, |
{ "glInterleavedArrays", (GLvoid *) glInterleavedArrays, _gloffset_InterleavedArrays }, |
{ "glNormalPointer", (GLvoid *) glNormalPointer, _gloffset_NormalPointer }, |
{ "glTexCoordPointer", (GLvoid *) glTexCoordPointer, _gloffset_TexCoordPointer }, |
{ "glVertexPointer", (GLvoid *) glVertexPointer, _gloffset_VertexPointer }, |
{ "glPolygonOffset", (GLvoid *) glPolygonOffset, _gloffset_PolygonOffset }, |
{ "glCopyTexImage1D", (GLvoid *) glCopyTexImage1D, _gloffset_CopyTexImage1D }, |
{ "glCopyTexImage2D", (GLvoid *) glCopyTexImage2D, _gloffset_CopyTexImage2D }, |
{ "glCopyTexSubImage1D", (GLvoid *) glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D }, |
{ "glCopyTexSubImage2D", (GLvoid *) glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D }, |
{ "glTexSubImage1D", (GLvoid *) glTexSubImage1D, _gloffset_TexSubImage1D }, |
{ "glTexSubImage2D", (GLvoid *) glTexSubImage2D, _gloffset_TexSubImage2D }, |
{ "glAreTexturesResident", (GLvoid *) glAreTexturesResident, _gloffset_AreTexturesResident }, |
{ "glBindTexture", (GLvoid *) glBindTexture, _gloffset_BindTexture }, |
{ "glDeleteTextures", (GLvoid *) glDeleteTextures, _gloffset_DeleteTextures }, |
{ "glGenTextures", (GLvoid *) glGenTextures, _gloffset_GenTextures }, |
{ "glIsTexture", (GLvoid *) glIsTexture, _gloffset_IsTexture }, |
{ "glPrioritizeTextures", (GLvoid *) glPrioritizeTextures, _gloffset_PrioritizeTextures }, |
{ "glIndexub", (GLvoid *) glIndexub, _gloffset_Indexub }, |
{ "glIndexubv", (GLvoid *) glIndexubv, _gloffset_Indexubv }, |
{ "glPopClientAttrib", (GLvoid *) glPopClientAttrib, _gloffset_PopClientAttrib }, |
{ "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib }, |
{ "glBlendColor", (GLvoid *) glBlendColor, _gloffset_BlendColor }, |
{ "glBlendEquation", (GLvoid *) glBlendEquation, _gloffset_BlendEquation }, |
{ "glDrawRangeElements", (GLvoid *) glDrawRangeElements, _gloffset_DrawRangeElements }, |
{ "glColorTable", (GLvoid *) glColorTable, _gloffset_ColorTable }, |
{ "glColorTableParameterfv", (GLvoid *) glColorTableParameterfv, _gloffset_ColorTableParameterfv }, |
{ "glColorTableParameteriv", (GLvoid *) glColorTableParameteriv, _gloffset_ColorTableParameteriv }, |
{ "glCopyColorTable", (GLvoid *) glCopyColorTable, _gloffset_CopyColorTable }, |
{ "glGetColorTable", (GLvoid *) glGetColorTable, _gloffset_GetColorTable }, |
{ "glGetColorTableParameterfv", (GLvoid *) glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv }, |
{ "glGetColorTableParameteriv", (GLvoid *) glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv }, |
{ "glColorSubTable", (GLvoid *) glColorSubTable, _gloffset_ColorSubTable }, |
{ "glCopyColorSubTable", (GLvoid *) glCopyColorSubTable, _gloffset_CopyColorSubTable }, |
{ "glConvolutionFilter1D", (GLvoid *) glConvolutionFilter1D, _gloffset_ConvolutionFilter1D }, |
{ "glConvolutionFilter2D", (GLvoid *) glConvolutionFilter2D, _gloffset_ConvolutionFilter2D }, |
{ "glConvolutionParameterf", (GLvoid *) glConvolutionParameterf, _gloffset_ConvolutionParameterf }, |
{ "glConvolutionParameterfv", (GLvoid *) glConvolutionParameterfv, _gloffset_ConvolutionParameterfv }, |
{ "glConvolutionParameteri", (GLvoid *) glConvolutionParameteri, _gloffset_ConvolutionParameteri }, |
{ "glConvolutionParameteriv", (GLvoid *) glConvolutionParameteriv, _gloffset_ConvolutionParameteriv }, |
{ "glCopyConvolutionFilter1D", (GLvoid *) glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D }, |
{ "glCopyConvolutionFilter2D", (GLvoid *) glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D }, |
{ "glGetConvolutionFilter", (GLvoid *) glGetConvolutionFilter, _gloffset_GetConvolutionFilter }, |
{ "glGetConvolutionParameterfv", (GLvoid *) glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv }, |
{ "glGetConvolutionParameteriv", (GLvoid *) glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv }, |
{ "glGetSeparableFilter", (GLvoid *) glGetSeparableFilter, _gloffset_GetSeparableFilter }, |
{ "glSeparableFilter2D", (GLvoid *) glSeparableFilter2D, _gloffset_SeparableFilter2D }, |
{ "glGetHistogram", (GLvoid *) glGetHistogram, _gloffset_GetHistogram }, |
{ "glGetHistogramParameterfv", (GLvoid *) glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv }, |
{ "glGetHistogramParameteriv", (GLvoid *) glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv }, |
{ "glGetMinmax", (GLvoid *) glGetMinmax, _gloffset_GetMinmax }, |
{ "glGetMinmaxParameterfv", (GLvoid *) glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv }, |
{ "glGetMinmaxParameteriv", (GLvoid *) glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv }, |
{ "glHistogram", (GLvoid *) glHistogram, _gloffset_Histogram }, |
{ "glMinmax", (GLvoid *) glMinmax, _gloffset_Minmax }, |
{ "glResetHistogram", (GLvoid *) glResetHistogram, _gloffset_ResetHistogram }, |
{ "glResetMinmax", (GLvoid *) glResetMinmax, _gloffset_ResetMinmax }, |
{ "glTexImage3D", (GLvoid *) glTexImage3D, _gloffset_TexImage3D }, |
{ "glTexSubImage3D", (GLvoid *) glTexSubImage3D, _gloffset_TexSubImage3D }, |
{ "glCopyTexSubImage3D", (GLvoid *) glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D }, |
{ "glActiveTextureARB", (GLvoid *) glActiveTextureARB, _gloffset_ActiveTextureARB }, |
{ "glClientActiveTextureARB", (GLvoid *) glClientActiveTextureARB, _gloffset_ClientActiveTextureARB }, |
{ "glMultiTexCoord1dARB", (GLvoid *) glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB }, |
{ "glMultiTexCoord1dvARB", (GLvoid *) glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB }, |
{ "glMultiTexCoord1fARB", (GLvoid *) glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB }, |
{ "glMultiTexCoord1fvARB", (GLvoid *) glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB }, |
{ "glMultiTexCoord1iARB", (GLvoid *) glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB }, |
{ "glMultiTexCoord1ivARB", (GLvoid *) glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB }, |
{ "glMultiTexCoord1sARB", (GLvoid *) glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB }, |
{ "glMultiTexCoord1svARB", (GLvoid *) glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB }, |
{ "glMultiTexCoord2dARB", (GLvoid *) glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB }, |
{ "glMultiTexCoord2dvARB", (GLvoid *) glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB }, |
{ "glMultiTexCoord2fARB", (GLvoid *) glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB }, |
{ "glMultiTexCoord2fvARB", (GLvoid *) glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB }, |
{ "glMultiTexCoord2iARB", (GLvoid *) glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB }, |
{ "glMultiTexCoord2ivARB", (GLvoid *) glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB }, |
{ "glMultiTexCoord2sARB", (GLvoid *) glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB }, |
{ "glMultiTexCoord2svARB", (GLvoid *) glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB }, |
{ "glMultiTexCoord3dARB", (GLvoid *) glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB }, |
{ "glMultiTexCoord3dvARB", (GLvoid *) glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB }, |
{ "glMultiTexCoord3fARB", (GLvoid *) glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB }, |
{ "glMultiTexCoord3fvARB", (GLvoid *) glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB }, |
{ "glMultiTexCoord3iARB", (GLvoid *) glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB }, |
{ "glMultiTexCoord3ivARB", (GLvoid *) glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB }, |
{ "glMultiTexCoord3sARB", (GLvoid *) glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB }, |
{ "glMultiTexCoord3svARB", (GLvoid *) glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB }, |
{ "glMultiTexCoord4dARB", (GLvoid *) glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB }, |
{ "glMultiTexCoord4dvARB", (GLvoid *) glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB }, |
{ "glMultiTexCoord4fARB", (GLvoid *) glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB }, |
{ "glMultiTexCoord4fvARB", (GLvoid *) glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB }, |
{ "glMultiTexCoord4iARB", (GLvoid *) glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB }, |
{ "glMultiTexCoord4ivARB", (GLvoid *) glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB }, |
{ "glMultiTexCoord4sARB", (GLvoid *) glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB }, |
{ "glMultiTexCoord4svARB", (GLvoid *) glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB }, |
{ "glLoadTransposeMatrixfARB", (GLvoid *) glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB }, |
{ "glLoadTransposeMatrixdARB", (GLvoid *) glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB }, |
{ "glMultTransposeMatrixfARB", (GLvoid *) glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB }, |
{ "glMultTransposeMatrixdARB", (GLvoid *) glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB }, |
{ "glSampleCoverageARB", (GLvoid *) glSampleCoverageARB, _gloffset_SampleCoverageARB }, |
{ "glCompressedTexImage3DARB", (GLvoid *) glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB }, |
{ "glCompressedTexImage2DARB", (GLvoid *) glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB }, |
{ "glCompressedTexImage1DARB", (GLvoid *) glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB }, |
{ "glCompressedTexSubImage3DARB", (GLvoid *) glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB }, |
{ "glCompressedTexSubImage2DARB", (GLvoid *) glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB }, |
{ "glCompressedTexSubImage1DARB", (GLvoid *) glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB }, |
{ "glGetCompressedTexImageARB", (GLvoid *) glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB }, |
{ "glActiveTexture", (GLvoid *) glActiveTexture, _gloffset_ActiveTextureARB }, |
{ "glClientActiveTexture", (GLvoid *) glClientActiveTexture, _gloffset_ClientActiveTextureARB }, |
{ "glMultiTexCoord1d", (GLvoid *) glMultiTexCoord1d, _gloffset_MultiTexCoord1dARB }, |
{ "glMultiTexCoord1dv", (GLvoid *) glMultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB }, |
{ "glMultiTexCoord1f", (GLvoid *) glMultiTexCoord1f, _gloffset_MultiTexCoord1fARB }, |
{ "glMultiTexCoord1fv", (GLvoid *) glMultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB }, |
{ "glMultiTexCoord1i", (GLvoid *) glMultiTexCoord1i, _gloffset_MultiTexCoord1iARB }, |
{ "glMultiTexCoord1iv", (GLvoid *) glMultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB }, |
{ "glMultiTexCoord1s", (GLvoid *) glMultiTexCoord1s, _gloffset_MultiTexCoord1sARB }, |
{ "glMultiTexCoord1sv", (GLvoid *) glMultiTexCoord1sv, _gloffset_MultiTexCoord1svARB }, |
{ "glMultiTexCoord2d", (GLvoid *) glMultiTexCoord2d, _gloffset_MultiTexCoord2dARB }, |
{ "glMultiTexCoord2dv", (GLvoid *) glMultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB }, |
{ "glMultiTexCoord2f", (GLvoid *) glMultiTexCoord2f, _gloffset_MultiTexCoord2fARB }, |
{ "glMultiTexCoord2fv", (GLvoid *) glMultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB }, |
{ "glMultiTexCoord2i", (GLvoid *) glMultiTexCoord2i, _gloffset_MultiTexCoord2iARB }, |
{ "glMultiTexCoord2iv", (GLvoid *) glMultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB }, |
{ "glMultiTexCoord2s", (GLvoid *) glMultiTexCoord2s, _gloffset_MultiTexCoord2sARB }, |
{ "glMultiTexCoord2sv", (GLvoid *) glMultiTexCoord2sv, _gloffset_MultiTexCoord2svARB }, |
{ "glMultiTexCoord3d", (GLvoid *) glMultiTexCoord3d, _gloffset_MultiTexCoord3dARB }, |
{ "glMultiTexCoord3dv", (GLvoid *) glMultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB }, |
{ "glMultiTexCoord3f", (GLvoid *) glMultiTexCoord3f, _gloffset_MultiTexCoord3fARB }, |
{ "glMultiTexCoord3fv", (GLvoid *) glMultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB }, |
{ "glMultiTexCoord3i", (GLvoid *) glMultiTexCoord3i, _gloffset_MultiTexCoord3iARB }, |
{ "glMultiTexCoord3iv", (GLvoid *) glMultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB }, |
{ "glMultiTexCoord3s", (GLvoid *) glMultiTexCoord3s, _gloffset_MultiTexCoord3sARB }, |
{ "glMultiTexCoord3sv", (GLvoid *) glMultiTexCoord3sv, _gloffset_MultiTexCoord3svARB }, |
{ "glMultiTexCoord4d", (GLvoid *) glMultiTexCoord4d, _gloffset_MultiTexCoord4dARB }, |
{ "glMultiTexCoord4dv", (GLvoid *) glMultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB }, |
{ "glMultiTexCoord4f", (GLvoid *) glMultiTexCoord4f, _gloffset_MultiTexCoord4fARB }, |
{ "glMultiTexCoord4fv", (GLvoid *) glMultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB }, |
{ "glMultiTexCoord4i", (GLvoid *) glMultiTexCoord4i, _gloffset_MultiTexCoord4iARB }, |
{ "glMultiTexCoord4iv", (GLvoid *) glMultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB }, |
{ "glMultiTexCoord4s", (GLvoid *) glMultiTexCoord4s, _gloffset_MultiTexCoord4sARB }, |
{ "glMultiTexCoord4sv", (GLvoid *) glMultiTexCoord4sv, _gloffset_MultiTexCoord4svARB }, |
{ "glLoadTransposeMatrixf", (GLvoid *) glLoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB }, |
{ "glLoadTransposeMatrixd", (GLvoid *) glLoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB }, |
{ "glMultTransposeMatrixf", (GLvoid *) glMultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB }, |
{ "glMultTransposeMatrixd", (GLvoid *) glMultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB }, |
{ "glSampleCoverage", (GLvoid *) glSampleCoverage, _gloffset_SampleCoverageARB }, |
{ "glCompressedTexImage3D", (GLvoid *) glCompressedTexImage3D, _gloffset_CompressedTexImage3DARB }, |
{ "glCompressedTexImage2D", (GLvoid *) glCompressedTexImage2D, _gloffset_CompressedTexImage2DARB }, |
{ "glCompressedTexImage1D", (GLvoid *) glCompressedTexImage1D, _gloffset_CompressedTexImage1DARB }, |
{ "glCompressedTexSubImage3D", (GLvoid *) glCompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB }, |
{ "glCompressedTexSubImage2D", (GLvoid *) glCompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB }, |
{ "glCompressedTexSubImage1D", (GLvoid *) glCompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB }, |
{ "glGetCompressedTexImage", (GLvoid *) glGetCompressedTexImage, _gloffset_GetCompressedTexImageARB }, |
{ "glBlendColorEXT", (GLvoid *) glBlendColorEXT, _gloffset_BlendColor }, |
{ "glPolygonOffsetEXT", (GLvoid *) glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT }, |
{ "glTexImage3DEXT", (GLvoid *) glTexImage3DEXT, _gloffset_TexImage3D }, |
{ "glTexSubImage3DEXT", (GLvoid *) glTexSubImage3DEXT, _gloffset_TexSubImage3D }, |
{ "glGetTexFilterFuncSGIS", (GLvoid *) glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS }, |
{ "glTexFilterFuncSGIS", (GLvoid *) glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS }, |
{ "glTexSubImage1DEXT", (GLvoid *) glTexSubImage1DEXT, _gloffset_TexSubImage1D }, |
{ "glTexSubImage2DEXT", (GLvoid *) glTexSubImage2DEXT, _gloffset_TexSubImage2D }, |
{ "glCopyTexImage1DEXT", (GLvoid *) glCopyTexImage1DEXT, _gloffset_CopyTexImage1D }, |
{ "glCopyTexImage2DEXT", (GLvoid *) glCopyTexImage2DEXT, _gloffset_CopyTexImage2D }, |
{ "glCopyTexSubImage1DEXT", (GLvoid *) glCopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D }, |
{ "glCopyTexSubImage2DEXT", (GLvoid *) glCopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D }, |
{ "glCopyTexSubImage3DEXT", (GLvoid *) glCopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D }, |
{ "glGetHistogramEXT", (GLvoid *) glGetHistogramEXT, _gloffset_GetHistogramEXT }, |
{ "glGetHistogramParameterfvEXT", (GLvoid *) glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT }, |
{ "glGetHistogramParameterivEXT", (GLvoid *) glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT }, |
{ "glGetMinmaxEXT", (GLvoid *) glGetMinmaxEXT, _gloffset_GetMinmaxEXT }, |
{ "glGetMinmaxParameterfvEXT", (GLvoid *) glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT }, |
{ "glGetMinmaxParameterivEXT", (GLvoid *) glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT }, |
{ "glHistogramEXT", (GLvoid *) glHistogramEXT, _gloffset_Histogram }, |
{ "glMinmaxEXT", (GLvoid *) glMinmaxEXT, _gloffset_Minmax }, |
{ "glResetHistogramEXT", (GLvoid *) glResetHistogramEXT, _gloffset_ResetHistogram }, |
{ "glResetMinmaxEXT", (GLvoid *) glResetMinmaxEXT, _gloffset_ResetMinmax }, |
{ "glConvolutionFilter1DEXT", (GLvoid *) glConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D }, |
{ "glConvolutionFilter2DEXT", (GLvoid *) glConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D }, |
{ "glConvolutionParameterfEXT", (GLvoid *) glConvolutionParameterfEXT, _gloffset_ConvolutionParameterf }, |
{ "glConvolutionParameterfvEXT", (GLvoid *) glConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv }, |
{ "glConvolutionParameteriEXT", (GLvoid *) glConvolutionParameteriEXT, _gloffset_ConvolutionParameteri }, |
{ "glConvolutionParameterivEXT", (GLvoid *) glConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv }, |
{ "glCopyConvolutionFilter1DEXT", (GLvoid *) glCopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D }, |
{ "glCopyConvolutionFilter2DEXT", (GLvoid *) glCopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D }, |
{ "glGetConvolutionFilterEXT", (GLvoid *) glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT }, |
{ "glGetConvolutionParameterfvEXT", (GLvoid *) glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT }, |
{ "glGetConvolutionParameterivEXT", (GLvoid *) glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT }, |
{ "glGetSeparableFilterEXT", (GLvoid *) glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT }, |
{ "glSeparableFilter2DEXT", (GLvoid *) glSeparableFilter2DEXT, _gloffset_SeparableFilter2D }, |
{ "glColorTableSGI", (GLvoid *) glColorTableSGI, _gloffset_ColorTable }, |
{ "glColorTableParameterfvSGI", (GLvoid *) glColorTableParameterfvSGI, _gloffset_ColorTableParameterfv }, |
{ "glColorTableParameterivSGI", (GLvoid *) glColorTableParameterivSGI, _gloffset_ColorTableParameteriv }, |
{ "glCopyColorTableSGI", (GLvoid *) glCopyColorTableSGI, _gloffset_CopyColorTable }, |
{ "glGetColorTableSGI", (GLvoid *) glGetColorTableSGI, _gloffset_GetColorTableSGI }, |
{ "glGetColorTableParameterfvSGI", (GLvoid *) glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI }, |
{ "glGetColorTableParameterivSGI", (GLvoid *) glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI }, |
{ "glPixelTexGenSGIX", (GLvoid *) glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX }, |
{ "glPixelTexGenParameteriSGIS", (GLvoid *) glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS }, |
{ "glPixelTexGenParameterivSGIS", (GLvoid *) glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS }, |
{ "glPixelTexGenParameterfSGIS", (GLvoid *) glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS }, |
{ "glPixelTexGenParameterfvSGIS", (GLvoid *) glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS }, |
{ "glGetPixelTexGenParameterivSGIS", (GLvoid *) glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS }, |
{ "glGetPixelTexGenParameterfvSGIS", (GLvoid *) glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS }, |
{ "glTexImage4DSGIS", (GLvoid *) glTexImage4DSGIS, _gloffset_TexImage4DSGIS }, |
{ "glTexSubImage4DSGIS", (GLvoid *) glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS }, |
{ "glAreTexturesResidentEXT", (GLvoid *) glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT }, |
{ "glBindTextureEXT", (GLvoid *) glBindTextureEXT, _gloffset_BindTexture }, |
{ "glDeleteTexturesEXT", (GLvoid *) glDeleteTexturesEXT, _gloffset_DeleteTextures }, |
{ "glGenTexturesEXT", (GLvoid *) glGenTexturesEXT, _gloffset_GenTexturesEXT }, |
{ "glIsTextureEXT", (GLvoid *) glIsTextureEXT, _gloffset_IsTextureEXT }, |
{ "glPrioritizeTexturesEXT", (GLvoid *) glPrioritizeTexturesEXT, _gloffset_PrioritizeTextures }, |
{ "glDetailTexFuncSGIS", (GLvoid *) glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS }, |
{ "glGetDetailTexFuncSGIS", (GLvoid *) glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS }, |
{ "glSharpenTexFuncSGIS", (GLvoid *) glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS }, |
{ "glGetSharpenTexFuncSGIS", (GLvoid *) glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS }, |
{ "glSampleMaskSGIS", (GLvoid *) glSampleMaskSGIS, _gloffset_SampleMaskSGIS }, |
{ "glSamplePatternSGIS", (GLvoid *) glSamplePatternSGIS, _gloffset_SamplePatternSGIS }, |
{ "glArrayElementEXT", (GLvoid *) glArrayElementEXT, _gloffset_ArrayElement }, |
{ "glColorPointerEXT", (GLvoid *) glColorPointerEXT, _gloffset_ColorPointerEXT }, |
{ "glDrawArraysEXT", (GLvoid *) glDrawArraysEXT, _gloffset_DrawArrays }, |
{ "glEdgeFlagPointerEXT", (GLvoid *) glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT }, |
{ "glGetPointervEXT", (GLvoid *) glGetPointervEXT, _gloffset_GetPointerv }, |
{ "glIndexPointerEXT", (GLvoid *) glIndexPointerEXT, _gloffset_IndexPointerEXT }, |
{ "glNormalPointerEXT", (GLvoid *) glNormalPointerEXT, _gloffset_NormalPointerEXT }, |
{ "glTexCoordPointerEXT", (GLvoid *) glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT }, |
{ "glVertexPointerEXT", (GLvoid *) glVertexPointerEXT, _gloffset_VertexPointerEXT }, |
{ "glBlendEquationEXT", (GLvoid *) glBlendEquationEXT, _gloffset_BlendEquation }, |
{ "glSpriteParameterfSGIX", (GLvoid *) glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX }, |
{ "glSpriteParameterfvSGIX", (GLvoid *) glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX }, |
{ "glSpriteParameteriSGIX", (GLvoid *) glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX }, |
{ "glSpriteParameterivSGIX", (GLvoid *) glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX }, |
{ "glPointParameterfEXT", (GLvoid *) glPointParameterfEXT, _gloffset_PointParameterfEXT }, |
{ "glPointParameterfvEXT", (GLvoid *) glPointParameterfvEXT, _gloffset_PointParameterfvEXT }, |
{ "glPointParameterfARB", (GLvoid *) glPointParameterfARB, _gloffset_PointParameterfEXT }, |
{ "glPointParameterfvARB", (GLvoid *) glPointParameterfvARB, _gloffset_PointParameterfvEXT }, |
{ "glPointParameterfSGIS", (GLvoid *) glPointParameterfSGIS, _gloffset_PointParameterfEXT }, |
{ "glPointParameterfvSGIS", (GLvoid *) glPointParameterfvSGIS, _gloffset_PointParameterfvEXT }, |
{ "glGetInstrumentsSGIX", (GLvoid *) glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX }, |
{ "glInstrumentsBufferSGIX", (GLvoid *) glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX }, |
{ "glPollInstrumentsSGIX", (GLvoid *) glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX }, |
{ "glReadInstrumentsSGIX", (GLvoid *) glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX }, |
{ "glStartInstrumentsSGIX", (GLvoid *) glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX }, |
{ "glStopInstrumentsSGIX", (GLvoid *) glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX }, |
{ "glFrameZoomSGIX", (GLvoid *) glFrameZoomSGIX, _gloffset_FrameZoomSGIX }, |
{ "glTagSampleBufferSGIX", (GLvoid *) glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX }, |
{ "glReferencePlaneSGIX", (GLvoid *) glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX }, |
{ "glFlushRasterSGIX", (GLvoid *) glFlushRasterSGIX, _gloffset_FlushRasterSGIX }, |
{ "glColorSubTableEXT", (GLvoid *) glColorSubTableEXT, _gloffset_ColorSubTable }, |
{ "glCopyColorSubTableEXT", (GLvoid *) glCopyColorSubTableEXT, _gloffset_CopyColorSubTable }, |
{ "glHintPGI", (GLvoid *) glHintPGI, _gloffset_HintPGI }, |
{ "glColorTableEXT", (GLvoid *) glColorTableEXT, _gloffset_ColorTable }, |
{ "glGetColorTableEXT", (GLvoid *) glGetColorTableEXT, _gloffset_GetColorTableEXT }, |
{ "glGetColorTableParameterivEXT", (GLvoid *) glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT }, |
{ "glGetColorTableParameterfvEXT", (GLvoid *) glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT }, |
{ "glGetListParameterfvSGIX", (GLvoid *) glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX }, |
{ "glGetListParameterivSGIX", (GLvoid *) glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX }, |
{ "glListParameterfSGIX", (GLvoid *) glListParameterfSGIX, _gloffset_ListParameterfSGIX }, |
{ "glListParameterfvSGIX", (GLvoid *) glListParameterfvSGIX, _gloffset_ListParameterfvSGIX }, |
{ "glListParameteriSGIX", (GLvoid *) glListParameteriSGIX, _gloffset_ListParameteriSGIX }, |
{ "glListParameterivSGIX", (GLvoid *) glListParameterivSGIX, _gloffset_ListParameterivSGIX }, |
{ "glIndexMaterialEXT", (GLvoid *) glIndexMaterialEXT, _gloffset_IndexMaterialEXT }, |
{ "glIndexFuncEXT", (GLvoid *) glIndexFuncEXT, _gloffset_IndexFuncEXT }, |
{ "glLockArraysEXT", (GLvoid *) glLockArraysEXT, _gloffset_LockArraysEXT }, |
{ "glUnlockArraysEXT", (GLvoid *) glUnlockArraysEXT, _gloffset_UnlockArraysEXT }, |
{ "glCullParameterdvEXT", (GLvoid *) glCullParameterdvEXT, _gloffset_CullParameterdvEXT }, |
{ "glCullParameterfvEXT", (GLvoid *) glCullParameterfvEXT, _gloffset_CullParameterfvEXT }, |
{ "glFragmentColorMaterialSGIX", (GLvoid *) glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX }, |
{ "glFragmentLightfSGIX", (GLvoid *) glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX }, |
{ "glFragmentLightfvSGIX", (GLvoid *) glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX }, |
{ "glFragmentLightiSGIX", (GLvoid *) glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX }, |
{ "glFragmentLightivSGIX", (GLvoid *) glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX }, |
{ "glFragmentLightModelfSGIX", (GLvoid *) glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX }, |
{ "glFragmentLightModelfvSGIX", (GLvoid *) glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX }, |
{ "glFragmentLightModeliSGIX", (GLvoid *) glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX }, |
{ "glFragmentLightModelivSGIX", (GLvoid *) glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX }, |
{ "glFragmentMaterialfSGIX", (GLvoid *) glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX }, |
{ "glFragmentMaterialfvSGIX", (GLvoid *) glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX }, |
{ "glFragmentMaterialiSGIX", (GLvoid *) glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX }, |
{ "glFragmentMaterialivSGIX", (GLvoid *) glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX }, |
{ "glGetFragmentLightfvSGIX", (GLvoid *) glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX }, |
{ "glGetFragmentLightivSGIX", (GLvoid *) glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX }, |
{ "glGetFragmentMaterialfvSGIX", (GLvoid *) glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX }, |
{ "glGetFragmentMaterialivSGIX", (GLvoid *) glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX }, |
{ "glLightEnviSGIX", (GLvoid *) glLightEnviSGIX, _gloffset_LightEnviSGIX }, |
{ "glDrawRangeElementsEXT", (GLvoid *) glDrawRangeElementsEXT, _gloffset_DrawRangeElements }, |
{ "glSecondaryColor3bEXT", (GLvoid *) glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT }, |
{ "glSecondaryColor3bvEXT", (GLvoid *) glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT }, |
{ "glSecondaryColor3dEXT", (GLvoid *) glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT }, |
{ "glSecondaryColor3dvEXT", (GLvoid *) glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT }, |
{ "glSecondaryColor3fEXT", (GLvoid *) glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT }, |
{ "glSecondaryColor3fvEXT", (GLvoid *) glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT }, |
{ "glSecondaryColor3iEXT", (GLvoid *) glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT }, |
{ "glSecondaryColor3ivEXT", (GLvoid *) glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT }, |
{ "glSecondaryColor3sEXT", (GLvoid *) glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT }, |
{ "glSecondaryColor3svEXT", (GLvoid *) glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT }, |
{ "glSecondaryColor3ubEXT", (GLvoid *) glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT }, |
{ "glSecondaryColor3ubvEXT", (GLvoid *) glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT }, |
{ "glSecondaryColor3uiEXT", (GLvoid *) glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT }, |
{ "glSecondaryColor3uivEXT", (GLvoid *) glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT }, |
{ "glSecondaryColor3usEXT", (GLvoid *) glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT }, |
{ "glSecondaryColor3usvEXT", (GLvoid *) glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT }, |
{ "glSecondaryColorPointerEXT", (GLvoid *) glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT }, |
{ "glMultiDrawArraysEXT", (GLvoid *) glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT }, |
{ "glMultiDrawElementsEXT", (GLvoid *) glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT }, |
{ "glFogCoordfEXT", (GLvoid *) glFogCoordfEXT, _gloffset_FogCoordfEXT }, |
{ "glFogCoordfvEXT", (GLvoid *) glFogCoordfvEXT, _gloffset_FogCoordfvEXT }, |
{ "glFogCoorddEXT", (GLvoid *) glFogCoorddEXT, _gloffset_FogCoorddEXT }, |
{ "glFogCoorddvEXT", (GLvoid *) glFogCoorddvEXT, _gloffset_FogCoorddvEXT }, |
{ "glFogCoordPointerEXT", (GLvoid *) glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT }, |
{ "glBlendFuncSeparateEXT", (GLvoid *) glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT }, |
{ "glBlendFuncSeparateINGR", (GLvoid *) glBlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT }, |
{ "glVertexWeightfEXT", (GLvoid *) glVertexWeightfEXT, _gloffset_VertexWeightfEXT }, |
{ "glVertexWeightfvEXT", (GLvoid *) glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT }, |
{ "glVertexWeightPointerEXT", (GLvoid *) glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT }, |
{ "glFlushVertexArrayRangeNV", (GLvoid *) glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV }, |
{ "glVertexArrayRangeNV", (GLvoid *) glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV }, |
{ "glCombinerParameterfvNV", (GLvoid *) glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV }, |
{ "glCombinerParameterfNV", (GLvoid *) glCombinerParameterfNV, _gloffset_CombinerParameterfNV }, |
{ "glCombinerParameterivNV", (GLvoid *) glCombinerParameterivNV, _gloffset_CombinerParameterivNV }, |
{ "glCombinerParameteriNV", (GLvoid *) glCombinerParameteriNV, _gloffset_CombinerParameteriNV }, |
{ "glCombinerInputNV", (GLvoid *) glCombinerInputNV, _gloffset_CombinerInputNV }, |
{ "glCombinerOutputNV", (GLvoid *) glCombinerOutputNV, _gloffset_CombinerOutputNV }, |
{ "glFinalCombinerInputNV", (GLvoid *) glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV }, |
{ "glGetCombinerInputParameterfvNV", (GLvoid *) glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV }, |
{ "glGetCombinerInputParameterivNV", (GLvoid *) glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV }, |
{ "glGetCombinerOutputParameterfvNV", (GLvoid *) glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV }, |
{ "glGetCombinerOutputParameterivNV", (GLvoid *) glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV }, |
{ "glGetFinalCombinerInputParameterfvNV", (GLvoid *) glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV }, |
{ "glGetFinalCombinerInputParameterivNV", (GLvoid *) glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV }, |
{ "glResizeBuffersMESA", (GLvoid *) glResizeBuffersMESA, _gloffset_ResizeBuffersMESA }, |
{ "glWindowPos2dMESA", (GLvoid *) glWindowPos2dMESA, _gloffset_WindowPos2dMESA }, |
{ "glWindowPos2dvMESA", (GLvoid *) glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA }, |
{ "glWindowPos2fMESA", (GLvoid *) glWindowPos2fMESA, _gloffset_WindowPos2fMESA }, |
{ "glWindowPos2fvMESA", (GLvoid *) glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA }, |
{ "glWindowPos2iMESA", (GLvoid *) glWindowPos2iMESA, _gloffset_WindowPos2iMESA }, |
{ "glWindowPos2ivMESA", (GLvoid *) glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA }, |
{ "glWindowPos2sMESA", (GLvoid *) glWindowPos2sMESA, _gloffset_WindowPos2sMESA }, |
{ "glWindowPos2svMESA", (GLvoid *) glWindowPos2svMESA, _gloffset_WindowPos2svMESA }, |
{ "glWindowPos3dMESA", (GLvoid *) glWindowPos3dMESA, _gloffset_WindowPos3dMESA }, |
{ "glWindowPos3dvMESA", (GLvoid *) glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA }, |
{ "glWindowPos3fMESA", (GLvoid *) glWindowPos3fMESA, _gloffset_WindowPos3fMESA }, |
{ "glWindowPos3fvMESA", (GLvoid *) glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA }, |
{ "glWindowPos3iMESA", (GLvoid *) glWindowPos3iMESA, _gloffset_WindowPos3iMESA }, |
{ "glWindowPos3ivMESA", (GLvoid *) glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA }, |
{ "glWindowPos3sMESA", (GLvoid *) glWindowPos3sMESA, _gloffset_WindowPos3sMESA }, |
{ "glWindowPos3svMESA", (GLvoid *) glWindowPos3svMESA, _gloffset_WindowPos3svMESA }, |
{ "glWindowPos4dMESA", (GLvoid *) glWindowPos4dMESA, _gloffset_WindowPos4dMESA }, |
{ "glWindowPos4dvMESA", (GLvoid *) glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA }, |
{ "glWindowPos4fMESA", (GLvoid *) glWindowPos4fMESA, _gloffset_WindowPos4fMESA }, |
{ "glWindowPos4fvMESA", (GLvoid *) glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA }, |
{ "glWindowPos4iMESA", (GLvoid *) glWindowPos4iMESA, _gloffset_WindowPos4iMESA }, |
{ "glWindowPos4ivMESA", (GLvoid *) glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA }, |
{ "glWindowPos4sMESA", (GLvoid *) glWindowPos4sMESA, _gloffset_WindowPos4sMESA }, |
{ "glWindowPos4svMESA", (GLvoid *) glWindowPos4svMESA, _gloffset_WindowPos4svMESA }, |
{ "glTbufferMask3DFX", (GLvoid *) glTbufferMask3DFX, _gloffset_TbufferMask3DFX }, |
{ "glSampleMaskEXT", (GLvoid *) glSampleMaskEXT, _gloffset_SampleMaskSGIS }, |
{ "glSamplePatternEXT", (GLvoid *) glSamplePatternEXT, _gloffset_SamplePatternSGIS }, |
{ "glDeleteFencesNV", (GLvoid *) glDeleteFencesNV, _gloffset_DeleteFencesNV }, |
{ "glGenFencesNV", (GLvoid *) glGenFencesNV, _gloffset_GenFencesNV }, |
{ "glIsFenceNV", (GLvoid *) glIsFenceNV, _gloffset_IsFenceNV }, |
{ "glTestFenceNV", (GLvoid *) glTestFenceNV, _gloffset_TestFenceNV }, |
{ "glGetFenceivNV", (GLvoid *) glGetFenceivNV, _gloffset_GetFenceivNV }, |
{ "glFinishFenceNV", (GLvoid *) glFinishFenceNV, _gloffset_FinishFenceNV }, |
{ "glSetFenceNV", (GLvoid *) glSetFenceNV, _gloffset_SetFenceNV }, |
{ "glWindowPos2dARB", (GLvoid *) glWindowPos2dARB, _gloffset_WindowPos2dMESA }, |
{ "glWindowPos2fARB", (GLvoid *) glWindowPos2fARB, _gloffset_WindowPos2fMESA }, |
{ "glWindowPos2iARB", (GLvoid *) glWindowPos2iARB, _gloffset_WindowPos2iMESA }, |
{ "glWindowPos2sARB", (GLvoid *) glWindowPos2sARB, _gloffset_WindowPos2sMESA }, |
{ "glWindowPos2dvARB", (GLvoid *) glWindowPos2dvARB, _gloffset_WindowPos2dvMESA }, |
{ "glWindowPos2fvARB", (GLvoid *) glWindowPos2fvARB, _gloffset_WindowPos2fvMESA }, |
{ "glWindowPos2ivARB", (GLvoid *) glWindowPos2ivARB, _gloffset_WindowPos2ivMESA }, |
{ "glWindowPos2svARB", (GLvoid *) glWindowPos2svARB, _gloffset_WindowPos2svMESA }, |
{ "glWindowPos3dARB", (GLvoid *) glWindowPos3dARB, _gloffset_WindowPos3dMESA }, |
{ "glWindowPos3fARB", (GLvoid *) glWindowPos3fARB, _gloffset_WindowPos3fMESA }, |
{ "glWindowPos3iARB", (GLvoid *) glWindowPos3iARB, _gloffset_WindowPos3iMESA }, |
{ "glWindowPos3sARB", (GLvoid *) glWindowPos3sARB, _gloffset_WindowPos3sMESA }, |
{ "glWindowPos3dvARB", (GLvoid *) glWindowPos3dvARB, _gloffset_WindowPos3dvMESA }, |
{ "glWindowPos3fvARB", (GLvoid *) glWindowPos3fvARB, _gloffset_WindowPos3fvMESA }, |
{ "glWindowPos3ivARB", (GLvoid *) glWindowPos3ivARB, _gloffset_WindowPos3ivMESA }, |
{ "glWindowPos3svARB", (GLvoid *) glWindowPos3svARB, _gloffset_WindowPos3svMESA }, |
{ "glAreProgramsResidentNV", (GLvoid *) glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV }, |
{ "glBindProgramNV", (GLvoid *) glBindProgramNV, _gloffset_BindProgramNV }, |
{ "glDeleteProgramsNV", (GLvoid *) glDeleteProgramsNV, _gloffset_DeleteProgramsNV }, |
{ "glExecuteProgramNV", (GLvoid *) glExecuteProgramNV, _gloffset_ExecuteProgramNV }, |
{ "glGenProgramsNV", (GLvoid *) glGenProgramsNV, _gloffset_GenProgramsNV }, |
{ "glGetProgramParameterdvNV", (GLvoid *) glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV }, |
{ "glGetProgramParameterfvNV", (GLvoid *) glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV }, |
{ "glGetProgramivNV", (GLvoid *) glGetProgramivNV, _gloffset_GetProgramivNV }, |
{ "glGetProgramStringNV", (GLvoid *) glGetProgramStringNV, _gloffset_GetProgramStringNV }, |
{ "glGetTrackMatrixivNV", (GLvoid *) glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV }, |
{ "glGetVertexAttribdvNV", (GLvoid *) glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV }, |
{ "glGetVertexAttribfvNV", (GLvoid *) glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV }, |
{ "glGetVertexAttribivNV", (GLvoid *) glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV }, |
{ "glGetVertexAttribPointervNV", (GLvoid *) glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV }, |
{ "glIsProgramNV", (GLvoid *) glIsProgramNV, _gloffset_IsProgramNV }, |
{ "glLoadProgramNV", (GLvoid *) glLoadProgramNV, _gloffset_LoadProgramNV }, |
{ "glProgramParameter4dNV", (GLvoid *) glProgramParameter4dNV, _gloffset_ProgramParameter4dNV }, |
{ "glProgramParameter4dvNV", (GLvoid *) glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV }, |
{ "glProgramParameter4fNV", (GLvoid *) glProgramParameter4fNV, _gloffset_ProgramParameter4fNV }, |
{ "glProgramParameter4fvNV", (GLvoid *) glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV }, |
{ "glProgramParameters4dvNV", (GLvoid *) glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV }, |
{ "glProgramParameters4fvNV", (GLvoid *) glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV }, |
{ "glRequestResidentProgramsNV", (GLvoid *) glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV }, |
{ "glTrackMatrixNV", (GLvoid *) glTrackMatrixNV, _gloffset_TrackMatrixNV }, |
{ "glVertexAttribPointerNV", (GLvoid *) glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV }, |
{ "glVertexAttrib1dNV", (GLvoid *) glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV }, |
{ "glVertexAttrib1dvNV", (GLvoid *) glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV }, |
{ "glVertexAttrib1fNV", (GLvoid *) glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV }, |
{ "glVertexAttrib1fvNV", (GLvoid *) glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV }, |
{ "glVertexAttrib1sNV", (GLvoid *) glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV }, |
{ "glVertexAttrib1svNV", (GLvoid *) glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV }, |
{ "glVertexAttrib2dNV", (GLvoid *) glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV }, |
{ "glVertexAttrib2dvNV", (GLvoid *) glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV }, |
{ "glVertexAttrib2fNV", (GLvoid *) glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV }, |
{ "glVertexAttrib2fvNV", (GLvoid *) glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV }, |
{ "glVertexAttrib2sNV", (GLvoid *) glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV }, |
{ "glVertexAttrib2svNV", (GLvoid *) glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV }, |
{ "glVertexAttrib3dNV", (GLvoid *) glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV }, |
{ "glVertexAttrib3dvNV", (GLvoid *) glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV }, |
{ "glVertexAttrib3fNV", (GLvoid *) glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV }, |
{ "glVertexAttrib3fvNV", (GLvoid *) glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV }, |
{ "glVertexAttrib3sNV", (GLvoid *) glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV }, |
{ "glVertexAttrib3svNV", (GLvoid *) glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV }, |
{ "glVertexAttrib4dNV", (GLvoid *) glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV }, |
{ "glVertexAttrib4dvNV", (GLvoid *) glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV }, |
{ "glVertexAttrib4fNV", (GLvoid *) glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV }, |
{ "glVertexAttrib4fvNV", (GLvoid *) glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV }, |
{ "glVertexAttrib4sNV", (GLvoid *) glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV }, |
{ "glVertexAttrib4svNV", (GLvoid *) glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV }, |
{ "glVertexAttrib4ubNV", (GLvoid *) glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV }, |
{ "glVertexAttrib4ubvNV", (GLvoid *) glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV }, |
{ "glVertexAttribs1dvNV", (GLvoid *) glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV }, |
{ "glVertexAttribs1fvNV", (GLvoid *) glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV }, |
{ "glVertexAttribs1svNV", (GLvoid *) glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV }, |
{ "glVertexAttribs2dvNV", (GLvoid *) glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV }, |
{ "glVertexAttribs2fvNV", (GLvoid *) glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV }, |
{ "glVertexAttribs2svNV", (GLvoid *) glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV }, |
{ "glVertexAttribs3dvNV", (GLvoid *) glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV }, |
{ "glVertexAttribs3fvNV", (GLvoid *) glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV }, |
{ "glVertexAttribs3svNV", (GLvoid *) glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV }, |
{ "glVertexAttribs4dvNV", (GLvoid *) glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV }, |
{ "glVertexAttribs4fvNV", (GLvoid *) glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV }, |
{ "glVertexAttribs4svNV", (GLvoid *) glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV }, |
{ "glVertexAttribs4ubvNV", (GLvoid *) glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV }, |
{ "glPointParameteriNV", (GLvoid *) glPointParameteriNV, _gloffset_PointParameteriNV }, |
{ "glPointParameterivNV", (GLvoid *) glPointParameterivNV, _gloffset_PointParameterivNV }, |
{ "glBlendFuncSeparate", (GLvoid *) glBlendFuncSeparate, _gloffset_BlendFuncSeparateEXT }, |
{ "glFogCoordf", (GLvoid *) glFogCoordf, _gloffset_FogCoordfEXT }, |
{ "glFogCoordfv", (GLvoid *) glFogCoordfv, _gloffset_FogCoordfvEXT }, |
{ "glFogCoordd", (GLvoid *) glFogCoordd, _gloffset_FogCoorddEXT }, |
{ "glFogCoorddv", (GLvoid *) glFogCoorddv, _gloffset_FogCoorddvEXT }, |
{ "glFogCoordPointer", (GLvoid *) glFogCoordPointer, _gloffset_FogCoordPointerEXT }, |
{ "glMultiDrawArrays", (GLvoid *) glMultiDrawArrays, _gloffset_MultiDrawArraysEXT }, |
{ "glMultiDrawElements", (GLvoid *) glMultiDrawElements, _gloffset_MultiDrawElementsEXT }, |
{ "glPointParameterf", (GLvoid *) glPointParameterf, _gloffset_PointParameterfEXT }, |
{ "glPointParameterfv", (GLvoid *) glPointParameterfv, _gloffset_PointParameterfvEXT }, |
{ "glPointParameteri", (GLvoid *) glPointParameteri, _gloffset_PointParameteriNV }, |
{ "glPointParameteriv", (GLvoid *) glPointParameteriv, _gloffset_PointParameterivNV }, |
{ "glSecondaryColor3b", (GLvoid *) glSecondaryColor3b, _gloffset_SecondaryColor3bEXT }, |
{ "glSecondaryColor3bv", (GLvoid *) glSecondaryColor3bv, _gloffset_SecondaryColor3bvEXT }, |
{ "glSecondaryColor3d", (GLvoid *) glSecondaryColor3d, _gloffset_SecondaryColor3dEXT }, |
{ "glSecondaryColor3dv", (GLvoid *) glSecondaryColor3dv, _gloffset_SecondaryColor3dvEXT }, |
{ "glSecondaryColor3f", (GLvoid *) glSecondaryColor3f, _gloffset_SecondaryColor3fEXT }, |
{ "glSecondaryColor3fv", (GLvoid *) glSecondaryColor3fv, _gloffset_SecondaryColor3fvEXT }, |
{ "glSecondaryColor3i", (GLvoid *) glSecondaryColor3i, _gloffset_SecondaryColor3iEXT }, |
{ "glSecondaryColor3iv", (GLvoid *) glSecondaryColor3iv, _gloffset_SecondaryColor3ivEXT }, |
{ "glSecondaryColor3s", (GLvoid *) glSecondaryColor3s, _gloffset_SecondaryColor3sEXT }, |
{ "glSecondaryColor3sv", (GLvoid *) glSecondaryColor3sv, _gloffset_SecondaryColor3svEXT }, |
{ "glSecondaryColor3ub", (GLvoid *) glSecondaryColor3ub, _gloffset_SecondaryColor3ubEXT }, |
{ "glSecondaryColor3ubv", (GLvoid *) glSecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT }, |
{ "glSecondaryColor3ui", (GLvoid *) glSecondaryColor3ui, _gloffset_SecondaryColor3uiEXT }, |
{ "glSecondaryColor3uiv", (GLvoid *) glSecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT }, |
{ "glSecondaryColor3us", (GLvoid *) glSecondaryColor3us, _gloffset_SecondaryColor3usEXT }, |
{ "glSecondaryColor3usv", (GLvoid *) glSecondaryColor3usv, _gloffset_SecondaryColor3usvEXT }, |
{ "glSecondaryColorPointer", (GLvoid *) glSecondaryColorPointer, _gloffset_SecondaryColorPointerEXT }, |
{ "glWindowPos2d", (GLvoid *) glWindowPos2d, _gloffset_WindowPos2dMESA }, |
{ "glWindowPos2dv", (GLvoid *) glWindowPos2dv, _gloffset_WindowPos2dvMESA }, |
{ "glWindowPos2f", (GLvoid *) glWindowPos2f, _gloffset_WindowPos2fMESA }, |
{ "glWindowPos2fv", (GLvoid *) glWindowPos2fv, _gloffset_WindowPos2fvMESA }, |
{ "glWindowPos2i", (GLvoid *) glWindowPos2i, _gloffset_WindowPos2iMESA }, |
{ "glWindowPos2iv", (GLvoid *) glWindowPos2iv, _gloffset_WindowPos2ivMESA }, |
{ "glWindowPos2s", (GLvoid *) glWindowPos2s, _gloffset_WindowPos2sMESA }, |
{ "glWindowPos2sv", (GLvoid *) glWindowPos2sv, _gloffset_WindowPos2svMESA }, |
{ "glWindowPos3d", (GLvoid *) glWindowPos3d, _gloffset_WindowPos3dMESA }, |
{ "glWindowPos3dv", (GLvoid *) glWindowPos3dv, _gloffset_WindowPos3dvMESA }, |
{ "glWindowPos3f", (GLvoid *) glWindowPos3f, _gloffset_WindowPos3fMESA }, |
{ "glWindowPos3fv", (GLvoid *) glWindowPos3fv, _gloffset_WindowPos3fvMESA }, |
{ "glWindowPos3i", (GLvoid *) glWindowPos3i, _gloffset_WindowPos3iMESA }, |
{ "glWindowPos3iv", (GLvoid *) glWindowPos3iv, _gloffset_WindowPos3ivMESA }, |
{ "glWindowPos3s", (GLvoid *) glWindowPos3s, _gloffset_WindowPos3sMESA }, |
{ "glWindowPos3sv", (GLvoid *) glWindowPos3sv, _gloffset_WindowPos3svMESA }, |
{ "glActiveStencilFaceEXT", (GLvoid *) glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT }, |
{ NULL, NULL } /* end of list marker */ |
}; |
/shark/tags/rel_0_4/ports/mesa/src/texformat.h |
---|
0,0 → 1,149 |
/* $Id: texformat.h,v 1.1 2003-02-28 11:42:05 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
* |
* Author: |
* Gareth Hughes |
*/ |
#ifndef TEXFORMAT_H |
#define TEXFORMAT_H |
#include "mtypes.h" |
/* |
* The Mesa internal texture image types. |
* All texture images must be stored in one of these formats. |
*/ |
enum _format { |
/* Hardware-friendly formats. Drivers can override the default |
* formats and convert texture images to one of these as required. |
* The driver's ChooseTextureFormat() function will choose one of |
* these formats. |
* These formats are all little endian, as shown below. They will be |
* most useful for x86-based PC graphics card drivers. |
* |
* NOTE: In the default case, some of these formats will be |
* duplicates of the generic formats listed below. However, these |
* formats guarantee their internal component sizes, while GLchan may |
* vary betwen GLubyte, GLushort and GLfloat. |
*/ |
/* msb <------ TEXEL BITS -----------> lsb */ |
/* ---- ---- ---- ---- ---- ---- ---- ---- */ |
MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ |
MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ |
MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ |
MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ |
MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ |
MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ |
MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ |
MESA_FORMAT_RGB332, /* RRRG GGBB */ |
MESA_FORMAT_A8, /* AAAA AAAA */ |
MESA_FORMAT_L8, /* LLLL LLLL */ |
MESA_FORMAT_I8, /* IIII IIII */ |
MESA_FORMAT_CI8, /* CCCC CCCC */ |
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ |
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ |
#if 0 |
/* upcoming little-endian formats: */ |
/* msb <------ TEXEL BITS -----------> lsb */ |
/* ---- ---- ---- ---- ---- ---- ---- ---- */ |
MESA_FORMAT_ABGR8888, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ |
MESA_FORMAT_BGRA8888, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ |
MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ |
MESA_FORMAT_BGR565, /* BBBB BGGG GGGR RRRR */ |
MESA_FORMAT_BGRA4444, /* BBBB GGGG RRRR AAAA */ |
MESA_FORMAT_BGRA5551, /* BBBB BGGG GGRR RRRA */ |
MESA_FORMAT_LA88, /* LLLL LLLL AAAA AAAA */ |
MESA_FORMAT_BGR233, /* BBGG GRRR */ |
#endif |
/* Generic GLchan-based formats. These are the default formats used |
* by the software rasterizer and, unless the driver overrides the |
* texture image functions, incoming images will be converted to one |
* of these formats. Components are arrays of GLchan values, so |
* there will be no big/little endian issues. |
* |
* NOTE: Because these are based on the GLchan datatype, one cannot |
* assume 8 bits per channel with these formats. If you require |
* GLubyte channels, use one of the hardware formats above. |
*/ |
MESA_FORMAT_RGBA, |
MESA_FORMAT_RGB, |
MESA_FORMAT_ALPHA, |
MESA_FORMAT_LUMINANCE, |
MESA_FORMAT_LUMINANCE_ALPHA, |
MESA_FORMAT_INTENSITY, |
MESA_FORMAT_COLOR_INDEX, |
MESA_FORMAT_DEPTH_COMPONENT |
}; |
extern GLboolean |
_mesa_is_hardware_tex_format( const struct gl_texture_format *format ); |
extern const struct gl_texture_format * |
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, |
GLenum format, GLenum type ); |
extern GLint |
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat); |
/* The default formats, GLchan per component: |
*/ |
extern const struct gl_texture_format _mesa_texformat_rgba; |
extern const struct gl_texture_format _mesa_texformat_rgb; |
extern const struct gl_texture_format _mesa_texformat_alpha; |
extern const struct gl_texture_format _mesa_texformat_luminance; |
extern const struct gl_texture_format _mesa_texformat_luminance_alpha; |
extern const struct gl_texture_format _mesa_texformat_intensity; |
extern const struct gl_texture_format _mesa_texformat_color_index; |
extern const struct gl_texture_format _mesa_texformat_depth_component; |
/* The hardware-friendly formats: |
*/ |
extern const struct gl_texture_format _mesa_texformat_rgba8888; |
extern const struct gl_texture_format _mesa_texformat_argb8888; |
extern const struct gl_texture_format _mesa_texformat_rgb888; |
extern const struct gl_texture_format _mesa_texformat_rgb565; |
extern const struct gl_texture_format _mesa_texformat_argb4444; |
extern const struct gl_texture_format _mesa_texformat_argb1555; |
extern const struct gl_texture_format _mesa_texformat_al88; |
extern const struct gl_texture_format _mesa_texformat_rgb332; |
extern const struct gl_texture_format _mesa_texformat_a8; |
extern const struct gl_texture_format _mesa_texformat_l8; |
extern const struct gl_texture_format _mesa_texformat_i8; |
extern const struct gl_texture_format _mesa_texformat_ci8; |
extern const struct gl_texture_format _mesa_texformat_ycbcr; |
extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; |
/* The null format: |
*/ |
extern const struct gl_texture_format _mesa_null_texformat; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/get.c |
---|
0,0 → 1,5708 |
/* $Id: get.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "enable.h" |
#include "enums.h" |
#include "extensions.h" |
#include "get.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
#include "texcompress.h" |
#include "math/m_matrix.h" |
#define FLOAT_TO_BOOL(X) ( (X)==0.0F ? GL_FALSE : GL_TRUE ) |
#define INT_TO_BOOL(I) ( (I)==0 ? GL_FALSE : GL_TRUE ) |
#define ENUM_TO_BOOL(E) ( (E)==0 ? GL_FALSE : GL_TRUE ) |
#ifdef SPECIALCAST |
/* Needed for an Amiga compiler */ |
#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) |
#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) |
#else |
/* all other compilers */ |
#define ENUM_TO_FLOAT(X) ((GLfloat)(X)) |
#define ENUM_TO_DOUBLE(X) ((GLdouble)(X)) |
#endif |
/* Check if named extension is enabled, if not generate error and return */ |
#define CHECK_EXTENSION_B(EXTNAME, PNAME) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_VALUE, \ |
"glGetBooleanv(0x%x)", (int) PNAME); \ |
return; \ |
} |
#define CHECK_EXTENSION_I(EXTNAME, PNAME) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_VALUE, \ |
"glGetIntegerv(0x%x)", (int) PNAME); \ |
return; \ |
} |
#define CHECK_EXTENSION_F(EXTNAME, PNAME) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_VALUE, \ |
"glGetFloatv(0x%x)", (int) PNAME); \ |
return; \ |
} |
#define CHECK_EXTENSION_D(EXTNAME, PNAME) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_VALUE, \ |
"glGetDoublev(0x%x)", (int) PNAME); \ |
return; \ |
} |
static GLenum |
pixel_texgen_mode(const GLcontext *ctx) |
{ |
if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { |
if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { |
return GL_RGBA; |
} |
else { |
return GL_RGB; |
} |
} |
else { |
if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { |
return GL_ALPHA; |
} |
else { |
return GL_NONE; |
} |
} |
} |
void |
_mesa_GetBooleanv( GLenum pname, GLboolean *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint i; |
GLuint texUnit = ctx->Texture.CurrentUnit; |
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!params) |
return; |
/* We need this in order to get correct results for |
* GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases. |
*/ |
FLUSH_VERTICES(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname)); |
if (ctx->Driver.GetBooleanv |
&& (*ctx->Driver.GetBooleanv)(ctx, pname, params)) |
return; |
switch (pname) { |
case GL_ACCUM_RED_BITS: |
*params = INT_TO_BOOL(ctx->Visual.accumRedBits); |
break; |
case GL_ACCUM_GREEN_BITS: |
*params = INT_TO_BOOL(ctx->Visual.accumGreenBits); |
break; |
case GL_ACCUM_BLUE_BITS: |
*params = INT_TO_BOOL(ctx->Visual.accumBlueBits); |
break; |
case GL_ACCUM_ALPHA_BITS: |
*params = INT_TO_BOOL(ctx->Visual.accumAlphaBits); |
break; |
case GL_ACCUM_CLEAR_VALUE: |
params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[2]); |
params[3] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[3]); |
break; |
case GL_ALPHA_BIAS: |
*params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias); |
break; |
case GL_ALPHA_BITS: |
*params = INT_TO_BOOL(ctx->Visual.alphaBits); |
break; |
case GL_ALPHA_SCALE: |
*params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale); |
break; |
case GL_ALPHA_TEST: |
*params = ctx->Color.AlphaEnabled; |
break; |
case GL_ALPHA_TEST_FUNC: |
*params = ENUM_TO_BOOL(ctx->Color.AlphaFunc); |
break; |
case GL_ALPHA_TEST_REF: |
*params = ctx->Color.AlphaRef ? GL_TRUE : GL_FALSE; |
break; |
case GL_ATTRIB_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->AttribStackDepth); |
break; |
case GL_AUTO_NORMAL: |
*params = ctx->Eval.AutoNormal; |
break; |
case GL_AUX_BUFFERS: |
*params = (ctx->Const.NumAuxBuffers) ? GL_TRUE : GL_FALSE; |
break; |
case GL_BLEND: |
*params = ctx->Color.BlendEnabled; |
break; |
case GL_BLEND_DST: |
*params = ENUM_TO_BOOL(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC: |
*params = ENUM_TO_BOOL(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_SRC_RGB_EXT: |
*params = ENUM_TO_BOOL(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_DST_RGB_EXT: |
*params = ENUM_TO_BOOL(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC_ALPHA_EXT: |
*params = ENUM_TO_BOOL(ctx->Color.BlendSrcA); |
break; |
case GL_BLEND_DST_ALPHA_EXT: |
*params = ENUM_TO_BOOL(ctx->Color.BlendDstA); |
break; |
case GL_BLEND_EQUATION_EXT: |
*params = ENUM_TO_BOOL( ctx->Color.BlendEquation ); |
break; |
case GL_BLEND_COLOR_EXT: |
params[0] = FLOAT_TO_BOOL( ctx->Color.BlendColor[0] ); |
params[1] = FLOAT_TO_BOOL( ctx->Color.BlendColor[1] ); |
params[2] = FLOAT_TO_BOOL( ctx->Color.BlendColor[2] ); |
params[3] = FLOAT_TO_BOOL( ctx->Color.BlendColor[3] ); |
break; |
case GL_BLUE_BIAS: |
*params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias); |
break; |
case GL_BLUE_BITS: |
*params = INT_TO_BOOL( ctx->Visual.blueBits ); |
break; |
case GL_BLUE_SCALE: |
*params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale); |
break; |
case GL_CLIENT_ATTRIB_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->ClientAttribStackDepth); |
break; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) |
*params = GL_TRUE; |
else |
*params = GL_FALSE; |
break; |
case GL_COLOR_CLEAR_VALUE: |
params[0] = ctx->Color.ClearColor[0] ? GL_TRUE : GL_FALSE; |
params[1] = ctx->Color.ClearColor[1] ? GL_TRUE : GL_FALSE; |
params[2] = ctx->Color.ClearColor[2] ? GL_TRUE : GL_FALSE; |
params[3] = ctx->Color.ClearColor[3] ? GL_TRUE : GL_FALSE; |
break; |
case GL_COLOR_MATERIAL: |
*params = ctx->Light.ColorMaterialEnabled; |
break; |
case GL_COLOR_MATERIAL_FACE: |
*params = ENUM_TO_BOOL(ctx->Light.ColorMaterialFace); |
break; |
case GL_COLOR_MATERIAL_PARAMETER: |
*params = ENUM_TO_BOOL(ctx->Light.ColorMaterialMode); |
break; |
case GL_COLOR_WRITEMASK: |
params[0] = ctx->Color.ColorMask[RCOMP] ? GL_TRUE : GL_FALSE; |
params[1] = ctx->Color.ColorMask[GCOMP] ? GL_TRUE : GL_FALSE; |
params[2] = ctx->Color.ColorMask[BCOMP] ? GL_TRUE : GL_FALSE; |
params[3] = ctx->Color.ColorMask[ACOMP] ? GL_TRUE : GL_FALSE; |
break; |
case GL_CULL_FACE: |
*params = ctx->Polygon.CullFlag; |
break; |
case GL_CULL_FACE_MODE: |
*params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode); |
break; |
case GL_CURRENT_COLOR: |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); |
params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); |
break; |
case GL_CURRENT_INDEX: |
FLUSH_CURRENT(ctx, 0); |
*params = INT_TO_BOOL(ctx->Current.Index); |
break; |
case GL_CURRENT_NORMAL: |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); |
break; |
case GL_CURRENT_RASTER_COLOR: |
params[0] = FLOAT_TO_BOOL(ctx->Current.RasterColor[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.RasterColor[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.RasterColor[2]); |
params[3] = FLOAT_TO_BOOL(ctx->Current.RasterColor[3]); |
break; |
case GL_CURRENT_RASTER_DISTANCE: |
*params = FLOAT_TO_BOOL(ctx->Current.RasterDistance); |
break; |
case GL_CURRENT_RASTER_INDEX: |
*params = FLOAT_TO_BOOL(ctx->Current.RasterIndex); |
break; |
case GL_CURRENT_RASTER_POSITION: |
params[0] = FLOAT_TO_BOOL(ctx->Current.RasterPos[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.RasterPos[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.RasterPos[2]); |
params[3] = FLOAT_TO_BOOL(ctx->Current.RasterPos[3]); |
break; |
case GL_CURRENT_RASTER_TEXTURE_COORDS: |
params[0] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][2]); |
params[3] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][3]); |
break; |
case GL_CURRENT_RASTER_POSITION_VALID: |
*params = ctx->Current.RasterPosValid; |
break; |
case GL_CURRENT_TEXTURE_COORDS: |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); |
params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); |
params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); |
params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); |
break; |
case GL_DEPTH_BIAS: |
*params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias); |
break; |
case GL_DEPTH_BITS: |
*params = INT_TO_BOOL(ctx->Visual.depthBits); |
break; |
case GL_DEPTH_CLEAR_VALUE: |
*params = FLOAT_TO_BOOL(ctx->Depth.Clear); |
break; |
case GL_DEPTH_FUNC: |
*params = ENUM_TO_BOOL(ctx->Depth.Func); |
break; |
case GL_DEPTH_RANGE: |
params[0] = FLOAT_TO_BOOL(ctx->Viewport.Near); |
params[1] = FLOAT_TO_BOOL(ctx->Viewport.Far); |
break; |
case GL_DEPTH_SCALE: |
*params = FLOAT_TO_BOOL(ctx->Pixel.DepthScale); |
break; |
case GL_DEPTH_TEST: |
*params = ctx->Depth.Test; |
break; |
case GL_DEPTH_WRITEMASK: |
*params = ctx->Depth.Mask; |
break; |
case GL_DITHER: |
*params = ctx->Color.DitherFlag; |
break; |
case GL_DOUBLEBUFFER: |
*params = ctx->Visual.doubleBufferMode; |
break; |
case GL_DRAW_BUFFER: |
*params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); |
break; |
case GL_EDGE_FLAG: |
FLUSH_CURRENT(ctx, 0); |
*params = ctx->Current.EdgeFlag; |
break; |
case GL_FEEDBACK_BUFFER_SIZE: |
*params = INT_TO_BOOL(ctx->Feedback.BufferSize); |
break; |
case GL_FEEDBACK_BUFFER_TYPE: |
*params = INT_TO_BOOL(ctx->Feedback.Type); |
break; |
case GL_FOG: |
*params = ctx->Fog.Enabled; |
break; |
case GL_FOG_COLOR: |
params[0] = FLOAT_TO_BOOL(ctx->Fog.Color[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Fog.Color[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Fog.Color[2]); |
params[3] = FLOAT_TO_BOOL(ctx->Fog.Color[3]); |
break; |
case GL_FOG_DENSITY: |
*params = FLOAT_TO_BOOL(ctx->Fog.Density); |
break; |
case GL_FOG_END: |
*params = FLOAT_TO_BOOL(ctx->Fog.End); |
break; |
case GL_FOG_HINT: |
*params = ENUM_TO_BOOL(ctx->Hint.Fog); |
break; |
case GL_FOG_INDEX: |
*params = FLOAT_TO_BOOL(ctx->Fog.Index); |
break; |
case GL_FOG_MODE: |
*params = ENUM_TO_BOOL(ctx->Fog.Mode); |
break; |
case GL_FOG_START: |
*params = FLOAT_TO_BOOL(ctx->Fog.End); |
break; |
case GL_FRONT_FACE: |
*params = ENUM_TO_BOOL(ctx->Polygon.FrontFace); |
break; |
case GL_GREEN_BIAS: |
*params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias); |
break; |
case GL_GREEN_BITS: |
*params = INT_TO_BOOL( ctx->Visual.greenBits ); |
break; |
case GL_GREEN_SCALE: |
*params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); |
break; |
case GL_INDEX_BITS: |
*params = INT_TO_BOOL( ctx->Visual.indexBits ); |
break; |
case GL_INDEX_CLEAR_VALUE: |
*params = INT_TO_BOOL(ctx->Color.ClearIndex); |
break; |
case GL_INDEX_MODE: |
*params = ctx->Visual.rgbMode ? GL_FALSE : GL_TRUE; |
break; |
case GL_INDEX_OFFSET: |
*params = INT_TO_BOOL(ctx->Pixel.IndexOffset); |
break; |
case GL_INDEX_SHIFT: |
*params = INT_TO_BOOL(ctx->Pixel.IndexShift); |
break; |
case GL_INDEX_WRITEMASK: |
*params = INT_TO_BOOL(ctx->Color.IndexMask); |
break; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
*params = ctx->Light.Light[pname-GL_LIGHT0].Enabled; |
break; |
case GL_LIGHTING: |
*params = ctx->Light.Enabled; |
break; |
case GL_LIGHT_MODEL_AMBIENT: |
params[0] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[2]); |
params[3] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[3]); |
break; |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
params[0] = ENUM_TO_BOOL(ctx->Light.Model.ColorControl); |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
*params = ctx->Light.Model.LocalViewer; |
break; |
case GL_LIGHT_MODEL_TWO_SIDE: |
*params = ctx->Light.Model.TwoSide; |
break; |
case GL_LINE_SMOOTH: |
*params = ctx->Line.SmoothFlag; |
break; |
case GL_LINE_SMOOTH_HINT: |
*params = ENUM_TO_BOOL(ctx->Hint.LineSmooth); |
break; |
case GL_LINE_STIPPLE: |
*params = ctx->Line.StippleFlag; |
break; |
case GL_LINE_STIPPLE_PATTERN: |
*params = INT_TO_BOOL(ctx->Line.StipplePattern); |
break; |
case GL_LINE_STIPPLE_REPEAT: |
*params = INT_TO_BOOL(ctx->Line.StippleFactor); |
break; |
case GL_LINE_WIDTH: |
*params = FLOAT_TO_BOOL(ctx->Line.Width); |
break; |
case GL_LINE_WIDTH_GRANULARITY: |
*params = FLOAT_TO_BOOL(ctx->Const.LineWidthGranularity); |
break; |
case GL_LINE_WIDTH_RANGE: |
params[0] = FLOAT_TO_BOOL(ctx->Const.MinLineWidthAA); |
params[1] = FLOAT_TO_BOOL(ctx->Const.MaxLineWidthAA); |
break; |
case GL_ALIASED_LINE_WIDTH_RANGE: |
params[0] = FLOAT_TO_BOOL(ctx->Const.MinLineWidth); |
params[1] = FLOAT_TO_BOOL(ctx->Const.MaxLineWidth); |
break; |
case GL_LIST_BASE: |
*params = INT_TO_BOOL(ctx->List.ListBase); |
break; |
case GL_LIST_INDEX: |
*params = INT_TO_BOOL( ctx->CurrentListNum ); |
break; |
case GL_LIST_MODE: |
*params = ENUM_TO_BOOL( ctx->ExecuteFlag |
? GL_COMPILE_AND_EXECUTE : GL_COMPILE ); |
break; |
case GL_INDEX_LOGIC_OP: |
*params = ctx->Color.IndexLogicOpEnabled; |
break; |
case GL_COLOR_LOGIC_OP: |
*params = ctx->Color.ColorLogicOpEnabled; |
break; |
case GL_LOGIC_OP_MODE: |
*params = ENUM_TO_BOOL(ctx->Color.LogicOp); |
break; |
case GL_MAP1_COLOR_4: |
*params = ctx->Eval.Map1Color4; |
break; |
case GL_MAP1_GRID_DOMAIN: |
params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u1); |
params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u2); |
break; |
case GL_MAP1_GRID_SEGMENTS: |
*params = INT_TO_BOOL(ctx->Eval.MapGrid1un); |
break; |
case GL_MAP1_INDEX: |
*params = ctx->Eval.Map1Index; |
break; |
case GL_MAP1_NORMAL: |
*params = ctx->Eval.Map1Normal; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
*params = ctx->Eval.Map1TextureCoord1; |
break; |
case GL_MAP1_TEXTURE_COORD_2: |
*params = ctx->Eval.Map1TextureCoord2; |
break; |
case GL_MAP1_TEXTURE_COORD_3: |
*params = ctx->Eval.Map1TextureCoord3; |
break; |
case GL_MAP1_TEXTURE_COORD_4: |
*params = ctx->Eval.Map1TextureCoord4; |
break; |
case GL_MAP1_VERTEX_3: |
*params = ctx->Eval.Map1Vertex3; |
break; |
case GL_MAP1_VERTEX_4: |
*params = ctx->Eval.Map1Vertex4; |
break; |
case GL_MAP2_COLOR_4: |
*params = ctx->Eval.Map2Color4; |
break; |
case GL_MAP2_GRID_DOMAIN: |
params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u1); |
params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u2); |
params[2] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v1); |
params[3] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v2); |
break; |
case GL_MAP2_GRID_SEGMENTS: |
params[0] = INT_TO_BOOL(ctx->Eval.MapGrid2un); |
params[1] = INT_TO_BOOL(ctx->Eval.MapGrid2vn); |
break; |
case GL_MAP2_INDEX: |
*params = ctx->Eval.Map2Index; |
break; |
case GL_MAP2_NORMAL: |
*params = ctx->Eval.Map2Normal; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
*params = ctx->Eval.Map2TextureCoord1; |
break; |
case GL_MAP2_TEXTURE_COORD_2: |
*params = ctx->Eval.Map2TextureCoord2; |
break; |
case GL_MAP2_TEXTURE_COORD_3: |
*params = ctx->Eval.Map2TextureCoord3; |
break; |
case GL_MAP2_TEXTURE_COORD_4: |
*params = ctx->Eval.Map2TextureCoord4; |
break; |
case GL_MAP2_VERTEX_3: |
*params = ctx->Eval.Map2Vertex3; |
break; |
case GL_MAP2_VERTEX_4: |
*params = ctx->Eval.Map2Vertex4; |
break; |
case GL_MAP_COLOR: |
*params = ctx->Pixel.MapColorFlag; |
break; |
case GL_MAP_STENCIL: |
*params = ctx->Pixel.MapStencilFlag; |
break; |
case GL_MATRIX_MODE: |
*params = ENUM_TO_BOOL( ctx->Transform.MatrixMode ); |
break; |
case GL_MAX_ATTRIB_STACK_DEPTH: |
*params = INT_TO_BOOL(MAX_ATTRIB_STACK_DEPTH); |
break; |
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: |
*params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH); |
break; |
case GL_MAX_CLIP_PLANES: |
*params = INT_TO_BOOL(ctx->Const.MaxClipPlanes); |
break; |
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ |
*params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize); |
break; |
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ |
*params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize); |
break; |
case GL_MAX_EVAL_ORDER: |
*params = INT_TO_BOOL(MAX_EVAL_ORDER); |
break; |
case GL_MAX_LIGHTS: |
*params = INT_TO_BOOL(ctx->Const.MaxLights); |
break; |
case GL_MAX_LIST_NESTING: |
*params = INT_TO_BOOL(MAX_LIST_NESTING); |
break; |
case GL_MAX_MODELVIEW_STACK_DEPTH: |
*params = INT_TO_BOOL(MAX_MODELVIEW_STACK_DEPTH); |
break; |
case GL_MAX_NAME_STACK_DEPTH: |
*params = INT_TO_BOOL(MAX_NAME_STACK_DEPTH); |
break; |
case GL_MAX_PIXEL_MAP_TABLE: |
*params = INT_TO_BOOL(MAX_PIXEL_MAP_TABLE); |
break; |
case GL_MAX_PROJECTION_STACK_DEPTH: |
*params = INT_TO_BOOL(MAX_PROJECTION_STACK_DEPTH); |
break; |
case GL_MAX_TEXTURE_SIZE: |
*params = INT_TO_BOOL(1 << (ctx->Const.MaxTextureLevels - 1)); |
break; |
case GL_MAX_3D_TEXTURE_SIZE: |
*params = INT_TO_BOOL(1 << (ctx->Const.Max3DTextureLevels - 1)); |
break; |
case GL_MAX_TEXTURE_STACK_DEPTH: |
*params = INT_TO_BOOL(MAX_TEXTURE_STACK_DEPTH); |
break; |
case GL_MAX_VIEWPORT_DIMS: |
params[0] = INT_TO_BOOL(MAX_WIDTH); |
params[1] = INT_TO_BOOL(MAX_HEIGHT); |
break; |
case GL_MODELVIEW_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(ctx->ModelviewMatrixStack.Top->m[i]); |
} |
break; |
case GL_MODELVIEW_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->ModelviewMatrixStack.Depth + 1); |
break; |
case GL_NAME_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->Select.NameStackDepth); |
break; |
case GL_NORMALIZE: |
*params = ctx->Transform.Normalize; |
break; |
case GL_PACK_ALIGNMENT: |
*params = INT_TO_BOOL(ctx->Pack.Alignment); |
break; |
case GL_PACK_LSB_FIRST: |
*params = ctx->Pack.LsbFirst; |
break; |
case GL_PACK_ROW_LENGTH: |
*params = INT_TO_BOOL(ctx->Pack.RowLength); |
break; |
case GL_PACK_SKIP_PIXELS: |
*params = INT_TO_BOOL(ctx->Pack.SkipPixels); |
break; |
case GL_PACK_SKIP_ROWS: |
*params = INT_TO_BOOL(ctx->Pack.SkipRows); |
break; |
case GL_PACK_SWAP_BYTES: |
*params = ctx->Pack.SwapBytes; |
break; |
case GL_PACK_SKIP_IMAGES_EXT: |
*params = ctx->Pack.SkipImages; |
break; |
case GL_PACK_IMAGE_HEIGHT_EXT: |
*params = ctx->Pack.ImageHeight; |
break; |
case GL_PACK_INVERT_MESA: |
*params = ctx->Pack.Invert; |
break; |
case GL_PERSPECTIVE_CORRECTION_HINT: |
*params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection); |
break; |
case GL_PIXEL_MAP_A_TO_A_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapAtoAsize); |
break; |
case GL_PIXEL_MAP_B_TO_B_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapBtoBsize); |
break; |
case GL_PIXEL_MAP_G_TO_G_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapGtoGsize); |
break; |
case GL_PIXEL_MAP_I_TO_A_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapItoAsize); |
break; |
case GL_PIXEL_MAP_I_TO_B_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapItoBsize); |
break; |
case GL_PIXEL_MAP_I_TO_G_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapItoGsize); |
break; |
case GL_PIXEL_MAP_I_TO_I_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapItoIsize); |
break; |
case GL_PIXEL_MAP_I_TO_R_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapItoRsize); |
break; |
case GL_PIXEL_MAP_R_TO_R_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapRtoRsize); |
break; |
case GL_PIXEL_MAP_S_TO_S_SIZE: |
*params = INT_TO_BOOL(ctx->Pixel.MapStoSsize); |
break; |
case GL_POINT_SIZE: |
*params = FLOAT_TO_BOOL(ctx->Point.Size); |
break; |
case GL_POINT_SIZE_GRANULARITY: |
*params = FLOAT_TO_BOOL(ctx->Const.PointSizeGranularity ); |
break; |
case GL_POINT_SIZE_RANGE: |
params[0] = FLOAT_TO_BOOL(ctx->Const.MinPointSizeAA); |
params[1] = FLOAT_TO_BOOL(ctx->Const.MaxPointSizeAA); |
break; |
case GL_ALIASED_POINT_SIZE_RANGE: |
params[0] = FLOAT_TO_BOOL(ctx->Const.MinPointSize); |
params[1] = FLOAT_TO_BOOL(ctx->Const.MaxPointSize); |
break; |
case GL_POINT_SMOOTH: |
*params = ctx->Point.SmoothFlag; |
break; |
case GL_POINT_SMOOTH_HINT: |
*params = ENUM_TO_BOOL(ctx->Hint.PointSmooth); |
break; |
case GL_POINT_SIZE_MIN_EXT: |
*params = FLOAT_TO_BOOL(ctx->Point.MinSize); |
break; |
case GL_POINT_SIZE_MAX_EXT: |
*params = FLOAT_TO_BOOL(ctx->Point.MaxSize); |
break; |
case GL_POINT_FADE_THRESHOLD_SIZE_EXT: |
*params = FLOAT_TO_BOOL(ctx->Point.Threshold); |
break; |
case GL_DISTANCE_ATTENUATION_EXT: |
params[0] = FLOAT_TO_BOOL(ctx->Point.Params[0]); |
params[1] = FLOAT_TO_BOOL(ctx->Point.Params[1]); |
params[2] = FLOAT_TO_BOOL(ctx->Point.Params[2]); |
break; |
case GL_POLYGON_MODE: |
params[0] = ENUM_TO_BOOL(ctx->Polygon.FrontMode); |
params[1] = ENUM_TO_BOOL(ctx->Polygon.BackMode); |
break; |
case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */ |
*params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits ); |
break; |
case GL_POLYGON_OFFSET_FACTOR: |
*params = FLOAT_TO_BOOL( ctx->Polygon.OffsetFactor ); |
break; |
case GL_POLYGON_OFFSET_UNITS: |
*params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits ); |
break; |
case GL_POLYGON_SMOOTH: |
*params = ctx->Polygon.SmoothFlag; |
break; |
case GL_POLYGON_SMOOTH_HINT: |
*params = ENUM_TO_BOOL(ctx->Hint.PolygonSmooth); |
break; |
case GL_POLYGON_STIPPLE: |
*params = ctx->Polygon.StippleFlag; |
break; |
case GL_PROJECTION_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(ctx->ProjectionMatrixStack.Top->m[i]); |
} |
break; |
case GL_PROJECTION_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->ProjectionMatrixStack.Depth + 1); |
break; |
case GL_READ_BUFFER: |
*params = ENUM_TO_BOOL(ctx->Pixel.ReadBuffer); |
break; |
case GL_RED_BIAS: |
*params = FLOAT_TO_BOOL(ctx->Pixel.RedBias); |
break; |
case GL_RED_BITS: |
*params = INT_TO_BOOL( ctx->Visual.redBits ); |
break; |
case GL_RED_SCALE: |
*params = FLOAT_TO_BOOL(ctx->Pixel.RedScale); |
break; |
case GL_RENDER_MODE: |
*params = ENUM_TO_BOOL(ctx->RenderMode); |
break; |
case GL_RESCALE_NORMAL: |
*params = ctx->Transform.RescaleNormals; |
break; |
case GL_RGBA_MODE: |
*params = ctx->Visual.rgbMode; |
break; |
case GL_SCISSOR_BOX: |
params[0] = INT_TO_BOOL(ctx->Scissor.X); |
params[1] = INT_TO_BOOL(ctx->Scissor.Y); |
params[2] = INT_TO_BOOL(ctx->Scissor.Width); |
params[3] = INT_TO_BOOL(ctx->Scissor.Height); |
break; |
case GL_SCISSOR_TEST: |
*params = ctx->Scissor.Enabled; |
break; |
case GL_SELECTION_BUFFER_SIZE: |
*params = INT_TO_BOOL(ctx->Select.BufferSize); |
break; |
case GL_SHADE_MODEL: |
*params = ENUM_TO_BOOL(ctx->Light.ShadeModel); |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
*params = ctx->Texture.SharedPalette; |
break; |
case GL_STENCIL_BITS: |
*params = INT_TO_BOOL(ctx->Visual.stencilBits); |
break; |
case GL_STENCIL_CLEAR_VALUE: |
*params = INT_TO_BOOL(ctx->Stencil.Clear); |
break; |
case GL_STENCIL_FAIL: |
*params = ENUM_TO_BOOL(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_FUNC: |
*params = ENUM_TO_BOOL(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_FAIL: |
*params = ENUM_TO_BOOL(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_PASS: |
*params = ENUM_TO_BOOL(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_REF: |
*params = INT_TO_BOOL(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_TEST: |
*params = ctx->Stencil.Enabled; |
break; |
case GL_STENCIL_VALUE_MASK: |
*params = INT_TO_BOOL(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_WRITEMASK: |
*params = INT_TO_BOOL(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); |
break; |
case GL_STEREO: |
*params = ctx->Visual.stereoMode; |
break; |
case GL_SUBPIXEL_BITS: |
*params = INT_TO_BOOL(ctx->Const.SubPixelBits); |
break; |
case GL_TEXTURE_1D: |
*params = _mesa_IsEnabled(GL_TEXTURE_1D); |
break; |
case GL_TEXTURE_2D: |
*params = _mesa_IsEnabled(GL_TEXTURE_2D); |
break; |
case GL_TEXTURE_3D: |
*params = _mesa_IsEnabled(GL_TEXTURE_3D); |
break; |
case GL_TEXTURE_BINDING_1D: |
*params = INT_TO_BOOL(textureUnit->Current1D->Name); |
break; |
case GL_TEXTURE_BINDING_2D: |
*params = INT_TO_BOOL(textureUnit->Current2D->Name); |
break; |
case GL_TEXTURE_BINDING_3D: |
*params = INT_TO_BOOL(textureUnit->Current3D->Name); |
break; |
case GL_TEXTURE_ENV_COLOR: |
{ |
params[0] = FLOAT_TO_BOOL(textureUnit->EnvColor[0]); |
params[1] = FLOAT_TO_BOOL(textureUnit->EnvColor[1]); |
params[2] = FLOAT_TO_BOOL(textureUnit->EnvColor[2]); |
params[3] = FLOAT_TO_BOOL(textureUnit->EnvColor[3]); |
} |
break; |
case GL_TEXTURE_ENV_MODE: |
*params = ENUM_TO_BOOL(textureUnit->EnvMode); |
break; |
case GL_TEXTURE_GEN_S: |
*params = (textureUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
break; |
case GL_TEXTURE_GEN_T: |
*params = (textureUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
break; |
case GL_TEXTURE_GEN_R: |
*params = (textureUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
break; |
case GL_TEXTURE_GEN_Q: |
*params = (textureUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
break; |
case GL_TEXTURE_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = |
FLOAT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Top->m[i]); |
} |
break; |
case GL_TEXTURE_STACK_DEPTH: |
*params = INT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Depth + 1); |
break; |
case GL_UNPACK_ALIGNMENT: |
*params = INT_TO_BOOL(ctx->Unpack.Alignment); |
break; |
case GL_UNPACK_LSB_FIRST: |
*params = ctx->Unpack.LsbFirst; |
break; |
case GL_UNPACK_ROW_LENGTH: |
*params = INT_TO_BOOL(ctx->Unpack.RowLength); |
break; |
case GL_UNPACK_SKIP_PIXELS: |
*params = INT_TO_BOOL(ctx->Unpack.SkipPixels); |
break; |
case GL_UNPACK_SKIP_ROWS: |
*params = INT_TO_BOOL(ctx->Unpack.SkipRows); |
break; |
case GL_UNPACK_SWAP_BYTES: |
*params = ctx->Unpack.SwapBytes; |
break; |
case GL_UNPACK_SKIP_IMAGES_EXT: |
*params = ctx->Unpack.SkipImages; |
break; |
case GL_UNPACK_IMAGE_HEIGHT_EXT: |
*params = ctx->Unpack.ImageHeight; |
break; |
case GL_UNPACK_CLIENT_STORAGE_APPLE: |
*params = ctx->Unpack.ClientStorage; |
break; |
case GL_VIEWPORT: |
params[0] = INT_TO_BOOL(ctx->Viewport.X); |
params[1] = INT_TO_BOOL(ctx->Viewport.Y); |
params[2] = INT_TO_BOOL(ctx->Viewport.Width); |
params[3] = INT_TO_BOOL(ctx->Viewport.Height); |
break; |
case GL_ZOOM_X: |
*params = FLOAT_TO_BOOL(ctx->Pixel.ZoomX); |
break; |
case GL_ZOOM_Y: |
*params = FLOAT_TO_BOOL(ctx->Pixel.ZoomY); |
break; |
case GL_VERTEX_ARRAY: |
*params = ctx->Array.Vertex.Enabled; |
break; |
case GL_VERTEX_ARRAY_SIZE: |
*params = INT_TO_BOOL(ctx->Array.Vertex.Size); |
break; |
case GL_VERTEX_ARRAY_TYPE: |
*params = ENUM_TO_BOOL(ctx->Array.Vertex.Type); |
break; |
case GL_VERTEX_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.Vertex.Stride); |
break; |
case GL_VERTEX_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
case GL_NORMAL_ARRAY: |
*params = ctx->Array.Normal.Enabled; |
break; |
case GL_NORMAL_ARRAY_TYPE: |
*params = ENUM_TO_BOOL(ctx->Array.Normal.Type); |
break; |
case GL_NORMAL_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.Normal.Stride); |
break; |
case GL_NORMAL_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
case GL_COLOR_ARRAY: |
*params = ctx->Array.Color.Enabled; |
break; |
case GL_COLOR_ARRAY_SIZE: |
*params = INT_TO_BOOL(ctx->Array.Color.Size); |
break; |
case GL_COLOR_ARRAY_TYPE: |
*params = ENUM_TO_BOOL(ctx->Array.Color.Type); |
break; |
case GL_COLOR_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.Color.Stride); |
break; |
case GL_COLOR_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
case GL_INDEX_ARRAY: |
*params = ctx->Array.Index.Enabled; |
break; |
case GL_INDEX_ARRAY_TYPE: |
*params = ENUM_TO_BOOL(ctx->Array.Index.Type); |
break; |
case GL_INDEX_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.Index.Stride); |
break; |
case GL_INDEX_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
case GL_TEXTURE_COORD_ARRAY: |
*params = ctx->Array.TexCoord[texUnit].Enabled; |
break; |
case GL_TEXTURE_COORD_ARRAY_SIZE: |
*params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Size); |
break; |
case GL_TEXTURE_COORD_ARRAY_TYPE: |
*params = ENUM_TO_BOOL(ctx->Array.TexCoord[texUnit].Type); |
break; |
case GL_TEXTURE_COORD_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Stride); |
break; |
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
case GL_EDGE_FLAG_ARRAY: |
*params = ctx->Array.EdgeFlag.Enabled; |
break; |
case GL_EDGE_FLAG_ARRAY_STRIDE: |
*params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride); |
break; |
case GL_EDGE_FLAG_ARRAY_COUNT_EXT: |
*params = INT_TO_BOOL(0); |
break; |
/* GL_ARB_multitexture */ |
case GL_MAX_TEXTURE_UNITS_ARB: |
CHECK_EXTENSION_B(ARB_multitexture, pname); |
*params = INT_TO_BOOL(ctx->Const.MaxTextureUnits); |
break; |
case GL_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_B(ARB_multitexture, pname); |
*params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); |
break; |
case GL_CLIENT_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_B(ARB_multitexture, pname); |
*params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); |
break; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
CHECK_EXTENSION_B(ARB_texture_cube_map, pname); |
*params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); |
break; |
case GL_TEXTURE_BINDING_CUBE_MAP_ARB: |
CHECK_EXTENSION_B(ARB_texture_cube_map, pname); |
*params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); |
break; |
case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: |
CHECK_EXTENSION_B(ARB_texture_cube_map, pname); |
*params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1)); |
break; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSION_HINT_ARB: |
CHECK_EXTENSION_B(ARB_texture_compression, pname); |
*params = INT_TO_BOOL(ctx->Hint.TextureCompression); |
break; |
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_B(ARB_texture_compression, pname); |
*params = INT_TO_BOOL(_mesa_get_compressed_formats(ctx, NULL)); |
break; |
case GL_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_B(ARB_texture_compression, pname); |
{ |
GLint formats[100]; |
GLuint i, n; |
n = _mesa_get_compressed_formats(ctx, formats); |
for (i = 0; i < n; i++) |
params[i] = INT_TO_BOOL(formats[i]); |
} |
break; |
/* GL_EXT_compiled_vertex_array */ |
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: |
*params = ctx->Array.LockFirst ? GL_TRUE : GL_FALSE; |
break; |
case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: |
*params = ctx->Array.LockCount ? GL_TRUE : GL_FALSE; |
break; |
/* GL_ARB_transpose_matrix */ |
case GL_TRANSPOSE_COLOR_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ColorMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(tm[i]); |
} |
} |
break; |
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(tm[i]); |
} |
} |
break; |
case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(tm[i]); |
} |
} |
break; |
case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(tm[i]); |
} |
} |
break; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION_B(HP_occlusion_test, pname); |
*params = ctx->Depth.OcclusionTest; |
return; |
case GL_OCCLUSION_TEST_RESULT_HP: |
CHECK_EXTENSION_B(HP_occlusion_test, pname); |
if (ctx->Depth.OcclusionTest) |
*params = ctx->OcclusionResult; |
else |
*params = ctx->OcclusionResultSaved; |
/* reset flag now */ |
ctx->OcclusionResult = GL_FALSE; |
ctx->OcclusionResultSaved = GL_FALSE; |
return; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
*params = ctx->Pixel.PixelTextureEnabled; |
break; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
*params = ctx->Pixel.PixelTextureEnabled; |
break; |
case GL_PIXEL_TEX_GEN_MODE_SGIX: |
*params = (GLboolean) pixel_texgen_mode(ctx); |
break; |
/* GL_SGI_color_matrix (also in 1.2 imaging) */ |
case GL_COLOR_MATRIX_SGI: |
for (i=0;i<16;i++) { |
params[i] = FLOAT_TO_BOOL(ctx->ColorMatrixStack.Top->m[i]); |
} |
break; |
case GL_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = INT_TO_BOOL(ctx->ColorMatrixStack.Depth + 1); |
break; |
case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH); |
break; |
case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[0]); |
break; |
case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[1]); |
break; |
case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[2]); |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[3]); |
break; |
case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[0]); |
break; |
case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[1]); |
break; |
case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[2]); |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[3]); |
break; |
/* GL_EXT_convolution (also in 1.2 imaging) */ |
case GL_CONVOLUTION_1D_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = ctx->Pixel.Convolution1DEnabled; |
break; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = ctx->Pixel.Convolution2DEnabled; |
break; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = ctx->Pixel.Separable2DEnabled; |
break; |
case GL_POST_CONVOLUTION_RED_SCALE_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]); |
break; |
case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]); |
break; |
case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]); |
break; |
case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]); |
break; |
case GL_POST_CONVOLUTION_RED_BIAS_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]); |
break; |
case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]); |
break; |
case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); |
break; |
case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: |
CHECK_EXTENSION_B(EXT_convolution, pname); |
*params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); |
break; |
/* GL_EXT_histogram (also in 1.2 imaging) */ |
case GL_HISTOGRAM: |
CHECK_EXTENSION_B(EXT_histogram, pname); |
*params = ctx->Pixel.HistogramEnabled; |
break; |
case GL_MINMAX: |
CHECK_EXTENSION_B(EXT_histogram, pname); |
*params = ctx->Pixel.MinMaxEnabled; |
break; |
/* GL_SGI_color_table (also in 1.2 imaging */ |
case GL_COLOR_TABLE_SGI: |
*params = ctx->Pixel.ColorTableEnabled; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
*params = ctx->Pixel.PostConvolutionColorTableEnabled; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
*params = ctx->Pixel.PostColorMatrixColorTableEnabled; |
break; |
/* GL_EXT_secondary_color */ |
case GL_COLOR_SUM_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
*params = ctx->Fog.ColorSumEnabled; |
break; |
case GL_CURRENT_SECONDARY_COLOR_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
FLUSH_CURRENT(ctx, 0); |
params[0] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); |
params[1] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); |
params[2] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); |
break; |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
*params = ctx->Array.SecondaryColor.Enabled; |
break; |
case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
*params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type); |
break; |
case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
*params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); |
break; |
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: |
CHECK_EXTENSION_B(EXT_secondary_color, pname); |
*params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); |
break; |
/* GL_EXT_fog_coord */ |
case GL_CURRENT_FOG_COORDINATE_EXT: |
CHECK_EXTENSION_B(EXT_fog_coord, pname); |
FLUSH_CURRENT(ctx, 0); |
*params = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); |
break; |
case GL_FOG_COORDINATE_ARRAY_EXT: |
CHECK_EXTENSION_B(EXT_fog_coord, pname); |
*params = ctx->Array.FogCoord.Enabled; |
break; |
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_B(EXT_fog_coord, pname); |
*params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type); |
break; |
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_B(EXT_fog_coord, pname); |
*params = INT_TO_BOOL(ctx->Array.FogCoord.Stride); |
break; |
/* GL_EXT_texture_lod_bias */ |
case GL_MAX_TEXTURE_LOD_BIAS_EXT: |
*params = FLOAT_TO_BOOL(ctx->Const.MaxTextureLodBias); |
break; |
/* GL_EXT_texture_filter_anisotropic */ |
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: |
CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname); |
*params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy); |
break; |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = ctx->Multisample.Enabled; |
break; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = ctx->Multisample.SampleAlphaToCoverage; |
break; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = ctx->Multisample.SampleAlphaToOne; |
break; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = ctx->Multisample.SampleCoverage; |
break; |
case GL_SAMPLE_COVERAGE_VALUE_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue); |
break; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = ctx->Multisample.SampleCoverageInvert; |
break; |
case GL_SAMPLE_BUFFERS_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = 0; /* XXX fix someday */ |
break; |
case GL_SAMPLES_ARB: |
CHECK_EXTENSION_B(ARB_multisample, pname); |
*params = 0; /* XXX fix someday */ |
break; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION_B(IBM_rasterpos_clip, pname); |
*params = ctx->Transform.RasterPositionUnclipped; |
break; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = ctx->Point.PointSprite; |
break; |
case GL_POINT_SPRITE_R_MODE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = ENUM_TO_BOOL(ctx->Point.SpriteRMode); |
break; |
/* GL_SGIS_generate_mipmap */ |
case GL_GENERATE_MIPMAP_HINT_SGIS: |
CHECK_EXTENSION_B(SGIS_generate_mipmap, pname); |
*params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap); |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = ctx->VertexProgram.Enabled; |
break; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = ctx->VertexProgram.PointSizeEnabled; |
break; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = ctx->VertexProgram.TwoSideEnabled; |
break; |
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (MAX_PROGRAM_STACK_DEPTH > 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_MAX_TRACK_MATRICES_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (MAX_PROGRAM_MATRICES > 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_CURRENT_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (ctx->CurrentStack->Depth > 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_CURRENT_MATRIX_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (ctx->Transform.MatrixMode != 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_VERTEX_PROGRAM_BINDING_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (ctx->VertexProgram.CurrentID != 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_PROGRAM_ERROR_POSITION_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
*params = (ctx->VertexProgram.ErrorPos != 0) ? GL_TRUE : GL_FALSE; |
break; |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; |
*params = ctx->Array.VertexAttrib[n].Enabled; |
} |
break; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; |
*params = ctx->Eval.Map1Attrib[n]; |
} |
break; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; |
*params = ctx->Eval.Map2Attrib[n]; |
} |
break; |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION_B(NV_texture_rectangle, pname); |
*params = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); |
break; |
case GL_TEXTURE_BINDING_RECTANGLE_NV: |
CHECK_EXTENSION_B(NV_texture_rectangle, pname); |
*params = INT_TO_BOOL(textureUnit->CurrentRect->Name); |
break; |
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: |
CHECK_EXTENSION_B(NV_texture_rectangle, pname); |
*params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize); |
break; |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION_B(EXT_stencil_two_side, pname); |
*params = ctx->Stencil.TestTwoSide; |
break; |
case GL_ACTIVE_STENCIL_FACE_EXT: |
CHECK_EXTENSION_B(EXT_stencil_two_side, pname); |
*params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); |
} |
} |
void |
_mesa_GetDoublev( GLenum pname, GLdouble *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint i; |
GLuint texUnit = ctx->Texture.CurrentUnit; |
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!params) |
return; |
/* We need this in order to get correct results for |
* GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases. |
*/ |
FLUSH_VERTICES(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname)); |
if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params)) |
return; |
switch (pname) { |
case GL_ACCUM_RED_BITS: |
*params = (GLdouble) ctx->Visual.accumRedBits; |
break; |
case GL_ACCUM_GREEN_BITS: |
*params = (GLdouble) ctx->Visual.accumGreenBits; |
break; |
case GL_ACCUM_BLUE_BITS: |
*params = (GLdouble) ctx->Visual.accumBlueBits; |
break; |
case GL_ACCUM_ALPHA_BITS: |
*params = (GLdouble) ctx->Visual.accumAlphaBits; |
break; |
case GL_ACCUM_CLEAR_VALUE: |
params[0] = (GLdouble) ctx->Accum.ClearColor[0]; |
params[1] = (GLdouble) ctx->Accum.ClearColor[1]; |
params[2] = (GLdouble) ctx->Accum.ClearColor[2]; |
params[3] = (GLdouble) ctx->Accum.ClearColor[3]; |
break; |
case GL_ALPHA_BIAS: |
*params = (GLdouble) ctx->Pixel.AlphaBias; |
break; |
case GL_ALPHA_BITS: |
*params = (GLdouble) ctx->Visual.alphaBits; |
break; |
case GL_ALPHA_SCALE: |
*params = (GLdouble) ctx->Pixel.AlphaScale; |
break; |
case GL_ALPHA_TEST: |
*params = (GLdouble) ctx->Color.AlphaEnabled; |
break; |
case GL_ALPHA_TEST_FUNC: |
*params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc); |
break; |
case GL_ALPHA_TEST_REF: |
*params = (GLdouble) ctx->Color.AlphaRef; |
break; |
case GL_ATTRIB_STACK_DEPTH: |
*params = (GLdouble ) (ctx->AttribStackDepth); |
break; |
case GL_AUTO_NORMAL: |
*params = (GLdouble) ctx->Eval.AutoNormal; |
break; |
case GL_AUX_BUFFERS: |
*params = (GLdouble) ctx->Const.NumAuxBuffers; |
break; |
case GL_BLEND: |
*params = (GLdouble) ctx->Color.BlendEnabled; |
break; |
case GL_BLEND_DST: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_SRC_RGB_EXT: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_DST_RGB_EXT: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC_ALPHA_EXT: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendSrcA); |
break; |
case GL_BLEND_DST_ALPHA_EXT: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendDstA); |
break; |
case GL_BLEND_EQUATION_EXT: |
*params = ENUM_TO_DOUBLE(ctx->Color.BlendEquation); |
break; |
case GL_BLEND_COLOR_EXT: |
params[0] = (GLdouble) ctx->Color.BlendColor[0]; |
params[1] = (GLdouble) ctx->Color.BlendColor[1]; |
params[2] = (GLdouble) ctx->Color.BlendColor[2]; |
params[3] = (GLdouble) ctx->Color.BlendColor[3]; |
break; |
case GL_BLUE_BIAS: |
*params = (GLdouble) ctx->Pixel.BlueBias; |
break; |
case GL_BLUE_BITS: |
*params = (GLdouble) ctx->Visual.blueBits; |
break; |
case GL_BLUE_SCALE: |
*params = (GLdouble) ctx->Pixel.BlueScale; |
break; |
case GL_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLdouble) (ctx->ClientAttribStackDepth); |
break; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) |
*params = 1.0; |
else |
*params = 0.0; |
break; |
case GL_COLOR_CLEAR_VALUE: |
params[0] = (GLdouble) ctx->Color.ClearColor[0]; |
params[1] = (GLdouble) ctx->Color.ClearColor[1]; |
params[2] = (GLdouble) ctx->Color.ClearColor[2]; |
params[3] = (GLdouble) ctx->Color.ClearColor[3]; |
break; |
case GL_COLOR_MATERIAL: |
*params = (GLdouble) ctx->Light.ColorMaterialEnabled; |
break; |
case GL_COLOR_MATERIAL_FACE: |
*params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialFace); |
break; |
case GL_COLOR_MATERIAL_PARAMETER: |
*params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialMode); |
break; |
case GL_COLOR_WRITEMASK: |
params[0] = ctx->Color.ColorMask[RCOMP] ? 1.0 : 0.0; |
params[1] = ctx->Color.ColorMask[GCOMP] ? 1.0 : 0.0; |
params[2] = ctx->Color.ColorMask[BCOMP] ? 1.0 : 0.0; |
params[3] = ctx->Color.ColorMask[ACOMP] ? 1.0 : 0.0; |
break; |
case GL_CULL_FACE: |
*params = (GLdouble) ctx->Polygon.CullFlag; |
break; |
case GL_CULL_FACE_MODE: |
*params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode); |
break; |
case GL_CURRENT_COLOR: |
FLUSH_CURRENT(ctx, 0); |
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; |
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; |
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; |
params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; |
break; |
case GL_CURRENT_INDEX: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLdouble) ctx->Current.Index; |
break; |
case GL_CURRENT_NORMAL: |
FLUSH_CURRENT(ctx, 0); |
params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; |
params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; |
params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; |
break; |
case GL_CURRENT_RASTER_COLOR: |
params[0] = (GLdouble) ctx->Current.RasterColor[0]; |
params[1] = (GLdouble) ctx->Current.RasterColor[1]; |
params[2] = (GLdouble) ctx->Current.RasterColor[2]; |
params[3] = (GLdouble) ctx->Current.RasterColor[3]; |
break; |
case GL_CURRENT_RASTER_DISTANCE: |
params[0] = (GLdouble) ctx->Current.RasterDistance; |
break; |
case GL_CURRENT_RASTER_INDEX: |
*params = (GLdouble) ctx->Current.RasterIndex; |
break; |
case GL_CURRENT_RASTER_POSITION: |
params[0] = (GLdouble) ctx->Current.RasterPos[0]; |
params[1] = (GLdouble) ctx->Current.RasterPos[1]; |
params[2] = (GLdouble) ctx->Current.RasterPos[2]; |
params[3] = (GLdouble) ctx->Current.RasterPos[3]; |
break; |
case GL_CURRENT_RASTER_TEXTURE_COORDS: |
params[0] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][0]; |
params[1] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][1]; |
params[2] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][2]; |
params[3] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][3]; |
break; |
case GL_CURRENT_RASTER_POSITION_VALID: |
*params = (GLdouble) ctx->Current.RasterPosValid; |
break; |
case GL_CURRENT_TEXTURE_COORDS: |
FLUSH_CURRENT(ctx, 0); |
params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; |
params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; |
params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; |
params[3] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; |
break; |
case GL_DEPTH_BIAS: |
*params = (GLdouble) ctx->Pixel.DepthBias; |
break; |
case GL_DEPTH_BITS: |
*params = (GLdouble) ctx->Visual.depthBits; |
break; |
case GL_DEPTH_CLEAR_VALUE: |
*params = (GLdouble) ctx->Depth.Clear; |
break; |
case GL_DEPTH_FUNC: |
*params = ENUM_TO_DOUBLE(ctx->Depth.Func); |
break; |
case GL_DEPTH_RANGE: |
params[0] = (GLdouble) ctx->Viewport.Near; |
params[1] = (GLdouble) ctx->Viewport.Far; |
break; |
case GL_DEPTH_SCALE: |
*params = (GLdouble) ctx->Pixel.DepthScale; |
break; |
case GL_DEPTH_TEST: |
*params = (GLdouble) ctx->Depth.Test; |
break; |
case GL_DEPTH_WRITEMASK: |
*params = (GLdouble) ctx->Depth.Mask; |
break; |
case GL_DITHER: |
*params = (GLdouble) ctx->Color.DitherFlag; |
break; |
case GL_DOUBLEBUFFER: |
*params = (GLdouble) ctx->Visual.doubleBufferMode; |
break; |
case GL_DRAW_BUFFER: |
*params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); |
break; |
case GL_EDGE_FLAG: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLdouble) ctx->Current.EdgeFlag; |
break; |
case GL_FEEDBACK_BUFFER_SIZE: |
*params = (GLdouble) ctx->Feedback.BufferSize; |
break; |
case GL_FEEDBACK_BUFFER_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Feedback.Type); |
break; |
case GL_FOG: |
*params = (GLdouble) ctx->Fog.Enabled; |
break; |
case GL_FOG_COLOR: |
params[0] = (GLdouble) ctx->Fog.Color[0]; |
params[1] = (GLdouble) ctx->Fog.Color[1]; |
params[2] = (GLdouble) ctx->Fog.Color[2]; |
params[3] = (GLdouble) ctx->Fog.Color[3]; |
break; |
case GL_FOG_DENSITY: |
*params = (GLdouble) ctx->Fog.Density; |
break; |
case GL_FOG_END: |
*params = (GLdouble) ctx->Fog.End; |
break; |
case GL_FOG_HINT: |
*params = ENUM_TO_DOUBLE(ctx->Hint.Fog); |
break; |
case GL_FOG_INDEX: |
*params = (GLdouble) ctx->Fog.Index; |
break; |
case GL_FOG_MODE: |
*params = ENUM_TO_DOUBLE(ctx->Fog.Mode); |
break; |
case GL_FOG_START: |
*params = (GLdouble) ctx->Fog.Start; |
break; |
case GL_FRONT_FACE: |
*params = ENUM_TO_DOUBLE(ctx->Polygon.FrontFace); |
break; |
case GL_GREEN_BIAS: |
*params = (GLdouble) ctx->Pixel.GreenBias; |
break; |
case GL_GREEN_BITS: |
*params = (GLdouble) ctx->Visual.greenBits; |
break; |
case GL_GREEN_SCALE: |
*params = (GLdouble) ctx->Pixel.GreenScale; |
break; |
case GL_INDEX_BITS: |
*params = (GLdouble) ctx->Visual.indexBits; |
break; |
case GL_INDEX_CLEAR_VALUE: |
*params = (GLdouble) ctx->Color.ClearIndex; |
break; |
case GL_INDEX_MODE: |
*params = ctx->Visual.rgbMode ? 0.0 : 1.0; |
break; |
case GL_INDEX_OFFSET: |
*params = (GLdouble) ctx->Pixel.IndexOffset; |
break; |
case GL_INDEX_SHIFT: |
*params = (GLdouble) ctx->Pixel.IndexShift; |
break; |
case GL_INDEX_WRITEMASK: |
*params = (GLdouble) ctx->Color.IndexMask; |
break; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
*params = (GLdouble) ctx->Light.Light[pname-GL_LIGHT0].Enabled; |
break; |
case GL_LIGHTING: |
*params = (GLdouble) ctx->Light.Enabled; |
break; |
case GL_LIGHT_MODEL_AMBIENT: |
params[0] = (GLdouble) ctx->Light.Model.Ambient[0]; |
params[1] = (GLdouble) ctx->Light.Model.Ambient[1]; |
params[2] = (GLdouble) ctx->Light.Model.Ambient[2]; |
params[3] = (GLdouble) ctx->Light.Model.Ambient[3]; |
break; |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
params[0] = (GLdouble) ctx->Light.Model.ColorControl; |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
*params = (GLdouble) ctx->Light.Model.LocalViewer; |
break; |
case GL_LIGHT_MODEL_TWO_SIDE: |
*params = (GLdouble) ctx->Light.Model.TwoSide; |
break; |
case GL_LINE_SMOOTH: |
*params = (GLdouble) ctx->Line.SmoothFlag; |
break; |
case GL_LINE_SMOOTH_HINT: |
*params = ENUM_TO_DOUBLE(ctx->Hint.LineSmooth); |
break; |
case GL_LINE_STIPPLE: |
*params = (GLdouble) ctx->Line.StippleFlag; |
break; |
case GL_LINE_STIPPLE_PATTERN: |
*params = (GLdouble) ctx->Line.StipplePattern; |
break; |
case GL_LINE_STIPPLE_REPEAT: |
*params = (GLdouble) ctx->Line.StippleFactor; |
break; |
case GL_LINE_WIDTH: |
*params = (GLdouble) ctx->Line.Width; |
break; |
case GL_LINE_WIDTH_GRANULARITY: |
*params = (GLdouble) ctx->Const.LineWidthGranularity; |
break; |
case GL_LINE_WIDTH_RANGE: |
params[0] = (GLdouble) ctx->Const.MinLineWidthAA; |
params[1] = (GLdouble) ctx->Const.MaxLineWidthAA; |
break; |
case GL_ALIASED_LINE_WIDTH_RANGE: |
params[0] = (GLdouble) ctx->Const.MinLineWidth; |
params[1] = (GLdouble) ctx->Const.MaxLineWidth; |
break; |
case GL_LIST_BASE: |
*params = (GLdouble) ctx->List.ListBase; |
break; |
case GL_LIST_INDEX: |
*params = (GLdouble) ctx->CurrentListNum; |
break; |
case GL_LIST_MODE: |
*params = ctx->ExecuteFlag ? ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE) |
: ENUM_TO_DOUBLE(GL_COMPILE); |
break; |
case GL_INDEX_LOGIC_OP: |
*params = (GLdouble) ctx->Color.IndexLogicOpEnabled; |
break; |
case GL_COLOR_LOGIC_OP: |
*params = (GLdouble) ctx->Color.ColorLogicOpEnabled; |
break; |
case GL_LOGIC_OP_MODE: |
*params = ENUM_TO_DOUBLE(ctx->Color.LogicOp); |
break; |
case GL_MAP1_COLOR_4: |
*params = (GLdouble) ctx->Eval.Map1Color4; |
break; |
case GL_MAP1_GRID_DOMAIN: |
params[0] = (GLdouble) ctx->Eval.MapGrid1u1; |
params[1] = (GLdouble) ctx->Eval.MapGrid1u2; |
break; |
case GL_MAP1_GRID_SEGMENTS: |
*params = (GLdouble) ctx->Eval.MapGrid1un; |
break; |
case GL_MAP1_INDEX: |
*params = (GLdouble) ctx->Eval.Map1Index; |
break; |
case GL_MAP1_NORMAL: |
*params = (GLdouble) ctx->Eval.Map1Normal; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
*params = (GLdouble) ctx->Eval.Map1TextureCoord1; |
break; |
case GL_MAP1_TEXTURE_COORD_2: |
*params = (GLdouble) ctx->Eval.Map1TextureCoord2; |
break; |
case GL_MAP1_TEXTURE_COORD_3: |
*params = (GLdouble) ctx->Eval.Map1TextureCoord3; |
break; |
case GL_MAP1_TEXTURE_COORD_4: |
*params = (GLdouble) ctx->Eval.Map1TextureCoord4; |
break; |
case GL_MAP1_VERTEX_3: |
*params = (GLdouble) ctx->Eval.Map1Vertex3; |
break; |
case GL_MAP1_VERTEX_4: |
*params = (GLdouble) ctx->Eval.Map1Vertex4; |
break; |
case GL_MAP2_COLOR_4: |
*params = (GLdouble) ctx->Eval.Map2Color4; |
break; |
case GL_MAP2_GRID_DOMAIN: |
params[0] = (GLdouble) ctx->Eval.MapGrid2u1; |
params[1] = (GLdouble) ctx->Eval.MapGrid2u2; |
params[2] = (GLdouble) ctx->Eval.MapGrid2v1; |
params[3] = (GLdouble) ctx->Eval.MapGrid2v2; |
break; |
case GL_MAP2_GRID_SEGMENTS: |
params[0] = (GLdouble) ctx->Eval.MapGrid2un; |
params[1] = (GLdouble) ctx->Eval.MapGrid2vn; |
break; |
case GL_MAP2_INDEX: |
*params = (GLdouble) ctx->Eval.Map2Index; |
break; |
case GL_MAP2_NORMAL: |
*params = (GLdouble) ctx->Eval.Map2Normal; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
*params = (GLdouble) ctx->Eval.Map2TextureCoord1; |
break; |
case GL_MAP2_TEXTURE_COORD_2: |
*params = (GLdouble) ctx->Eval.Map2TextureCoord2; |
break; |
case GL_MAP2_TEXTURE_COORD_3: |
*params = (GLdouble) ctx->Eval.Map2TextureCoord3; |
break; |
case GL_MAP2_TEXTURE_COORD_4: |
*params = (GLdouble) ctx->Eval.Map2TextureCoord4; |
break; |
case GL_MAP2_VERTEX_3: |
*params = (GLdouble) ctx->Eval.Map2Vertex3; |
break; |
case GL_MAP2_VERTEX_4: |
*params = (GLdouble) ctx->Eval.Map2Vertex4; |
break; |
case GL_MAP_COLOR: |
*params = (GLdouble) ctx->Pixel.MapColorFlag; |
break; |
case GL_MAP_STENCIL: |
*params = (GLdouble) ctx->Pixel.MapStencilFlag; |
break; |
case GL_MATRIX_MODE: |
*params = ENUM_TO_DOUBLE(ctx->Transform.MatrixMode); |
break; |
case GL_MAX_ATTRIB_STACK_DEPTH: |
*params = (GLdouble) MAX_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLdouble) MAX_CLIENT_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIP_PLANES: |
*params = (GLdouble) ctx->Const.MaxClipPlanes; |
break; |
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ |
*params = (GLdouble) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ |
*params = (GLdouble) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_EVAL_ORDER: |
*params = (GLdouble) MAX_EVAL_ORDER; |
break; |
case GL_MAX_LIGHTS: |
*params = (GLdouble) ctx->Const.MaxLights; |
break; |
case GL_MAX_LIST_NESTING: |
*params = (GLdouble) MAX_LIST_NESTING; |
break; |
case GL_MAX_MODELVIEW_STACK_DEPTH: |
*params = (GLdouble) MAX_MODELVIEW_STACK_DEPTH; |
break; |
case GL_MAX_NAME_STACK_DEPTH: |
*params = (GLdouble) MAX_NAME_STACK_DEPTH; |
break; |
case GL_MAX_PIXEL_MAP_TABLE: |
*params = (GLdouble) MAX_PIXEL_MAP_TABLE; |
break; |
case GL_MAX_PROJECTION_STACK_DEPTH: |
*params = (GLdouble) MAX_PROJECTION_STACK_DEPTH; |
break; |
case GL_MAX_TEXTURE_SIZE: |
*params = (GLdouble) (1 << (ctx->Const.MaxTextureLevels - 1)); |
break; |
case GL_MAX_3D_TEXTURE_SIZE: |
*params = (GLdouble) (1 << (ctx->Const.Max3DTextureLevels - 1)); |
break; |
case GL_MAX_TEXTURE_STACK_DEPTH: |
*params = (GLdouble) MAX_TEXTURE_STACK_DEPTH; |
break; |
case GL_MAX_VIEWPORT_DIMS: |
params[0] = (GLdouble) MAX_WIDTH; |
params[1] = (GLdouble) MAX_HEIGHT; |
break; |
case GL_MODELVIEW_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) ctx->ModelviewMatrixStack.Top->m[i]; |
} |
break; |
case GL_MODELVIEW_STACK_DEPTH: |
*params = (GLdouble) (ctx->ModelviewMatrixStack.Depth + 1); |
break; |
case GL_NAME_STACK_DEPTH: |
*params = (GLdouble) ctx->Select.NameStackDepth; |
break; |
case GL_NORMALIZE: |
*params = (GLdouble) ctx->Transform.Normalize; |
break; |
case GL_PACK_ALIGNMENT: |
*params = (GLdouble) ctx->Pack.Alignment; |
break; |
case GL_PACK_LSB_FIRST: |
*params = (GLdouble) ctx->Pack.LsbFirst; |
break; |
case GL_PACK_ROW_LENGTH: |
*params = (GLdouble) ctx->Pack.RowLength; |
break; |
case GL_PACK_SKIP_PIXELS: |
*params = (GLdouble) ctx->Pack.SkipPixels; |
break; |
case GL_PACK_SKIP_ROWS: |
*params = (GLdouble) ctx->Pack.SkipRows; |
break; |
case GL_PACK_SWAP_BYTES: |
*params = (GLdouble) ctx->Pack.SwapBytes; |
break; |
case GL_PACK_SKIP_IMAGES_EXT: |
*params = (GLdouble) ctx->Pack.SkipImages; |
break; |
case GL_PACK_IMAGE_HEIGHT_EXT: |
*params = (GLdouble) ctx->Pack.ImageHeight; |
break; |
case GL_PACK_INVERT_MESA: |
*params = (GLdouble) ctx->Pack.Invert; |
break; |
case GL_PERSPECTIVE_CORRECTION_HINT: |
*params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection); |
break; |
case GL_PIXEL_MAP_A_TO_A_SIZE: |
*params = (GLdouble) ctx->Pixel.MapAtoAsize; |
break; |
case GL_PIXEL_MAP_B_TO_B_SIZE: |
*params = (GLdouble) ctx->Pixel.MapBtoBsize; |
break; |
case GL_PIXEL_MAP_G_TO_G_SIZE: |
*params = (GLdouble) ctx->Pixel.MapGtoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_A_SIZE: |
*params = (GLdouble) ctx->Pixel.MapItoAsize; |
break; |
case GL_PIXEL_MAP_I_TO_B_SIZE: |
*params = (GLdouble) ctx->Pixel.MapItoBsize; |
break; |
case GL_PIXEL_MAP_I_TO_G_SIZE: |
*params = (GLdouble) ctx->Pixel.MapItoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_I_SIZE: |
*params = (GLdouble) ctx->Pixel.MapItoIsize; |
break; |
case GL_PIXEL_MAP_I_TO_R_SIZE: |
*params = (GLdouble) ctx->Pixel.MapItoRsize; |
break; |
case GL_PIXEL_MAP_R_TO_R_SIZE: |
*params = (GLdouble) ctx->Pixel.MapRtoRsize; |
break; |
case GL_PIXEL_MAP_S_TO_S_SIZE: |
*params = (GLdouble) ctx->Pixel.MapStoSsize; |
break; |
case GL_POINT_SIZE: |
*params = (GLdouble) ctx->Point.Size; |
break; |
case GL_POINT_SIZE_GRANULARITY: |
*params = (GLdouble) ctx->Const.PointSizeGranularity; |
break; |
case GL_POINT_SIZE_RANGE: |
params[0] = (GLdouble) ctx->Const.MinPointSizeAA; |
params[1] = (GLdouble) ctx->Const.MaxPointSizeAA; |
break; |
case GL_ALIASED_POINT_SIZE_RANGE: |
params[0] = (GLdouble) ctx->Const.MinPointSize; |
params[1] = (GLdouble) ctx->Const.MaxPointSize; |
break; |
case GL_POINT_SMOOTH: |
*params = (GLdouble) ctx->Point.SmoothFlag; |
break; |
case GL_POINT_SMOOTH_HINT: |
*params = ENUM_TO_DOUBLE(ctx->Hint.PointSmooth); |
break; |
case GL_POINT_SIZE_MIN_EXT: |
*params = (GLdouble) (ctx->Point.MinSize); |
break; |
case GL_POINT_SIZE_MAX_EXT: |
*params = (GLdouble) (ctx->Point.MaxSize); |
break; |
case GL_POINT_FADE_THRESHOLD_SIZE_EXT: |
*params = (GLdouble) (ctx->Point.Threshold); |
break; |
case GL_DISTANCE_ATTENUATION_EXT: |
params[0] = (GLdouble) (ctx->Point.Params[0]); |
params[1] = (GLdouble) (ctx->Point.Params[1]); |
params[2] = (GLdouble) (ctx->Point.Params[2]); |
break; |
case GL_POLYGON_MODE: |
params[0] = ENUM_TO_DOUBLE(ctx->Polygon.FrontMode); |
params[1] = ENUM_TO_DOUBLE(ctx->Polygon.BackMode); |
break; |
case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */ |
*params = (GLdouble) ctx->Polygon.OffsetUnits; |
break; |
case GL_POLYGON_OFFSET_FACTOR: |
*params = (GLdouble) ctx->Polygon.OffsetFactor; |
break; |
case GL_POLYGON_OFFSET_UNITS: |
*params = (GLdouble) ctx->Polygon.OffsetUnits; |
break; |
case GL_POLYGON_SMOOTH: |
*params = (GLdouble) ctx->Polygon.SmoothFlag; |
break; |
case GL_POLYGON_SMOOTH_HINT: |
*params = ENUM_TO_DOUBLE(ctx->Hint.PolygonSmooth); |
break; |
case GL_POLYGON_STIPPLE: |
*params = (GLdouble) ctx->Polygon.StippleFlag; |
break; |
case GL_PROJECTION_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) ctx->ProjectionMatrixStack.Top->m[i]; |
} |
break; |
case GL_PROJECTION_STACK_DEPTH: |
*params = (GLdouble) (ctx->ProjectionMatrixStack.Depth + 1); |
break; |
case GL_READ_BUFFER: |
*params = ENUM_TO_DOUBLE(ctx->Pixel.ReadBuffer); |
break; |
case GL_RED_BIAS: |
*params = (GLdouble) ctx->Pixel.RedBias; |
break; |
case GL_RED_BITS: |
*params = (GLdouble) ctx->Visual.redBits; |
break; |
case GL_RED_SCALE: |
*params = (GLdouble) ctx->Pixel.RedScale; |
break; |
case GL_RENDER_MODE: |
*params = ENUM_TO_DOUBLE(ctx->RenderMode); |
break; |
case GL_RESCALE_NORMAL: |
*params = (GLdouble) ctx->Transform.RescaleNormals; |
break; |
case GL_RGBA_MODE: |
*params = (GLdouble) ctx->Visual.rgbMode; |
break; |
case GL_SCISSOR_BOX: |
params[0] = (GLdouble) ctx->Scissor.X; |
params[1] = (GLdouble) ctx->Scissor.Y; |
params[2] = (GLdouble) ctx->Scissor.Width; |
params[3] = (GLdouble) ctx->Scissor.Height; |
break; |
case GL_SCISSOR_TEST: |
*params = (GLdouble) ctx->Scissor.Enabled; |
break; |
case GL_SELECTION_BUFFER_SIZE: |
*params = (GLdouble) ctx->Select.BufferSize; |
break; |
case GL_SHADE_MODEL: |
*params = ENUM_TO_DOUBLE(ctx->Light.ShadeModel); |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
*params = (GLdouble) ctx->Texture.SharedPalette; |
break; |
case GL_STENCIL_BITS: |
*params = (GLdouble) ctx->Visual.stencilBits; |
break; |
case GL_STENCIL_CLEAR_VALUE: |
*params = (GLdouble) ctx->Stencil.Clear; |
break; |
case GL_STENCIL_FAIL: |
*params = ENUM_TO_DOUBLE(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_FUNC: |
*params = ENUM_TO_DOUBLE(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_FAIL: |
*params = ENUM_TO_DOUBLE(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_PASS: |
*params = ENUM_TO_DOUBLE(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_REF: |
*params = (GLdouble) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_TEST: |
*params = (GLdouble) ctx->Stencil.Enabled; |
break; |
case GL_STENCIL_VALUE_MASK: |
*params = (GLdouble) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_WRITEMASK: |
*params = (GLdouble) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STEREO: |
*params = (GLdouble) ctx->Visual.stereoMode; |
break; |
case GL_SUBPIXEL_BITS: |
*params = (GLdouble) ctx->Const.SubPixelBits; |
break; |
case GL_TEXTURE_1D: |
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_2D: |
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_3D: |
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_BINDING_1D: |
*params = (GLdouble) textureUnit->Current1D->Name; |
break; |
case GL_TEXTURE_BINDING_2D: |
*params = (GLdouble) textureUnit->Current2D->Name; |
break; |
case GL_TEXTURE_BINDING_3D: |
*params = (GLdouble) textureUnit->Current3D->Name; |
break; |
case GL_TEXTURE_ENV_COLOR: |
params[0] = (GLdouble) textureUnit->EnvColor[0]; |
params[1] = (GLdouble) textureUnit->EnvColor[1]; |
params[2] = (GLdouble) textureUnit->EnvColor[2]; |
params[3] = (GLdouble) textureUnit->EnvColor[3]; |
break; |
case GL_TEXTURE_ENV_MODE: |
*params = ENUM_TO_DOUBLE(textureUnit->EnvMode); |
break; |
case GL_TEXTURE_GEN_S: |
*params = (textureUnit->TexGenEnabled & S_BIT) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_GEN_T: |
*params = (textureUnit->TexGenEnabled & T_BIT) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_GEN_R: |
*params = (textureUnit->TexGenEnabled & R_BIT) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_GEN_Q: |
*params = (textureUnit->TexGenEnabled & Q_BIT) ? 1.0 : 0.0; |
break; |
case GL_TEXTURE_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) ctx->TextureMatrixStack[texUnit].Top->m[i]; |
} |
break; |
case GL_TEXTURE_STACK_DEPTH: |
*params = (GLdouble) (ctx->TextureMatrixStack[texUnit].Depth + 1); |
break; |
case GL_UNPACK_ALIGNMENT: |
*params = (GLdouble) ctx->Unpack.Alignment; |
break; |
case GL_UNPACK_LSB_FIRST: |
*params = (GLdouble) ctx->Unpack.LsbFirst; |
break; |
case GL_UNPACK_ROW_LENGTH: |
*params = (GLdouble) ctx->Unpack.RowLength; |
break; |
case GL_UNPACK_SKIP_PIXELS: |
*params = (GLdouble) ctx->Unpack.SkipPixels; |
break; |
case GL_UNPACK_SKIP_ROWS: |
*params = (GLdouble) ctx->Unpack.SkipRows; |
break; |
case GL_UNPACK_SWAP_BYTES: |
*params = (GLdouble) ctx->Unpack.SwapBytes; |
break; |
case GL_UNPACK_SKIP_IMAGES_EXT: |
*params = (GLdouble) ctx->Unpack.SkipImages; |
break; |
case GL_UNPACK_IMAGE_HEIGHT_EXT: |
*params = (GLdouble) ctx->Unpack.ImageHeight; |
break; |
case GL_UNPACK_CLIENT_STORAGE_APPLE: |
*params = (GLdouble) ctx->Unpack.ClientStorage; |
break; |
case GL_VIEWPORT: |
params[0] = (GLdouble) ctx->Viewport.X; |
params[1] = (GLdouble) ctx->Viewport.Y; |
params[2] = (GLdouble) ctx->Viewport.Width; |
params[3] = (GLdouble) ctx->Viewport.Height; |
break; |
case GL_ZOOM_X: |
*params = (GLdouble) ctx->Pixel.ZoomX; |
break; |
case GL_ZOOM_Y: |
*params = (GLdouble) ctx->Pixel.ZoomY; |
break; |
case GL_VERTEX_ARRAY: |
*params = (GLdouble) ctx->Array.Vertex.Enabled; |
break; |
case GL_VERTEX_ARRAY_SIZE: |
*params = (GLdouble) ctx->Array.Vertex.Size; |
break; |
case GL_VERTEX_ARRAY_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Array.Vertex.Type); |
break; |
case GL_VERTEX_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.Vertex.Stride; |
break; |
case GL_VERTEX_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_NORMAL_ARRAY: |
*params = (GLdouble) ctx->Array.Normal.Enabled; |
break; |
case GL_NORMAL_ARRAY_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Array.Normal.Type); |
break; |
case GL_NORMAL_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.Normal.Stride; |
break; |
case GL_NORMAL_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_COLOR_ARRAY: |
*params = (GLdouble) ctx->Array.Color.Enabled; |
break; |
case GL_COLOR_ARRAY_SIZE: |
*params = (GLdouble) ctx->Array.Color.Size; |
break; |
case GL_COLOR_ARRAY_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Array.Color.Type); |
break; |
case GL_COLOR_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.Color.Stride; |
break; |
case GL_COLOR_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_INDEX_ARRAY: |
*params = (GLdouble) ctx->Array.Index.Enabled; |
break; |
case GL_INDEX_ARRAY_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Array.Index.Type); |
break; |
case GL_INDEX_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.Index.Stride; |
break; |
case GL_INDEX_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_TEXTURE_COORD_ARRAY: |
*params = (GLdouble) ctx->Array.TexCoord[texUnit].Enabled; |
break; |
case GL_TEXTURE_COORD_ARRAY_SIZE: |
*params = (GLdouble) ctx->Array.TexCoord[texUnit].Size; |
break; |
case GL_TEXTURE_COORD_ARRAY_TYPE: |
*params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[texUnit].Type); |
break; |
case GL_TEXTURE_COORD_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.TexCoord[texUnit].Stride; |
break; |
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_EDGE_FLAG_ARRAY: |
*params = (GLdouble) ctx->Array.EdgeFlag.Enabled; |
break; |
case GL_EDGE_FLAG_ARRAY_STRIDE: |
*params = (GLdouble) ctx->Array.EdgeFlag.Stride; |
break; |
case GL_EDGE_FLAG_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
/* GL_ARB_multitexture */ |
case GL_MAX_TEXTURE_UNITS_ARB: |
CHECK_EXTENSION_D(ARB_multitexture, pname); |
*params = (GLdouble) ctx->Const.MaxTextureUnits; |
break; |
case GL_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_D(ARB_multitexture, pname); |
*params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); |
break; |
case GL_CLIENT_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_D(ARB_multitexture, pname); |
*params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); |
break; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
CHECK_EXTENSION_D(ARB_texture_cube_map, pname); |
*params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); |
break; |
case GL_TEXTURE_BINDING_CUBE_MAP_ARB: |
CHECK_EXTENSION_D(ARB_texture_cube_map, pname); |
*params = (GLdouble) textureUnit->CurrentCubeMap->Name; |
break; |
case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: |
CHECK_EXTENSION_D(ARB_texture_cube_map, pname); |
*params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); |
break; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSION_HINT_ARB: |
CHECK_EXTENSION_D(ARB_texture_compression, pname); |
*params = (GLdouble) ctx->Hint.TextureCompression; |
break; |
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_D(ARB_texture_compression, pname); |
*params = (GLdouble) _mesa_get_compressed_formats(ctx, NULL); |
break; |
case GL_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_D(ARB_texture_compression, pname); |
{ |
GLint formats[100]; |
GLuint i, n; |
n = _mesa_get_compressed_formats(ctx, formats); |
for (i = 0; i < n; i++) |
params[i] = (GLdouble) formats[i]; |
} |
break; |
/* GL_EXT_compiled_vertex_array */ |
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: |
*params = (GLdouble) ctx->Array.LockFirst; |
break; |
case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: |
*params = (GLdouble) ctx->Array.LockCount; |
break; |
/* GL_ARB_transpose_matrix */ |
case GL_TRANSPOSE_COLOR_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ColorMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) tm[i]; |
} |
} |
break; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION_D(HP_occlusion_test, pname); |
*params = (GLdouble) ctx->Depth.OcclusionTest; |
break; |
case GL_OCCLUSION_TEST_RESULT_HP: |
CHECK_EXTENSION_D(HP_occlusion_test, pname); |
if (ctx->Depth.OcclusionTest) |
*params = (GLdouble) ctx->OcclusionResult; |
else |
*params = (GLdouble) ctx->OcclusionResultSaved; |
/* reset flag now */ |
ctx->OcclusionResult = GL_FALSE; |
ctx->OcclusionResultSaved = GL_FALSE; |
break; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
*params = (GLdouble) ctx->Pixel.PixelTextureEnabled; |
break; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
*params = (GLdouble) ctx->Pixel.PixelTextureEnabled; |
break; |
case GL_PIXEL_TEX_GEN_MODE_SGIX: |
*params = (GLdouble) pixel_texgen_mode(ctx); |
break; |
/* GL_SGI_color_matrix (also in 1.2 imaging) */ |
case GL_COLOR_MATRIX_SGI: |
for (i=0;i<16;i++) { |
params[i] = (GLdouble) ctx->ColorMatrixStack.Top->m[i]; |
} |
break; |
case GL_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = (GLdouble) (ctx->ColorMatrixStack.Depth + 1); |
break; |
case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = (GLdouble) MAX_COLOR_STACK_DEPTH; |
break; |
case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixScale[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixScale[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixScale[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixScale[3]; |
break; |
case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixBias[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixBias[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixBias[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixBias[3]; |
break; |
/* GL_EXT_convolution (also in 1.2 imaging) */ |
case GL_CONVOLUTION_1D_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.Convolution1DEnabled; |
break; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.Convolution2DEnabled; |
break; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.Separable2DEnabled; |
break; |
case GL_POST_CONVOLUTION_RED_SCALE_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionScale[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionScale[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionScale[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionScale[3]; |
break; |
case GL_POST_CONVOLUTION_RED_BIAS_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionBias[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionBias[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: |
CHECK_EXTENSION_D(EXT_convolution, pname); |
*params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; |
break; |
/* GL_EXT_histogram (also in 1.2 imaging) */ |
case GL_HISTOGRAM: |
CHECK_EXTENSION_D(EXT_histogram, pname); |
*params = (GLdouble) ctx->Pixel.HistogramEnabled; |
break; |
case GL_MINMAX: |
CHECK_EXTENSION_D(EXT_histogram, pname); |
*params = (GLdouble) ctx->Pixel.MinMaxEnabled; |
break; |
/* GL_SGI_color_table (also in 1.2 imaging */ |
case GL_COLOR_TABLE_SGI: |
*params = (GLdouble) ctx->Pixel.ColorTableEnabled; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
*params = (GLdouble) ctx->Pixel.PostConvolutionColorTableEnabled; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
*params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled; |
break; |
/* GL_EXT_secondary_color */ |
case GL_COLOR_SUM_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
*params = (GLdouble) ctx->Fog.ColorSumEnabled; |
break; |
case GL_CURRENT_SECONDARY_COLOR_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
FLUSH_CURRENT(ctx, 0); |
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; |
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; |
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; |
break; |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
*params = (GLdouble) ctx->Array.SecondaryColor.Enabled; |
break; |
case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
*params = (GLdouble) ctx->Array.SecondaryColor.Type; |
break; |
case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
*params = (GLdouble) ctx->Array.SecondaryColor.Stride; |
break; |
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: |
CHECK_EXTENSION_D(EXT_secondary_color, pname); |
*params = (GLdouble) ctx->Array.SecondaryColor.Stride; |
break; |
/* GL_EXT_fog_coord */ |
case GL_CURRENT_FOG_COORDINATE_EXT: |
CHECK_EXTENSION_D(EXT_fog_coord, pname); |
FLUSH_CURRENT(ctx, 0); |
*params = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
break; |
case GL_FOG_COORDINATE_ARRAY_EXT: |
CHECK_EXTENSION_D(EXT_fog_coord, pname); |
*params = (GLdouble) ctx->Array.FogCoord.Enabled; |
break; |
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_D(EXT_fog_coord, pname); |
*params = (GLdouble) ctx->Array.FogCoord.Type; |
break; |
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_D(EXT_fog_coord, pname); |
*params = (GLdouble) ctx->Array.FogCoord.Stride; |
break; |
/* GL_EXT_texture_lod_bias */ |
case GL_MAX_TEXTURE_LOD_BIAS_EXT: |
*params = (GLdouble) ctx->Const.MaxTextureLodBias; |
break; |
/* GL_EXT_texture_filter_anisotropic */ |
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: |
CHECK_EXTENSION_D(EXT_texture_filter_anisotropic, pname); |
*params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy; |
break; |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = (GLdouble) ctx->Multisample.Enabled; |
break; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage; |
break; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = (GLdouble) ctx->Multisample.SampleAlphaToOne; |
break; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = (GLdouble) ctx->Multisample.SampleCoverage; |
break; |
case GL_SAMPLE_COVERAGE_VALUE_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = ctx->Multisample.SampleCoverageValue; |
break; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = (GLdouble) ctx->Multisample.SampleCoverageInvert; |
break; |
case GL_SAMPLE_BUFFERS_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = 0.0; /* XXX fix someday */ |
break; |
case GL_SAMPLES_ARB: |
CHECK_EXTENSION_D(ARB_multisample, pname); |
*params = 0.0; /* XXX fix someday */ |
break; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION_D(IBM_rasterpos_clip, pname); |
*params = (GLdouble) ctx->Transform.RasterPositionUnclipped; |
break; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLdouble) ctx->Point.PointSprite; |
break; |
case GL_POINT_SPRITE_R_MODE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLdouble) ctx->Point.SpriteRMode; |
break; |
/* GL_SGIS_generate_mipmap */ |
case GL_GENERATE_MIPMAP_HINT_SGIS: |
CHECK_EXTENSION_D(SGIS_generate_mipmap, pname); |
*params = (GLdouble) ctx->Hint.GenerateMipmap; |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->VertexProgram.Enabled; |
break; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->VertexProgram.PointSizeEnabled; |
break; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->VertexProgram.TwoSideEnabled; |
break; |
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) MAX_PROGRAM_STACK_DEPTH; |
break; |
case GL_MAX_TRACK_MATRICES_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) MAX_PROGRAM_MATRICES; |
break; |
case GL_CURRENT_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->CurrentStack->Depth; |
break; |
case GL_CURRENT_MATRIX_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->Transform.MatrixMode; |
break; |
case GL_VERTEX_PROGRAM_BINDING_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->VertexProgram.CurrentID; |
break; |
case GL_PROGRAM_ERROR_POSITION_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
*params = (GLdouble) ctx->VertexProgram.ErrorPos; |
break; |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION_D(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; |
*params = (GLdouble) ctx->Array.VertexAttrib[n].Enabled; |
} |
break; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; |
*params = (GLdouble) ctx->Eval.Map1Attrib[n]; |
} |
break; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; |
*params = (GLdouble) ctx->Eval.Map2Attrib[n]; |
} |
break; |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION_D(NV_texture_rectangle, pname); |
*params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); |
break; |
case GL_TEXTURE_BINDING_RECTANGLE_NV: |
CHECK_EXTENSION_D(NV_texture_rectangle, pname); |
*params = (GLdouble) textureUnit->CurrentRect->Name; |
break; |
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: |
CHECK_EXTENSION_D(NV_texture_rectangle, pname); |
*params = (GLdouble) ctx->Const.MaxTextureRectSize; |
break; |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION_D(EXT_stencil_two_side, pname); |
*params = (GLdouble) ctx->Stencil.TestTwoSide; |
break; |
case GL_ACTIVE_STENCIL_FACE_EXT: |
CHECK_EXTENSION_D(EXT_stencil_two_side, pname); |
*params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname); |
} |
} |
void |
_mesa_GetFloatv( GLenum pname, GLfloat *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint i; |
GLuint texUnit = ctx->Texture.CurrentUnit; |
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!params) |
return; |
/* We need this in order to get correct results for |
* GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases. |
*/ |
FLUSH_VERTICES(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname)); |
if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params)) |
return; |
switch (pname) { |
case GL_ACCUM_RED_BITS: |
*params = (GLfloat) ctx->Visual.accumRedBits; |
break; |
case GL_ACCUM_GREEN_BITS: |
*params = (GLfloat) ctx->Visual.accumGreenBits; |
break; |
case GL_ACCUM_BLUE_BITS: |
*params = (GLfloat) ctx->Visual.accumBlueBits; |
break; |
case GL_ACCUM_ALPHA_BITS: |
*params = (GLfloat) ctx->Visual.accumAlphaBits; |
break; |
case GL_ACCUM_CLEAR_VALUE: |
params[0] = ctx->Accum.ClearColor[0]; |
params[1] = ctx->Accum.ClearColor[1]; |
params[2] = ctx->Accum.ClearColor[2]; |
params[3] = ctx->Accum.ClearColor[3]; |
break; |
case GL_ALPHA_BIAS: |
*params = ctx->Pixel.AlphaBias; |
break; |
case GL_ALPHA_BITS: |
*params = (GLfloat) ctx->Visual.alphaBits; |
break; |
case GL_ALPHA_SCALE: |
*params = ctx->Pixel.AlphaScale; |
break; |
case GL_ALPHA_TEST: |
*params = (GLfloat) ctx->Color.AlphaEnabled; |
break; |
case GL_ALPHA_TEST_FUNC: |
*params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); |
break; |
case GL_ALPHA_TEST_REF: |
*params = (GLfloat) ctx->Color.AlphaRef; |
break; |
case GL_ATTRIB_STACK_DEPTH: |
*params = (GLfloat) (ctx->AttribStackDepth); |
break; |
case GL_AUTO_NORMAL: |
*params = (GLfloat) ctx->Eval.AutoNormal; |
break; |
case GL_AUX_BUFFERS: |
*params = (GLfloat) ctx->Const.NumAuxBuffers; |
break; |
case GL_BLEND: |
*params = (GLfloat) ctx->Color.BlendEnabled; |
break; |
case GL_BLEND_DST: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_SRC_RGB_EXT: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); |
break; |
case GL_BLEND_DST_RGB_EXT: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); |
break; |
case GL_BLEND_SRC_ALPHA_EXT: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendSrcA); |
break; |
case GL_BLEND_DST_ALPHA_EXT: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendDstA); |
break; |
case GL_BLEND_EQUATION_EXT: |
*params = ENUM_TO_FLOAT(ctx->Color.BlendEquation); |
break; |
case GL_BLEND_COLOR_EXT: |
params[0] = ctx->Color.BlendColor[0]; |
params[1] = ctx->Color.BlendColor[1]; |
params[2] = ctx->Color.BlendColor[2]; |
params[3] = ctx->Color.BlendColor[3]; |
break; |
case GL_BLUE_BIAS: |
*params = ctx->Pixel.BlueBias; |
break; |
case GL_BLUE_BITS: |
*params = (GLfloat) ctx->Visual.blueBits; |
break; |
case GL_BLUE_SCALE: |
*params = ctx->Pixel.BlueScale; |
break; |
case GL_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLfloat) (ctx->ClientAttribStackDepth); |
break; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) |
*params = 1.0; |
else |
*params = 0.0; |
break; |
case GL_COLOR_CLEAR_VALUE: |
params[0] = ctx->Color.ClearColor[0]; |
params[1] = ctx->Color.ClearColor[1]; |
params[2] = ctx->Color.ClearColor[2]; |
params[3] = ctx->Color.ClearColor[3]; |
break; |
case GL_COLOR_MATERIAL: |
*params = (GLfloat) ctx->Light.ColorMaterialEnabled; |
break; |
case GL_COLOR_MATERIAL_FACE: |
*params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace); |
break; |
case GL_COLOR_MATERIAL_PARAMETER: |
*params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode); |
break; |
case GL_COLOR_WRITEMASK: |
params[0] = ctx->Color.ColorMask[RCOMP] ? 1.0F : 0.0F; |
params[1] = ctx->Color.ColorMask[GCOMP] ? 1.0F : 0.0F; |
params[2] = ctx->Color.ColorMask[BCOMP] ? 1.0F : 0.0F; |
params[3] = ctx->Color.ColorMask[ACOMP] ? 1.0F : 0.0F; |
break; |
case GL_CULL_FACE: |
*params = (GLfloat) ctx->Polygon.CullFlag; |
break; |
case GL_CULL_FACE_MODE: |
*params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); |
break; |
case GL_CURRENT_COLOR: |
FLUSH_CURRENT(ctx, 0); |
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; |
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; |
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; |
params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; |
break; |
case GL_CURRENT_INDEX: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLfloat) ctx->Current.Index; |
break; |
case GL_CURRENT_NORMAL: |
FLUSH_CURRENT(ctx, 0); |
params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; |
params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; |
params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; |
break; |
case GL_CURRENT_RASTER_COLOR: |
params[0] = ctx->Current.RasterColor[0]; |
params[1] = ctx->Current.RasterColor[1]; |
params[2] = ctx->Current.RasterColor[2]; |
params[3] = ctx->Current.RasterColor[3]; |
break; |
case GL_CURRENT_RASTER_DISTANCE: |
params[0] = ctx->Current.RasterDistance; |
break; |
case GL_CURRENT_RASTER_INDEX: |
*params = (GLfloat) ctx->Current.RasterIndex; |
break; |
case GL_CURRENT_RASTER_POSITION: |
params[0] = ctx->Current.RasterPos[0]; |
params[1] = ctx->Current.RasterPos[1]; |
params[2] = ctx->Current.RasterPos[2]; |
params[3] = ctx->Current.RasterPos[3]; |
break; |
case GL_CURRENT_RASTER_TEXTURE_COORDS: |
params[0] = ctx->Current.RasterTexCoords[texUnit][0]; |
params[1] = ctx->Current.RasterTexCoords[texUnit][1]; |
params[2] = ctx->Current.RasterTexCoords[texUnit][2]; |
params[3] = ctx->Current.RasterTexCoords[texUnit][3]; |
break; |
case GL_CURRENT_RASTER_POSITION_VALID: |
*params = (GLfloat) ctx->Current.RasterPosValid; |
break; |
case GL_CURRENT_TEXTURE_COORDS: |
FLUSH_CURRENT(ctx, 0); |
params[0] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; |
params[1] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; |
params[2] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; |
params[3] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; |
break; |
case GL_DEPTH_BIAS: |
*params = (GLfloat) ctx->Pixel.DepthBias; |
break; |
case GL_DEPTH_BITS: |
*params = (GLfloat) ctx->Visual.depthBits; |
break; |
case GL_DEPTH_CLEAR_VALUE: |
*params = (GLfloat) ctx->Depth.Clear; |
break; |
case GL_DEPTH_FUNC: |
*params = ENUM_TO_FLOAT(ctx->Depth.Func); |
break; |
case GL_DEPTH_RANGE: |
params[0] = (GLfloat) ctx->Viewport.Near; |
params[1] = (GLfloat) ctx->Viewport.Far; |
break; |
case GL_DEPTH_SCALE: |
*params = (GLfloat) ctx->Pixel.DepthScale; |
break; |
case GL_DEPTH_TEST: |
*params = (GLfloat) ctx->Depth.Test; |
break; |
case GL_DEPTH_WRITEMASK: |
*params = (GLfloat) ctx->Depth.Mask; |
break; |
case GL_DITHER: |
*params = (GLfloat) ctx->Color.DitherFlag; |
break; |
case GL_DOUBLEBUFFER: |
*params = (GLfloat) ctx->Visual.doubleBufferMode; |
break; |
case GL_DRAW_BUFFER: |
*params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); |
break; |
case GL_EDGE_FLAG: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLfloat) ctx->Current.EdgeFlag; |
break; |
case GL_FEEDBACK_BUFFER_SIZE: |
*params = (GLfloat) ctx->Feedback.BufferSize; |
break; |
case GL_FEEDBACK_BUFFER_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Feedback.Type); |
break; |
case GL_FOG: |
*params = (GLfloat) ctx->Fog.Enabled; |
break; |
case GL_FOG_COLOR: |
params[0] = ctx->Fog.Color[0]; |
params[1] = ctx->Fog.Color[1]; |
params[2] = ctx->Fog.Color[2]; |
params[3] = ctx->Fog.Color[3]; |
break; |
case GL_FOG_DENSITY: |
*params = ctx->Fog.Density; |
break; |
case GL_FOG_END: |
*params = ctx->Fog.End; |
break; |
case GL_FOG_HINT: |
*params = ENUM_TO_FLOAT(ctx->Hint.Fog); |
break; |
case GL_FOG_INDEX: |
*params = ctx->Fog.Index; |
break; |
case GL_FOG_MODE: |
*params = ENUM_TO_FLOAT(ctx->Fog.Mode); |
break; |
case GL_FOG_START: |
*params = ctx->Fog.Start; |
break; |
case GL_FRONT_FACE: |
*params = ENUM_TO_FLOAT(ctx->Polygon.FrontFace); |
break; |
case GL_GREEN_BIAS: |
*params = (GLfloat) ctx->Pixel.GreenBias; |
break; |
case GL_GREEN_BITS: |
*params = (GLfloat) ctx->Visual.greenBits; |
break; |
case GL_GREEN_SCALE: |
*params = (GLfloat) ctx->Pixel.GreenScale; |
break; |
case GL_INDEX_BITS: |
*params = (GLfloat) ctx->Visual.indexBits; |
break; |
case GL_INDEX_CLEAR_VALUE: |
*params = (GLfloat) ctx->Color.ClearIndex; |
break; |
case GL_INDEX_MODE: |
*params = ctx->Visual.rgbMode ? 0.0F : 1.0F; |
break; |
case GL_INDEX_OFFSET: |
*params = (GLfloat) ctx->Pixel.IndexOffset; |
break; |
case GL_INDEX_SHIFT: |
*params = (GLfloat) ctx->Pixel.IndexShift; |
break; |
case GL_INDEX_WRITEMASK: |
*params = (GLfloat) ctx->Color.IndexMask; |
break; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
*params = (GLfloat) ctx->Light.Light[pname-GL_LIGHT0].Enabled; |
break; |
case GL_LIGHTING: |
*params = (GLfloat) ctx->Light.Enabled; |
break; |
case GL_LIGHT_MODEL_AMBIENT: |
params[0] = ctx->Light.Model.Ambient[0]; |
params[1] = ctx->Light.Model.Ambient[1]; |
params[2] = ctx->Light.Model.Ambient[2]; |
params[3] = ctx->Light.Model.Ambient[3]; |
break; |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl); |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
*params = (GLfloat) ctx->Light.Model.LocalViewer; |
break; |
case GL_LIGHT_MODEL_TWO_SIDE: |
*params = (GLfloat) ctx->Light.Model.TwoSide; |
break; |
case GL_LINE_SMOOTH: |
*params = (GLfloat) ctx->Line.SmoothFlag; |
break; |
case GL_LINE_SMOOTH_HINT: |
*params = ENUM_TO_FLOAT(ctx->Hint.LineSmooth); |
break; |
case GL_LINE_STIPPLE: |
*params = (GLfloat) ctx->Line.StippleFlag; |
break; |
case GL_LINE_STIPPLE_PATTERN: |
*params = (GLfloat) ctx->Line.StipplePattern; |
break; |
case GL_LINE_STIPPLE_REPEAT: |
*params = (GLfloat) ctx->Line.StippleFactor; |
break; |
case GL_LINE_WIDTH: |
*params = (GLfloat) ctx->Line.Width; |
break; |
case GL_LINE_WIDTH_GRANULARITY: |
*params = (GLfloat) ctx->Const.LineWidthGranularity; |
break; |
case GL_LINE_WIDTH_RANGE: |
params[0] = (GLfloat) ctx->Const.MinLineWidthAA; |
params[1] = (GLfloat) ctx->Const.MaxLineWidthAA; |
break; |
case GL_ALIASED_LINE_WIDTH_RANGE: |
params[0] = (GLfloat) ctx->Const.MinLineWidth; |
params[1] = (GLfloat) ctx->Const.MaxLineWidth; |
break; |
case GL_LIST_BASE: |
*params = (GLfloat) ctx->List.ListBase; |
break; |
case GL_LIST_INDEX: |
*params = (GLfloat) ctx->CurrentListNum; |
break; |
case GL_LIST_MODE: |
*params = ctx->ExecuteFlag ? ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE) |
: ENUM_TO_FLOAT(GL_COMPILE); |
break; |
case GL_INDEX_LOGIC_OP: |
*params = (GLfloat) ctx->Color.IndexLogicOpEnabled; |
break; |
case GL_COLOR_LOGIC_OP: |
*params = (GLfloat) ctx->Color.ColorLogicOpEnabled; |
break; |
case GL_LOGIC_OP_MODE: |
*params = ENUM_TO_FLOAT(ctx->Color.LogicOp); |
break; |
case GL_MAP1_COLOR_4: |
*params = (GLfloat) ctx->Eval.Map1Color4; |
break; |
case GL_MAP1_GRID_DOMAIN: |
params[0] = ctx->Eval.MapGrid1u1; |
params[1] = ctx->Eval.MapGrid1u2; |
break; |
case GL_MAP1_GRID_SEGMENTS: |
*params = (GLfloat) ctx->Eval.MapGrid1un; |
break; |
case GL_MAP1_INDEX: |
*params = (GLfloat) ctx->Eval.Map1Index; |
break; |
case GL_MAP1_NORMAL: |
*params = (GLfloat) ctx->Eval.Map1Normal; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
*params = (GLfloat) ctx->Eval.Map1TextureCoord1; |
break; |
case GL_MAP1_TEXTURE_COORD_2: |
*params = (GLfloat) ctx->Eval.Map1TextureCoord2; |
break; |
case GL_MAP1_TEXTURE_COORD_3: |
*params = (GLfloat) ctx->Eval.Map1TextureCoord3; |
break; |
case GL_MAP1_TEXTURE_COORD_4: |
*params = (GLfloat) ctx->Eval.Map1TextureCoord4; |
break; |
case GL_MAP1_VERTEX_3: |
*params = (GLfloat) ctx->Eval.Map1Vertex3; |
break; |
case GL_MAP1_VERTEX_4: |
*params = (GLfloat) ctx->Eval.Map1Vertex4; |
break; |
case GL_MAP2_COLOR_4: |
*params = (GLfloat) ctx->Eval.Map2Color4; |
break; |
case GL_MAP2_GRID_DOMAIN: |
params[0] = ctx->Eval.MapGrid2u1; |
params[1] = ctx->Eval.MapGrid2u2; |
params[2] = ctx->Eval.MapGrid2v1; |
params[3] = ctx->Eval.MapGrid2v2; |
break; |
case GL_MAP2_GRID_SEGMENTS: |
params[0] = (GLfloat) ctx->Eval.MapGrid2un; |
params[1] = (GLfloat) ctx->Eval.MapGrid2vn; |
break; |
case GL_MAP2_INDEX: |
*params = (GLfloat) ctx->Eval.Map2Index; |
break; |
case GL_MAP2_NORMAL: |
*params = (GLfloat) ctx->Eval.Map2Normal; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
*params = ctx->Eval.Map2TextureCoord1; |
break; |
case GL_MAP2_TEXTURE_COORD_2: |
*params = ctx->Eval.Map2TextureCoord2; |
break; |
case GL_MAP2_TEXTURE_COORD_3: |
*params = ctx->Eval.Map2TextureCoord3; |
break; |
case GL_MAP2_TEXTURE_COORD_4: |
*params = ctx->Eval.Map2TextureCoord4; |
break; |
case GL_MAP2_VERTEX_3: |
*params = (GLfloat) ctx->Eval.Map2Vertex3; |
break; |
case GL_MAP2_VERTEX_4: |
*params = (GLfloat) ctx->Eval.Map2Vertex4; |
break; |
case GL_MAP_COLOR: |
*params = (GLfloat) ctx->Pixel.MapColorFlag; |
break; |
case GL_MAP_STENCIL: |
*params = (GLfloat) ctx->Pixel.MapStencilFlag; |
break; |
case GL_MATRIX_MODE: |
*params = ENUM_TO_FLOAT(ctx->Transform.MatrixMode); |
break; |
case GL_MAX_ATTRIB_STACK_DEPTH: |
*params = (GLfloat) MAX_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLfloat) MAX_CLIENT_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIP_PLANES: |
*params = (GLfloat) ctx->Const.MaxClipPlanes; |
break; |
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ |
*params = (GLfloat) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ |
*params = (GLfloat) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_EVAL_ORDER: |
*params = (GLfloat) MAX_EVAL_ORDER; |
break; |
case GL_MAX_LIGHTS: |
*params = (GLfloat) ctx->Const.MaxLights; |
break; |
case GL_MAX_LIST_NESTING: |
*params = (GLfloat) MAX_LIST_NESTING; |
break; |
case GL_MAX_MODELVIEW_STACK_DEPTH: |
*params = (GLfloat) MAX_MODELVIEW_STACK_DEPTH; |
break; |
case GL_MAX_NAME_STACK_DEPTH: |
*params = (GLfloat) MAX_NAME_STACK_DEPTH; |
break; |
case GL_MAX_PIXEL_MAP_TABLE: |
*params = (GLfloat) MAX_PIXEL_MAP_TABLE; |
break; |
case GL_MAX_PROJECTION_STACK_DEPTH: |
*params = (GLfloat) MAX_PROJECTION_STACK_DEPTH; |
break; |
case GL_MAX_TEXTURE_SIZE: |
*params = (GLfloat) (1 << (ctx->Const.MaxTextureLevels - 1)); |
break; |
case GL_MAX_3D_TEXTURE_SIZE: |
*params = (GLfloat) (1 << (ctx->Const.Max3DTextureLevels - 1)); |
break; |
case GL_MAX_TEXTURE_STACK_DEPTH: |
*params = (GLfloat) MAX_TEXTURE_STACK_DEPTH; |
break; |
case GL_MAX_VIEWPORT_DIMS: |
params[0] = (GLfloat) MAX_WIDTH; |
params[1] = (GLfloat) MAX_HEIGHT; |
break; |
case GL_MODELVIEW_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = ctx->ModelviewMatrixStack.Top->m[i]; |
} |
break; |
case GL_MODELVIEW_STACK_DEPTH: |
*params = (GLfloat) (ctx->ModelviewMatrixStack.Depth + 1); |
break; |
case GL_NAME_STACK_DEPTH: |
*params = (GLfloat) ctx->Select.NameStackDepth; |
break; |
case GL_NORMALIZE: |
*params = (GLfloat) ctx->Transform.Normalize; |
break; |
case GL_PACK_ALIGNMENT: |
*params = (GLfloat) ctx->Pack.Alignment; |
break; |
case GL_PACK_LSB_FIRST: |
*params = (GLfloat) ctx->Pack.LsbFirst; |
break; |
case GL_PACK_ROW_LENGTH: |
*params = (GLfloat) ctx->Pack.RowLength; |
break; |
case GL_PACK_SKIP_PIXELS: |
*params = (GLfloat) ctx->Pack.SkipPixels; |
break; |
case GL_PACK_SKIP_ROWS: |
*params = (GLfloat) ctx->Pack.SkipRows; |
break; |
case GL_PACK_SWAP_BYTES: |
*params = (GLfloat) ctx->Pack.SwapBytes; |
break; |
case GL_PACK_SKIP_IMAGES_EXT: |
*params = (GLfloat) ctx->Pack.SkipImages; |
break; |
case GL_PACK_IMAGE_HEIGHT_EXT: |
*params = (GLfloat) ctx->Pack.ImageHeight; |
break; |
case GL_PACK_INVERT_MESA: |
*params = (GLfloat) ctx->Pack.Invert; |
break; |
case GL_PERSPECTIVE_CORRECTION_HINT: |
*params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); |
break; |
case GL_PIXEL_MAP_A_TO_A_SIZE: |
*params = (GLfloat) ctx->Pixel.MapAtoAsize; |
break; |
case GL_PIXEL_MAP_B_TO_B_SIZE: |
*params = (GLfloat) ctx->Pixel.MapBtoBsize; |
break; |
case GL_PIXEL_MAP_G_TO_G_SIZE: |
*params = (GLfloat) ctx->Pixel.MapGtoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_A_SIZE: |
*params = (GLfloat) ctx->Pixel.MapItoAsize; |
break; |
case GL_PIXEL_MAP_I_TO_B_SIZE: |
*params = (GLfloat) ctx->Pixel.MapItoBsize; |
break; |
case GL_PIXEL_MAP_I_TO_G_SIZE: |
*params = (GLfloat) ctx->Pixel.MapItoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_I_SIZE: |
*params = (GLfloat) ctx->Pixel.MapItoIsize; |
break; |
case GL_PIXEL_MAP_I_TO_R_SIZE: |
*params = (GLfloat) ctx->Pixel.MapItoRsize; |
break; |
case GL_PIXEL_MAP_R_TO_R_SIZE: |
*params = (GLfloat) ctx->Pixel.MapRtoRsize; |
break; |
case GL_PIXEL_MAP_S_TO_S_SIZE: |
*params = (GLfloat) ctx->Pixel.MapStoSsize; |
break; |
case GL_POINT_SIZE: |
*params = (GLfloat) ctx->Point.Size; |
break; |
case GL_POINT_SIZE_GRANULARITY: |
*params = (GLfloat) ctx->Const.PointSizeGranularity; |
break; |
case GL_POINT_SIZE_RANGE: |
params[0] = (GLfloat) ctx->Const.MinPointSizeAA; |
params[1] = (GLfloat) ctx->Const.MaxPointSizeAA; |
break; |
case GL_ALIASED_POINT_SIZE_RANGE: |
params[0] = (GLfloat) ctx->Const.MinPointSize; |
params[1] = (GLfloat) ctx->Const.MaxPointSize; |
break; |
case GL_POINT_SMOOTH: |
*params = (GLfloat) ctx->Point.SmoothFlag; |
break; |
case GL_POINT_SMOOTH_HINT: |
*params = ENUM_TO_FLOAT(ctx->Hint.PointSmooth); |
break; |
case GL_POINT_SIZE_MIN_EXT: |
*params = (GLfloat) (ctx->Point.MinSize); |
break; |
case GL_POINT_SIZE_MAX_EXT: |
*params = (GLfloat) (ctx->Point.MaxSize); |
break; |
case GL_POINT_FADE_THRESHOLD_SIZE_EXT: |
*params = (GLfloat) (ctx->Point.Threshold); |
break; |
case GL_DISTANCE_ATTENUATION_EXT: |
params[0] = (GLfloat) (ctx->Point.Params[0]); |
params[1] = (GLfloat) (ctx->Point.Params[1]); |
params[2] = (GLfloat) (ctx->Point.Params[2]); |
break; |
case GL_POLYGON_MODE: |
params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode); |
params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode); |
break; |
#ifdef GL_EXT_polygon_offset |
case GL_POLYGON_OFFSET_BIAS_EXT: |
*params = ctx->Polygon.OffsetUnits; |
break; |
#endif |
case GL_POLYGON_OFFSET_FACTOR: |
*params = ctx->Polygon.OffsetFactor; |
break; |
case GL_POLYGON_OFFSET_UNITS: |
*params = ctx->Polygon.OffsetUnits; |
break; |
case GL_POLYGON_SMOOTH: |
*params = (GLfloat) ctx->Polygon.SmoothFlag; |
break; |
case GL_POLYGON_SMOOTH_HINT: |
*params = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth); |
break; |
case GL_POLYGON_STIPPLE: |
*params = (GLfloat) ctx->Polygon.StippleFlag; |
break; |
case GL_PROJECTION_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = ctx->ProjectionMatrixStack.Top->m[i]; |
} |
break; |
case GL_PROJECTION_STACK_DEPTH: |
*params = (GLfloat) (ctx->ProjectionMatrixStack.Depth + 1); |
break; |
case GL_READ_BUFFER: |
*params = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer); |
break; |
case GL_RED_BIAS: |
*params = ctx->Pixel.RedBias; |
break; |
case GL_RED_BITS: |
*params = (GLfloat) ctx->Visual.redBits; |
break; |
case GL_RED_SCALE: |
*params = ctx->Pixel.RedScale; |
break; |
case GL_RENDER_MODE: |
*params = ENUM_TO_FLOAT(ctx->RenderMode); |
break; |
case GL_RESCALE_NORMAL: |
*params = (GLfloat) ctx->Transform.RescaleNormals; |
break; |
case GL_RGBA_MODE: |
*params = (GLfloat) ctx->Visual.rgbMode; |
break; |
case GL_SCISSOR_BOX: |
params[0] = (GLfloat) ctx->Scissor.X; |
params[1] = (GLfloat) ctx->Scissor.Y; |
params[2] = (GLfloat) ctx->Scissor.Width; |
params[3] = (GLfloat) ctx->Scissor.Height; |
break; |
case GL_SCISSOR_TEST: |
*params = (GLfloat) ctx->Scissor.Enabled; |
break; |
case GL_SELECTION_BUFFER_SIZE: |
*params = (GLfloat) ctx->Select.BufferSize; |
break; |
case GL_SHADE_MODEL: |
*params = ENUM_TO_FLOAT(ctx->Light.ShadeModel); |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
*params = (GLfloat) ctx->Texture.SharedPalette; |
break; |
case GL_STENCIL_BITS: |
*params = (GLfloat) ctx->Visual.stencilBits; |
break; |
case GL_STENCIL_CLEAR_VALUE: |
*params = (GLfloat) ctx->Stencil.Clear; |
break; |
case GL_STENCIL_FAIL: |
*params = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_FUNC: |
*params = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_FAIL: |
*params = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_PASS_DEPTH_PASS: |
*params = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); |
break; |
case GL_STENCIL_REF: |
*params = (GLfloat) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_TEST: |
*params = (GLfloat) ctx->Stencil.Enabled; |
break; |
case GL_STENCIL_VALUE_MASK: |
*params = (GLfloat) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_WRITEMASK: |
*params = (GLfloat) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STEREO: |
*params = (GLfloat) ctx->Visual.stereoMode; |
break; |
case GL_SUBPIXEL_BITS: |
*params = (GLfloat) ctx->Const.SubPixelBits; |
break; |
case GL_TEXTURE_1D: |
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_2D: |
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_3D: |
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_BINDING_1D: |
*params = (GLfloat) textureUnit->Current1D->Name; |
break; |
case GL_TEXTURE_BINDING_2D: |
*params = (GLfloat) textureUnit->Current2D->Name; |
break; |
case GL_TEXTURE_BINDING_3D: |
*params = (GLfloat) textureUnit->Current2D->Name; |
break; |
case GL_TEXTURE_ENV_COLOR: |
params[0] = textureUnit->EnvColor[0]; |
params[1] = textureUnit->EnvColor[1]; |
params[2] = textureUnit->EnvColor[2]; |
params[3] = textureUnit->EnvColor[3]; |
break; |
case GL_TEXTURE_ENV_MODE: |
*params = ENUM_TO_FLOAT(textureUnit->EnvMode); |
break; |
case GL_TEXTURE_GEN_S: |
*params = (textureUnit->TexGenEnabled & S_BIT) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_GEN_T: |
*params = (textureUnit->TexGenEnabled & T_BIT) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_GEN_R: |
*params = (textureUnit->TexGenEnabled & R_BIT) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_GEN_Q: |
*params = (textureUnit->TexGenEnabled & Q_BIT) ? 1.0F : 0.0F; |
break; |
case GL_TEXTURE_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = ctx->TextureMatrixStack[texUnit].Top->m[i]; |
} |
break; |
case GL_TEXTURE_STACK_DEPTH: |
*params = (GLfloat) (ctx->TextureMatrixStack[texUnit].Depth + 1); |
break; |
case GL_UNPACK_ALIGNMENT: |
*params = (GLfloat) ctx->Unpack.Alignment; |
break; |
case GL_UNPACK_LSB_FIRST: |
*params = (GLfloat) ctx->Unpack.LsbFirst; |
break; |
case GL_UNPACK_ROW_LENGTH: |
*params = (GLfloat) ctx->Unpack.RowLength; |
break; |
case GL_UNPACK_SKIP_PIXELS: |
*params = (GLfloat) ctx->Unpack.SkipPixels; |
break; |
case GL_UNPACK_SKIP_ROWS: |
*params = (GLfloat) ctx->Unpack.SkipRows; |
break; |
case GL_UNPACK_SWAP_BYTES: |
*params = (GLfloat) ctx->Unpack.SwapBytes; |
break; |
case GL_UNPACK_SKIP_IMAGES_EXT: |
*params = (GLfloat) ctx->Unpack.SkipImages; |
break; |
case GL_UNPACK_IMAGE_HEIGHT_EXT: |
*params = (GLfloat) ctx->Unpack.ImageHeight; |
break; |
case GL_UNPACK_CLIENT_STORAGE_APPLE: |
*params = (GLfloat) ctx->Unpack.ClientStorage; |
break; |
case GL_VIEWPORT: |
params[0] = (GLfloat) ctx->Viewport.X; |
params[1] = (GLfloat) ctx->Viewport.Y; |
params[2] = (GLfloat) ctx->Viewport.Width; |
params[3] = (GLfloat) ctx->Viewport.Height; |
break; |
case GL_ZOOM_X: |
*params = (GLfloat) ctx->Pixel.ZoomX; |
break; |
case GL_ZOOM_Y: |
*params = (GLfloat) ctx->Pixel.ZoomY; |
break; |
case GL_VERTEX_ARRAY: |
*params = (GLfloat) ctx->Array.Vertex.Enabled; |
break; |
case GL_VERTEX_ARRAY_SIZE: |
*params = (GLfloat) ctx->Array.Vertex.Size; |
break; |
case GL_VERTEX_ARRAY_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Array.Vertex.Type); |
break; |
case GL_VERTEX_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.Vertex.Stride; |
break; |
case GL_VERTEX_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_NORMAL_ARRAY: |
*params = (GLfloat) ctx->Array.Normal.Enabled; |
break; |
case GL_NORMAL_ARRAY_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Array.Normal.Type); |
break; |
case GL_NORMAL_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.Normal.Stride; |
break; |
case GL_NORMAL_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_COLOR_ARRAY: |
*params = (GLfloat) ctx->Array.Color.Enabled; |
break; |
case GL_COLOR_ARRAY_SIZE: |
*params = (GLfloat) ctx->Array.Color.Size; |
break; |
case GL_COLOR_ARRAY_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Array.Color.Type); |
break; |
case GL_COLOR_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.Color.Stride; |
break; |
case GL_COLOR_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_INDEX_ARRAY: |
*params = (GLfloat) ctx->Array.Index.Enabled; |
break; |
case GL_INDEX_ARRAY_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Array.Index.Type); |
break; |
case GL_INDEX_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.Index.Stride; |
break; |
case GL_INDEX_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_TEXTURE_COORD_ARRAY: |
*params = (GLfloat) ctx->Array.TexCoord[texUnit].Enabled; |
break; |
case GL_TEXTURE_COORD_ARRAY_SIZE: |
*params = (GLfloat) ctx->Array.TexCoord[texUnit].Size; |
break; |
case GL_TEXTURE_COORD_ARRAY_TYPE: |
*params = ENUM_TO_FLOAT(ctx->Array.TexCoord[texUnit].Type); |
break; |
case GL_TEXTURE_COORD_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.TexCoord[texUnit].Stride; |
break; |
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
case GL_EDGE_FLAG_ARRAY: |
*params = (GLfloat) ctx->Array.EdgeFlag.Enabled; |
break; |
case GL_EDGE_FLAG_ARRAY_STRIDE: |
*params = (GLfloat) ctx->Array.EdgeFlag.Stride; |
break; |
case GL_EDGE_FLAG_ARRAY_COUNT_EXT: |
*params = 0.0; |
break; |
/* GL_ARB_multitexture */ |
case GL_MAX_TEXTURE_UNITS_ARB: |
CHECK_EXTENSION_F(ARB_multitexture, pname); |
*params = (GLfloat) ctx->Const.MaxTextureUnits; |
break; |
case GL_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_F(ARB_multitexture, pname); |
*params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); |
break; |
case GL_CLIENT_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_F(ARB_multitexture, pname); |
*params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); |
break; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
CHECK_EXTENSION_F(ARB_texture_cube_map, pname); |
*params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); |
break; |
case GL_TEXTURE_BINDING_CUBE_MAP_ARB: |
CHECK_EXTENSION_F(ARB_texture_cube_map, pname); |
*params = (GLfloat) textureUnit->CurrentCubeMap->Name; |
break; |
case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: |
CHECK_EXTENSION_F(ARB_texture_cube_map, pname); |
*params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); |
break; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSION_HINT_ARB: |
CHECK_EXTENSION_F(ARB_texture_compression, pname); |
*params = (GLfloat) ctx->Hint.TextureCompression; |
break; |
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_F(ARB_texture_compression, pname); |
*params = (GLfloat) _mesa_get_compressed_formats(ctx, NULL); |
break; |
case GL_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_F(ARB_texture_compression, pname); |
{ |
GLint formats[100]; |
GLuint i, n; |
n = _mesa_get_compressed_formats(ctx, formats); |
for (i = 0; i < n; i++) |
params[i] = (GLfloat) formats[i]; |
} |
break; |
/* GL_EXT_compiled_vertex_array */ |
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: |
CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); |
*params = (GLfloat) ctx->Array.LockFirst; |
break; |
case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: |
CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); |
*params = (GLfloat) ctx->Array.LockCount; |
break; |
/* GL_ARB_transpose_matrix */ |
case GL_TRANSPOSE_COLOR_MATRIX_ARB: |
_math_transposef(params, ctx->ColorMatrixStack.Top->m); |
break; |
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: |
_math_transposef(params, ctx->ModelviewMatrixStack.Top->m); |
break; |
case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: |
_math_transposef(params, ctx->ProjectionMatrixStack.Top->m); |
break; |
case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: |
_math_transposef(params, ctx->TextureMatrixStack[texUnit].Top->m); |
break; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION_F(HP_occlusion_test, pname); |
*params = (GLfloat) ctx->Depth.OcclusionTest; |
break; |
case GL_OCCLUSION_TEST_RESULT_HP: |
CHECK_EXTENSION_F(HP_occlusion_test, pname); |
if (ctx->Depth.OcclusionTest) |
*params = (GLfloat) ctx->OcclusionResult; |
else |
*params = (GLfloat) ctx->OcclusionResultSaved; |
/* reset flag now */ |
ctx->OcclusionResult = GL_FALSE; |
ctx->OcclusionResultSaved = GL_FALSE; |
break; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
*params = (GLfloat) ctx->Pixel.PixelTextureEnabled; |
break; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
*params = (GLfloat) ctx->Pixel.PixelTextureEnabled; |
break; |
case GL_PIXEL_TEX_GEN_MODE_SGIX: |
*params = (GLfloat) pixel_texgen_mode(ctx); |
break; |
/* GL_SGI_color_matrix (also in 1.2 imaging) */ |
case GL_COLOR_MATRIX_SGI: |
for (i=0;i<16;i++) { |
params[i] = ctx->ColorMatrixStack.Top->m[i]; |
} |
break; |
case GL_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = (GLfloat) (ctx->ColorMatrixStack.Depth + 1); |
break; |
case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: |
*params = (GLfloat) MAX_COLOR_STACK_DEPTH; |
break; |
case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: |
*params = ctx->Pixel.PostColorMatrixScale[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: |
*params = ctx->Pixel.PostColorMatrixScale[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: |
*params = ctx->Pixel.PostColorMatrixScale[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: |
*params = ctx->Pixel.PostColorMatrixScale[3]; |
break; |
case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: |
*params = ctx->Pixel.PostColorMatrixBias[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: |
*params = ctx->Pixel.PostColorMatrixBias[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: |
*params = ctx->Pixel.PostColorMatrixBias[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: |
*params = ctx->Pixel.PostColorMatrixBias[3]; |
break; |
/* GL_EXT_convolution (also in 1.2 imaging) */ |
case GL_CONVOLUTION_1D_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = (GLfloat) ctx->Pixel.Convolution1DEnabled; |
break; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = (GLfloat) ctx->Pixel.Convolution2DEnabled; |
break; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = (GLfloat) ctx->Pixel.Separable2DEnabled; |
break; |
case GL_POST_CONVOLUTION_RED_SCALE_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionScale[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionScale[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionScale[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionScale[3]; |
break; |
case GL_POST_CONVOLUTION_RED_BIAS_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionBias[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionBias[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionBias[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: |
CHECK_EXTENSION_F(EXT_convolution, pname); |
*params = ctx->Pixel.PostConvolutionBias[2]; |
break; |
/* GL_EXT_histogram (also in 1.2 imaging) */ |
case GL_HISTOGRAM: |
CHECK_EXTENSION_F(EXT_histogram, pname); |
*params = (GLfloat) ctx->Pixel.HistogramEnabled; |
break; |
case GL_MINMAX: |
CHECK_EXTENSION_F(EXT_histogram, pname); |
*params = (GLfloat) ctx->Pixel.MinMaxEnabled; |
break; |
/* GL_SGI_color_table (also in 1.2 imaging */ |
case GL_COLOR_TABLE_SGI: |
*params = (GLfloat) ctx->Pixel.ColorTableEnabled; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
*params = (GLfloat) ctx->Pixel.PostConvolutionColorTableEnabled; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
*params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled; |
break; |
/* GL_EXT_secondary_color */ |
case GL_COLOR_SUM_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
*params = (GLfloat) ctx->Fog.ColorSumEnabled; |
break; |
case GL_CURRENT_SECONDARY_COLOR_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
FLUSH_CURRENT(ctx, 0); |
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; |
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; |
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; |
break; |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
*params = (GLfloat) ctx->Array.SecondaryColor.Enabled; |
break; |
case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
*params = (GLfloat) ctx->Array.SecondaryColor.Type; |
break; |
case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
*params = (GLfloat) ctx->Array.SecondaryColor.Stride; |
break; |
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: |
CHECK_EXTENSION_F(EXT_secondary_color, pname); |
*params = (GLfloat) ctx->Array.SecondaryColor.Stride; |
break; |
/* GL_EXT_fog_coord */ |
case GL_CURRENT_FOG_COORDINATE_EXT: |
CHECK_EXTENSION_F(EXT_fog_coord, pname); |
FLUSH_CURRENT(ctx, 0); |
*params = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
break; |
case GL_FOG_COORDINATE_ARRAY_EXT: |
CHECK_EXTENSION_F(EXT_fog_coord, pname); |
*params = (GLfloat) ctx->Array.FogCoord.Enabled; |
break; |
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_F(EXT_fog_coord, pname); |
*params = (GLfloat) ctx->Array.FogCoord.Type; |
break; |
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_F(EXT_fog_coord, pname); |
*params = (GLfloat) ctx->Array.FogCoord.Stride; |
break; |
/* GL_EXT_texture_lod_bias */ |
case GL_MAX_TEXTURE_LOD_BIAS_EXT: |
*params = ctx->Const.MaxTextureLodBias; |
break; |
/* GL_EXT_texture_filter_anisotropic */ |
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: |
CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname); |
*params = ctx->Const.MaxTextureMaxAnisotropy; |
break; |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = (GLfloat) ctx->Multisample.Enabled; |
break; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage; |
break; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = (GLfloat) ctx->Multisample.SampleAlphaToOne; |
break; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = (GLfloat) ctx->Multisample.SampleCoverage; |
break; |
case GL_SAMPLE_COVERAGE_VALUE_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = ctx->Multisample.SampleCoverageValue; |
break; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = (GLfloat) ctx->Multisample.SampleCoverageInvert; |
break; |
case GL_SAMPLE_BUFFERS_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = 0.0; /* XXX fix someday */ |
break; |
case GL_SAMPLES_ARB: |
CHECK_EXTENSION_F(ARB_multisample, pname); |
*params = 0.0; /* XXX fix someday */ |
break; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION_F(IBM_rasterpos_clip, pname); |
*params = (GLfloat) ctx->Transform.RasterPositionUnclipped; |
break; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLfloat) ctx->Point.PointSprite; |
break; |
case GL_POINT_SPRITE_R_MODE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLfloat) ctx->Point.SpriteRMode; |
break; |
/* GL_SGIS_generate_mipmap */ |
case GL_GENERATE_MIPMAP_HINT_SGIS: |
CHECK_EXTENSION_F(SGIS_generate_mipmap, pname); |
*params = (GLfloat) ctx->Hint.GenerateMipmap; |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->VertexProgram.Enabled; |
break; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->VertexProgram.PointSizeEnabled; |
break; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->VertexProgram.TwoSideEnabled; |
break; |
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) MAX_PROGRAM_STACK_DEPTH; |
break; |
case GL_MAX_TRACK_MATRICES_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) MAX_PROGRAM_MATRICES; |
break; |
case GL_CURRENT_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->CurrentStack->Depth; |
break; |
case GL_CURRENT_MATRIX_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->Transform.MatrixMode; |
break; |
case GL_VERTEX_PROGRAM_BINDING_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->VertexProgram.CurrentID; |
break; |
case GL_PROGRAM_ERROR_POSITION_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
*params = (GLfloat) ctx->VertexProgram.ErrorPos; |
break; |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION_F(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; |
*params = (GLfloat) ctx->Array.VertexAttrib[n].Enabled; |
} |
break; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; |
*params = (GLfloat) ctx->Eval.Map1Attrib[n]; |
} |
break; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; |
*params = (GLfloat) ctx->Eval.Map2Attrib[n]; |
} |
break; |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION_F(NV_texture_rectangle, pname); |
*params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); |
break; |
case GL_TEXTURE_BINDING_RECTANGLE_NV: |
CHECK_EXTENSION_F(NV_texture_rectangle, pname); |
*params = (GLfloat) textureUnit->CurrentRect->Name; |
break; |
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: |
CHECK_EXTENSION_F(NV_texture_rectangle, pname); |
*params = (GLfloat) ctx->Const.MaxTextureRectSize; |
break; |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION_F(EXT_stencil_two_side, pname); |
*params = (GLfloat) ctx->Stencil.TestTwoSide; |
break; |
case GL_ACTIVE_STENCIL_FACE_EXT: |
CHECK_EXTENSION_F(EXT_stencil_two_side, pname); |
*params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname); |
} |
} |
void |
_mesa_GetIntegerv( GLenum pname, GLint *params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint i; |
GLuint texUnit = ctx->Texture.CurrentUnit; |
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!params) |
return; |
/* We need this in order to get correct results for |
* GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases. |
*/ |
FLUSH_VERTICES(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname)); |
if (ctx->Driver.GetIntegerv |
&& (*ctx->Driver.GetIntegerv)(ctx, pname, params)) |
return; |
switch (pname) { |
case GL_ACCUM_RED_BITS: |
*params = (GLint) ctx->Visual.accumRedBits; |
break; |
case GL_ACCUM_GREEN_BITS: |
*params = (GLint) ctx->Visual.accumGreenBits; |
break; |
case GL_ACCUM_BLUE_BITS: |
*params = (GLint) ctx->Visual.accumBlueBits; |
break; |
case GL_ACCUM_ALPHA_BITS: |
*params = (GLint) ctx->Visual.accumAlphaBits; |
break; |
case GL_ACCUM_CLEAR_VALUE: |
params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); |
params[1] = FLOAT_TO_INT( ctx->Accum.ClearColor[1] ); |
params[2] = FLOAT_TO_INT( ctx->Accum.ClearColor[2] ); |
params[3] = FLOAT_TO_INT( ctx->Accum.ClearColor[3] ); |
break; |
case GL_ALPHA_BIAS: |
*params = (GLint) ctx->Pixel.AlphaBias; |
break; |
case GL_ALPHA_BITS: |
*params = ctx->Visual.alphaBits; |
break; |
case GL_ALPHA_SCALE: |
*params = (GLint) ctx->Pixel.AlphaScale; |
break; |
case GL_ALPHA_TEST: |
*params = (GLint) ctx->Color.AlphaEnabled; |
break; |
case GL_ALPHA_TEST_REF: |
*params = FLOAT_TO_INT(ctx->Color.AlphaRef); |
break; |
case GL_ALPHA_TEST_FUNC: |
*params = (GLint) ctx->Color.AlphaFunc; |
break; |
case GL_ATTRIB_STACK_DEPTH: |
*params = (GLint) (ctx->AttribStackDepth); |
break; |
case GL_AUTO_NORMAL: |
*params = (GLint) ctx->Eval.AutoNormal; |
break; |
case GL_AUX_BUFFERS: |
*params = (GLint) ctx->Const.NumAuxBuffers; |
break; |
case GL_BLEND: |
*params = (GLint) ctx->Color.BlendEnabled; |
break; |
case GL_BLEND_DST: |
*params = (GLint) ctx->Color.BlendDstRGB; |
break; |
case GL_BLEND_SRC: |
*params = (GLint) ctx->Color.BlendSrcRGB; |
break; |
case GL_BLEND_SRC_RGB_EXT: |
*params = (GLint) ctx->Color.BlendSrcRGB; |
break; |
case GL_BLEND_DST_RGB_EXT: |
*params = (GLint) ctx->Color.BlendDstRGB; |
break; |
case GL_BLEND_SRC_ALPHA_EXT: |
*params = (GLint) ctx->Color.BlendSrcA; |
break; |
case GL_BLEND_DST_ALPHA_EXT: |
*params = (GLint) ctx->Color.BlendDstA; |
break; |
case GL_BLEND_EQUATION_EXT: |
*params = (GLint) ctx->Color.BlendEquation; |
break; |
case GL_BLEND_COLOR_EXT: |
params[0] = FLOAT_TO_INT( ctx->Color.BlendColor[0] ); |
params[1] = FLOAT_TO_INT( ctx->Color.BlendColor[1] ); |
params[2] = FLOAT_TO_INT( ctx->Color.BlendColor[2] ); |
params[3] = FLOAT_TO_INT( ctx->Color.BlendColor[3] ); |
break; |
case GL_BLUE_BIAS: |
*params = (GLint) ctx->Pixel.BlueBias; |
break; |
case GL_BLUE_BITS: |
*params = (GLint) ctx->Visual.blueBits; |
break; |
case GL_BLUE_SCALE: |
*params = (GLint) ctx->Pixel.BlueScale; |
break; |
case GL_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLint) (ctx->ClientAttribStackDepth); |
break; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) |
*params = 1; |
else |
*params = 0; |
break; |
case GL_COLOR_CLEAR_VALUE: |
params[0] = FLOAT_TO_INT( (ctx->Color.ClearColor[0]) ); |
params[1] = FLOAT_TO_INT( (ctx->Color.ClearColor[1]) ); |
params[2] = FLOAT_TO_INT( (ctx->Color.ClearColor[2]) ); |
params[3] = FLOAT_TO_INT( (ctx->Color.ClearColor[3]) ); |
break; |
case GL_COLOR_MATERIAL: |
*params = (GLint) ctx->Light.ColorMaterialEnabled; |
break; |
case GL_COLOR_MATERIAL_FACE: |
*params = (GLint) ctx->Light.ColorMaterialFace; |
break; |
case GL_COLOR_MATERIAL_PARAMETER: |
*params = (GLint) ctx->Light.ColorMaterialMode; |
break; |
case GL_COLOR_WRITEMASK: |
params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0; |
params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0; |
params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0; |
params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0; |
break; |
case GL_CULL_FACE: |
*params = (GLint) ctx->Polygon.CullFlag; |
break; |
case GL_CULL_FACE_MODE: |
*params = (GLint) ctx->Polygon.CullFaceMode; |
break; |
case GL_CURRENT_COLOR: |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); |
params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); |
params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); |
params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); |
break; |
case GL_CURRENT_INDEX: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLint) ctx->Current.Index; |
break; |
case GL_CURRENT_NORMAL: |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); |
params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); |
params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); |
break; |
case GL_CURRENT_RASTER_COLOR: |
params[0] = FLOAT_TO_INT( ctx->Current.RasterColor[0] ); |
params[1] = FLOAT_TO_INT( ctx->Current.RasterColor[1] ); |
params[2] = FLOAT_TO_INT( ctx->Current.RasterColor[2] ); |
params[3] = FLOAT_TO_INT( ctx->Current.RasterColor[3] ); |
break; |
case GL_CURRENT_RASTER_DISTANCE: |
params[0] = (GLint) ctx->Current.RasterDistance; |
break; |
case GL_CURRENT_RASTER_INDEX: |
*params = (GLint) ctx->Current.RasterIndex; |
break; |
case GL_CURRENT_RASTER_POSITION: |
params[0] = (GLint) ctx->Current.RasterPos[0]; |
params[1] = (GLint) ctx->Current.RasterPos[1]; |
params[2] = (GLint) ctx->Current.RasterPos[2]; |
params[3] = (GLint) ctx->Current.RasterPos[3]; |
break; |
case GL_CURRENT_RASTER_TEXTURE_COORDS: |
params[0] = (GLint) ctx->Current.RasterTexCoords[texUnit][0]; |
params[1] = (GLint) ctx->Current.RasterTexCoords[texUnit][1]; |
params[2] = (GLint) ctx->Current.RasterTexCoords[texUnit][2]; |
params[3] = (GLint) ctx->Current.RasterTexCoords[texUnit][3]; |
break; |
case GL_CURRENT_RASTER_POSITION_VALID: |
*params = (GLint) ctx->Current.RasterPosValid; |
break; |
case GL_CURRENT_TEXTURE_COORDS: |
FLUSH_CURRENT(ctx, 0); |
params[0] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; |
params[1] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; |
params[2] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; |
params[3] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; |
break; |
case GL_DEPTH_BIAS: |
*params = (GLint) ctx->Pixel.DepthBias; |
break; |
case GL_DEPTH_BITS: |
*params = ctx->Visual.depthBits; |
break; |
case GL_DEPTH_CLEAR_VALUE: |
*params = (GLint) ctx->Depth.Clear; |
break; |
case GL_DEPTH_FUNC: |
*params = (GLint) ctx->Depth.Func; |
break; |
case GL_DEPTH_RANGE: |
params[0] = (GLint) ctx->Viewport.Near; |
params[1] = (GLint) ctx->Viewport.Far; |
break; |
case GL_DEPTH_SCALE: |
*params = (GLint) ctx->Pixel.DepthScale; |
break; |
case GL_DEPTH_TEST: |
*params = (GLint) ctx->Depth.Test; |
break; |
case GL_DEPTH_WRITEMASK: |
*params = (GLint) ctx->Depth.Mask; |
break; |
case GL_DITHER: |
*params = (GLint) ctx->Color.DitherFlag; |
break; |
case GL_DOUBLEBUFFER: |
*params = (GLint) ctx->Visual.doubleBufferMode; |
break; |
case GL_DRAW_BUFFER: |
*params = (GLint) ctx->Color.DrawBuffer; |
break; |
case GL_EDGE_FLAG: |
FLUSH_CURRENT(ctx, 0); |
*params = (GLint) ctx->Current.EdgeFlag; |
break; |
case GL_FEEDBACK_BUFFER_SIZE: |
*params = ctx->Feedback.BufferSize; |
break; |
case GL_FEEDBACK_BUFFER_TYPE: |
*params = ctx->Feedback.Type; |
break; |
case GL_FOG: |
*params = (GLint) ctx->Fog.Enabled; |
break; |
case GL_FOG_COLOR: |
params[0] = FLOAT_TO_INT( ctx->Fog.Color[0] ); |
params[1] = FLOAT_TO_INT( ctx->Fog.Color[1] ); |
params[2] = FLOAT_TO_INT( ctx->Fog.Color[2] ); |
params[3] = FLOAT_TO_INT( ctx->Fog.Color[3] ); |
break; |
case GL_FOG_DENSITY: |
*params = (GLint) ctx->Fog.Density; |
break; |
case GL_FOG_END: |
*params = (GLint) ctx->Fog.End; |
break; |
case GL_FOG_HINT: |
*params = (GLint) ctx->Hint.Fog; |
break; |
case GL_FOG_INDEX: |
*params = (GLint) ctx->Fog.Index; |
break; |
case GL_FOG_MODE: |
*params = (GLint) ctx->Fog.Mode; |
break; |
case GL_FOG_START: |
*params = (GLint) ctx->Fog.Start; |
break; |
case GL_FRONT_FACE: |
*params = (GLint) ctx->Polygon.FrontFace; |
break; |
case GL_GREEN_BIAS: |
*params = (GLint) ctx->Pixel.GreenBias; |
break; |
case GL_GREEN_BITS: |
*params = (GLint) ctx->Visual.greenBits; |
break; |
case GL_GREEN_SCALE: |
*params = (GLint) ctx->Pixel.GreenScale; |
break; |
case GL_INDEX_BITS: |
*params = (GLint) ctx->Visual.indexBits; |
break; |
case GL_INDEX_CLEAR_VALUE: |
*params = (GLint) ctx->Color.ClearIndex; |
break; |
case GL_INDEX_MODE: |
*params = ctx->Visual.rgbMode ? 0 : 1; |
break; |
case GL_INDEX_OFFSET: |
*params = ctx->Pixel.IndexOffset; |
break; |
case GL_INDEX_SHIFT: |
*params = ctx->Pixel.IndexShift; |
break; |
case GL_INDEX_WRITEMASK: |
*params = (GLint) ctx->Color.IndexMask; |
break; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
*params = (GLint) ctx->Light.Light[pname-GL_LIGHT0].Enabled; |
break; |
case GL_LIGHTING: |
*params = (GLint) ctx->Light.Enabled; |
break; |
case GL_LIGHT_MODEL_AMBIENT: |
params[0] = FLOAT_TO_INT( ctx->Light.Model.Ambient[0] ); |
params[1] = FLOAT_TO_INT( ctx->Light.Model.Ambient[1] ); |
params[2] = FLOAT_TO_INT( ctx->Light.Model.Ambient[2] ); |
params[3] = FLOAT_TO_INT( ctx->Light.Model.Ambient[3] ); |
break; |
case GL_LIGHT_MODEL_COLOR_CONTROL: |
params[0] = (GLint) ctx->Light.Model.ColorControl; |
break; |
case GL_LIGHT_MODEL_LOCAL_VIEWER: |
*params = (GLint) ctx->Light.Model.LocalViewer; |
break; |
case GL_LIGHT_MODEL_TWO_SIDE: |
*params = (GLint) ctx->Light.Model.TwoSide; |
break; |
case GL_LINE_SMOOTH: |
*params = (GLint) ctx->Line.SmoothFlag; |
break; |
case GL_LINE_SMOOTH_HINT: |
*params = (GLint) ctx->Hint.LineSmooth; |
break; |
case GL_LINE_STIPPLE: |
*params = (GLint) ctx->Line.StippleFlag; |
break; |
case GL_LINE_STIPPLE_PATTERN: |
*params = (GLint) ctx->Line.StipplePattern; |
break; |
case GL_LINE_STIPPLE_REPEAT: |
*params = (GLint) ctx->Line.StippleFactor; |
break; |
case GL_LINE_WIDTH: |
*params = (GLint) ctx->Line.Width; |
break; |
case GL_LINE_WIDTH_GRANULARITY: |
*params = (GLint) ctx->Const.LineWidthGranularity; |
break; |
case GL_LINE_WIDTH_RANGE: |
params[0] = (GLint) ctx->Const.MinLineWidthAA; |
params[1] = (GLint) ctx->Const.MaxLineWidthAA; |
break; |
case GL_ALIASED_LINE_WIDTH_RANGE: |
params[0] = (GLint) ctx->Const.MinLineWidth; |
params[1] = (GLint) ctx->Const.MaxLineWidth; |
break; |
case GL_LIST_BASE: |
*params = (GLint) ctx->List.ListBase; |
break; |
case GL_LIST_INDEX: |
*params = (GLint) ctx->CurrentListNum; |
break; |
case GL_LIST_MODE: |
*params = ctx->ExecuteFlag ? (GLint) GL_COMPILE_AND_EXECUTE |
: (GLint) GL_COMPILE; |
break; |
case GL_INDEX_LOGIC_OP: |
*params = (GLint) ctx->Color.IndexLogicOpEnabled; |
break; |
case GL_COLOR_LOGIC_OP: |
*params = (GLint) ctx->Color.ColorLogicOpEnabled; |
break; |
case GL_LOGIC_OP_MODE: |
*params = (GLint) ctx->Color.LogicOp; |
break; |
case GL_MAP1_COLOR_4: |
*params = (GLint) ctx->Eval.Map1Color4; |
break; |
case GL_MAP1_GRID_DOMAIN: |
params[0] = (GLint) ctx->Eval.MapGrid1u1; |
params[1] = (GLint) ctx->Eval.MapGrid1u2; |
break; |
case GL_MAP1_GRID_SEGMENTS: |
*params = (GLint) ctx->Eval.MapGrid1un; |
break; |
case GL_MAP1_INDEX: |
*params = (GLint) ctx->Eval.Map1Index; |
break; |
case GL_MAP1_NORMAL: |
*params = (GLint) ctx->Eval.Map1Normal; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
*params = (GLint) ctx->Eval.Map1TextureCoord1; |
break; |
case GL_MAP1_TEXTURE_COORD_2: |
*params = (GLint) ctx->Eval.Map1TextureCoord2; |
break; |
case GL_MAP1_TEXTURE_COORD_3: |
*params = (GLint) ctx->Eval.Map1TextureCoord3; |
break; |
case GL_MAP1_TEXTURE_COORD_4: |
*params = (GLint) ctx->Eval.Map1TextureCoord4; |
break; |
case GL_MAP1_VERTEX_3: |
*params = (GLint) ctx->Eval.Map1Vertex3; |
break; |
case GL_MAP1_VERTEX_4: |
*params = (GLint) ctx->Eval.Map1Vertex4; |
break; |
case GL_MAP2_COLOR_4: |
*params = (GLint) ctx->Eval.Map2Color4; |
break; |
case GL_MAP2_GRID_DOMAIN: |
params[0] = (GLint) ctx->Eval.MapGrid2u1; |
params[1] = (GLint) ctx->Eval.MapGrid2u2; |
params[2] = (GLint) ctx->Eval.MapGrid2v1; |
params[3] = (GLint) ctx->Eval.MapGrid2v2; |
break; |
case GL_MAP2_GRID_SEGMENTS: |
params[0] = (GLint) ctx->Eval.MapGrid2un; |
params[1] = (GLint) ctx->Eval.MapGrid2vn; |
break; |
case GL_MAP2_INDEX: |
*params = (GLint) ctx->Eval.Map2Index; |
break; |
case GL_MAP2_NORMAL: |
*params = (GLint) ctx->Eval.Map2Normal; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
*params = (GLint) ctx->Eval.Map2TextureCoord1; |
break; |
case GL_MAP2_TEXTURE_COORD_2: |
*params = (GLint) ctx->Eval.Map2TextureCoord2; |
break; |
case GL_MAP2_TEXTURE_COORD_3: |
*params = (GLint) ctx->Eval.Map2TextureCoord3; |
break; |
case GL_MAP2_TEXTURE_COORD_4: |
*params = (GLint) ctx->Eval.Map2TextureCoord4; |
break; |
case GL_MAP2_VERTEX_3: |
*params = (GLint) ctx->Eval.Map2Vertex3; |
break; |
case GL_MAP2_VERTEX_4: |
*params = (GLint) ctx->Eval.Map2Vertex4; |
break; |
case GL_MAP_COLOR: |
*params = (GLint) ctx->Pixel.MapColorFlag; |
break; |
case GL_MAP_STENCIL: |
*params = (GLint) ctx->Pixel.MapStencilFlag; |
break; |
case GL_MATRIX_MODE: |
*params = (GLint) ctx->Transform.MatrixMode; |
break; |
case GL_MAX_ATTRIB_STACK_DEPTH: |
*params = (GLint) MAX_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: |
*params = (GLint) MAX_CLIENT_ATTRIB_STACK_DEPTH; |
break; |
case GL_MAX_CLIP_PLANES: |
*params = (GLint) ctx->Const.MaxClipPlanes; |
break; |
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ |
*params = (GLint) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ |
*params = (GLint) ctx->Const.MaxArrayLockSize; |
break; |
case GL_MAX_EVAL_ORDER: |
*params = (GLint) MAX_EVAL_ORDER; |
break; |
case GL_MAX_LIGHTS: |
*params = (GLint) ctx->Const.MaxLights; |
break; |
case GL_MAX_LIST_NESTING: |
*params = (GLint) MAX_LIST_NESTING; |
break; |
case GL_MAX_MODELVIEW_STACK_DEPTH: |
*params = (GLint) MAX_MODELVIEW_STACK_DEPTH; |
break; |
case GL_MAX_NAME_STACK_DEPTH: |
*params = (GLint) MAX_NAME_STACK_DEPTH; |
break; |
case GL_MAX_PIXEL_MAP_TABLE: |
*params = (GLint) MAX_PIXEL_MAP_TABLE; |
break; |
case GL_MAX_PROJECTION_STACK_DEPTH: |
*params = (GLint) MAX_PROJECTION_STACK_DEPTH; |
break; |
case GL_MAX_TEXTURE_SIZE: |
*params = (1 << (ctx->Const.MaxTextureLevels - 1)); |
break; |
case GL_MAX_3D_TEXTURE_SIZE: |
*params = (1 << (ctx->Const.Max3DTextureLevels - 1)); |
break; |
case GL_MAX_TEXTURE_STACK_DEPTH: |
*params = (GLint) MAX_TEXTURE_STACK_DEPTH; |
break; |
case GL_MAX_VIEWPORT_DIMS: |
params[0] = (GLint) MAX_WIDTH; |
params[1] = (GLint) MAX_HEIGHT; |
break; |
case GL_MODELVIEW_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLint) ctx->ModelviewMatrixStack.Top->m[i]; |
} |
break; |
case GL_MODELVIEW_STACK_DEPTH: |
*params = (GLint) (ctx->ModelviewMatrixStack.Depth + 1); |
break; |
case GL_NAME_STACK_DEPTH: |
*params = (GLint) ctx->Select.NameStackDepth; |
break; |
case GL_NORMALIZE: |
*params = (GLint) ctx->Transform.Normalize; |
break; |
case GL_PACK_ALIGNMENT: |
*params = ctx->Pack.Alignment; |
break; |
case GL_PACK_LSB_FIRST: |
*params = (GLint) ctx->Pack.LsbFirst; |
break; |
case GL_PACK_ROW_LENGTH: |
*params = ctx->Pack.RowLength; |
break; |
case GL_PACK_SKIP_PIXELS: |
*params = ctx->Pack.SkipPixels; |
break; |
case GL_PACK_SKIP_ROWS: |
*params = ctx->Pack.SkipRows; |
break; |
case GL_PACK_SWAP_BYTES: |
*params = (GLint) ctx->Pack.SwapBytes; |
break; |
case GL_PACK_SKIP_IMAGES_EXT: |
*params = ctx->Pack.SkipImages; |
break; |
case GL_PACK_IMAGE_HEIGHT_EXT: |
*params = ctx->Pack.ImageHeight; |
break; |
case GL_PACK_INVERT_MESA: |
*params = ctx->Pack.Invert; |
break; |
case GL_PERSPECTIVE_CORRECTION_HINT: |
*params = (GLint) ctx->Hint.PerspectiveCorrection; |
break; |
case GL_PIXEL_MAP_A_TO_A_SIZE: |
*params = ctx->Pixel.MapAtoAsize; |
break; |
case GL_PIXEL_MAP_B_TO_B_SIZE: |
*params = ctx->Pixel.MapBtoBsize; |
break; |
case GL_PIXEL_MAP_G_TO_G_SIZE: |
*params = ctx->Pixel.MapGtoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_A_SIZE: |
*params = ctx->Pixel.MapItoAsize; |
break; |
case GL_PIXEL_MAP_I_TO_B_SIZE: |
*params = ctx->Pixel.MapItoBsize; |
break; |
case GL_PIXEL_MAP_I_TO_G_SIZE: |
*params = ctx->Pixel.MapItoGsize; |
break; |
case GL_PIXEL_MAP_I_TO_I_SIZE: |
*params = ctx->Pixel.MapItoIsize; |
break; |
case GL_PIXEL_MAP_I_TO_R_SIZE: |
*params = ctx->Pixel.MapItoRsize; |
break; |
case GL_PIXEL_MAP_R_TO_R_SIZE: |
*params = ctx->Pixel.MapRtoRsize; |
break; |
case GL_PIXEL_MAP_S_TO_S_SIZE: |
*params = ctx->Pixel.MapStoSsize; |
break; |
case GL_POINT_SIZE: |
*params = (GLint) ctx->Point.Size; |
break; |
case GL_POINT_SIZE_GRANULARITY: |
*params = (GLint) ctx->Const.PointSizeGranularity; |
break; |
case GL_POINT_SIZE_RANGE: |
params[0] = (GLint) ctx->Const.MinPointSizeAA; |
params[1] = (GLint) ctx->Const.MaxPointSizeAA; |
break; |
case GL_ALIASED_POINT_SIZE_RANGE: |
params[0] = (GLint) ctx->Const.MinPointSize; |
params[1] = (GLint) ctx->Const.MaxPointSize; |
break; |
case GL_POINT_SMOOTH: |
*params = (GLint) ctx->Point.SmoothFlag; |
break; |
case GL_POINT_SMOOTH_HINT: |
*params = (GLint) ctx->Hint.PointSmooth; |
break; |
case GL_POINT_SIZE_MIN_EXT: |
*params = (GLint) (ctx->Point.MinSize); |
break; |
case GL_POINT_SIZE_MAX_EXT: |
*params = (GLint) (ctx->Point.MaxSize); |
break; |
case GL_POINT_FADE_THRESHOLD_SIZE_EXT: |
*params = (GLint) (ctx->Point.Threshold); |
break; |
case GL_DISTANCE_ATTENUATION_EXT: |
params[0] = (GLint) (ctx->Point.Params[0]); |
params[1] = (GLint) (ctx->Point.Params[1]); |
params[2] = (GLint) (ctx->Point.Params[2]); |
break; |
case GL_POLYGON_MODE: |
params[0] = (GLint) ctx->Polygon.FrontMode; |
params[1] = (GLint) ctx->Polygon.BackMode; |
break; |
case GL_POLYGON_OFFSET_BIAS_EXT: /* GL_EXT_polygon_offset */ |
*params = (GLint) ctx->Polygon.OffsetUnits; |
break; |
case GL_POLYGON_OFFSET_FACTOR: |
*params = (GLint) ctx->Polygon.OffsetFactor; |
break; |
case GL_POLYGON_OFFSET_UNITS: |
*params = (GLint) ctx->Polygon.OffsetUnits; |
break; |
case GL_POLYGON_SMOOTH: |
*params = (GLint) ctx->Polygon.SmoothFlag; |
break; |
case GL_POLYGON_SMOOTH_HINT: |
*params = (GLint) ctx->Hint.PolygonSmooth; |
break; |
case GL_POLYGON_STIPPLE: |
*params = (GLint) ctx->Polygon.StippleFlag; |
break; |
case GL_PROJECTION_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLint) ctx->ProjectionMatrixStack.Top->m[i]; |
} |
break; |
case GL_PROJECTION_STACK_DEPTH: |
*params = (GLint) (ctx->ProjectionMatrixStack.Depth + 1); |
break; |
case GL_READ_BUFFER: |
*params = (GLint) ctx->Pixel.ReadBuffer; |
break; |
case GL_RED_BIAS: |
*params = (GLint) ctx->Pixel.RedBias; |
break; |
case GL_RED_BITS: |
*params = (GLint) ctx->Visual.redBits; |
break; |
case GL_RED_SCALE: |
*params = (GLint) ctx->Pixel.RedScale; |
break; |
case GL_RENDER_MODE: |
*params = (GLint) ctx->RenderMode; |
break; |
case GL_RESCALE_NORMAL: |
*params = (GLint) ctx->Transform.RescaleNormals; |
break; |
case GL_RGBA_MODE: |
*params = (GLint) ctx->Visual.rgbMode; |
break; |
case GL_SCISSOR_BOX: |
params[0] = (GLint) ctx->Scissor.X; |
params[1] = (GLint) ctx->Scissor.Y; |
params[2] = (GLint) ctx->Scissor.Width; |
params[3] = (GLint) ctx->Scissor.Height; |
break; |
case GL_SCISSOR_TEST: |
*params = (GLint) ctx->Scissor.Enabled; |
break; |
case GL_SELECTION_BUFFER_SIZE: |
*params = (GLint) ctx->Select.BufferSize; |
break; |
case GL_SHADE_MODEL: |
*params = (GLint) ctx->Light.ShadeModel; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
*params = (GLint) ctx->Texture.SharedPalette; |
break; |
case GL_STENCIL_BITS: |
*params = ctx->Visual.stencilBits; |
break; |
case GL_STENCIL_CLEAR_VALUE: |
*params = (GLint) ctx->Stencil.Clear; |
break; |
case GL_STENCIL_FAIL: |
*params = (GLint) ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_FUNC: |
*params = (GLint) ctx->Stencil.Function[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_PASS_DEPTH_FAIL: |
*params = (GLint) ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_PASS_DEPTH_PASS: |
*params = (GLint) ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_REF: |
*params = (GLint) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_TEST: |
*params = (GLint) ctx->Stencil.Enabled; |
break; |
case GL_STENCIL_VALUE_MASK: |
*params = (GLint) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STENCIL_WRITEMASK: |
*params = (GLint) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; |
break; |
case GL_STEREO: |
*params = (GLint) ctx->Visual.stereoMode; |
break; |
case GL_SUBPIXEL_BITS: |
*params = ctx->Const.SubPixelBits; |
break; |
case GL_TEXTURE_1D: |
*params = _mesa_IsEnabled(GL_TEXTURE_1D) ? 1 : 0; |
break; |
case GL_TEXTURE_2D: |
*params = _mesa_IsEnabled(GL_TEXTURE_2D) ? 1 : 0; |
break; |
case GL_TEXTURE_3D: |
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1 : 0; |
break; |
case GL_TEXTURE_BINDING_1D: |
*params = textureUnit->Current1D->Name; |
break; |
case GL_TEXTURE_BINDING_2D: |
*params = textureUnit->Current2D->Name; |
break; |
case GL_TEXTURE_BINDING_3D: |
*params = textureUnit->Current3D->Name; |
break; |
case GL_TEXTURE_ENV_COLOR: |
params[0] = FLOAT_TO_INT( textureUnit->EnvColor[0] ); |
params[1] = FLOAT_TO_INT( textureUnit->EnvColor[1] ); |
params[2] = FLOAT_TO_INT( textureUnit->EnvColor[2] ); |
params[3] = FLOAT_TO_INT( textureUnit->EnvColor[3] ); |
break; |
case GL_TEXTURE_ENV_MODE: |
*params = (GLint) textureUnit->EnvMode; |
break; |
case GL_TEXTURE_GEN_S: |
*params = (textureUnit->TexGenEnabled & S_BIT) ? 1 : 0; |
break; |
case GL_TEXTURE_GEN_T: |
*params = (textureUnit->TexGenEnabled & T_BIT) ? 1 : 0; |
break; |
case GL_TEXTURE_GEN_R: |
*params = (textureUnit->TexGenEnabled & R_BIT) ? 1 : 0; |
break; |
case GL_TEXTURE_GEN_Q: |
*params = (textureUnit->TexGenEnabled & Q_BIT) ? 1 : 0; |
break; |
case GL_TEXTURE_MATRIX: |
for (i=0;i<16;i++) { |
params[i] = (GLint) ctx->TextureMatrixStack[texUnit].Top->m[i]; |
} |
break; |
case GL_TEXTURE_STACK_DEPTH: |
*params = (GLint) (ctx->TextureMatrixStack[texUnit].Depth + 1); |
break; |
case GL_UNPACK_ALIGNMENT: |
*params = ctx->Unpack.Alignment; |
break; |
case GL_UNPACK_LSB_FIRST: |
*params = (GLint) ctx->Unpack.LsbFirst; |
break; |
case GL_UNPACK_ROW_LENGTH: |
*params = ctx->Unpack.RowLength; |
break; |
case GL_UNPACK_SKIP_PIXELS: |
*params = ctx->Unpack.SkipPixels; |
break; |
case GL_UNPACK_SKIP_ROWS: |
*params = ctx->Unpack.SkipRows; |
break; |
case GL_UNPACK_SWAP_BYTES: |
*params = (GLint) ctx->Unpack.SwapBytes; |
break; |
case GL_UNPACK_SKIP_IMAGES_EXT: |
*params = ctx->Unpack.SkipImages; |
break; |
case GL_UNPACK_IMAGE_HEIGHT_EXT: |
*params = ctx->Unpack.ImageHeight; |
break; |
case GL_UNPACK_CLIENT_STORAGE_APPLE: |
*params = ctx->Unpack.ClientStorage; |
break; |
case GL_VIEWPORT: |
params[0] = (GLint) ctx->Viewport.X; |
params[1] = (GLint) ctx->Viewport.Y; |
params[2] = (GLint) ctx->Viewport.Width; |
params[3] = (GLint) ctx->Viewport.Height; |
break; |
case GL_ZOOM_X: |
*params = (GLint) ctx->Pixel.ZoomX; |
break; |
case GL_ZOOM_Y: |
*params = (GLint) ctx->Pixel.ZoomY; |
break; |
case GL_VERTEX_ARRAY: |
*params = (GLint) ctx->Array.Vertex.Enabled; |
break; |
case GL_VERTEX_ARRAY_SIZE: |
*params = ctx->Array.Vertex.Size; |
break; |
case GL_VERTEX_ARRAY_TYPE: |
*params = ctx->Array.Vertex.Type; |
break; |
case GL_VERTEX_ARRAY_STRIDE: |
*params = ctx->Array.Vertex.Stride; |
break; |
case GL_VERTEX_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
case GL_NORMAL_ARRAY: |
*params = (GLint) ctx->Array.Normal.Enabled; |
break; |
case GL_NORMAL_ARRAY_TYPE: |
*params = ctx->Array.Normal.Type; |
break; |
case GL_NORMAL_ARRAY_STRIDE: |
*params = ctx->Array.Normal.Stride; |
break; |
case GL_NORMAL_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
case GL_COLOR_ARRAY: |
*params = (GLint) ctx->Array.Color.Enabled; |
break; |
case GL_COLOR_ARRAY_SIZE: |
*params = ctx->Array.Color.Size; |
break; |
case GL_COLOR_ARRAY_TYPE: |
*params = ctx->Array.Color.Type; |
break; |
case GL_COLOR_ARRAY_STRIDE: |
*params = ctx->Array.Color.Stride; |
break; |
case GL_COLOR_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
case GL_INDEX_ARRAY: |
*params = (GLint) ctx->Array.Index.Enabled; |
break; |
case GL_INDEX_ARRAY_TYPE: |
*params = ctx->Array.Index.Type; |
break; |
case GL_INDEX_ARRAY_STRIDE: |
*params = ctx->Array.Index.Stride; |
break; |
case GL_INDEX_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
case GL_TEXTURE_COORD_ARRAY: |
*params = (GLint) ctx->Array.TexCoord[texUnit].Enabled; |
break; |
case GL_TEXTURE_COORD_ARRAY_SIZE: |
*params = ctx->Array.TexCoord[texUnit].Size; |
break; |
case GL_TEXTURE_COORD_ARRAY_TYPE: |
*params = ctx->Array.TexCoord[texUnit].Type; |
break; |
case GL_TEXTURE_COORD_ARRAY_STRIDE: |
*params = ctx->Array.TexCoord[texUnit].Stride; |
break; |
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
case GL_EDGE_FLAG_ARRAY: |
*params = (GLint) ctx->Array.EdgeFlag.Enabled; |
break; |
case GL_EDGE_FLAG_ARRAY_STRIDE: |
*params = ctx->Array.EdgeFlag.Stride; |
break; |
case GL_EDGE_FLAG_ARRAY_COUNT_EXT: |
*params = 0; |
break; |
/* GL_ARB_multitexture */ |
case GL_MAX_TEXTURE_UNITS_ARB: |
CHECK_EXTENSION_I(ARB_multitexture, pname); |
*params = ctx->Const.MaxTextureUnits; |
break; |
case GL_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_I(ARB_multitexture, pname); |
*params = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; |
break; |
case GL_CLIENT_ACTIVE_TEXTURE_ARB: |
CHECK_EXTENSION_I(ARB_multitexture, pname); |
*params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; |
break; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
CHECK_EXTENSION_I(ARB_texture_cube_map, pname); |
*params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); |
break; |
case GL_TEXTURE_BINDING_CUBE_MAP_ARB: |
CHECK_EXTENSION_I(ARB_texture_cube_map, pname); |
*params = textureUnit->CurrentCubeMap->Name; |
break; |
case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: |
CHECK_EXTENSION_I(ARB_texture_cube_map, pname); |
*params = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); |
break; |
/* GL_ARB_texture_compression */ |
case GL_TEXTURE_COMPRESSION_HINT_ARB: |
CHECK_EXTENSION_I(ARB_texture_compression, pname); |
*params = (GLint) ctx->Hint.TextureCompression; |
break; |
case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_I(ARB_texture_compression, pname); |
*params = (GLint) _mesa_get_compressed_formats(ctx, NULL); |
break; |
case GL_COMPRESSED_TEXTURE_FORMATS_ARB: |
CHECK_EXTENSION_I(ARB_texture_compression, pname); |
(void) _mesa_get_compressed_formats(ctx, params); |
break; |
/* GL_EXT_compiled_vertex_array */ |
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: |
CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); |
*params = ctx->Array.LockFirst; |
break; |
case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: |
CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); |
*params = ctx->Array.LockCount; |
break; |
/* GL_ARB_transpose_matrix */ |
case GL_TRANSPOSE_COLOR_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ColorMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLint) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLint) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLint) tm[i]; |
} |
} |
break; |
case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: |
{ |
GLfloat tm[16]; |
GLuint i; |
_math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); |
for (i=0;i<16;i++) { |
params[i] = (GLint) tm[i]; |
} |
} |
break; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION_I(HP_occlusion_test, pname); |
*params = (GLint) ctx->Depth.OcclusionTest; |
break; |
case GL_OCCLUSION_TEST_RESULT_HP: |
CHECK_EXTENSION_I(HP_occlusion_test, pname); |
if (ctx->Depth.OcclusionTest) |
*params = (GLint) ctx->OcclusionResult; |
else |
*params = (GLint) ctx->OcclusionResultSaved; |
/* reset flag now */ |
ctx->OcclusionResult = GL_FALSE; |
ctx->OcclusionResultSaved = GL_FALSE; |
break; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
CHECK_EXTENSION_I(SGIS_pixel_texture, pname); |
*params = (GLint) ctx->Pixel.PixelTextureEnabled; |
break; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
CHECK_EXTENSION_I(SGIX_pixel_texture, pname); |
*params = (GLint) ctx->Pixel.PixelTextureEnabled; |
break; |
case GL_PIXEL_TEX_GEN_MODE_SGIX: |
CHECK_EXTENSION_I(SGIX_pixel_texture, pname); |
*params = (GLint) pixel_texgen_mode(ctx); |
break; |
/* GL_SGI_color_matrix (also in 1.2 imaging) */ |
case GL_COLOR_MATRIX_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
for (i=0;i<16;i++) { |
params[i] = (GLint) ctx->ColorMatrixStack.Top->m[i]; |
} |
break; |
case GL_COLOR_MATRIX_STACK_DEPTH_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = ctx->ColorMatrixStack.Depth + 1; |
break; |
case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = MAX_COLOR_STACK_DEPTH; |
break; |
case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixScale[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixScale[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixScale[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixScale[3]; |
break; |
case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixBias[0]; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixBias[1]; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixBias[2]; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: |
CHECK_EXTENSION_I(SGI_color_matrix, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixBias[3]; |
break; |
/* GL_EXT_convolution (also in 1.2 imaging) */ |
case GL_CONVOLUTION_1D_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.Convolution1DEnabled; |
break; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.Convolution2DEnabled; |
break; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.Separable2DEnabled; |
break; |
case GL_POST_CONVOLUTION_RED_SCALE_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionScale[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionScale[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionScale[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionScale[3]; |
break; |
case GL_POST_CONVOLUTION_RED_BIAS_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionBias[0]; |
break; |
case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionBias[1]; |
break; |
case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionBias[2]; |
break; |
case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: |
CHECK_EXTENSION_I(EXT_convolution, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionBias[2]; |
break; |
/* GL_EXT_histogram (also in 1.2 imaging) */ |
case GL_HISTOGRAM: |
CHECK_EXTENSION_I(EXT_histogram, pname); |
*params = (GLint) ctx->Pixel.HistogramEnabled; |
break; |
case GL_MINMAX: |
CHECK_EXTENSION_I(EXT_histogram, pname); |
*params = (GLint) ctx->Pixel.MinMaxEnabled; |
break; |
/* GL_SGI_color_table (also in 1.2 imaging */ |
case GL_COLOR_TABLE_SGI: |
CHECK_EXTENSION_I(SGI_color_table, pname); |
*params = (GLint) ctx->Pixel.ColorTableEnabled; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
CHECK_EXTENSION_I(SGI_color_table, pname); |
*params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
CHECK_EXTENSION_I(SGI_color_table, pname); |
*params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; |
break; |
/* GL_EXT_secondary_color */ |
case GL_COLOR_SUM_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
*params = (GLint) ctx->Fog.ColorSumEnabled; |
break; |
case GL_CURRENT_SECONDARY_COLOR_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
FLUSH_CURRENT(ctx, 0); |
params[0] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]) ); |
params[1] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]) ); |
params[2] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]) ); |
break; |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
*params = (GLint) ctx->Array.SecondaryColor.Enabled; |
break; |
case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
*params = (GLint) ctx->Array.SecondaryColor.Type; |
break; |
case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
*params = (GLint) ctx->Array.SecondaryColor.Stride; |
break; |
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: |
CHECK_EXTENSION_I(EXT_secondary_color, pname); |
*params = (GLint) ctx->Array.SecondaryColor.Stride; |
break; |
/* GL_EXT_fog_coord */ |
case GL_CURRENT_FOG_COORDINATE_EXT: |
CHECK_EXTENSION_I(EXT_fog_coord, pname); |
FLUSH_CURRENT(ctx, 0); |
*params = (GLint) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; |
break; |
case GL_FOG_COORDINATE_ARRAY_EXT: |
CHECK_EXTENSION_I(EXT_fog_coord, pname); |
*params = (GLint) ctx->Array.FogCoord.Enabled; |
break; |
case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: |
CHECK_EXTENSION_I(EXT_fog_coord, pname); |
*params = (GLint) ctx->Array.FogCoord.Type; |
break; |
case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: |
CHECK_EXTENSION_I(EXT_fog_coord, pname); |
*params = (GLint) ctx->Array.FogCoord.Stride; |
break; |
/* GL_EXT_texture_lod_bias */ |
case GL_MAX_TEXTURE_LOD_BIAS_EXT: |
*params = (GLint) ctx->Const.MaxTextureLodBias; |
break; |
/* GL_EXT_texture_filter_anisotropic */ |
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: |
CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname); |
*params = (GLint) ctx->Const.MaxTextureMaxAnisotropy; |
break; |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.Enabled; |
break; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.SampleAlphaToCoverage; |
break; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.SampleAlphaToOne; |
break; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.SampleCoverage; |
break; |
case GL_SAMPLE_COVERAGE_VALUE_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.SampleCoverageValue; |
break; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = (GLint) ctx->Multisample.SampleCoverageInvert; |
break; |
case GL_SAMPLE_BUFFERS_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = 0; /* XXX fix someday */ |
break; |
case GL_SAMPLES_ARB: |
CHECK_EXTENSION_I(ARB_multisample, pname); |
*params = 0; /* XXX fix someday */ |
break; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION_I(IBM_rasterpos_clip, pname); |
*params = (GLint) ctx->Transform.RasterPositionUnclipped; |
break; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLint) ctx->Point.PointSprite; |
break; |
case GL_POINT_SPRITE_R_MODE_NV: |
CHECK_EXTENSION_B(NV_point_sprite, pname); |
*params = (GLint) ctx->Point.SpriteRMode; |
break; |
/* GL_SGIS_generate_mipmap */ |
case GL_GENERATE_MIPMAP_HINT_SGIS: |
CHECK_EXTENSION_I(SGIS_generate_mipmap, pname); |
*params = (GLint) ctx->Hint.GenerateMipmap; |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->VertexProgram.Enabled; |
break; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->VertexProgram.PointSizeEnabled; |
break; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->VertexProgram.TwoSideEnabled; |
break; |
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = MAX_PROGRAM_STACK_DEPTH; |
break; |
case GL_MAX_TRACK_MATRICES_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = MAX_PROGRAM_MATRICES; |
break; |
case GL_CURRENT_MATRIX_STACK_DEPTH_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = ctx->CurrentStack->Depth; |
break; |
case GL_CURRENT_MATRIX_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->Transform.MatrixMode; |
break; |
case GL_VERTEX_PROGRAM_BINDING_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->VertexProgram.CurrentID; |
break; |
case GL_PROGRAM_ERROR_POSITION_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
*params = (GLint) ctx->VertexProgram.ErrorPos; |
break; |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION_I(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; |
*params = (GLint) ctx->Array.VertexAttrib[n].Enabled; |
} |
break; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; |
*params = (GLint) ctx->Eval.Map1Attrib[n]; |
} |
break; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION_B(NV_vertex_program, pname); |
{ |
GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; |
*params = (GLint) ctx->Eval.Map2Attrib[n]; |
} |
break; |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION_I(NV_texture_rectangle, pname); |
*params = (GLint) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); |
break; |
case GL_TEXTURE_BINDING_RECTANGLE_NV: |
CHECK_EXTENSION_I(NV_texture_rectangle, pname); |
*params = (GLint) textureUnit->CurrentRect->Name; |
break; |
case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: |
CHECK_EXTENSION_I(NV_texture_rectangle, pname); |
*params = (GLint) ctx->Const.MaxTextureRectSize; |
break; |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION_I(EXT_stencil_two_side, pname); |
*params = (GLint) ctx->Stencil.TestTwoSide; |
break; |
case GL_ACTIVE_STENCIL_FACE_EXT: |
CHECK_EXTENSION_I(EXT_stencil_two_side, pname); |
*params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); |
} |
} |
void |
_mesa_GetPointerv( GLenum pname, GLvoid **params ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLuint texUnit = ctx->Texture.CurrentUnit; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!params) |
return; |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); |
if (ctx->Driver.GetPointerv |
&& (*ctx->Driver.GetPointerv)(ctx, pname, params)) |
return; |
switch (pname) { |
case GL_VERTEX_ARRAY_POINTER: |
*params = ctx->Array.Vertex.Ptr; |
break; |
case GL_NORMAL_ARRAY_POINTER: |
*params = ctx->Array.Normal.Ptr; |
break; |
case GL_COLOR_ARRAY_POINTER: |
*params = ctx->Array.Color.Ptr; |
break; |
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: |
*params = ctx->Array.SecondaryColor.Ptr; |
break; |
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: |
*params = ctx->Array.FogCoord.Ptr; |
break; |
case GL_INDEX_ARRAY_POINTER: |
*params = ctx->Array.Index.Ptr; |
break; |
case GL_TEXTURE_COORD_ARRAY_POINTER: |
*params = ctx->Array.TexCoord[texUnit].Ptr; |
break; |
case GL_EDGE_FLAG_ARRAY_POINTER: |
*params = ctx->Array.EdgeFlag.Ptr; |
break; |
case GL_FEEDBACK_BUFFER_POINTER: |
*params = ctx->Feedback.Buffer; |
break; |
case GL_SELECTION_BUFFER_POINTER: |
*params = ctx->Select.Buffer; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); |
return; |
} |
} |
const GLubyte * |
_mesa_GetString( GLenum name ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
static const char *vendor = "Brian Paul"; |
static const char *renderer = "Mesa"; |
static const char *version_1_2 = "1.2 Mesa 5.0"; |
static const char *version_1_3 = "1.3 Mesa 5.0"; |
static const char *version_1_4 = "1.4 Mesa 5.0"; |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); |
/* this is a required driver function */ |
assert(ctx->Driver.GetString); |
{ |
const GLubyte *str = (*ctx->Driver.GetString)(ctx, name); |
if (str) |
return str; |
switch (name) { |
case GL_VENDOR: |
return (const GLubyte *) vendor; |
case GL_RENDERER: |
return (const GLubyte *) renderer; |
case GL_VERSION: |
if (ctx->Extensions.ARB_multisample && |
ctx->Extensions.ARB_multitexture && |
ctx->Extensions.ARB_texture_border_clamp && |
ctx->Extensions.ARB_texture_compression && |
ctx->Extensions.ARB_texture_cube_map && |
ctx->Extensions.EXT_texture_env_add && |
ctx->Extensions.ARB_texture_env_combine && |
ctx->Extensions.ARB_texture_env_dot3) { |
if (ctx->Extensions.ARB_depth_texture && |
ctx->Extensions.ARB_shadow && |
ctx->Extensions.ARB_texture_env_crossbar && |
ctx->Extensions.ARB_texture_mirrored_repeat && |
ctx->Extensions.ARB_window_pos && |
ctx->Extensions.EXT_blend_color && |
ctx->Extensions.EXT_blend_func_separate && |
ctx->Extensions.EXT_blend_logic_op && |
ctx->Extensions.EXT_blend_minmax && |
ctx->Extensions.EXT_blend_subtract && |
ctx->Extensions.EXT_fog_coord && |
ctx->Extensions.EXT_multi_draw_arrays && |
ctx->Extensions.EXT_point_parameters && /*aka ARB*/ |
ctx->Extensions.EXT_secondary_color && |
ctx->Extensions.EXT_stencil_wrap && |
ctx->Extensions.SGIS_generate_mipmap) { |
return (const GLubyte *) version_1_4; |
} |
else { |
return (const GLubyte *) version_1_3; |
} |
} |
else { |
return (const GLubyte *) version_1_2; |
} |
case GL_EXTENSIONS: |
return (const GLubyte *) _mesa_extensions_get_string(ctx); |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); |
return (const GLubyte *) 0; |
} |
} |
} |
/* |
* Execute a glGetError command |
*/ |
GLenum |
_mesa_GetError( void ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLenum e = ctx->ErrorValue; |
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e)); |
ctx->ErrorValue = (GLenum) GL_NO_ERROR; |
return e; |
} |
/shark/tags/rel_0_4/ports/mesa/src/fog.h |
---|
0,0 → 1,52 |
/* $Id: fog.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef FOG_H |
#define FOG_H |
#include "mtypes.h" |
extern void |
_mesa_Fogf(GLenum pname, GLfloat param); |
extern void |
_mesa_Fogi(GLenum pname, GLint param ); |
extern void |
_mesa_Fogfv(GLenum pname, const GLfloat *params ); |
extern void |
_mesa_Fogiv(GLenum pname, const GLint *params ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/state.c |
---|
0,0 → 1,1073 |
/* $Id: state.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* This file manages recalculation of derived values in the |
* __GLcontext. |
*/ |
#include "glheader.h" |
#include "accum.h" |
#include "api_loopback.h" |
#include "attrib.h" |
#include "blend.h" |
#include "buffers.h" |
#include "clip.h" |
#include "colortab.h" |
#include "context.h" |
#include "convolve.h" |
#include "depth.h" |
#include "dlist.h" |
#include "drawpix.h" |
#include "enable.h" |
#include "eval.h" |
#include "get.h" |
#include "feedback.h" |
#include "fog.h" |
#include "hint.h" |
#include "histogram.h" |
#include "light.h" |
#include "lines.h" |
#include "matrix.h" |
#include "mmath.h" |
#include "pixel.h" |
#include "points.h" |
#include "polygon.h" |
#include "rastpos.h" |
#include "state.h" |
#include "stencil.h" |
#include "teximage.h" |
#include "texobj.h" |
#include "texstate.h" |
#include "mtypes.h" |
#include "varray.h" |
#if FEATURE_NV_vertex_program |
#include "vpstate.h" |
#endif |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
static int |
generic_noop(void) |
{ |
#ifdef DEBUG |
_mesa_problem(NULL, "User called no-op dispatch function"); |
#endif |
return 0; |
} |
/* |
* Set all pointers in the given dispatch table to point to a |
* generic no-op function. |
*/ |
void |
_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize) |
{ |
GLuint i; |
void **dispatch = (void **) table; |
for (i = 0; i < tableSize; i++) { |
dispatch[i] = (void *) generic_noop; |
} |
} |
/* |
* Initialize the given dispatch table with pointers to Mesa's |
* immediate-mode commands. |
* |
* Pointers to begin/end object commands and a few others |
* are provided via the vtxfmt interface elsewhere. |
*/ |
void |
_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) |
{ |
/* first initialize all dispatch slots to no-op */ |
_mesa_init_no_op_table(exec, tableSize); |
_mesa_loopback_init_api_table( exec, GL_TRUE ); |
/* load the dispatch slots we understand */ |
exec->Accum = _mesa_Accum; |
exec->AlphaFunc = _mesa_AlphaFunc; |
exec->Bitmap = _mesa_Bitmap; |
exec->BlendFunc = _mesa_BlendFunc; |
exec->CallList = _mesa_CallList; |
exec->CallLists = _mesa_CallLists; |
exec->Clear = _mesa_Clear; |
exec->ClearAccum = _mesa_ClearAccum; |
exec->ClearColor = _mesa_ClearColor; |
exec->ClearDepth = _mesa_ClearDepth; |
exec->ClearIndex = _mesa_ClearIndex; |
exec->ClearStencil = _mesa_ClearStencil; |
exec->ClipPlane = _mesa_ClipPlane; |
exec->ColorMask = _mesa_ColorMask; |
exec->ColorMaterial = _mesa_ColorMaterial; |
exec->CopyPixels = _mesa_CopyPixels; |
exec->CullFace = _mesa_CullFace; |
exec->DeleteLists = _mesa_DeleteLists; |
exec->DepthFunc = _mesa_DepthFunc; |
exec->DepthMask = _mesa_DepthMask; |
exec->DepthRange = _mesa_DepthRange; |
exec->Disable = _mesa_Disable; |
exec->DrawBuffer = _mesa_DrawBuffer; |
exec->DrawPixels = _mesa_DrawPixels; |
exec->Enable = _mesa_Enable; |
exec->EndList = _mesa_EndList; |
exec->FeedbackBuffer = _mesa_FeedbackBuffer; |
exec->Finish = _mesa_Finish; |
exec->Flush = _mesa_Flush; |
exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT; |
exec->Fogf = _mesa_Fogf; |
exec->Fogfv = _mesa_Fogfv; |
exec->Fogi = _mesa_Fogi; |
exec->Fogiv = _mesa_Fogiv; |
exec->FrontFace = _mesa_FrontFace; |
exec->Frustum = _mesa_Frustum; |
exec->GenLists = _mesa_GenLists; |
exec->GetBooleanv = _mesa_GetBooleanv; |
exec->GetClipPlane = _mesa_GetClipPlane; |
exec->GetDoublev = _mesa_GetDoublev; |
exec->GetError = _mesa_GetError; |
exec->GetFloatv = _mesa_GetFloatv; |
exec->GetIntegerv = _mesa_GetIntegerv; |
exec->GetLightfv = _mesa_GetLightfv; |
exec->GetLightiv = _mesa_GetLightiv; |
exec->GetMapdv = _mesa_GetMapdv; |
exec->GetMapfv = _mesa_GetMapfv; |
exec->GetMapiv = _mesa_GetMapiv; |
exec->GetMaterialfv = _mesa_GetMaterialfv; |
exec->GetMaterialiv = _mesa_GetMaterialiv; |
exec->GetPixelMapfv = _mesa_GetPixelMapfv; |
exec->GetPixelMapuiv = _mesa_GetPixelMapuiv; |
exec->GetPixelMapusv = _mesa_GetPixelMapusv; |
exec->GetPolygonStipple = _mesa_GetPolygonStipple; |
exec->GetString = _mesa_GetString; |
exec->GetTexEnvfv = _mesa_GetTexEnvfv; |
exec->GetTexEnviv = _mesa_GetTexEnviv; |
exec->GetTexGendv = _mesa_GetTexGendv; |
exec->GetTexGenfv = _mesa_GetTexGenfv; |
exec->GetTexGeniv = _mesa_GetTexGeniv; |
exec->GetTexImage = _mesa_GetTexImage; |
exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv; |
exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv; |
exec->GetTexParameterfv = _mesa_GetTexParameterfv; |
exec->GetTexParameteriv = _mesa_GetTexParameteriv; |
exec->Hint = _mesa_Hint; |
exec->IndexMask = _mesa_IndexMask; |
exec->InitNames = _mesa_InitNames; |
exec->IsEnabled = _mesa_IsEnabled; |
exec->IsList = _mesa_IsList; |
exec->LightModelf = _mesa_LightModelf; |
exec->LightModelfv = _mesa_LightModelfv; |
exec->LightModeli = _mesa_LightModeli; |
exec->LightModeliv = _mesa_LightModeliv; |
exec->Lightf = _mesa_Lightf; |
exec->Lightfv = _mesa_Lightfv; |
exec->Lighti = _mesa_Lighti; |
exec->Lightiv = _mesa_Lightiv; |
exec->LineStipple = _mesa_LineStipple; |
exec->LineWidth = _mesa_LineWidth; |
exec->ListBase = _mesa_ListBase; |
exec->LoadIdentity = _mesa_LoadIdentity; |
exec->LoadMatrixd = _mesa_LoadMatrixd; |
exec->LoadMatrixf = _mesa_LoadMatrixf; |
exec->LoadName = _mesa_LoadName; |
exec->LogicOp = _mesa_LogicOp; |
exec->Map1d = _mesa_Map1d; |
exec->Map1f = _mesa_Map1f; |
exec->Map2d = _mesa_Map2d; |
exec->Map2f = _mesa_Map2f; |
exec->MapGrid1d = _mesa_MapGrid1d; |
exec->MapGrid1f = _mesa_MapGrid1f; |
exec->MapGrid2d = _mesa_MapGrid2d; |
exec->MapGrid2f = _mesa_MapGrid2f; |
exec->MatrixMode = _mesa_MatrixMode; |
exec->MultMatrixd = _mesa_MultMatrixd; |
exec->MultMatrixf = _mesa_MultMatrixf; |
exec->NewList = _mesa_NewList; |
exec->Ortho = _mesa_Ortho; |
exec->PassThrough = _mesa_PassThrough; |
exec->PixelMapfv = _mesa_PixelMapfv; |
exec->PixelMapuiv = _mesa_PixelMapuiv; |
exec->PixelMapusv = _mesa_PixelMapusv; |
exec->PixelStoref = _mesa_PixelStoref; |
exec->PixelStorei = _mesa_PixelStorei; |
exec->PixelTransferf = _mesa_PixelTransferf; |
exec->PixelTransferi = _mesa_PixelTransferi; |
exec->PixelZoom = _mesa_PixelZoom; |
exec->PointSize = _mesa_PointSize; |
exec->PolygonMode = _mesa_PolygonMode; |
exec->PolygonOffset = _mesa_PolygonOffset; |
exec->PolygonStipple = _mesa_PolygonStipple; |
exec->PopAttrib = _mesa_PopAttrib; |
exec->PopMatrix = _mesa_PopMatrix; |
exec->PopName = _mesa_PopName; |
exec->PushAttrib = _mesa_PushAttrib; |
exec->PushMatrix = _mesa_PushMatrix; |
exec->PushName = _mesa_PushName; |
exec->RasterPos2d = _mesa_RasterPos2d; |
exec->RasterPos2dv = _mesa_RasterPos2dv; |
exec->RasterPos2f = _mesa_RasterPos2f; |
exec->RasterPos2fv = _mesa_RasterPos2fv; |
exec->RasterPos2i = _mesa_RasterPos2i; |
exec->RasterPos2iv = _mesa_RasterPos2iv; |
exec->RasterPos2s = _mesa_RasterPos2s; |
exec->RasterPos2sv = _mesa_RasterPos2sv; |
exec->RasterPos3d = _mesa_RasterPos3d; |
exec->RasterPos3dv = _mesa_RasterPos3dv; |
exec->RasterPos3f = _mesa_RasterPos3f; |
exec->RasterPos3fv = _mesa_RasterPos3fv; |
exec->RasterPos3i = _mesa_RasterPos3i; |
exec->RasterPos3iv = _mesa_RasterPos3iv; |
exec->RasterPos3s = _mesa_RasterPos3s; |
exec->RasterPos3sv = _mesa_RasterPos3sv; |
exec->RasterPos4d = _mesa_RasterPos4d; |
exec->RasterPos4dv = _mesa_RasterPos4dv; |
exec->RasterPos4f = _mesa_RasterPos4f; |
exec->RasterPos4fv = _mesa_RasterPos4fv; |
exec->RasterPos4i = _mesa_RasterPos4i; |
exec->RasterPos4iv = _mesa_RasterPos4iv; |
exec->RasterPos4s = _mesa_RasterPos4s; |
exec->RasterPos4sv = _mesa_RasterPos4sv; |
exec->ReadBuffer = _mesa_ReadBuffer; |
exec->ReadPixels = _mesa_ReadPixels; |
exec->RenderMode = _mesa_RenderMode; |
exec->Rotated = _mesa_Rotated; |
exec->Rotatef = _mesa_Rotatef; |
exec->Scaled = _mesa_Scaled; |
exec->Scalef = _mesa_Scalef; |
exec->Scissor = _mesa_Scissor; |
exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT; |
exec->SelectBuffer = _mesa_SelectBuffer; |
exec->ShadeModel = _mesa_ShadeModel; |
exec->StencilFunc = _mesa_StencilFunc; |
exec->StencilMask = _mesa_StencilMask; |
exec->StencilOp = _mesa_StencilOp; |
exec->TexEnvf = _mesa_TexEnvf; |
exec->TexEnvfv = _mesa_TexEnvfv; |
exec->TexEnvi = _mesa_TexEnvi; |
exec->TexEnviv = _mesa_TexEnviv; |
exec->TexGend = _mesa_TexGend; |
exec->TexGendv = _mesa_TexGendv; |
exec->TexGenf = _mesa_TexGenf; |
exec->TexGenfv = _mesa_TexGenfv; |
exec->TexGeni = _mesa_TexGeni; |
exec->TexGeniv = _mesa_TexGeniv; |
exec->TexImage1D = _mesa_TexImage1D; |
exec->TexImage2D = _mesa_TexImage2D; |
exec->TexParameterf = _mesa_TexParameterf; |
exec->TexParameterfv = _mesa_TexParameterfv; |
exec->TexParameteri = _mesa_TexParameteri; |
exec->TexParameteriv = _mesa_TexParameteriv; |
exec->Translated = _mesa_Translated; |
exec->Translatef = _mesa_Translatef; |
exec->Viewport = _mesa_Viewport; |
/* 1.1 */ |
exec->AreTexturesResident = _mesa_AreTexturesResident; |
exec->AreTexturesResidentEXT = _mesa_AreTexturesResident; |
exec->BindTexture = _mesa_BindTexture; |
exec->ColorPointer = _mesa_ColorPointer; |
exec->CopyTexImage1D = _mesa_CopyTexImage1D; |
exec->CopyTexImage2D = _mesa_CopyTexImage2D; |
exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D; |
exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D; |
exec->DeleteTextures = _mesa_DeleteTextures; |
exec->DisableClientState = _mesa_DisableClientState; |
exec->EdgeFlagPointer = _mesa_EdgeFlagPointer; |
exec->EnableClientState = _mesa_EnableClientState; |
exec->GenTextures = _mesa_GenTextures; |
exec->GenTexturesEXT = _mesa_GenTextures; |
exec->GetPointerv = _mesa_GetPointerv; |
exec->IndexPointer = _mesa_IndexPointer; |
exec->InterleavedArrays = _mesa_InterleavedArrays; |
exec->IsTexture = _mesa_IsTexture; |
exec->IsTextureEXT = _mesa_IsTexture; |
exec->NormalPointer = _mesa_NormalPointer; |
exec->PopClientAttrib = _mesa_PopClientAttrib; |
exec->PrioritizeTextures = _mesa_PrioritizeTextures; |
exec->PushClientAttrib = _mesa_PushClientAttrib; |
exec->TexCoordPointer = _mesa_TexCoordPointer; |
exec->TexSubImage1D = _mesa_TexSubImage1D; |
exec->TexSubImage2D = _mesa_TexSubImage2D; |
exec->VertexPointer = _mesa_VertexPointer; |
/* 1.2 */ |
exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D; |
exec->TexImage3D = _mesa_TexImage3D; |
exec->TexSubImage3D = _mesa_TexSubImage3D; |
/* OpenGL 1.2 GL_ARB_imaging */ |
exec->BlendColor = _mesa_BlendColor; |
exec->BlendEquation = _mesa_BlendEquation; |
exec->ColorSubTable = _mesa_ColorSubTable; |
exec->ColorTable = _mesa_ColorTable; |
exec->ColorTableParameterfv = _mesa_ColorTableParameterfv; |
exec->ColorTableParameteriv = _mesa_ColorTableParameteriv; |
exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D; |
exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D; |
exec->ConvolutionParameterf = _mesa_ConvolutionParameterf; |
exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv; |
exec->ConvolutionParameteri = _mesa_ConvolutionParameteri; |
exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv; |
exec->CopyColorSubTable = _mesa_CopyColorSubTable; |
exec->CopyColorTable = _mesa_CopyColorTable; |
exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D; |
exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D; |
exec->GetColorTable = _mesa_GetColorTable; |
exec->GetColorTableEXT = _mesa_GetColorTable; |
exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv; |
exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; |
exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv; |
exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; |
exec->GetConvolutionFilter = _mesa_GetConvolutionFilter; |
exec->GetConvolutionFilterEXT = _mesa_GetConvolutionFilter; |
exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv; |
exec->GetConvolutionParameterfvEXT = _mesa_GetConvolutionParameterfv; |
exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv; |
exec->GetConvolutionParameterivEXT = _mesa_GetConvolutionParameteriv; |
exec->GetHistogram = _mesa_GetHistogram; |
exec->GetHistogramEXT = _mesa_GetHistogram; |
exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv; |
exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; |
exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv; |
exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; |
exec->GetMinmax = _mesa_GetMinmax; |
exec->GetMinmaxEXT = _mesa_GetMinmax; |
exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv; |
exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; |
exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv; |
exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; |
exec->GetSeparableFilter = _mesa_GetSeparableFilter; |
exec->GetSeparableFilterEXT = _mesa_GetSeparableFilter; |
exec->Histogram = _mesa_Histogram; |
exec->Minmax = _mesa_Minmax; |
exec->ResetHistogram = _mesa_ResetHistogram; |
exec->ResetMinmax = _mesa_ResetMinmax; |
exec->SeparableFilter2D = _mesa_SeparableFilter2D; |
/* 2. GL_EXT_blend_color */ |
#if 0 |
exec->BlendColorEXT = _mesa_BlendColorEXT; |
#endif |
/* 3. GL_EXT_polygon_offset */ |
exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; |
/* 6. GL_EXT_texture3d */ |
#if 0 |
exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; |
exec->TexImage3DEXT = _mesa_TexImage3DEXT; |
exec->TexSubImage3DEXT = _mesa_TexSubImage3D; |
#endif |
/* 11. GL_EXT_histogram */ |
exec->GetHistogramEXT = _mesa_GetHistogram; |
exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; |
exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; |
exec->GetMinmaxEXT = _mesa_GetMinmax; |
exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; |
exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; |
/* ?. GL_SGIX_pixel_texture */ |
exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; |
/* 15. GL_SGIS_pixel_texture */ |
exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; |
exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; |
exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; |
exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS; |
exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; |
exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; |
/* 30. GL_EXT_vertex_array */ |
exec->ColorPointerEXT = _mesa_ColorPointerEXT; |
exec->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT; |
exec->IndexPointerEXT = _mesa_IndexPointerEXT; |
exec->NormalPointerEXT = _mesa_NormalPointerEXT; |
exec->TexCoordPointerEXT = _mesa_TexCoordPointerEXT; |
exec->VertexPointerEXT = _mesa_VertexPointerEXT; |
/* 37. GL_EXT_blend_minmax */ |
#if 0 |
exec->BlendEquationEXT = _mesa_BlendEquationEXT; |
#endif |
/* 54. GL_EXT_point_parameters */ |
exec->PointParameterfEXT = _mesa_PointParameterfEXT; |
exec->PointParameterfvEXT = _mesa_PointParameterfvEXT; |
/* 78. GL_EXT_paletted_texture */ |
#if 0 |
exec->ColorTableEXT = _mesa_ColorTableEXT; |
exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; |
#endif |
exec->GetColorTableEXT = _mesa_GetColorTable; |
exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; |
exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; |
/* 97. GL_EXT_compiled_vertex_array */ |
exec->LockArraysEXT = _mesa_LockArraysEXT; |
exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; |
/* 148. GL_EXT_multi_draw_arrays */ |
exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT; |
exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT; |
/* 173. GL_INGR_blend_func_separate */ |
exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; |
/* 196. GL_MESA_resize_buffers */ |
exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; |
/* 197. GL_MESA_window_pos */ |
exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; |
exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; |
exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; |
exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; |
exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; |
exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; |
exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; |
exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; |
exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; |
exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; |
exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; |
exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; |
exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; |
exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; |
exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; |
exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; |
exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; |
exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; |
exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; |
exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; |
exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; |
exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; |
exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; |
exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; |
/* 233. GL_NV_vertex_program */ |
#if FEATURE_NV_vertex_program |
exec->BindProgramNV = _mesa_BindProgramNV; |
exec->DeleteProgramsNV = _mesa_DeleteProgramsNV; |
exec->ExecuteProgramNV = _mesa_ExecuteProgramNV; |
exec->GenProgramsNV = _mesa_GenProgramsNV; |
exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV; |
exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV; |
exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV; |
exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV; |
exec->GetProgramivNV = _mesa_GetProgramivNV; |
exec->GetProgramStringNV = _mesa_GetProgramStringNV; |
exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV; |
exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV; |
exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV; |
exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV; |
exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV; |
exec->IsProgramNV = _mesa_IsProgramNV; |
exec->LoadProgramNV = _mesa_LoadProgramNV; |
exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV; |
exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV; |
exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV; |
exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV; |
exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV; |
exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV; |
exec->TrackMatrixNV = _mesa_TrackMatrixNV; |
exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; |
#endif |
/* 262. GL_NV_point_sprite */ |
exec->PointParameteriNV = _mesa_PointParameteriNV; |
exec->PointParameterivNV = _mesa_PointParameterivNV; |
/* 268. GL_EXT_stencil_two_side */ |
exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT; |
/* ARB 1. GL_ARB_multitexture */ |
exec->ActiveTextureARB = _mesa_ActiveTextureARB; |
exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; |
/* ARB 3. GL_ARB_transpose_matrix */ |
exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB; |
exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; |
exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; |
exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB; |
/* ARB 5. GL_ARB_multisample */ |
exec->SampleCoverageARB = _mesa_SampleCoverageARB; |
/* ARB 12. GL_ARB_texture_compression */ |
exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB; |
exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB; |
exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB; |
exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB; |
exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB; |
exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB; |
exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; |
/* ARB 14. GL_ARB_point_parameters */ |
/* reuse EXT_point_parameters functions */ |
} |
/**********************************************************************/ |
/***** State update logic *****/ |
/**********************************************************************/ |
/* |
* Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET |
* in ctx->_TriangleCaps if needed. |
*/ |
static void |
update_polygon( GLcontext *ctx ) |
{ |
ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET); |
if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) |
ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; |
/* Any Polygon offsets enabled? */ |
if (ctx->Polygon.OffsetPoint || |
ctx->Polygon.OffsetLine || |
ctx->Polygon.OffsetFill) { |
ctx->_TriangleCaps |= DD_TRI_OFFSET; |
} |
} |
static void |
calculate_model_project_matrix( GLcontext *ctx ) |
{ |
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, |
ctx->ProjectionMatrixStack.Top, |
ctx->ModelviewMatrixStack.Top ); |
_math_matrix_analyse( &ctx->_ModelProjectMatrix ); |
} |
static void |
update_modelview_scale( GLcontext *ctx ) |
{ |
ctx->_ModelViewInvScale = 1.0F; |
if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE | |
MAT_FLAG_GENERAL_SCALE | |
MAT_FLAG_GENERAL_3D | |
MAT_FLAG_GENERAL) ) { |
const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv; |
GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10]; |
if (f < 1e-12) f = 1.0; |
if (ctx->_NeedEyeCoords) |
ctx->_ModelViewInvScale = (GLfloat) (1.0/GL_SQRT(f)); |
else |
ctx->_ModelViewInvScale = (GLfloat) GL_SQRT(f); |
} |
} |
/* Bring uptodate any state that relies on _NeedEyeCoords. |
*/ |
static void |
update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) |
{ |
/* Check if the truth-value interpretations of the bitfields have |
* changed: |
*/ |
if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) { |
/* Recalculate all state that depends on _NeedEyeCoords. |
*/ |
update_modelview_scale(ctx); |
_mesa_compute_light_positions( ctx ); |
if (ctx->Driver.LightingSpaceChange) |
ctx->Driver.LightingSpaceChange( ctx ); |
} |
else { |
GLuint new_state = ctx->NewState; |
/* Recalculate that same state only if it has been invalidated |
* by other statechanges. |
*/ |
if (new_state & _NEW_MODELVIEW) |
update_modelview_scale(ctx); |
if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) |
_mesa_compute_light_positions( ctx ); |
} |
} |
static void |
update_drawbuffer( GLcontext *ctx ) |
{ |
ctx->DrawBuffer->_Xmin = 0; |
ctx->DrawBuffer->_Ymin = 0; |
ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width; |
ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height; |
if (ctx->Scissor.Enabled) { |
if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) { |
ctx->DrawBuffer->_Xmin = ctx->Scissor.X; |
} |
if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) { |
ctx->DrawBuffer->_Ymin = ctx->Scissor.Y; |
} |
if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) { |
ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width; |
} |
if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) { |
ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height; |
} |
} |
} |
/* NOTE: This routine references Tranform attribute values to compute |
* userclip positions in clip space, but is only called on |
* _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values |
* up to date across changes to the Transform attributes. |
*/ |
static void |
update_projection( GLcontext *ctx ) |
{ |
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
/* Recompute clip plane positions in clipspace. This is also done |
* in _mesa_ClipPlane(). |
*/ |
if (ctx->Transform.ClipPlanesEnabled) { |
GLuint p; |
for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { |
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { |
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p], |
ctx->Transform.EyeUserPlane[p], |
ctx->ProjectionMatrixStack.Top->inv ); |
} |
} |
} |
} |
/* |
* Return a bitmask of IMAGE_*_BIT flags which to indicate which |
* pixel transfer operations are enabled. |
*/ |
static void |
update_image_transfer_state(GLcontext *ctx) |
{ |
GLuint mask = 0; |
if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F || |
ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F || |
ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F || |
ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F) |
mask |= IMAGE_SCALE_BIAS_BIT; |
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) |
mask |= IMAGE_SHIFT_OFFSET_BIT; |
if (ctx->Pixel.MapColorFlag) |
mask |= IMAGE_MAP_COLOR_BIT; |
if (ctx->Pixel.ColorTableEnabled) |
mask |= IMAGE_COLOR_TABLE_BIT; |
if (ctx->Pixel.Convolution1DEnabled || |
ctx->Pixel.Convolution2DEnabled || |
ctx->Pixel.Separable2DEnabled) { |
mask |= IMAGE_CONVOLUTION_BIT; |
if (ctx->Pixel.PostConvolutionScale[0] != 1.0F || |
ctx->Pixel.PostConvolutionScale[1] != 1.0F || |
ctx->Pixel.PostConvolutionScale[2] != 1.0F || |
ctx->Pixel.PostConvolutionScale[3] != 1.0F || |
ctx->Pixel.PostConvolutionBias[0] != 0.0F || |
ctx->Pixel.PostConvolutionBias[1] != 0.0F || |
ctx->Pixel.PostConvolutionBias[2] != 0.0F || |
ctx->Pixel.PostConvolutionBias[3] != 0.0F) { |
mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS; |
} |
} |
if (ctx->Pixel.PostConvolutionColorTableEnabled) |
mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; |
if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || |
ctx->Pixel.PostColorMatrixScale[0] != 1.0F || |
ctx->Pixel.PostColorMatrixBias[0] != 0.0F || |
ctx->Pixel.PostColorMatrixScale[1] != 1.0F || |
ctx->Pixel.PostColorMatrixBias[1] != 0.0F || |
ctx->Pixel.PostColorMatrixScale[2] != 1.0F || |
ctx->Pixel.PostColorMatrixBias[2] != 0.0F || |
ctx->Pixel.PostColorMatrixScale[3] != 1.0F || |
ctx->Pixel.PostColorMatrixBias[3] != 0.0F) |
mask |= IMAGE_COLOR_MATRIX_BIT; |
if (ctx->Pixel.PostColorMatrixColorTableEnabled) |
mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; |
if (ctx->Pixel.HistogramEnabled) |
mask |= IMAGE_HISTOGRAM_BIT; |
if (ctx->Pixel.MinMaxEnabled) |
mask |= IMAGE_MIN_MAX_BIT; |
ctx->_ImageTransferState = mask; |
} |
/* Note: This routine refers to derived texture attribute values to |
* compute the ENABLE_TEXMAT flags, but is only called on |
* _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT |
* flags are updated by _mesa_update_textures(), below. |
* |
* If both TEXTURE and TEXTURE_MATRIX change at once, these values |
* will be computed twice. |
*/ |
static void |
update_texture_matrices( GLcontext *ctx ) |
{ |
GLuint i; |
ctx->Texture._TexMatEnabled = 0; |
for (i=0; i < ctx->Const.MaxTextureUnits; i++) { |
if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) { |
_math_matrix_analyse( ctx->TextureMatrixStack[i].Top ); |
if (ctx->Texture.Unit[i]._ReallyEnabled && |
ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY) |
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); |
if (ctx->Driver.TextureMatrix) |
ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top); |
} |
} |
} |
/* Note: This routine refers to derived texture matrix values to |
* compute the ENABLE_TEXMAT flags, but is only called on |
* _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT |
* flags are updated by _mesa_update_texture_matrices, above. |
* |
* If both TEXTURE and TEXTURE_MATRIX change at once, these values |
* will be computed twice. |
*/ |
static void |
update_texture_state( GLcontext *ctx ) |
{ |
GLuint unit; |
ctx->Texture._EnabledUnits = 0; |
ctx->Texture._GenFlags = 0; |
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN; |
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN; |
ctx->Texture._TexMatEnabled = 0; |
ctx->Texture._TexGenEnabled = 0; |
/* Update texture unit state. |
*/ |
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
texUnit->_ReallyEnabled = 0; |
texUnit->_GenFlags = 0; |
if (!texUnit->Enabled) |
continue; |
/* Look for the highest-priority texture target that's enabled and |
* complete. That's the one we'll use for texturing. |
*/ |
if (texUnit->Enabled & TEXTURE_CUBE_BIT) { |
struct gl_texture_object *texObj = texUnit->CurrentCubeMap; |
if (!texObj->Complete) { |
_mesa_test_texobj_completeness(ctx, texObj); |
} |
if (texObj->Complete) { |
texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT; |
texUnit->_Current = texObj; |
} |
} |
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) { |
struct gl_texture_object *texObj = texUnit->Current3D; |
if (!texObj->Complete) { |
_mesa_test_texobj_completeness(ctx, texObj); |
} |
if (texObj->Complete) { |
texUnit->_ReallyEnabled = TEXTURE_3D_BIT; |
texUnit->_Current = texObj; |
} |
} |
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) { |
struct gl_texture_object *texObj = texUnit->CurrentRect; |
if (!texObj->Complete) { |
_mesa_test_texobj_completeness(ctx, texObj); |
} |
if (texObj->Complete) { |
texUnit->_ReallyEnabled = TEXTURE_RECT_BIT; |
texUnit->_Current = texObj; |
} |
} |
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) { |
struct gl_texture_object *texObj = texUnit->Current2D; |
if (!texObj->Complete) { |
_mesa_test_texobj_completeness(ctx, texObj); |
} |
if (texObj->Complete) { |
texUnit->_ReallyEnabled = TEXTURE_2D_BIT; |
texUnit->_Current = texObj; |
} |
} |
if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) { |
struct gl_texture_object *texObj = texUnit->Current1D; |
if (!texObj->Complete) { |
_mesa_test_texobj_completeness(ctx, texObj); |
} |
if (texObj->Complete) { |
texUnit->_ReallyEnabled = TEXTURE_1D_BIT; |
texUnit->_Current = texObj; |
} |
} |
if (!texUnit->_ReallyEnabled) { |
texUnit->_Current = NULL; |
continue; |
} |
if (texUnit->_ReallyEnabled) |
ctx->Texture._EnabledUnits |= (1 << unit); |
if (texUnit->TexGenEnabled) { |
if (texUnit->TexGenEnabled & S_BIT) { |
texUnit->_GenFlags |= texUnit->_GenBitS; |
} |
if (texUnit->TexGenEnabled & T_BIT) { |
texUnit->_GenFlags |= texUnit->_GenBitT; |
} |
if (texUnit->TexGenEnabled & Q_BIT) { |
texUnit->_GenFlags |= texUnit->_GenBitQ; |
} |
if (texUnit->TexGenEnabled & R_BIT) { |
texUnit->_GenFlags |= texUnit->_GenBitR; |
} |
ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); |
ctx->Texture._GenFlags |= texUnit->_GenFlags; |
} |
if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) |
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); |
} |
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) { |
ctx->_NeedNormals |= NEED_NORMALS_TEXGEN; |
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; |
} |
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) { |
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; |
} |
} |
/* |
* If ctx->NewState is non-zero then this function MUST be called before |
* rendering any primitive. Basically, function pointers and miscellaneous |
* flags are updated to reflect the current state of the state machine. |
* |
* The above constraint is now maintained largely by the two Exec |
* dispatch tables, which trigger the appropriate flush on transition |
* between State and Geometry modes. |
* |
* Special care is taken with the derived value _NeedEyeCoords. This |
* is a bitflag which is updated with information from a number of |
* attribute groups (MODELVIEW, LIGHT, TEXTURE). A lot of derived |
* state references this value, and must be treated with care to |
* ensure that updates are done correctly. All state dependent on |
* _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(), |
* and from nowhere else. |
*/ |
void _mesa_update_state( GLcontext *ctx ) |
{ |
const GLuint new_state = ctx->NewState; |
const GLuint oldneedeyecoords = ctx->_NeedEyeCoords; |
if (MESA_VERBOSE & VERBOSE_STATE) |
_mesa_print_state("_mesa_update_state", new_state); |
if (new_state & _NEW_MODELVIEW) |
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); |
if (new_state & _NEW_PROJECTION) |
update_projection( ctx ); |
if (new_state & _NEW_TEXTURE_MATRIX) |
update_texture_matrices( ctx ); |
if (new_state & _NEW_COLOR_MATRIX) |
_math_matrix_analyse( ctx->ColorMatrixStack.Top ); |
/* References ColorMatrix.type (derived above). |
*/ |
if (new_state & _IMAGE_NEW_TRANSFER_STATE) |
update_image_transfer_state(ctx); |
/* Contributes to NeedEyeCoords, NeedNormals. |
*/ |
if (new_state & _NEW_TEXTURE) |
update_texture_state( ctx ); |
if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR)) |
update_drawbuffer( ctx ); |
if (new_state & _NEW_POLYGON) |
update_polygon( ctx ); |
/* Contributes to NeedEyeCoords, NeedNormals. |
*/ |
if (new_state & _NEW_LIGHT) |
_mesa_update_lighting( ctx ); |
/* We can light in object space if the modelview matrix preserves |
* lengths and relative angles. |
*/ |
if (new_state & (_NEW_MODELVIEW|_NEW_LIGHT)) { |
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT_MODELVIEW; |
if (ctx->Light.Enabled && |
!TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top, MAT_FLAGS_LENGTH_PRESERVING)) |
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; |
} |
#if 0 |
/* XXX this is a bit of a hack. We should be checking elsewhere if |
* vertex program mode is enabled. We set _NeedEyeCoords to zero to |
* ensure that the combined modelview/projection matrix is computed |
* in calculate_model_project_matrix(). |
*/ |
if (ctx->VertexProgram.Enabled) |
ctx->_NeedEyeCoords = 0; |
/* KW: it's now always computed. |
*/ |
#endif |
/* Keep ModelviewProject uptodate always to allow tnl |
* implementations that go model->clip even when eye is required. |
*/ |
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) |
calculate_model_project_matrix(ctx); |
/* ctx->_NeedEyeCoords is now uptodate. |
* |
* If the truth value of this variable has changed, update for the |
* new lighting space and recompute the positions of lights and the |
* normal transform. |
* |
* If the lighting space hasn't changed, may still need to recompute |
* light positions & normal transforms for other reasons. |
*/ |
if (new_state & (_NEW_MODELVIEW | |
_NEW_LIGHT | |
_MESA_NEW_NEED_EYE_COORDS)) |
update_tnl_spaces( ctx, oldneedeyecoords ); |
/* |
* Here the driver sets up all the ctx->Driver function pointers |
* to it's specific, private functions, and performs any |
* internal state management necessary, including invalidating |
* state of active modules. |
* |
* Set ctx->NewState to zero to avoid recursion if |
* Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) |
*/ |
ctx->NewState = 0; |
ctx->Driver.UpdateState(ctx, new_state); |
ctx->Array.NewState = 0; |
/* At this point we can do some assertions to be sure the required |
* device driver function pointers are all initialized. |
*/ |
ASSERT(ctx->Driver.GetString); |
ASSERT(ctx->Driver.UpdateState); |
ASSERT(ctx->Driver.Clear); |
ASSERT(ctx->Driver.GetBufferSize); |
if (ctx->Visual.accumRedBits > 0) { |
ASSERT(ctx->Driver.Accum); |
} |
ASSERT(ctx->Driver.DrawPixels); |
ASSERT(ctx->Driver.ReadPixels); |
ASSERT(ctx->Driver.CopyPixels); |
ASSERT(ctx->Driver.Bitmap); |
ASSERT(ctx->Driver.ResizeBuffers); |
ASSERT(ctx->Driver.TexImage1D); |
ASSERT(ctx->Driver.TexImage2D); |
ASSERT(ctx->Driver.TexImage3D); |
ASSERT(ctx->Driver.TexSubImage1D); |
ASSERT(ctx->Driver.TexSubImage2D); |
ASSERT(ctx->Driver.TexSubImage3D); |
ASSERT(ctx->Driver.CopyTexImage1D); |
ASSERT(ctx->Driver.CopyTexImage2D); |
ASSERT(ctx->Driver.CopyTexSubImage1D); |
ASSERT(ctx->Driver.CopyTexSubImage2D); |
ASSERT(ctx->Driver.CopyTexSubImage3D); |
if (ctx->Extensions.ARB_texture_compression) { |
#if 0 /* HW drivers need these, but not SW rasterizers */ |
ASSERT(ctx->Driver.CompressedTexImage1D); |
ASSERT(ctx->Driver.CompressedTexImage2D); |
ASSERT(ctx->Driver.CompressedTexImage3D); |
ASSERT(ctx->Driver.CompressedTexSubImage1D); |
ASSERT(ctx->Driver.CompressedTexSubImage2D); |
ASSERT(ctx->Driver.CompressedTexSubImage3D); |
#endif |
} |
} |
/* Is this helpful? |
*/ |
void |
_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ) |
{ |
if (flag) |
ctx->_NeedEyeCoords &= ~NEED_EYE_DRIVER; |
else |
ctx->_NeedEyeCoords |= NEED_EYE_DRIVER; |
ctx->NewState |= _NEW_POINT; /* one of the bits from |
* _MESA_NEW_NEED_EYE_COORDS. |
*/ |
} |
/shark/tags/rel_0_4/ports/mesa/src/pixel.c |
---|
0,0 → 1,1331 |
/* $Id: pixel.c,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "colormac.h" |
#include "context.h" |
#include "macros.h" |
#include "pixel.h" |
#include "mtypes.h" |
/**********************************************************************/ |
/***** glPixelZoom *****/ |
/**********************************************************************/ |
void |
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
if (ctx->Pixel.ZoomX == xfactor && |
ctx->Pixel.ZoomY == yfactor) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.ZoomX = xfactor; |
ctx->Pixel.ZoomY = yfactor; |
} |
/**********************************************************************/ |
/***** glPixelStore *****/ |
/**********************************************************************/ |
void |
_mesa_PixelStorei( GLenum pname, GLint param ) |
{ |
/* NOTE: this call can't be compiled into the display list */ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (pname) { |
case GL_PACK_SWAP_BYTES: |
if (param == (GLint)ctx->Pack.SwapBytes) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_PACK_LSB_FIRST: |
if (param == (GLint)ctx->Pack.LsbFirst) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_PACK_ROW_LENGTH: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.RowLength == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.RowLength = param; |
break; |
case GL_PACK_IMAGE_HEIGHT: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.ImageHeight == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.ImageHeight = param; |
break; |
case GL_PACK_SKIP_PIXELS: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.SkipPixels == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.SkipPixels = param; |
break; |
case GL_PACK_SKIP_ROWS: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.SkipRows == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.SkipRows = param; |
break; |
case GL_PACK_SKIP_IMAGES: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.SkipImages == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.SkipImages = param; |
break; |
case GL_PACK_ALIGNMENT: |
if (param!=1 && param!=2 && param!=4 && param!=8) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Pack.Alignment == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.Alignment = param; |
break; |
case GL_PACK_INVERT_MESA: |
if (!ctx->Extensions.MESA_pack_invert) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); |
return; |
} |
if (ctx->Pack.Invert == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Pack.Invert = param; |
break; |
case GL_UNPACK_SWAP_BYTES: |
if (param == (GLint)ctx->Unpack.SwapBytes) |
return; |
if ((GLint)ctx->Unpack.SwapBytes == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_UNPACK_LSB_FIRST: |
if (param == (GLint)ctx->Unpack.LsbFirst) |
return; |
if ((GLint)ctx->Unpack.LsbFirst == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_UNPACK_ROW_LENGTH: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Unpack.RowLength == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.RowLength = param; |
break; |
case GL_UNPACK_IMAGE_HEIGHT: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Unpack.ImageHeight == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.ImageHeight = param; |
break; |
case GL_UNPACK_SKIP_PIXELS: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Unpack.SkipPixels == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.SkipPixels = param; |
break; |
case GL_UNPACK_SKIP_ROWS: |
if (param<0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Unpack.SkipRows == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.SkipRows = param; |
break; |
case GL_UNPACK_SKIP_IMAGES: |
if (param < 0) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); |
return; |
} |
if (ctx->Unpack.SkipImages == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.SkipImages = param; |
break; |
case GL_UNPACK_ALIGNMENT: |
if (param!=1 && param!=2 && param!=4 && param!=8) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" ); |
return; |
} |
if (ctx->Unpack.Alignment == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.Alignment = param; |
break; |
case GL_UNPACK_CLIENT_STORAGE_APPLE: |
if (param == (GLint)ctx->Unpack.ClientStorage) |
return; |
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); |
ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); |
return; |
} |
} |
void |
_mesa_PixelStoref( GLenum pname, GLfloat param ) |
{ |
_mesa_PixelStorei( pname, (GLint) param ); |
} |
/**********************************************************************/ |
/***** glPixelMap *****/ |
/**********************************************************************/ |
void |
_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) |
{ |
GLint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); |
return; |
} |
if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) { |
/* test that mapsize is a power of two */ |
if (_mesa_bitcount((GLuint) mapsize) != 1) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); |
return; |
} |
} |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
switch (map) { |
case GL_PIXEL_MAP_S_TO_S: |
ctx->Pixel.MapStoSsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapStoS[i] = (GLint) values[i]; |
} |
break; |
case GL_PIXEL_MAP_I_TO_I: |
ctx->Pixel.MapItoIsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapItoI[i] = (GLint) values[i]; |
} |
break; |
case GL_PIXEL_MAP_I_TO_R: |
ctx->Pixel.MapItoRsize = mapsize; |
for (i=0;i<mapsize;i++) { |
GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); |
ctx->Pixel.MapItoR[i] = val; |
ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F); |
} |
break; |
case GL_PIXEL_MAP_I_TO_G: |
ctx->Pixel.MapItoGsize = mapsize; |
for (i=0;i<mapsize;i++) { |
GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); |
ctx->Pixel.MapItoG[i] = val; |
ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F); |
} |
break; |
case GL_PIXEL_MAP_I_TO_B: |
ctx->Pixel.MapItoBsize = mapsize; |
for (i=0;i<mapsize;i++) { |
GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); |
ctx->Pixel.MapItoB[i] = val; |
ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F); |
} |
break; |
case GL_PIXEL_MAP_I_TO_A: |
ctx->Pixel.MapItoAsize = mapsize; |
for (i=0;i<mapsize;i++) { |
GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); |
ctx->Pixel.MapItoA[i] = val; |
ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F); |
} |
break; |
case GL_PIXEL_MAP_R_TO_R: |
ctx->Pixel.MapRtoRsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F ); |
} |
break; |
case GL_PIXEL_MAP_G_TO_G: |
ctx->Pixel.MapGtoGsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F ); |
} |
break; |
case GL_PIXEL_MAP_B_TO_B: |
ctx->Pixel.MapBtoBsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F ); |
} |
break; |
case GL_PIXEL_MAP_A_TO_A: |
ctx->Pixel.MapAtoAsize = mapsize; |
for (i=0;i<mapsize;i++) { |
ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F ); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" ); |
} |
} |
void |
_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ) |
{ |
const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE); |
GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; |
GLint i; |
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) { |
for (i=0;i<n;i++) { |
fvalues[i] = (GLfloat) values[i]; |
} |
} |
else { |
for (i=0;i<n;i++) { |
fvalues[i] = UINT_TO_FLOAT( values[i] ); |
} |
} |
_mesa_PixelMapfv(map, mapsize, fvalues); |
} |
void |
_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values ) |
{ |
const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE); |
GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; |
GLint i; |
if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) { |
for (i=0;i<n;i++) { |
fvalues[i] = (GLfloat) values[i]; |
} |
} |
else { |
for (i=0;i<n;i++) { |
fvalues[i] = USHORT_TO_FLOAT( values[i] ); |
} |
} |
_mesa_PixelMapfv(map, mapsize, fvalues); |
} |
void |
_mesa_GetPixelMapfv( GLenum map, GLfloat *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (map) { |
case GL_PIXEL_MAP_I_TO_I: |
for (i=0;i<ctx->Pixel.MapItoIsize;i++) { |
values[i] = (GLfloat) ctx->Pixel.MapItoI[i]; |
} |
break; |
case GL_PIXEL_MAP_S_TO_S: |
for (i=0;i<ctx->Pixel.MapStoSsize;i++) { |
values[i] = (GLfloat) ctx->Pixel.MapStoS[i]; |
} |
break; |
case GL_PIXEL_MAP_I_TO_R: |
MEMCPY(values,ctx->Pixel.MapItoR,ctx->Pixel.MapItoRsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_I_TO_G: |
MEMCPY(values,ctx->Pixel.MapItoG,ctx->Pixel.MapItoGsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_I_TO_B: |
MEMCPY(values,ctx->Pixel.MapItoB,ctx->Pixel.MapItoBsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_I_TO_A: |
MEMCPY(values,ctx->Pixel.MapItoA,ctx->Pixel.MapItoAsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_R_TO_R: |
MEMCPY(values,ctx->Pixel.MapRtoR,ctx->Pixel.MapRtoRsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_G_TO_G: |
MEMCPY(values,ctx->Pixel.MapGtoG,ctx->Pixel.MapGtoGsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_B_TO_B: |
MEMCPY(values,ctx->Pixel.MapBtoB,ctx->Pixel.MapBtoBsize*sizeof(GLfloat)); |
break; |
case GL_PIXEL_MAP_A_TO_A: |
MEMCPY(values,ctx->Pixel.MapAtoA,ctx->Pixel.MapAtoAsize*sizeof(GLfloat)); |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); |
} |
} |
void |
_mesa_GetPixelMapuiv( GLenum map, GLuint *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (map) { |
case GL_PIXEL_MAP_I_TO_I: |
MEMCPY(values, ctx->Pixel.MapItoI, ctx->Pixel.MapItoIsize*sizeof(GLint)); |
break; |
case GL_PIXEL_MAP_S_TO_S: |
MEMCPY(values, ctx->Pixel.MapStoS, ctx->Pixel.MapStoSsize*sizeof(GLint)); |
break; |
case GL_PIXEL_MAP_I_TO_R: |
for (i=0;i<ctx->Pixel.MapItoRsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_G: |
for (i=0;i<ctx->Pixel.MapItoGsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_B: |
for (i=0;i<ctx->Pixel.MapItoBsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_A: |
for (i=0;i<ctx->Pixel.MapItoAsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] ); |
} |
break; |
case GL_PIXEL_MAP_R_TO_R: |
for (i=0;i<ctx->Pixel.MapRtoRsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] ); |
} |
break; |
case GL_PIXEL_MAP_G_TO_G: |
for (i=0;i<ctx->Pixel.MapGtoGsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] ); |
} |
break; |
case GL_PIXEL_MAP_B_TO_B: |
for (i=0;i<ctx->Pixel.MapBtoBsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] ); |
} |
break; |
case GL_PIXEL_MAP_A_TO_A: |
for (i=0;i<ctx->Pixel.MapAtoAsize;i++) { |
values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] ); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); |
} |
} |
void |
_mesa_GetPixelMapusv( GLenum map, GLushort *values ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint i; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (map) { |
case GL_PIXEL_MAP_I_TO_I: |
for (i=0;i<ctx->Pixel.MapItoIsize;i++) { |
values[i] = (GLushort) ctx->Pixel.MapItoI[i]; |
} |
break; |
case GL_PIXEL_MAP_S_TO_S: |
for (i=0;i<ctx->Pixel.MapStoSsize;i++) { |
values[i] = (GLushort) ctx->Pixel.MapStoS[i]; |
} |
break; |
case GL_PIXEL_MAP_I_TO_R: |
for (i=0;i<ctx->Pixel.MapItoRsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoR[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_G: |
for (i=0;i<ctx->Pixel.MapItoGsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoG[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_B: |
for (i=0;i<ctx->Pixel.MapItoBsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoB[i] ); |
} |
break; |
case GL_PIXEL_MAP_I_TO_A: |
for (i=0;i<ctx->Pixel.MapItoAsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoA[i] ); |
} |
break; |
case GL_PIXEL_MAP_R_TO_R: |
for (i=0;i<ctx->Pixel.MapRtoRsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapRtoR[i] ); |
} |
break; |
case GL_PIXEL_MAP_G_TO_G: |
for (i=0;i<ctx->Pixel.MapGtoGsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapGtoG[i] ); |
} |
break; |
case GL_PIXEL_MAP_B_TO_B: |
for (i=0;i<ctx->Pixel.MapBtoBsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapBtoB[i] ); |
} |
break; |
case GL_PIXEL_MAP_A_TO_A: |
for (i=0;i<ctx->Pixel.MapAtoAsize;i++) { |
values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapAtoA[i] ); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); |
} |
} |
/**********************************************************************/ |
/***** glPixelTransfer *****/ |
/**********************************************************************/ |
/* |
* Implements glPixelTransfer[fi] whether called immediately or from a |
* display list. |
*/ |
void |
_mesa_PixelTransferf( GLenum pname, GLfloat param ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
switch (pname) { |
case GL_MAP_COLOR: |
if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE)) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_MAP_STENCIL: |
if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE)) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE; |
break; |
case GL_INDEX_SHIFT: |
if (ctx->Pixel.IndexShift == (GLint) param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.IndexShift = (GLint) param; |
break; |
case GL_INDEX_OFFSET: |
if (ctx->Pixel.IndexOffset == (GLint) param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.IndexOffset = (GLint) param; |
break; |
case GL_RED_SCALE: |
if (ctx->Pixel.RedScale == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.RedScale = param; |
break; |
case GL_RED_BIAS: |
if (ctx->Pixel.RedBias == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.RedBias = param; |
break; |
case GL_GREEN_SCALE: |
if (ctx->Pixel.GreenScale == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.GreenScale = param; |
break; |
case GL_GREEN_BIAS: |
if (ctx->Pixel.GreenBias == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.GreenBias = param; |
break; |
case GL_BLUE_SCALE: |
if (ctx->Pixel.BlueScale == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.BlueScale = param; |
break; |
case GL_BLUE_BIAS: |
if (ctx->Pixel.BlueBias == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.BlueBias = param; |
break; |
case GL_ALPHA_SCALE: |
if (ctx->Pixel.AlphaScale == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.AlphaScale = param; |
break; |
case GL_ALPHA_BIAS: |
if (ctx->Pixel.AlphaBias == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.AlphaBias = param; |
break; |
case GL_DEPTH_SCALE: |
if (ctx->Pixel.DepthScale == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.DepthScale = param; |
break; |
case GL_DEPTH_BIAS: |
if (ctx->Pixel.DepthBias == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.DepthBias = param; |
break; |
case GL_POST_COLOR_MATRIX_RED_SCALE: |
if (ctx->Pixel.PostColorMatrixScale[0] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixScale[0] = param; |
break; |
case GL_POST_COLOR_MATRIX_RED_BIAS: |
if (ctx->Pixel.PostColorMatrixBias[0] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixBias[0] = param; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_SCALE: |
if (ctx->Pixel.PostColorMatrixScale[1] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixScale[1] = param; |
break; |
case GL_POST_COLOR_MATRIX_GREEN_BIAS: |
if (ctx->Pixel.PostColorMatrixBias[1] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixBias[1] = param; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_SCALE: |
if (ctx->Pixel.PostColorMatrixScale[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixScale[2] = param; |
break; |
case GL_POST_COLOR_MATRIX_BLUE_BIAS: |
if (ctx->Pixel.PostColorMatrixBias[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixBias[2] = param; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_SCALE: |
if (ctx->Pixel.PostColorMatrixScale[3] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixScale[3] = param; |
break; |
case GL_POST_COLOR_MATRIX_ALPHA_BIAS: |
if (ctx->Pixel.PostColorMatrixBias[3] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixBias[3] = param; |
break; |
case GL_POST_CONVOLUTION_RED_SCALE: |
if (ctx->Pixel.PostConvolutionScale[0] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionScale[0] = param; |
break; |
case GL_POST_CONVOLUTION_RED_BIAS: |
if (ctx->Pixel.PostConvolutionBias[0] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionBias[0] = param; |
break; |
case GL_POST_CONVOLUTION_GREEN_SCALE: |
if (ctx->Pixel.PostConvolutionScale[1] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionScale[1] = param; |
break; |
case GL_POST_CONVOLUTION_GREEN_BIAS: |
if (ctx->Pixel.PostConvolutionBias[1] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionBias[1] = param; |
break; |
case GL_POST_CONVOLUTION_BLUE_SCALE: |
if (ctx->Pixel.PostConvolutionScale[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionScale[2] = param; |
break; |
case GL_POST_CONVOLUTION_BLUE_BIAS: |
if (ctx->Pixel.PostConvolutionBias[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionBias[2] = param; |
break; |
case GL_POST_CONVOLUTION_ALPHA_SCALE: |
if (ctx->Pixel.PostConvolutionScale[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionScale[2] = param; |
break; |
case GL_POST_CONVOLUTION_ALPHA_BIAS: |
if (ctx->Pixel.PostConvolutionBias[2] == param) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionBias[2] = param; |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); |
return; |
} |
} |
void |
_mesa_PixelTransferi( GLenum pname, GLint param ) |
{ |
_mesa_PixelTransferf( pname, (GLfloat) param ); |
} |
/**********************************************************************/ |
/***** Pixel processing functions ******/ |
/**********************************************************************/ |
/* |
* Apply scale and bias factors to an array of RGBA pixels. |
*/ |
void |
_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4], |
GLfloat rScale, GLfloat gScale, |
GLfloat bScale, GLfloat aScale, |
GLfloat rBias, GLfloat gBias, |
GLfloat bBias, GLfloat aBias) |
{ |
if (rScale != 1.0 || rBias != 0.0) { |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias; |
} |
} |
if (gScale != 1.0 || gBias != 0.0) { |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias; |
} |
} |
if (bScale != 1.0 || bBias != 0.0) { |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias; |
} |
} |
if (aScale != 1.0 || aBias != 0.0) { |
GLuint i; |
for (i = 0; i < n; i++) { |
rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias; |
} |
} |
} |
/* |
* Apply pixel mapping to an array of floating point RGBA pixels. |
*/ |
void |
_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) |
{ |
const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1); |
const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1); |
const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1); |
const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1); |
const GLfloat *rMap = ctx->Pixel.MapRtoR; |
const GLfloat *gMap = ctx->Pixel.MapGtoG; |
const GLfloat *bMap = ctx->Pixel.MapBtoB; |
const GLfloat *aMap = ctx->Pixel.MapAtoA; |
GLuint i; |
for (i=0;i<n;i++) { |
GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); |
GLfloat g = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); |
GLfloat b = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); |
GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); |
rgba[i][RCOMP] = rMap[IROUND(r * rscale)]; |
rgba[i][GCOMP] = gMap[IROUND(g * gscale)]; |
rgba[i][BCOMP] = bMap[IROUND(b * bscale)]; |
rgba[i][ACOMP] = aMap[IROUND(a * ascale)]; |
} |
} |
/* |
* Apply the color matrix and post color matrix scaling and biasing. |
*/ |
void |
_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) |
{ |
const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0]; |
const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; |
const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; |
const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; |
const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; |
const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; |
const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; |
const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; |
const GLfloat *m = ctx->ColorMatrixStack.Top->m; |
GLuint i; |
for (i = 0; i < n; i++) { |
const GLfloat r = rgba[i][RCOMP]; |
const GLfloat g = rgba[i][GCOMP]; |
const GLfloat b = rgba[i][BCOMP]; |
const GLfloat a = rgba[i][ACOMP]; |
rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; |
rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; |
rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; |
rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; |
} |
} |
/* |
* Apply a color table lookup to an array of colors. |
*/ |
void |
_mesa_lookup_rgba(const struct gl_color_table *table, |
GLuint n, GLfloat rgba[][4]) |
{ |
ASSERT(table->FloatTable); |
if (!table->Table || table->Size == 0) |
return; |
switch (table->Format) { |
case GL_INTENSITY: |
/* replace RGBA with I */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][RCOMP] * scale); |
GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, 1)]); |
rgba[i][RCOMP] = rgba[i][GCOMP] = |
rgba[i][BCOMP] = rgba[i][ACOMP] = c; |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][RCOMP] * scale); |
GLfloat c = lut[CLAMP(j, 0, max)]; |
rgba[i][RCOMP] = rgba[i][GCOMP] = |
rgba[i][BCOMP] = rgba[i][ACOMP] = c; |
} |
} |
break; |
case GL_LUMINANCE: |
/* replace RGB with L */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][RCOMP] * scale); |
GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][RCOMP] * scale); |
GLfloat c = lut[CLAMP(j, 0, max)]; |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; |
} |
} |
break; |
case GL_ALPHA: |
/* replace A with A */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][ACOMP] * scale); |
rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint j = IROUND(rgba[i][ACOMP] * scale); |
rgba[i][ACOMP] = lut[CLAMP(j, 0, max)]; |
} |
} |
break; |
case GL_LUMINANCE_ALPHA: |
/* replace RGBA with LLLA */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jL = IROUND(rgba[i][RCOMP] * scale); |
GLint jA = IROUND(rgba[i][ACOMP] * scale); |
GLfloat luminance, alpha; |
jL = CLAMP(jL, 0, max); |
jA = CLAMP(jA, 0, max); |
luminance = CHAN_TO_FLOAT(lut[jL * 2 + 0]); |
alpha = CHAN_TO_FLOAT(lut[jA * 2 + 1]); |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; |
rgba[i][ACOMP] = alpha;; |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jL = IROUND(rgba[i][RCOMP] * scale); |
GLint jA = IROUND(rgba[i][ACOMP] * scale); |
GLfloat luminance, alpha; |
jL = CLAMP(jL, 0, max); |
jA = CLAMP(jA, 0, max); |
luminance = lut[jL * 2 + 0]; |
alpha = lut[jA * 2 + 1]; |
rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; |
rgba[i][ACOMP] = alpha;; |
} |
} |
break; |
case GL_RGB: |
/* replace RGB with RGB */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jR = IROUND(rgba[i][RCOMP] * scale); |
GLint jG = IROUND(rgba[i][GCOMP] * scale); |
GLint jB = IROUND(rgba[i][BCOMP] * scale); |
jR = CLAMP(jR, 0, max); |
jG = CLAMP(jG, 0, max); |
jB = CLAMP(jB, 0, max); |
rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 3 + 0]); |
rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 3 + 1]); |
rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 3 + 2]); |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jR = IROUND(rgba[i][RCOMP] * scale); |
GLint jG = IROUND(rgba[i][GCOMP] * scale); |
GLint jB = IROUND(rgba[i][BCOMP] * scale); |
jR = CLAMP(jR, 0, max); |
jG = CLAMP(jG, 0, max); |
jB = CLAMP(jB, 0, max); |
rgba[i][RCOMP] = lut[jR * 3 + 0]; |
rgba[i][GCOMP] = lut[jG * 3 + 1]; |
rgba[i][BCOMP] = lut[jB * 3 + 2]; |
} |
} |
break; |
case GL_RGBA: |
/* replace RGBA with RGBA */ |
if (!table->FloatTable) { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLchan *lut = (const GLchan *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jR = IROUND(rgba[i][RCOMP] * scale); |
GLint jG = IROUND(rgba[i][GCOMP] * scale); |
GLint jB = IROUND(rgba[i][BCOMP] * scale); |
GLint jA = IROUND(rgba[i][ACOMP] * scale); |
jR = CLAMP(jR, 0, max); |
jG = CLAMP(jG, 0, max); |
jB = CLAMP(jB, 0, max); |
jA = CLAMP(jA, 0, max); |
rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 4 + 0]); |
rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 4 + 1]); |
rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 4 + 2]); |
rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[jA * 4 + 3]); |
} |
} |
else { |
const GLint max = table->Size - 1; |
const GLfloat scale = (GLfloat) max; |
const GLfloat *lut = (const GLfloat *) table->Table; |
GLuint i; |
for (i = 0; i < n; i++) { |
GLint jR = IROUND(rgba[i][RCOMP] * scale); |
GLint jG = IROUND(rgba[i][GCOMP] * scale); |
GLint jB = IROUND(rgba[i][BCOMP] * scale); |
GLint jA = IROUND(rgba[i][ACOMP] * scale); |
jR = CLAMP(jR, 0, max); |
jG = CLAMP(jG, 0, max); |
jB = CLAMP(jB, 0, max); |
jA = CLAMP(jA, 0, max); |
rgba[i][RCOMP] = lut[jR * 4 + 0]; |
rgba[i][GCOMP] = lut[jG * 4 + 1]; |
rgba[i][BCOMP] = lut[jB * 4 + 2]; |
rgba[i][ACOMP] = lut[jA * 4 + 3]; |
} |
} |
break; |
default: |
_mesa_problem(NULL, "Bad format in _mesa_lookup_rgba"); |
return; |
} |
} |
/* |
* Apply color index shift and offset to an array of pixels. |
*/ |
void |
_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) |
{ |
GLint shift = ctx->Pixel.IndexShift; |
GLint offset = ctx->Pixel.IndexOffset; |
GLuint i; |
if (shift > 0) { |
for (i=0;i<n;i++) { |
indexes[i] = (indexes[i] << shift) + offset; |
} |
} |
else if (shift < 0) { |
shift = -shift; |
for (i=0;i<n;i++) { |
indexes[i] = (indexes[i] >> shift) + offset; |
} |
} |
else { |
for (i=0;i<n;i++) { |
indexes[i] = indexes[i] + offset; |
} |
} |
} |
/* |
* Apply color index mapping to color indexes. |
*/ |
void |
_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) |
{ |
GLuint mask = ctx->Pixel.MapItoIsize - 1; |
GLuint i; |
for (i=0;i<n;i++) { |
index[i] = ctx->Pixel.MapItoI[ index[i] & mask ]; |
} |
} |
/* |
* Map color indexes to rgba values. |
*/ |
void |
_mesa_map_ci_to_rgba_chan( const GLcontext *ctx, GLuint n, |
const GLuint index[], GLchan rgba[][4] ) |
{ |
#if CHAN_BITS == 8 |
GLuint rmask = ctx->Pixel.MapItoRsize - 1; |
GLuint gmask = ctx->Pixel.MapItoGsize - 1; |
GLuint bmask = ctx->Pixel.MapItoBsize - 1; |
GLuint amask = ctx->Pixel.MapItoAsize - 1; |
const GLubyte *rMap = ctx->Pixel.MapItoR8; |
const GLubyte *gMap = ctx->Pixel.MapItoG8; |
const GLubyte *bMap = ctx->Pixel.MapItoB8; |
const GLubyte *aMap = ctx->Pixel.MapItoA8; |
GLuint i; |
for (i=0;i<n;i++) { |
rgba[i][RCOMP] = rMap[index[i] & rmask]; |
rgba[i][GCOMP] = gMap[index[i] & gmask]; |
rgba[i][BCOMP] = bMap[index[i] & bmask]; |
rgba[i][ACOMP] = aMap[index[i] & amask]; |
} |
#else |
GLuint rmask = ctx->Pixel.MapItoRsize - 1; |
GLuint gmask = ctx->Pixel.MapItoGsize - 1; |
GLuint bmask = ctx->Pixel.MapItoBsize - 1; |
GLuint amask = ctx->Pixel.MapItoAsize - 1; |
const GLfloat *rMap = ctx->Pixel.MapItoR; |
const GLfloat *gMap = ctx->Pixel.MapItoG; |
const GLfloat *bMap = ctx->Pixel.MapItoB; |
const GLfloat *aMap = ctx->Pixel.MapItoA; |
GLuint i; |
for (i=0;i<n;i++) { |
CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], rMap[index[i] & rmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], gMap[index[i] & gmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], bMap[index[i] & bmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], aMap[index[i] & amask]); |
} |
#endif |
} |
/* |
* Map color indexes to float rgba values. |
*/ |
void |
_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, |
const GLuint index[], GLfloat rgba[][4] ) |
{ |
GLuint rmask = ctx->Pixel.MapItoRsize - 1; |
GLuint gmask = ctx->Pixel.MapItoGsize - 1; |
GLuint bmask = ctx->Pixel.MapItoBsize - 1; |
GLuint amask = ctx->Pixel.MapItoAsize - 1; |
const GLfloat *rMap = ctx->Pixel.MapItoR; |
const GLfloat *gMap = ctx->Pixel.MapItoG; |
const GLfloat *bMap = ctx->Pixel.MapItoB; |
const GLfloat *aMap = ctx->Pixel.MapItoA; |
GLuint i; |
for (i=0;i<n;i++) { |
rgba[i][RCOMP] = rMap[index[i] & rmask]; |
rgba[i][GCOMP] = gMap[index[i] & gmask]; |
rgba[i][BCOMP] = bMap[index[i] & bmask]; |
rgba[i][ACOMP] = aMap[index[i] & amask]; |
} |
} |
/* |
* Map 8-bit color indexes to rgb values. |
*/ |
void |
_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], |
GLchan rgba[][4] ) |
{ |
#if CHAN_BITS == 8 |
GLuint rmask = ctx->Pixel.MapItoRsize - 1; |
GLuint gmask = ctx->Pixel.MapItoGsize - 1; |
GLuint bmask = ctx->Pixel.MapItoBsize - 1; |
GLuint amask = ctx->Pixel.MapItoAsize - 1; |
const GLubyte *rMap = ctx->Pixel.MapItoR8; |
const GLubyte *gMap = ctx->Pixel.MapItoG8; |
const GLubyte *bMap = ctx->Pixel.MapItoB8; |
const GLubyte *aMap = ctx->Pixel.MapItoA8; |
GLuint i; |
for (i=0;i<n;i++) { |
rgba[i][RCOMP] = rMap[index[i] & rmask]; |
rgba[i][GCOMP] = gMap[index[i] & gmask]; |
rgba[i][BCOMP] = bMap[index[i] & bmask]; |
rgba[i][ACOMP] = aMap[index[i] & amask]; |
} |
#else |
GLuint rmask = ctx->Pixel.MapItoRsize - 1; |
GLuint gmask = ctx->Pixel.MapItoGsize - 1; |
GLuint bmask = ctx->Pixel.MapItoBsize - 1; |
GLuint amask = ctx->Pixel.MapItoAsize - 1; |
const GLfloat *rMap = ctx->Pixel.MapItoR; |
const GLfloat *gMap = ctx->Pixel.MapItoG; |
const GLfloat *bMap = ctx->Pixel.MapItoB; |
const GLfloat *aMap = ctx->Pixel.MapItoA; |
GLuint i; |
for (i=0;i<n;i++) { |
CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], rMap[index[i] & rmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], gMap[index[i] & gmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], bMap[index[i] & bmask]); |
CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], aMap[index[i] & amask]); |
} |
#endif |
} |
void |
_mesa_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, |
GLstencil stencil[] ) |
{ |
GLuint i; |
GLint shift = ctx->Pixel.IndexShift; |
GLint offset = ctx->Pixel.IndexOffset; |
if (shift > 0) { |
for (i=0;i<n;i++) { |
stencil[i] = (stencil[i] << shift) + offset; |
} |
} |
else if (shift < 0) { |
shift = -shift; |
for (i=0;i<n;i++) { |
stencil[i] = (stencil[i] >> shift) + offset; |
} |
} |
else { |
for (i=0;i<n;i++) { |
stencil[i] = stencil[i] + offset; |
} |
} |
} |
void |
_mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) |
{ |
GLuint mask = ctx->Pixel.MapStoSsize - 1; |
GLuint i; |
for (i=0;i<n;i++) { |
stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; |
} |
} |
/* |
* This function converts an array of GLchan colors to GLfloat colors. |
* Most importantly, it undoes the non-uniform quantization of pixel |
* values introduced when we convert shallow (< 8 bit) pixel values |
* to GLubytes in the ctx->Driver.ReadRGBASpan() functions. |
* This fixes a number of OpenGL conformance failures when running on |
* 16bpp displays, for example. |
*/ |
void |
_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, |
CONST GLchan rgba[][4], GLfloat rgbaf[][4]) |
{ |
#if CHAN_TYPE == GL_FLOAT |
MEMCPY(rgbaf, rgba, n * 4 * sizeof(GLfloat)); |
#else |
const GLuint rShift = CHAN_BITS - ctx->Visual.redBits; |
const GLuint gShift = CHAN_BITS - ctx->Visual.greenBits; |
const GLuint bShift = CHAN_BITS - ctx->Visual.blueBits; |
GLuint aShift; |
const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1); |
const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1); |
const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1); |
GLfloat aScale; |
GLuint i; |
if (ctx->Visual.alphaBits > 0) { |
aShift = CHAN_BITS - ctx->Visual.alphaBits; |
aScale = 1.0F / (GLfloat) ((1 << ctx->Visual.alphaBits) - 1); |
} |
else { |
aShift = 0; |
aScale = 1.0F / CHAN_MAXF; |
} |
for (i = 0; i < n; i++) { |
const GLint r = rgba[i][RCOMP] >> rShift; |
const GLint g = rgba[i][GCOMP] >> gShift; |
const GLint b = rgba[i][BCOMP] >> bShift; |
const GLint a = rgba[i][ACOMP] >> aShift; |
rgbaf[i][RCOMP] = (GLfloat) r * rScale; |
rgbaf[i][GCOMP] = (GLfloat) g * gScale; |
rgbaf[i][BCOMP] = (GLfloat) b * bScale; |
rgbaf[i][ACOMP] = (GLfloat) a * aScale; |
} |
#endif |
} |
/shark/tags/rel_0_4/ports/mesa/src/get.h |
---|
0,0 → 1,58 |
/* $Id: get.h,v 1.1 2003-02-28 11:42:01 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef GET_H |
#define GET_H |
#include "mtypes.h" |
extern void |
_mesa_GetBooleanv( GLenum pname, GLboolean *params ); |
extern void |
_mesa_GetDoublev( GLenum pname, GLdouble *params ); |
extern void |
_mesa_GetFloatv( GLenum pname, GLfloat *params ); |
extern void |
_mesa_GetIntegerv( GLenum pname, GLint *params ); |
extern void |
_mesa_GetPointerv( GLenum pname, GLvoid **params ); |
extern const GLubyte * |
_mesa_GetString( GLenum name ); |
extern GLenum |
_mesa_GetError( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/state.h |
---|
0,0 → 1,52 |
/* $Id: state.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef STATE_H |
#define STATE_H |
#include "mtypes.h" |
extern void |
_mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize); |
extern void |
_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize); |
extern void |
_mesa_update_state( GLcontext *ctx ); |
extern void |
_mesa_print_state( const char *msg, GLuint state ); |
extern void |
_mesa_print_enable_flags( const char *msg, GLuint flags ); |
extern void |
_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/enable.c |
---|
0,0 → 1,1286 |
/* $Id: enable.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "context.h" |
#include "enable.h" |
#include "light.h" |
#include "macros.h" |
#include "mmath.h" |
#include "simple_list.h" |
#include "mtypes.h" |
#include "enums.h" |
#include "math/m_matrix.h" |
#include "math/m_xform.h" |
#define CHECK_EXTENSION(EXTNAME, CAP) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ |
state ? "Enable" : "Disable", CAP); \ |
return; \ |
} |
static void |
client_state( GLcontext *ctx, GLenum cap, GLboolean state ) |
{ |
GLuint flag; |
GLuint *var; |
switch (cap) { |
case GL_VERTEX_ARRAY: |
var = &ctx->Array.Vertex.Enabled; |
flag = _NEW_ARRAY_VERTEX; |
break; |
case GL_NORMAL_ARRAY: |
var = &ctx->Array.Normal.Enabled; |
flag = _NEW_ARRAY_NORMAL; |
break; |
case GL_COLOR_ARRAY: |
var = &ctx->Array.Color.Enabled; |
flag = _NEW_ARRAY_COLOR0; |
break; |
case GL_INDEX_ARRAY: |
var = &ctx->Array.Index.Enabled; |
flag = _NEW_ARRAY_INDEX; |
break; |
case GL_TEXTURE_COORD_ARRAY: |
var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; |
flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); |
break; |
case GL_EDGE_FLAG_ARRAY: |
var = &ctx->Array.EdgeFlag.Enabled; |
flag = _NEW_ARRAY_EDGEFLAG; |
break; |
case GL_FOG_COORDINATE_ARRAY_EXT: |
var = &ctx->Array.FogCoord.Enabled; |
flag = _NEW_ARRAY_FOGCOORD; |
break; |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
var = &ctx->Array.SecondaryColor.Enabled; |
flag = _NEW_ARRAY_COLOR1; |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
{ |
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
var = &ctx->Array.VertexAttrib[n].Enabled; |
flag = _NEW_ARRAY_ATTRIB(n); |
} |
break; |
#endif /* FEATURE_NV_vertex_program */ |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, |
"glEnable/DisableClientState(0x%x)", cap); |
return; |
} |
if (*var == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_ARRAY); |
ctx->Array.NewState |= flag; |
*var = state; |
if (state) |
ctx->Array._Enabled |= flag; |
else |
ctx->Array._Enabled &= ~flag; |
if (ctx->Driver.Enable) { |
(*ctx->Driver.Enable)( ctx, cap, state ); |
} |
} |
void |
_mesa_EnableClientState( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
client_state( ctx, cap, GL_TRUE ); |
} |
void |
_mesa_DisableClientState( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
client_state( ctx, cap, GL_FALSE ); |
} |
#undef CHECK_EXTENSION |
#define CHECK_EXTENSION(EXTNAME, CAP) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ |
state ? "Enable" : "Disable", CAP); \ |
return; \ |
} |
/* |
* Perform glEnable and glDisable calls. |
*/ |
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) |
{ |
if (MESA_VERBOSE & VERBOSE_API) |
_mesa_debug(ctx, "%s %s (newstate is %x)\n", |
state ? "glEnable" : "glDisable", |
_mesa_lookup_enum_by_nr(cap), |
ctx->NewState); |
switch (cap) { |
case GL_ALPHA_TEST: |
if (ctx->Color.AlphaEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.AlphaEnabled = state; |
break; |
case GL_AUTO_NORMAL: |
if (ctx->Eval.AutoNormal == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.AutoNormal = state; |
break; |
case GL_BLEND: |
if (ctx->Color.BlendEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.BlendEnabled = state; |
/* The following needed to accomodate 1.0 RGB logic op blending */ |
ctx->Color.ColorLogicOpEnabled = |
(ctx->Color.BlendEquation == GL_LOGIC_OP && state); |
break; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
{ |
const GLuint p = cap - GL_CLIP_PLANE0; |
if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
if (state) { |
ctx->Transform.ClipPlanesEnabled |= (1 << p); |
if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) |
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); |
/* This derived state also calculated in clip.c and |
* from _mesa_update_state() on changes to EyeUserPlane |
* and ctx->ProjectionMatrix respectively. |
*/ |
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p], |
ctx->Transform.EyeUserPlane[p], |
ctx->ProjectionMatrixStack.Top->inv ); |
} |
else { |
ctx->Transform.ClipPlanesEnabled &= ~(1 << p); |
} |
} |
break; |
case GL_COLOR_MATERIAL: |
if (ctx->Light.ColorMaterialEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.ColorMaterialEnabled = state; |
if (state) { |
FLUSH_CURRENT(ctx, 0); |
_mesa_update_color_material( ctx, |
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); |
} |
break; |
case GL_CULL_FACE: |
if (ctx->Polygon.CullFlag == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.CullFlag = state; |
break; |
case GL_DEPTH_TEST: |
if (state && ctx->Visual.depthBits==0) { |
_mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); |
return; |
} |
if (ctx->Depth.Test==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_DEPTH); |
ctx->Depth.Test = state; |
break; |
case GL_DITHER: |
if (ctx->NoDither) { |
state = GL_FALSE; /* MESA_NO_DITHER env var */ |
} |
if (ctx->Color.DitherFlag==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.DitherFlag = state; |
break; |
case GL_FOG: |
if (ctx->Fog.Enabled==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.Enabled = state; |
break; |
case GL_HISTOGRAM: |
CHECK_EXTENSION(EXT_histogram, cap); |
if (ctx->Pixel.HistogramEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.HistogramEnabled = state; |
break; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; |
if (state) { |
insert_at_tail(&ctx->Light.EnabledList, |
&ctx->Light.Light[cap-GL_LIGHT0]); |
} |
else { |
remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); |
} |
break; |
case GL_LIGHTING: |
if (ctx->Light.Enabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_LIGHT); |
ctx->Light.Enabled = state; |
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) |
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; |
else |
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; |
if ((ctx->Light.Enabled && |
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) |
|| ctx->Fog.ColorSumEnabled) |
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; |
else |
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; |
break; |
case GL_LINE_SMOOTH: |
if (ctx->Line.SmoothFlag == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_LINE); |
ctx->Line.SmoothFlag = state; |
ctx->_TriangleCaps ^= DD_LINE_SMOOTH; |
break; |
case GL_LINE_STIPPLE: |
if (ctx->Line.StippleFlag == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_LINE); |
ctx->Line.StippleFlag = state; |
ctx->_TriangleCaps ^= DD_LINE_STIPPLE; |
break; |
case GL_INDEX_LOGIC_OP: |
if (ctx->Color.IndexLogicOpEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.IndexLogicOpEnabled = state; |
break; |
case GL_COLOR_LOGIC_OP: |
if (ctx->Color.ColorLogicOpEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_COLOR); |
ctx->Color.ColorLogicOpEnabled = state; |
break; |
case GL_MAP1_COLOR_4: |
if (ctx->Eval.Map1Color4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Color4 = state; |
break; |
case GL_MAP1_INDEX: |
if (ctx->Eval.Map1Index == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Index = state; |
break; |
case GL_MAP1_NORMAL: |
if (ctx->Eval.Map1Normal == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Normal = state; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
if (ctx->Eval.Map1TextureCoord1 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1TextureCoord1 = state; |
break; |
case GL_MAP1_TEXTURE_COORD_2: |
if (ctx->Eval.Map1TextureCoord2 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1TextureCoord2 = state; |
break; |
case GL_MAP1_TEXTURE_COORD_3: |
if (ctx->Eval.Map1TextureCoord3 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1TextureCoord3 = state; |
break; |
case GL_MAP1_TEXTURE_COORD_4: |
if (ctx->Eval.Map1TextureCoord4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1TextureCoord4 = state; |
break; |
case GL_MAP1_VERTEX_3: |
if (ctx->Eval.Map1Vertex3 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Vertex3 = state; |
break; |
case GL_MAP1_VERTEX_4: |
if (ctx->Eval.Map1Vertex4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Vertex4 = state; |
break; |
case GL_MAP2_COLOR_4: |
if (ctx->Eval.Map2Color4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Color4 = state; |
break; |
case GL_MAP2_INDEX: |
if (ctx->Eval.Map2Index == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Index = state; |
break; |
case GL_MAP2_NORMAL: |
if (ctx->Eval.Map2Normal == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Normal = state; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
if (ctx->Eval.Map2TextureCoord1 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2TextureCoord1 = state; |
break; |
case GL_MAP2_TEXTURE_COORD_2: |
if (ctx->Eval.Map2TextureCoord2 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2TextureCoord2 = state; |
break; |
case GL_MAP2_TEXTURE_COORD_3: |
if (ctx->Eval.Map2TextureCoord3 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2TextureCoord3 = state; |
break; |
case GL_MAP2_TEXTURE_COORD_4: |
if (ctx->Eval.Map2TextureCoord4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2TextureCoord4 = state; |
break; |
case GL_MAP2_VERTEX_3: |
if (ctx->Eval.Map2Vertex3 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Vertex3 = state; |
break; |
case GL_MAP2_VERTEX_4: |
if (ctx->Eval.Map2Vertex4 == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Vertex4 = state; |
break; |
case GL_MINMAX: |
if (ctx->Pixel.MinMaxEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.MinMaxEnabled = state; |
break; |
case GL_NORMALIZE: |
if (ctx->Transform.Normalize == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
ctx->Transform.Normalize = state; |
break; |
case GL_POINT_SMOOTH: |
if (ctx->Point.SmoothFlag==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.SmoothFlag = state; |
ctx->_TriangleCaps ^= DD_POINT_SMOOTH; |
break; |
case GL_POLYGON_SMOOTH: |
if (ctx->Polygon.SmoothFlag==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.SmoothFlag = state; |
ctx->_TriangleCaps ^= DD_TRI_SMOOTH; |
break; |
case GL_POLYGON_STIPPLE: |
if (ctx->Polygon.StippleFlag==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.StippleFlag = state; |
ctx->_TriangleCaps ^= DD_TRI_STIPPLE; |
break; |
case GL_POLYGON_OFFSET_POINT: |
if (ctx->Polygon.OffsetPoint==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.OffsetPoint = state; |
break; |
case GL_POLYGON_OFFSET_LINE: |
if (ctx->Polygon.OffsetLine==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.OffsetLine = state; |
break; |
case GL_POLYGON_OFFSET_FILL: |
/*case GL_POLYGON_OFFSET_EXT:*/ |
if (ctx->Polygon.OffsetFill==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POLYGON); |
ctx->Polygon.OffsetFill = state; |
break; |
case GL_RESCALE_NORMAL_EXT: |
if (ctx->Transform.RescaleNormals == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
ctx->Transform.RescaleNormals = state; |
break; |
case GL_SCISSOR_TEST: |
if (ctx->Scissor.Enabled==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_SCISSOR); |
ctx->Scissor.Enabled = state; |
break; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
if (ctx->Texture.SharedPalette == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
ctx->Texture.SharedPalette = state; |
break; |
case GL_STENCIL_TEST: |
if (state && ctx->Visual.stencilBits==0) { |
_mesa_warning(ctx, |
"glEnable(GL_STENCIL_TEST) but no stencil buffer"); |
return; |
} |
if (ctx->Stencil.Enabled==state) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.Enabled = state; |
break; |
case GL_TEXTURE_1D: { |
const GLuint curr = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; |
if (state) |
newenabled |= TEXTURE_1D_BIT; |
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->Enabled = newenabled; |
break; |
} |
case GL_TEXTURE_2D: { |
const GLuint curr = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; |
if (state) |
newenabled |= TEXTURE_2D_BIT; |
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->Enabled = newenabled; |
break; |
} |
case GL_TEXTURE_3D: { |
const GLuint curr = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; |
if (state) |
newenabled |= TEXTURE_3D_BIT; |
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->Enabled = newenabled; |
break; |
} |
case GL_TEXTURE_GEN_Q: { |
GLuint unit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; |
if (state) |
newenabled |= Q_BIT; |
if (texUnit->TexGenEnabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->TexGenEnabled = newenabled; |
break; |
} |
case GL_TEXTURE_GEN_R: { |
GLuint unit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; |
if (state) |
newenabled |= R_BIT; |
if (texUnit->TexGenEnabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->TexGenEnabled = newenabled; |
break; |
} |
break; |
case GL_TEXTURE_GEN_S: { |
GLuint unit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; |
if (state) |
newenabled |= S_BIT; |
if (texUnit->TexGenEnabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->TexGenEnabled = newenabled; |
break; |
} |
break; |
case GL_TEXTURE_GEN_T: { |
GLuint unit = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; |
GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; |
if (state) |
newenabled |= T_BIT; |
if (texUnit->TexGenEnabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->TexGenEnabled = newenabled; |
break; |
} |
break; |
/* |
* CLIENT STATE!!! |
*/ |
case GL_VERTEX_ARRAY: |
case GL_NORMAL_ARRAY: |
case GL_COLOR_ARRAY: |
case GL_INDEX_ARRAY: |
case GL_TEXTURE_COORD_ARRAY: |
case GL_EDGE_FLAG_ARRAY: |
case GL_FOG_COORDINATE_ARRAY_EXT: |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
client_state( ctx, cap, state ); |
return; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION(HP_occlusion_test, cap); |
if (ctx->Depth.OcclusionTest == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_DEPTH); |
ctx->Depth.OcclusionTest = state; |
if (state) |
ctx->OcclusionResult = ctx->OcclusionResultSaved; |
else |
ctx->OcclusionResultSaved = ctx->OcclusionResult; |
break; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
CHECK_EXTENSION(SGIS_pixel_texture, cap); |
if (ctx->Pixel.PixelTextureEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PixelTextureEnabled = state; |
break; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
CHECK_EXTENSION(SGIX_pixel_texture, cap); |
if (ctx->Pixel.PixelTextureEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PixelTextureEnabled = state; |
break; |
/* GL_SGI_color_table */ |
case GL_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table, cap); |
if (ctx->Pixel.ColorTableEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.ColorTableEnabled = state; |
break; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table, cap); |
if (ctx->Pixel.PostConvolutionColorTableEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostConvolutionColorTableEnabled = state; |
break; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table, cap); |
if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.PostColorMatrixColorTableEnabled = state; |
break; |
/* GL_EXT_convolution */ |
case GL_CONVOLUTION_1D: |
CHECK_EXTENSION(EXT_convolution, cap); |
if (ctx->Pixel.Convolution1DEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.Convolution1DEnabled = state; |
break; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION(EXT_convolution, cap); |
if (ctx->Pixel.Convolution2DEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.Convolution2DEnabled = state; |
break; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION(EXT_convolution, cap); |
if (ctx->Pixel.Separable2DEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->Pixel.Separable2DEnabled = state; |
break; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
{ |
const GLuint curr = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; |
CHECK_EXTENSION(ARB_texture_cube_map, cap); |
if (state) |
newenabled |= TEXTURE_CUBE_BIT; |
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->Enabled = newenabled; |
} |
break; |
/* GL_EXT_secondary_color */ |
case GL_COLOR_SUM_EXT: |
CHECK_EXTENSION(EXT_secondary_color, cap); |
if (ctx->Fog.ColorSumEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_FOG); |
ctx->Fog.ColorSumEnabled = state; |
if ((ctx->Light.Enabled && |
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) |
|| ctx->Fog.ColorSumEnabled) |
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; |
else |
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; |
break; |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION(ARB_multisample, cap); |
if (ctx->Multisample.Enabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
ctx->Multisample.Enabled = state; |
break; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION(ARB_multisample, cap); |
if (ctx->Multisample.SampleAlphaToCoverage == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
ctx->Multisample.SampleAlphaToCoverage = state; |
break; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION(ARB_multisample, cap); |
if (ctx->Multisample.SampleAlphaToOne == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
ctx->Multisample.SampleAlphaToOne = state; |
break; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION(ARB_multisample, cap); |
if (ctx->Multisample.SampleCoverage == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
ctx->Multisample.SampleCoverage = state; |
break; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION(ARB_multisample, cap); |
if (ctx->Multisample.SampleCoverageInvert == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); |
ctx->Multisample.SampleCoverageInvert = state; |
break; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION(IBM_rasterpos_clip, cap); |
if (ctx->Transform.RasterPositionUnclipped == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM); |
ctx->Transform.RasterPositionUnclipped = state; |
break; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
CHECK_EXTENSION(NV_point_sprite, cap); |
if (ctx->Point.PointSprite == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT); |
ctx->Point.PointSprite = state; |
break; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
if (ctx->VertexProgram.Enabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */ |
ctx->VertexProgram.Enabled = state; |
break; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
if (ctx->VertexProgram.PointSizeEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM); |
ctx->VertexProgram.PointSizeEnabled = state; |
break; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
if (ctx->VertexProgram.TwoSideEnabled == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */ |
ctx->VertexProgram.TwoSideEnabled = state; |
break; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
{ |
const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map1Attrib[map] = state; |
} |
break; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION(NV_vertex_program, cap); |
{ |
const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.Map2Attrib[map] = state; |
} |
break; |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION(NV_texture_rectangle, cap); |
{ |
const GLuint curr = ctx->Texture.CurrentUnit; |
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; |
CHECK_EXTENSION(NV_texture_rectangle, cap); |
if (state) |
newenabled |= TEXTURE_RECT_BIT; |
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) |
return; |
FLUSH_VERTICES(ctx, _NEW_TEXTURE); |
texUnit->Enabled = newenabled; |
} |
break; |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION(EXT_stencil_two_side, cap); |
if (ctx->Stencil.TestTwoSide == state) |
return; |
FLUSH_VERTICES(ctx, _NEW_STENCIL); |
ctx->Stencil.TestTwoSide = state; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, |
"%s(0x%x)", state ? "glEnable" : "glDisable", cap); |
return; |
} |
if (ctx->Driver.Enable) { |
(*ctx->Driver.Enable)( ctx, cap, state ); |
} |
} |
void |
_mesa_Enable( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
_mesa_set_enable( ctx, cap, GL_TRUE ); |
} |
void |
_mesa_Disable( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
_mesa_set_enable( ctx, cap, GL_FALSE ); |
} |
#undef CHECK_EXTENSION |
#define CHECK_EXTENSION(EXTNAME) \ |
if (!ctx->Extensions.EXTNAME) { \ |
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ |
return GL_FALSE; \ |
} |
GLboolean |
_mesa_IsEnabled( GLenum cap ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
switch (cap) { |
case GL_ALPHA_TEST: |
return ctx->Color.AlphaEnabled; |
case GL_AUTO_NORMAL: |
return ctx->Eval.AutoNormal; |
case GL_BLEND: |
return ctx->Color.BlendEnabled; |
case GL_CLIP_PLANE0: |
case GL_CLIP_PLANE1: |
case GL_CLIP_PLANE2: |
case GL_CLIP_PLANE3: |
case GL_CLIP_PLANE4: |
case GL_CLIP_PLANE5: |
return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; |
case GL_COLOR_MATERIAL: |
return ctx->Light.ColorMaterialEnabled; |
case GL_CULL_FACE: |
return ctx->Polygon.CullFlag; |
case GL_DEPTH_TEST: |
return ctx->Depth.Test; |
case GL_DITHER: |
return ctx->Color.DitherFlag; |
case GL_FOG: |
return ctx->Fog.Enabled; |
case GL_LIGHTING: |
return ctx->Light.Enabled; |
case GL_LIGHT0: |
case GL_LIGHT1: |
case GL_LIGHT2: |
case GL_LIGHT3: |
case GL_LIGHT4: |
case GL_LIGHT5: |
case GL_LIGHT6: |
case GL_LIGHT7: |
return ctx->Light.Light[cap-GL_LIGHT0].Enabled; |
case GL_LINE_SMOOTH: |
return ctx->Line.SmoothFlag; |
case GL_LINE_STIPPLE: |
return ctx->Line.StippleFlag; |
case GL_INDEX_LOGIC_OP: |
return ctx->Color.IndexLogicOpEnabled; |
case GL_COLOR_LOGIC_OP: |
return ctx->Color.ColorLogicOpEnabled; |
case GL_MAP1_COLOR_4: |
return ctx->Eval.Map1Color4; |
case GL_MAP1_INDEX: |
return ctx->Eval.Map1Index; |
case GL_MAP1_NORMAL: |
return ctx->Eval.Map1Normal; |
case GL_MAP1_TEXTURE_COORD_1: |
return ctx->Eval.Map1TextureCoord1; |
case GL_MAP1_TEXTURE_COORD_2: |
return ctx->Eval.Map1TextureCoord2; |
case GL_MAP1_TEXTURE_COORD_3: |
return ctx->Eval.Map1TextureCoord3; |
case GL_MAP1_TEXTURE_COORD_4: |
return ctx->Eval.Map1TextureCoord4; |
case GL_MAP1_VERTEX_3: |
return ctx->Eval.Map1Vertex3; |
case GL_MAP1_VERTEX_4: |
return ctx->Eval.Map1Vertex4; |
case GL_MAP2_COLOR_4: |
return ctx->Eval.Map2Color4; |
case GL_MAP2_INDEX: |
return ctx->Eval.Map2Index; |
case GL_MAP2_NORMAL: |
return ctx->Eval.Map2Normal; |
case GL_MAP2_TEXTURE_COORD_1: |
return ctx->Eval.Map2TextureCoord1; |
case GL_MAP2_TEXTURE_COORD_2: |
return ctx->Eval.Map2TextureCoord2; |
case GL_MAP2_TEXTURE_COORD_3: |
return ctx->Eval.Map2TextureCoord3; |
case GL_MAP2_TEXTURE_COORD_4: |
return ctx->Eval.Map2TextureCoord4; |
case GL_MAP2_VERTEX_3: |
return ctx->Eval.Map2Vertex3; |
case GL_MAP2_VERTEX_4: |
return ctx->Eval.Map2Vertex4; |
case GL_NORMALIZE: |
return ctx->Transform.Normalize; |
case GL_POINT_SMOOTH: |
return ctx->Point.SmoothFlag; |
case GL_POLYGON_SMOOTH: |
return ctx->Polygon.SmoothFlag; |
case GL_POLYGON_STIPPLE: |
return ctx->Polygon.StippleFlag; |
case GL_POLYGON_OFFSET_POINT: |
return ctx->Polygon.OffsetPoint; |
case GL_POLYGON_OFFSET_LINE: |
return ctx->Polygon.OffsetLine; |
case GL_POLYGON_OFFSET_FILL: |
/*case GL_POLYGON_OFFSET_EXT:*/ |
return ctx->Polygon.OffsetFill; |
case GL_RESCALE_NORMAL_EXT: |
return ctx->Transform.RescaleNormals; |
case GL_SCISSOR_TEST: |
return ctx->Scissor.Enabled; |
case GL_SHARED_TEXTURE_PALETTE_EXT: |
return ctx->Texture.SharedPalette; |
case GL_STENCIL_TEST: |
return ctx->Stencil.Enabled; |
case GL_TEXTURE_1D: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_2D: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_3D: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_GEN_Q: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_GEN_R: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_GEN_S: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
} |
case GL_TEXTURE_GEN_T: |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
} |
/* |
* CLIENT STATE!!! |
*/ |
case GL_VERTEX_ARRAY: |
return (ctx->Array.Vertex.Enabled != 0); |
case GL_NORMAL_ARRAY: |
return (ctx->Array.Normal.Enabled != 0); |
case GL_COLOR_ARRAY: |
return (ctx->Array.Color.Enabled != 0); |
case GL_INDEX_ARRAY: |
return (ctx->Array.Index.Enabled != 0); |
case GL_TEXTURE_COORD_ARRAY: |
return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); |
case GL_EDGE_FLAG_ARRAY: |
return (ctx->Array.EdgeFlag.Enabled != 0); |
case GL_FOG_COORDINATE_ARRAY_EXT: |
CHECK_EXTENSION(EXT_fog_coord); |
return (ctx->Array.FogCoord.Enabled != 0); |
case GL_SECONDARY_COLOR_ARRAY_EXT: |
CHECK_EXTENSION(EXT_secondary_color); |
return (ctx->Array.SecondaryColor.Enabled != 0); |
/* GL_EXT_histogram */ |
case GL_HISTOGRAM: |
CHECK_EXTENSION(EXT_histogram); |
return ctx->Pixel.HistogramEnabled; |
case GL_MINMAX: |
CHECK_EXTENSION(EXT_histogram); |
return ctx->Pixel.MinMaxEnabled; |
/* GL_HP_occlusion_test */ |
case GL_OCCLUSION_TEST_HP: |
CHECK_EXTENSION(HP_occlusion_test); |
return ctx->Depth.OcclusionTest; |
/* GL_SGIS_pixel_texture */ |
case GL_PIXEL_TEXTURE_SGIS: |
CHECK_EXTENSION(SGIS_pixel_texture); |
return ctx->Pixel.PixelTextureEnabled; |
/* GL_SGIX_pixel_texture */ |
case GL_PIXEL_TEX_GEN_SGIX: |
CHECK_EXTENSION(SGIX_pixel_texture); |
return ctx->Pixel.PixelTextureEnabled; |
/* GL_SGI_color_table */ |
case GL_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table); |
return ctx->Pixel.ColorTableEnabled; |
case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table); |
return ctx->Pixel.PostConvolutionColorTableEnabled; |
case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
CHECK_EXTENSION(SGI_color_table); |
return ctx->Pixel.PostColorMatrixColorTableEnabled; |
/* GL_EXT_convolution */ |
case GL_CONVOLUTION_1D: |
CHECK_EXTENSION(EXT_convolution); |
return ctx->Pixel.Convolution1DEnabled; |
case GL_CONVOLUTION_2D: |
CHECK_EXTENSION(EXT_convolution); |
return ctx->Pixel.Convolution2DEnabled; |
case GL_SEPARABLE_2D: |
CHECK_EXTENSION(EXT_convolution); |
return ctx->Pixel.Separable2DEnabled; |
/* GL_ARB_texture_cube_map */ |
case GL_TEXTURE_CUBE_MAP_ARB: |
CHECK_EXTENSION(ARB_texture_cube_map); |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; |
} |
/* GL_ARB_multisample */ |
case GL_MULTISAMPLE_ARB: |
CHECK_EXTENSION(ARB_multisample); |
return ctx->Multisample.Enabled; |
case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: |
CHECK_EXTENSION(ARB_multisample); |
return ctx->Multisample.SampleAlphaToCoverage; |
case GL_SAMPLE_ALPHA_TO_ONE_ARB: |
CHECK_EXTENSION(ARB_multisample); |
return ctx->Multisample.SampleAlphaToOne; |
case GL_SAMPLE_COVERAGE_ARB: |
CHECK_EXTENSION(ARB_multisample); |
return ctx->Multisample.SampleCoverage; |
case GL_SAMPLE_COVERAGE_INVERT_ARB: |
CHECK_EXTENSION(ARB_multisample); |
return ctx->Multisample.SampleCoverageInvert; |
/* GL_IBM_rasterpos_clip */ |
case GL_RASTER_POSITION_UNCLIPPED_IBM: |
CHECK_EXTENSION(IBM_rasterpos_clip); |
return ctx->Transform.RasterPositionUnclipped; |
/* GL_NV_point_sprite */ |
case GL_POINT_SPRITE_NV: |
return ctx->Point.PointSprite; |
#if FEATURE_NV_vertex_program |
case GL_VERTEX_PROGRAM_NV: |
CHECK_EXTENSION(NV_vertex_program); |
return ctx->VertexProgram.Enabled; |
case GL_VERTEX_PROGRAM_POINT_SIZE_NV: |
CHECK_EXTENSION(NV_vertex_program); |
return ctx->VertexProgram.PointSizeEnabled; |
case GL_VERTEX_PROGRAM_TWO_SIDE_NV: |
CHECK_EXTENSION(NV_vertex_program); |
return ctx->VertexProgram.TwoSideEnabled; |
case GL_VERTEX_ATTRIB_ARRAY0_NV: |
case GL_VERTEX_ATTRIB_ARRAY1_NV: |
case GL_VERTEX_ATTRIB_ARRAY2_NV: |
case GL_VERTEX_ATTRIB_ARRAY3_NV: |
case GL_VERTEX_ATTRIB_ARRAY4_NV: |
case GL_VERTEX_ATTRIB_ARRAY5_NV: |
case GL_VERTEX_ATTRIB_ARRAY6_NV: |
case GL_VERTEX_ATTRIB_ARRAY7_NV: |
case GL_VERTEX_ATTRIB_ARRAY8_NV: |
case GL_VERTEX_ATTRIB_ARRAY9_NV: |
case GL_VERTEX_ATTRIB_ARRAY10_NV: |
case GL_VERTEX_ATTRIB_ARRAY11_NV: |
case GL_VERTEX_ATTRIB_ARRAY12_NV: |
case GL_VERTEX_ATTRIB_ARRAY13_NV: |
case GL_VERTEX_ATTRIB_ARRAY14_NV: |
case GL_VERTEX_ATTRIB_ARRAY15_NV: |
CHECK_EXTENSION(NV_vertex_program); |
{ |
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; |
return (ctx->Array.VertexAttrib[n].Enabled != 0); |
} |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION(NV_vertex_program); |
{ |
const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); |
return ctx->Eval.Map1Attrib[map]; |
} |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
CHECK_EXTENSION(NV_vertex_program); |
{ |
const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); |
return ctx->Eval.Map2Attrib[map]; |
} |
#endif /* FEATURE_NV_vertex_program */ |
/* GL_NV_texture_rectangle */ |
case GL_TEXTURE_RECTANGLE_NV: |
CHECK_EXTENSION(NV_texture_rectangle); |
{ |
const struct gl_texture_unit *texUnit; |
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; |
} |
/* GL_EXT_stencil_two_side */ |
case GL_STENCIL_TEST_TWO_SIDE_EXT: |
CHECK_EXTENSION(EXT_stencil_two_side); |
return ctx->Stencil.TestTwoSide; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); |
return GL_FALSE; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src/pixel.h |
---|
0,0 → 1,139 |
/* $Id: pixel.h,v 1.1 2003-02-28 11:42:04 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef PIXEL_H |
#define PIXEL_H |
#include "mtypes.h" |
/* |
* API functions |
*/ |
extern void |
_mesa_GetPixelMapfv( GLenum map, GLfloat *values ); |
extern void |
_mesa_GetPixelMapuiv( GLenum map, GLuint *values ); |
extern void |
_mesa_GetPixelMapusv( GLenum map, GLushort *values ); |
extern void |
_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ); |
extern void |
_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ); |
extern void |
_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values ); |
extern void |
_mesa_PixelStoref( GLenum pname, GLfloat param ); |
extern void |
_mesa_PixelStorei( GLenum pname, GLint param ); |
extern void |
_mesa_PixelTransferf( GLenum pname, GLfloat param ); |
extern void |
_mesa_PixelTransferi( GLenum pname, GLint param ); |
extern void |
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); |
/* |
* Pixel processing functions |
*/ |
extern void |
_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4], |
GLfloat rScale, GLfloat gScale, |
GLfloat bScale, GLfloat aScale, |
GLfloat rBias, GLfloat gBias, |
GLfloat bBias, GLfloat aBias); |
extern void |
_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); |
extern void |
_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); |
extern void |
_mesa_lookup_rgba(const struct gl_color_table *table, |
GLuint n, GLfloat rgba[][4]); |
extern void |
_mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n, |
GLuint indexes[]); |
extern void |
_mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]); |
extern void |
_mesa_map_ci_to_rgba_chan(const GLcontext *ctx, |
GLuint n, const GLuint index[], |
GLchan rgba[][4]); |
extern void |
_mesa_map_ci_to_rgba(const GLcontext *ctx, |
GLuint n, const GLuint index[], GLfloat rgba[][4]); |
extern void |
_mesa_map_ci8_to_rgba(const GLcontext *ctx, |
GLuint n, const GLubyte index[], |
GLchan rgba[][4]); |
extern void |
_mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n, |
GLstencil indexes[]); |
extern void |
_mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]); |
extern void |
_mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, |
CONST GLchan rgba[][4], GLfloat rgbaf[][4]); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/glapitemp.h |
---|
0,0 → 1,5171 |
/* DO NOT EDIT! This file is generated by the glapitemp.py script. */ |
/* |
* This file is a template which generates the OpenGL API entry point |
* functions. It should be included by a .c file which first defines |
* the following macros: |
* KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 |
* KEYWORD2 - usually nothing, but might be __stdcall on Win32 |
* NAME(n) - builds the final function name (usually add "gl" prefix) |
* DISPATCH(func, args, msg) - code to do dispatch of named function. |
* msg is a printf-style debug message. |
* RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value |
* |
* Here's an example which generates the usual OpenGL functions: |
* #define KEYWORD1 |
* #define KEYWORD2 |
* #define NAME(func) gl##func |
* #define DISPATCH(func, args, msg) \ |
* struct _glapi_table *dispatch = CurrentDispatch; \ |
* (*dispatch->func) args |
* #define RETURN DISPATCH(func, args, msg) \ |
* struct _glapi_table *dispatch = CurrentDispatch; \ |
* return (*dispatch->func) args |
* |
*/ |
#ifndef KEYWORD1 |
#define KEYWORD1 |
#endif |
#ifndef KEYWORD2 |
#define KEYWORD2 |
#endif |
#ifndef NAME |
#error NAME must be defined |
#endif |
#ifndef DISPATCH |
#error DISPATCH must be defined |
#endif |
#ifndef RETURN_DISPATCH |
#error RETURN_DISPATCH must be defined |
#endif |
GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */ |
KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) |
{ |
DISPATCH(NewList, (list, mode), (F, "glNewList(%d, 0x%x);\n", list, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(EndList)(void) |
{ |
DISPATCH(EndList, (), (F, "glEndList();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) |
{ |
DISPATCH(CallList, (list), (F, "glCallList(%d);\n", list)); |
} |
KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid * lists) |
{ |
DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);\n", n, type, (void *) lists)); |
} |
KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range) |
{ |
DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%d, %d);\n", list, range)); |
} |
KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range) |
{ |
RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);\n", range)); |
} |
KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base) |
{ |
DISPATCH(ListBase, (base), (F, "glListBase(%d);\n", base)); |
} |
KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) |
{ |
DISPATCH(Begin, (mode), (F, "glBegin(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap) |
{ |
DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d, %d, %f, %f, %f, %f, %p);\n", width, height, xorig, yorig, xmove, ymove, (void *) bitmap)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) |
{ |
DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte * v) |
{ |
DISPATCH(Color3bv, (v), (F, "glColor3bv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) |
{ |
DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble * v) |
{ |
DISPATCH(Color3dv, (v), (F, "glColor3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) |
{ |
DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat * v) |
{ |
DISPATCH(Color3fv, (v), (F, "glColor3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) |
{ |
DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint * v) |
{ |
DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) |
{ |
DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort * v) |
{ |
DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) |
{ |
DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte * v) |
{ |
DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) |
{ |
DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint * v) |
{ |
DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) |
{ |
DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort * v) |
{ |
DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) |
{ |
DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte * v) |
{ |
DISPATCH(Color4bv, (v), (F, "glColor4bv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) |
{ |
DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble * v) |
{ |
DISPATCH(Color4dv, (v), (F, "glColor4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
{ |
DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4f(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat * v) |
{ |
DISPATCH(Color4fv, (v), (F, "glColor4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) |
{ |
DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint * v) |
{ |
DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) |
{ |
DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort * v) |
{ |
DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) |
{ |
DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte * v) |
{ |
DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) |
{ |
DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint * v) |
{ |
DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) |
{ |
DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort * v) |
{ |
DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) |
{ |
DISPATCH(EdgeFlag, (flag), (F, "glEdgeFlag(%d);\n", flag)); |
} |
KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean * flag) |
{ |
DISPATCH(EdgeFlagv, (flag), (F, "glEdgeFlagv(%p);\n", (void *) flag)); |
} |
KEYWORD1 void KEYWORD2 NAME(End)(void) |
{ |
DISPATCH(End, (), (F, "glEnd();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) |
{ |
DISPATCH(Indexd, (c), (F, "glIndexd(%f);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble * c) |
{ |
DISPATCH(Indexdv, (c), (F, "glIndexdv(%p);\n", (void *) c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) |
{ |
DISPATCH(Indexf, (c), (F, "glIndexf(%f);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat * c) |
{ |
DISPATCH(Indexfv, (c), (F, "glIndexfv(%p);\n", (void *) c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) |
{ |
DISPATCH(Indexi, (c), (F, "glIndexi(%d);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint * c) |
{ |
DISPATCH(Indexiv, (c), (F, "glIndexiv(%p);\n", (void *) c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) |
{ |
DISPATCH(Indexs, (c), (F, "glIndexs(%d);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort * c) |
{ |
DISPATCH(Indexsv, (c), (F, "glIndexsv(%p);\n", (void *) c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) |
{ |
DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);\n", nx, ny, nz)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte * v) |
{ |
DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) |
{ |
DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);\n", nx, ny, nz)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble * v) |
{ |
DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) |
{ |
DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%f, %f, %f);\n", nx, ny, nz)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat * v) |
{ |
DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) |
{ |
DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);\n", nx, ny, nz)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint * v) |
{ |
DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) |
{ |
DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);\n", nx, ny, nz)); |
} |
KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort * v) |
{ |
DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y) |
{ |
DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble * v) |
{ |
DISPATCH(RasterPos2dv, (v), (F, "glRasterPos2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y) |
{ |
DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat * v) |
{ |
DISPATCH(RasterPos2fv, (v), (F, "glRasterPos2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y) |
{ |
DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint * v) |
{ |
DISPATCH(RasterPos2iv, (v), (F, "glRasterPos2iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y) |
{ |
DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort * v) |
{ |
DISPATCH(RasterPos2sv, (v), (F, "glRasterPos2sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble * v) |
{ |
DISPATCH(RasterPos3dv, (v), (F, "glRasterPos3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat * v) |
{ |
DISPATCH(RasterPos3fv, (v), (F, "glRasterPos3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z) |
{ |
DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint * v) |
{ |
DISPATCH(RasterPos3iv, (v), (F, "glRasterPos3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort * v) |
{ |
DISPATCH(RasterPos3sv, (v), (F, "glRasterPos3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble * v) |
{ |
DISPATCH(RasterPos4dv, (v), (F, "glRasterPos4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat * v) |
{ |
DISPATCH(RasterPos4fv, (v), (F, "glRasterPos4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) |
{ |
DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint * v) |
{ |
DISPATCH(RasterPos4iv, (v), (F, "glRasterPos4iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort * v) |
{ |
DISPATCH(RasterPos4sv, (v), (F, "glRasterPos4sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) |
{ |
DISPATCH(Rectd, (x1, y1, x2, y2), (F, "glRectd(%f, %f, %f, %f);\n", x1, y1, x2, y2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble * v1, const GLdouble * v2) |
{ |
DISPATCH(Rectdv, (v1, v2), (F, "glRectdv(%p, %p);\n", (void *) v1, (void *) v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) |
{ |
DISPATCH(Rectf, (x1, y1, x2, y2), (F, "glRectf(%f, %f, %f, %f);\n", x1, y1, x2, y2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat * v1, const GLfloat * v2) |
{ |
DISPATCH(Rectfv, (v1, v2), (F, "glRectfv(%p, %p);\n", (void *) v1, (void *) v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) |
{ |
DISPATCH(Recti, (x1, y1, x2, y2), (F, "glRecti(%d, %d, %d, %d);\n", x1, y1, x2, y2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint * v1, const GLint * v2) |
{ |
DISPATCH(Rectiv, (v1, v2), (F, "glRectiv(%p, %p);\n", (void *) v1, (void *) v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) |
{ |
DISPATCH(Rects, (x1, y1, x2, y2), (F, "glRects(%d, %d, %d, %d);\n", x1, y1, x2, y2)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort * v1, const GLshort * v2) |
{ |
DISPATCH(Rectsv, (v1, v2), (F, "glRectsv(%p, %p);\n", (void *) v1, (void *) v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) |
{ |
DISPATCH(TexCoord1d, (s), (F, "glTexCoord1d(%f);\n", s)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble * v) |
{ |
DISPATCH(TexCoord1dv, (v), (F, "glTexCoord1dv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) |
{ |
DISPATCH(TexCoord1f, (s), (F, "glTexCoord1f(%f);\n", s)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat * v) |
{ |
DISPATCH(TexCoord1fv, (v), (F, "glTexCoord1fv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) |
{ |
DISPATCH(TexCoord1i, (s), (F, "glTexCoord1i(%d);\n", s)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint * v) |
{ |
DISPATCH(TexCoord1iv, (v), (F, "glTexCoord1iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) |
{ |
DISPATCH(TexCoord1s, (s), (F, "glTexCoord1s(%d);\n", s)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort * v) |
{ |
DISPATCH(TexCoord1sv, (v), (F, "glTexCoord1sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) |
{ |
DISPATCH(TexCoord2d, (s, t), (F, "glTexCoord2d(%f, %f);\n", s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble * v) |
{ |
DISPATCH(TexCoord2dv, (v), (F, "glTexCoord2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) |
{ |
DISPATCH(TexCoord2f, (s, t), (F, "glTexCoord2f(%f, %f);\n", s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat * v) |
{ |
DISPATCH(TexCoord2fv, (v), (F, "glTexCoord2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) |
{ |
DISPATCH(TexCoord2i, (s, t), (F, "glTexCoord2i(%d, %d);\n", s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint * v) |
{ |
DISPATCH(TexCoord2iv, (v), (F, "glTexCoord2iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) |
{ |
DISPATCH(TexCoord2s, (s, t), (F, "glTexCoord2s(%d, %d);\n", s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort * v) |
{ |
DISPATCH(TexCoord2sv, (v), (F, "glTexCoord2sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) |
{ |
DISPATCH(TexCoord3d, (s, t, r), (F, "glTexCoord3d(%f, %f, %f);\n", s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble * v) |
{ |
DISPATCH(TexCoord3dv, (v), (F, "glTexCoord3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) |
{ |
DISPATCH(TexCoord3f, (s, t, r), (F, "glTexCoord3f(%f, %f, %f);\n", s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat * v) |
{ |
DISPATCH(TexCoord3fv, (v), (F, "glTexCoord3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) |
{ |
DISPATCH(TexCoord3i, (s, t, r), (F, "glTexCoord3i(%d, %d, %d);\n", s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint * v) |
{ |
DISPATCH(TexCoord3iv, (v), (F, "glTexCoord3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) |
{ |
DISPATCH(TexCoord3s, (s, t, r), (F, "glTexCoord3s(%d, %d, %d);\n", s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort * v) |
{ |
DISPATCH(TexCoord3sv, (v), (F, "glTexCoord3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) |
{ |
DISPATCH(TexCoord4d, (s, t, r, q), (F, "glTexCoord4d(%f, %f, %f, %f);\n", s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble * v) |
{ |
DISPATCH(TexCoord4dv, (v), (F, "glTexCoord4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) |
{ |
DISPATCH(TexCoord4f, (s, t, r, q), (F, "glTexCoord4f(%f, %f, %f, %f);\n", s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat * v) |
{ |
DISPATCH(TexCoord4fv, (v), (F, "glTexCoord4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) |
{ |
DISPATCH(TexCoord4i, (s, t, r, q), (F, "glTexCoord4i(%d, %d, %d, %d);\n", s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint * v) |
{ |
DISPATCH(TexCoord4iv, (v), (F, "glTexCoord4iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) |
{ |
DISPATCH(TexCoord4s, (s, t, r, q), (F, "glTexCoord4s(%d, %d, %d, %d);\n", s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort * v) |
{ |
DISPATCH(TexCoord4sv, (v), (F, "glTexCoord4sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) |
{ |
DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble * v) |
{ |
DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) |
{ |
DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat * v) |
{ |
DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) |
{ |
DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint * v) |
{ |
DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) |
{ |
DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort * v) |
{ |
DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble * v) |
{ |
DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat * v) |
{ |
DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) |
{ |
DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint * v) |
{ |
DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort * v) |
{ |
DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble * v) |
{ |
DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat * v) |
{ |
DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) |
{ |
DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint * v) |
{ |
DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort * v) |
{ |
DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble * equation) |
{ |
DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(0x%x, %p);\n", plane, (void *) equation)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode) |
{ |
DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);\n", face, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode) |
{ |
DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param) |
{ |
DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param) |
{ |
DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint * params) |
{ |
DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode) |
{ |
DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) |
{ |
DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);\n", target, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(Lightf)(GLenum light, GLenum pname, GLfloat param) |
{ |
DISPATCH(Lightf, (light, pname, param), (F, "glLightf(0x%x, 0x%x, %f);\n", light, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param) |
{ |
DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);\n", light, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint * params) |
{ |
DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(LightModelf)(GLenum pname, GLfloat param) |
{ |
DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(LightModeli)(GLenum pname, GLint param) |
{ |
DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint * params) |
{ |
DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern) |
{ |
DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, %d);\n", factor, pattern)); |
} |
KEYWORD1 void KEYWORD2 NAME(LineWidth)(GLfloat width) |
{ |
DISPATCH(LineWidth, (width), (F, "glLineWidth(%f);\n", width)); |
} |
KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) |
{ |
DISPATCH(Materialf, (face, pname, param), (F, "glMaterialf(0x%x, 0x%x, %f);\n", face, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(Materialfv, (face, pname, params), (F, "glMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) |
{ |
DISPATCH(Materiali, (face, pname, param), (F, "glMateriali(0x%x, 0x%x, %d);\n", face, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint * params) |
{ |
DISPATCH(Materialiv, (face, pname, params), (F, "glMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size) |
{ |
DISPATCH(PointSize, (size), (F, "glPointSize(%f);\n", size)); |
} |
KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode) |
{ |
DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);\n", face, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte * mask) |
{ |
DISPATCH(PolygonStipple, (mask), (F, "glPolygonStipple(%p);\n", (void *) mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);\n", x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode) |
{ |
DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) |
{ |
DISPATCH(TexParameterf, (target, pname, param), (F, "glTexParameterf(0x%x, 0x%x, %f);\n", target, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(TexParameterfv, (target, pname, params), (F, "glTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) |
{ |
DISPATCH(TexParameteri, (target, pname, param), (F, "glTexParameteri(0x%x, 0x%x, %d);\n", target, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(TexParameteriv, (target, pname, params), (F, "glTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, "glTexImage1D(0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, border, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, "glTexImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, border, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) |
{ |
DISPATCH(TexEnvf, (target, pname, param), (F, "glTexEnvf(0x%x, 0x%x, %f);\n", target, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(TexEnvfv, (target, pname, params), (F, "glTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) |
{ |
DISPATCH(TexEnvi, (target, pname, param), (F, "glTexEnvi(0x%x, 0x%x, %d);\n", target, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(TexEnviv, (target, pname, params), (F, "glTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) |
{ |
DISPATCH(TexGend, (coord, pname, param), (F, "glTexGend(0x%x, 0x%x, %f);\n", coord, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble * params) |
{ |
DISPATCH(TexGendv, (coord, pname, params), (F, "glTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) |
{ |
DISPATCH(TexGenf, (coord, pname, param), (F, "glTexGenf(0x%x, 0x%x, %f);\n", coord, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(TexGenfv, (coord, pname, params), (F, "glTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) |
{ |
DISPATCH(TexGeni, (coord, pname, param), (F, "glTexGeni(0x%x, 0x%x, %d);\n", coord, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint * params) |
{ |
DISPATCH(TexGeniv, (coord, pname, params), (F, "glTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer) |
{ |
DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);\n", size, type, (void *) buffer)); |
} |
KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint * buffer) |
{ |
DISPATCH(SelectBuffer, (size, buffer), (F, "glSelectBuffer(%d, %p);\n", size, (void *) buffer)); |
} |
KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode) |
{ |
RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(InitNames)(void) |
{ |
DISPATCH(InitNames, (), (F, "glInitNames();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name) |
{ |
DISPATCH(LoadName, (name), (F, "glLoadName(%d);\n", name)); |
} |
KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token) |
{ |
DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);\n", token)); |
} |
KEYWORD1 void KEYWORD2 NAME(PopName)(void) |
{ |
DISPATCH(PopName, (), (F, "glPopName();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name) |
{ |
DISPATCH(PushName, (name), (F, "glPushName(%d);\n", name)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode) |
{ |
DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) |
{ |
DISPATCH(Clear, (mask), (F, "glClear(%p);\n", (void *) mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
{ |
DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c) |
{ |
DISPATCH(ClearIndex, (c), (F, "glClearIndex(%f);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
{ |
DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s) |
{ |
DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);\n", s)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth) |
{ |
DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%f);\n", depth)); |
} |
KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask) |
{ |
DISPATCH(StencilMask, (mask), (F, "glStencilMask(%d);\n", mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
{ |
DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag) |
{ |
DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);\n", flag)); |
} |
KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) |
{ |
DISPATCH(IndexMask, (mask), (F, "glIndexMask(%d);\n", mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) |
{ |
DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %f);\n", op, value)); |
} |
KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap) |
{ |
DISPATCH(Disable, (cap), (F, "glDisable(0x%x);\n", cap)); |
} |
KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) |
{ |
DISPATCH(Enable, (cap), (F, "glEnable(0x%x);\n", cap)); |
} |
KEYWORD1 void KEYWORD2 NAME(Finish)(void) |
{ |
DISPATCH(Finish, (), (F, "glFinish();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(Flush)(void) |
{ |
DISPATCH(Flush, (), (F, "glFlush();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void) |
{ |
DISPATCH(PopAttrib, (), (F, "glPopAttrib();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(PushAttrib)(GLbitfield mask) |
{ |
DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(%p);\n", (void *) mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points) |
{ |
DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, "glMap1d(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points) |
{ |
DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, "glMap1f(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points) |
{ |
DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2d(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points) |
{ |
DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2f(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) |
{ |
DISPATCH(MapGrid1d, (un, u1, u2), (F, "glMapGrid1d(%d, %f, %f);\n", un, u1, u2)); |
} |
KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) |
{ |
DISPATCH(MapGrid1f, (un, u1, u2), (F, "glMapGrid1f(%d, %f, %f);\n", un, u1, u2)); |
} |
KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) |
{ |
DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2d(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) |
{ |
DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2f(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) |
{ |
DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%f);\n", u)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble * u) |
{ |
DISPATCH(EvalCoord1dv, (u), (F, "glEvalCoord1dv(%p);\n", (void *) u)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) |
{ |
DISPATCH(EvalCoord1f, (u), (F, "glEvalCoord1f(%f);\n", u)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat * u) |
{ |
DISPATCH(EvalCoord1fv, (u), (F, "glEvalCoord1fv(%p);\n", (void *) u)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) |
{ |
DISPATCH(EvalCoord2d, (u, v), (F, "glEvalCoord2d(%f, %f);\n", u, v)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble * u) |
{ |
DISPATCH(EvalCoord2dv, (u), (F, "glEvalCoord2dv(%p /* %g, %g */);\n", (void *) u, u[0], u[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) |
{ |
DISPATCH(EvalCoord2f, (u, v), (F, "glEvalCoord2f(%f, %f);\n", u, v)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat * u) |
{ |
DISPATCH(EvalCoord2fv, (u), (F, "glEvalCoord2fv(%p /* %g, %g */);\n", (void *) u, u[0], u[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) |
{ |
DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh1(0x%x, %d, %d);\n", mode, i1, i2)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) |
{ |
DISPATCH(EvalPoint1, (i), (F, "glEvalPoint1(%d);\n", i)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) |
{ |
DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);\n", mode, i1, i2, j1, j2)); |
} |
KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) |
{ |
DISPATCH(EvalPoint2, (i, j), (F, "glEvalPoint2(%d, %d);\n", i, j)); |
} |
KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) |
{ |
DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %f);\n", func, ref)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) |
{ |
DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);\n", sfactor, dfactor)); |
} |
KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode) |
{ |
DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);\n", opcode)); |
} |
KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask) |
{ |
DISPATCH(StencilFunc, (func, ref, mask), (F, "glStencilFunc(0x%x, %d, %d);\n", func, ref, mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) |
{ |
DISPATCH(StencilOp, (fail, zfail, zpass), (F, "glStencilOp(0x%x, 0x%x, 0x%x);\n", fail, zfail, zpass)); |
} |
KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func) |
{ |
DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);\n", func)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor) |
{ |
DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);\n", xfactor, yfactor)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param) |
{ |
DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param) |
{ |
DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLint mapsize, const GLfloat * values) |
{ |
DISPATCH(PixelMapfv, (map, mapsize, values), (F, "glPixelMapfv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLint mapsize, const GLuint * values) |
{ |
DISPATCH(PixelMapuiv, (map, mapsize, values), (F, "glPixelMapuiv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLint mapsize, const GLushort * values) |
{ |
DISPATCH(PixelMapusv, (map, mapsize, values), (F, "glPixelMapusv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(ReadBuffer)(GLenum mode) |
{ |
DISPATCH(ReadBuffer, (mode), (F, "glReadBuffer(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) |
{ |
DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x);\n", x, y, width, height, type)); |
} |
KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels) |
{ |
DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, "glReadPixels(%d, %d, %d, %d, 0x%x, 0x%x, %p);\n", x, y, width, height, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);\n", width, height, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean * params) |
{ |
DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble * equation) |
{ |
DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(0x%x, %p);\n", plane, (void *) equation)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble * params) |
{ |
DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void) |
{ |
RETURN_DISPATCH(GetError, (), (F, "glGetError();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint * params) |
{ |
DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint * params) |
{ |
DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble * v) |
{ |
DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat * v) |
{ |
DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint * v) |
{ |
DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint * params) |
{ |
DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat * values) |
{ |
DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);\n", map, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint * values) |
{ |
DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);\n", map, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort * values) |
{ |
DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);\n", map, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte * mask) |
{ |
DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);\n", (void *) mask)); |
} |
KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name) |
{ |
RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);\n", name)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGetTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params) |
{ |
DISPATCH(GetTexGendv, (coord, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetTexGenfv, (coord, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum coord, GLenum pname, GLint * params) |
{ |
DISPATCH(GetTexGeniv, (coord, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels) |
{ |
DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);\n", target, level, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) |
{ |
DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (void *) params)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) |
{ |
RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);\n", cap)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) |
{ |
RETURN_DISPATCH(IsList, (list), (F, "glIsList(%d);\n", list)); |
} |
KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd zNear, GLclampd zFar) |
{ |
DISPATCH(DepthRange, (zNear, zFar), (F, "glDepthRange(%f, %f);\n", zNear, zFar)); |
} |
KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) |
{ |
DISPATCH(Frustum, (left, right, bottom, top, zNear, zFar), (F, "glFrustum(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void) |
{ |
DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat * m) |
{ |
DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble * m) |
{ |
DISPATCH(LoadMatrixd, (m), (F, "glLoadMatrixd(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) |
{ |
DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat * m) |
{ |
DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble * m) |
{ |
DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) |
{ |
DISPATCH(Ortho, (left, right, bottom, top, zNear, zFar), (F, "glOrtho(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); |
} |
KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void) |
{ |
DISPATCH(PopMatrix, (), (F, "glPopMatrix();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void) |
{ |
DISPATCH(PushMatrix, (), (F, "glPushMatrix();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(Rotated, (angle, x, y, z), (F, "glRotated(%f, %f, %f, %f);\n", angle, x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%f, %f, %f, %f);\n", angle, x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(Scaled, (x, y, z), (F, "glScaled(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(Scalef, (x, y, z), (F, "glScalef(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(Translated, (x, y, z), (F, "glTranslated(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);\n", x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) |
{ |
DISPATCH(ArrayElement, (i), (F, "glArrayElement(%d);\n", i)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(ColorPointer, (size, type, stride, pointer), (F, "glColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum array) |
{ |
DISPATCH(DisableClientState, (array), (F, "glDisableClientState(0x%x);\n", array)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) |
{ |
DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);\n", mode, first, count)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) |
{ |
DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p);\n", mode, count, type, (void *) indices)); |
} |
KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(EdgeFlagPointer, (stride, pointer), (F, "glEdgeFlagPointer(%d, %p);\n", stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum array) |
{ |
DISPATCH(EnableClientState, (array), (F, "glEnableClientState(0x%x);\n", array)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid ** params) |
{ |
DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(IndexPointer, (type, stride, pointer), (F, "glIndexPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);\n", format, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(NormalPointer, (type, stride, pointer), (F, "glNormalPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(TexCoordPointer, (size, type, stride, pointer), (F, "glTexCoordPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(VertexPointer, (size, type, stride, pointer), (F, "glVertexPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) |
{ |
DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%f, %f);\n", factor, units)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) |
{ |
DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
{ |
DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1D(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2D(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1D(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (void *) pixels)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences) |
{ |
RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);\n", n, (void *) textures, (void *) residences)); |
} |
KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) |
{ |
DISPATCH(BindTexture, (target, texture), (F, "glBindTexture(0x%x, %d);\n", target, texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures) |
{ |
DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (void *) textures)); |
} |
KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint * textures) |
{ |
DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);\n", n, (void *) textures)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) |
{ |
RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%d);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities) |
{ |
DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);\n", n, (void *) textures, (void *) priorities)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) |
{ |
DISPATCH(Indexub, (c), (F, "glIndexub(%d);\n", c)); |
} |
KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte * c) |
{ |
DISPATCH(Indexubv, (c), (F, "glIndexubv(%p);\n", (void *) c)); |
} |
KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) |
{ |
DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) |
{ |
DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(%p);\n", (void *) mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
{ |
DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) |
{ |
DISPATCH(BlendEquation, (mode), (F, "glBlendEquation(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) |
{ |
DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElements(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (void *) indices)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) |
{ |
DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTable(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) table)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTable(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table) |
{ |
DISPATCH(GetColorTable, (target, format, type, table), (F, "glGetColorTable(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) table)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, "glGetColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, "glGetColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) |
{ |
DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTable(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTable(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) |
{ |
DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1D(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) |
{ |
DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) |
{ |
DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterf(0x%x, 0x%x, %f);\n", target, pname, params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) |
{ |
DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteri(0x%x, 0x%x, %d);\n", target, pname, params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1D(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2D(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image) |
{ |
DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, "glGetConvolutionFilter(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, "glGetConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, "glGetConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) |
{ |
DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, "glGetSeparableFilter(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (void *) row, (void *) column, (void *) span)); |
} |
KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) |
{ |
DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (void *) row, (void *) column)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) |
{ |
DISPATCH(GetHistogram, (target, reset, format, type, values), (F, "glGetHistogram(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, "glGetHistogramParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, "glGetHistogramParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) |
{ |
DISPATCH(GetMinmax, (target, reset, format, type, values), (F, "glGetMinmax(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, "glGetMinmaxParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, "glGetMinmaxParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) |
{ |
DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogram(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); |
} |
KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) |
{ |
DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmax(0x%x, 0x%x, %d);\n", target, internalformat, sink)); |
} |
KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) |
{ |
DISPATCH(ResetHistogram, (target), (F, "glResetHistogram(0x%x);\n", target)); |
} |
KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) |
{ |
DISPATCH(ResetMinmax, (target), (F, "glResetMinmax(0x%x);\n", target)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3D(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) |
{ |
DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTextureARB(0x%x);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) |
{ |
DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTextureARB(0x%x);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) |
{ |
DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1dARB(0x%x, %f);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dvARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) |
{ |
DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1fARB(0x%x, %f);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fvARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) |
{ |
DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1iARB(0x%x, %d);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1ivARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) |
{ |
DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1sARB(0x%x, %d);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1svARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) |
{ |
DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2dARB(0x%x, %f, %f);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dvARB(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) |
{ |
DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2fARB(0x%x, %f, %f);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fvARB(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) |
{ |
DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2iARB(0x%x, %d, %d);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2ivARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) |
{ |
DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2sARB(0x%x, %d, %d);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2svARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) |
{ |
DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3dARB(0x%x, %f, %f, %f);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dvARB(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) |
{ |
DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3fARB(0x%x, %f, %f, %f);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fvARB(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) |
{ |
DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3iARB(0x%x, %d, %d, %d);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3ivARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) |
{ |
DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3sARB(0x%x, %d, %d, %d);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3svARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) |
{ |
DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4dARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dvARB(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) |
{ |
DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4fARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fvARB(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) |
{ |
DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4iARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4ivARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) |
{ |
DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4sARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4svARB(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat * m) |
{ |
DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble * m) |
{ |
DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixdARB(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat * m) |
{ |
DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixfARB(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble * m) |
{ |
DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixdARB(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) |
{ |
DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);\n", value, invert)); |
} |
KEYWORD1 void KEYWORD2 NAME(__unused413)(void) |
{ |
DISPATCH(__unused413, (), (F, "gl__unused413();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img) |
{ |
DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImageARB(0x%x, %d, %p);\n", target, level, (void *) img)); |
} |
KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture) |
{ |
DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTexture(0x%x);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture) |
{ |
DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTexture(0x%x);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s) |
{ |
DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1d(0x%x, %f);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s) |
{ |
DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1f(0x%x, %f);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s) |
{ |
DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1i(0x%x, %d);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1iv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s) |
{ |
DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1s(0x%x, %d);\n", target, s)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1sv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) |
{ |
DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2d(0x%x, %f, %f);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dv(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) |
{ |
DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2f(0x%x, %f, %f);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fv(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t) |
{ |
DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2i(0x%x, %d, %d);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2iv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) |
{ |
DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2s(0x%x, %d, %d);\n", target, s, t)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2sv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) |
{ |
DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3d(0x%x, %f, %f, %f);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dv(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) |
{ |
DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3f(0x%x, %f, %f, %f);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fv(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) |
{ |
DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3i(0x%x, %d, %d, %d);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3iv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) |
{ |
DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3s(0x%x, %d, %d, %d);\n", target, s, t, r)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3sv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) |
{ |
DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4d(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble * v) |
{ |
DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dv(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) |
{ |
DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4f(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat * v) |
{ |
DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fv(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) |
{ |
DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4i(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint * v) |
{ |
DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4iv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) |
{ |
DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4s(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort * v) |
{ |
DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4sv(0x%x, %p);\n", target, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat * m) |
{ |
DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixf(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m) |
{ |
DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat * m) |
{ |
DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixf(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble * m) |
{ |
DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixd(%p);\n", (void *) m)); |
} |
KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert) |
{ |
DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverage(%f, %d);\n", value, invert)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) |
{ |
DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1D(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint level, GLvoid * img) |
{ |
DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImage(0x%x, %d, %p);\n", target, level, (void *) img)); |
} |
/* No dispatch for WeightbvARB() */ |
/* No dispatch for WeightsvARB() */ |
/* No dispatch for WeightivARB() */ |
/* No dispatch for WeightfvARB() */ |
/* No dispatch for WeightdvARB() */ |
/* No dispatch for WeightubvARB() */ |
/* No dispatch for WeightusvARB() */ |
/* No dispatch for WeightuivARB() */ |
/* No dispatch for WeightPointerARB() */ |
/* No dispatch for VertexBlendARB() */ |
/* No dispatch for CurrentPaletteMatrixARB() */ |
/* No dispatch for MatrixIndexubvARB() */ |
/* No dispatch for MatrixIndexusvARB() */ |
/* No dispatch for MatrixIndexuivARB() */ |
/* No dispatch for MatrixIndexPointerARB() */ |
KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
{ |
DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColorEXT(%f, %f, %f, %f);\n", red, green, blue, alpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) |
{ |
DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights) |
{ |
DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, "glGetTexFilterFuncSGIS(0x%x, 0x%x, %p);\n", target, filter, (void *) weights)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights) |
{ |
DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, "glTexFilterFuncSGIS(0x%x, 0x%x, %d, %p);\n", target, filter, n, (void *) weights)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1DEXT(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) |
{ |
DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
{ |
DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1DEXT(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) |
{ |
DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, "glGetHistogramEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, "glGetHistogramParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, "glGetHistogramParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) |
{ |
DISPATCH(GetMinmaxEXT, (target, reset, format, type, values), (F, "glGetMinmaxEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, "glGetMinmaxParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, "glGetMinmaxParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) |
{ |
DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogramEXT(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); |
} |
KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) |
{ |
DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmaxEXT(0x%x, 0x%x, %d);\n", target, internalformat, sink)); |
} |
KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) |
{ |
DISPATCH(ResetHistogram, (target), (F, "glResetHistogramEXT(0x%x);\n", target)); |
} |
KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) |
{ |
DISPATCH(ResetMinmax, (target), (F, "glResetMinmaxEXT(0x%x);\n", target)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) |
{ |
DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1DEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) |
{ |
DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) |
{ |
DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterfEXT(0x%x, 0x%x, %f);\n", target, pname, params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) |
{ |
DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteriEXT(0x%x, 0x%x, %d);\n", target, pname, params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1DEXT(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) |
{ |
DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image) |
{ |
DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, "glGetConvolutionFilterEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) image)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, "glGetConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, "glGetConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) |
{ |
DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, "glGetSeparableFilterEXT(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (void *) row, (void *) column, (void *) span)); |
} |
KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) |
{ |
DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (void *) row, (void *) column)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) |
{ |
DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableSGI(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) table)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint * params) |
{ |
DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTableSGI(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table) |
{ |
DISPATCH(GetColorTableSGI, (target, format, type, table), (F, "glGetColorTableSGI(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) table)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, "glGetColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, "glGetColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) |
{ |
DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum pname, GLint param) |
{ |
DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params) |
{ |
DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params) |
{ |
DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexImage4DSGIS, (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels), (F, "glTexImage4DSGIS(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, size4d, border, format, type, (void *) pixels)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels) |
{ |
DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels), (F, "glTexSubImage4DSGIS(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, (void *) pixels)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences) |
{ |
RETURN_DISPATCH(AreTexturesResidentEXT, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d, %p, %p);\n", n, (void *) textures, (void *) residences)); |
} |
KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) |
{ |
DISPATCH(BindTexture, (target, texture), (F, "glBindTextureEXT(0x%x, %d);\n", target, texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint * textures) |
{ |
DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTexturesEXT(%d, %p);\n", n, (void *) textures)); |
} |
KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint * textures) |
{ |
DISPATCH(GenTexturesEXT, (n, textures), (F, "glGenTexturesEXT(%d, %p);\n", n, (void *) textures)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) |
{ |
RETURN_DISPATCH(IsTextureEXT, (texture), (F, "glIsTextureEXT(%d);\n", texture)); |
} |
KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint * textures, const GLclampf * priorities) |
{ |
DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTexturesEXT(%d, %p, %p);\n", n, (void *) textures, (void *) priorities)); |
} |
KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) |
{ |
DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, "glDetailTexFuncSGIS(0x%x, %d, %p);\n", target, n, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat * points) |
{ |
DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, "glGetDetailTexFuncSGIS(0x%x, %p);\n", target, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) |
{ |
DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, "glSharpenTexFuncSGIS(0x%x, %d, %p);\n", target, n, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points) |
{ |
DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, "glGetSharpenTexFuncSGIS(0x%x, %p);\n", target, (void *) points)); |
} |
KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) |
{ |
DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); |
} |
KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) |
{ |
DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); |
} |
KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) |
{ |
DISPATCH(ArrayElement, (i), (F, "glArrayElementEXT(%d);\n", i)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) |
{ |
DISPATCH(ColorPointerEXT, (size, type, stride, count, pointer), (F, "glColorPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) |
{ |
DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArraysEXT(0x%x, %d, %d);\n", mode, first, count)); |
} |
KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer) |
{ |
DISPATCH(EdgeFlagPointerEXT, (stride, count, pointer), (F, "glEdgeFlagPointerEXT(%d, %d, %p);\n", stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, GLvoid ** params) |
{ |
DISPATCH(GetPointerv, (pname, params), (F, "glGetPointervEXT(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) |
{ |
DISPATCH(IndexPointerEXT, (type, stride, count, pointer), (F, "glIndexPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) |
{ |
DISPATCH(NormalPointerEXT, (type, stride, count, pointer), (F, "glNormalPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) |
{ |
DISPATCH(TexCoordPointerEXT, (size, type, stride, count, pointer), (F, "glTexCoordPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) |
{ |
DISPATCH(VertexPointerEXT, (size, type, stride, count, pointer), (F, "glVertexPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) |
{ |
DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);\n", mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) |
{ |
DISPATCH(SpriteParameterfSGIX, (pname, param), (F, "glSpriteParameterfSGIX(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(SpriteParameterfvSGIX, (pname, params), (F, "glSpriteParameterfvSGIX(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) |
{ |
DISPATCH(SpriteParameteriSGIX, (pname, param), (F, "glSpriteParameteriSGIX(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint * params) |
{ |
DISPATCH(SpriteParameterivSGIX, (pname, params), (F, "glSpriteParameterivSGIX(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfARB)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfARB(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfvARB)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvARB(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) |
{ |
RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, "glGetInstrumentsSGIX();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint * buffer) |
{ |
DISPATCH(InstrumentsBufferSGIX, (size, buffer), (F, "glInstrumentsBufferSGIX(%d, %p);\n", size, (void *) buffer)); |
} |
KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint * marker_p) |
{ |
RETURN_DISPATCH(PollInstrumentsSGIX, (marker_p), (F, "glPollInstrumentsSGIX(%p);\n", (void *) marker_p)); |
} |
KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) |
{ |
DISPATCH(ReadInstrumentsSGIX, (marker), (F, "glReadInstrumentsSGIX(%d);\n", marker)); |
} |
KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) |
{ |
DISPATCH(StartInstrumentsSGIX, (), (F, "glStartInstrumentsSGIX();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) |
{ |
DISPATCH(StopInstrumentsSGIX, (marker), (F, "glStopInstrumentsSGIX(%d);\n", marker)); |
} |
KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) |
{ |
DISPATCH(FrameZoomSGIX, (factor), (F, "glFrameZoomSGIX(%d);\n", factor)); |
} |
KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) |
{ |
DISPATCH(TagSampleBufferSGIX, (), (F, "glTagSampleBufferSGIX();\n")); |
} |
/* No dispatch for DeformationMap3dSGIX() */ |
/* No dispatch for DeformationMap3fSGIX() */ |
/* No dispatch for DeformSGIX() */ |
/* No dispatch for LoadIdentityDeformationMapSGIX() */ |
KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble * equation) |
{ |
DISPATCH(ReferencePlaneSGIX, (equation), (F, "glReferencePlaneSGIX(%p);\n", (void *) equation)); |
} |
KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) |
{ |
DISPATCH(FlushRasterSGIX, (), (F, "glFlushRasterSGIX();\n")); |
} |
/* No dispatch for FogFuncSGIS() */ |
/* No dispatch for GetFogFuncSGIS() */ |
/* No dispatch for ImageTransformParameteriHP() */ |
/* No dispatch for ImageTransformParameterfHP() */ |
/* No dispatch for ImageTransformParameterivHP() */ |
/* No dispatch for ImageTransformParameterfvHP() */ |
/* No dispatch for GetImageTransformParameterivHP() */ |
/* No dispatch for GetImageTransformParameterfvHP() */ |
KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) |
{ |
DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTableEXT(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) |
{ |
DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTableEXT(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); |
} |
KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) |
{ |
DISPATCH(HintPGI, (target, mode), (F, "glHintPGI(0x%x, %d);\n", target, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) |
{ |
DISPATCH(ColorTable, (target, internalFormat, width, format, type, table), (F, "glColorTableEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalFormat, width, format, type, (void *) table)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data) |
{ |
DISPATCH(GetColorTableEXT, (target, format, type, data), (F, "glGetColorTableEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) data)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params) |
{ |
DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, "glGetColorTableParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, "glGetColorTableParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetListParameterfvSGIX, (list, pname, params), (F, "glGetListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params) |
{ |
DISPATCH(GetListParameterivSGIX, (list, pname, params), (F, "glGetListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param) |
{ |
DISPATCH(ListParameterfSGIX, (list, pname, param), (F, "glListParameterfSGIX(%d, 0x%x, %f);\n", list, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(ListParameterfvSGIX, (list, pname, params), (F, "glListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum pname, GLint param) |
{ |
DISPATCH(ListParameteriSGIX, (list, pname, param), (F, "glListParameteriSGIX(%d, 0x%x, %d);\n", list, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params) |
{ |
DISPATCH(ListParameterivSGIX, (list, pname, params), (F, "glListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) |
{ |
DISPATCH(IndexMaterialEXT, (face, mode), (F, "glIndexMaterialEXT(0x%x, 0x%x);\n", face, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLclampf ref) |
{ |
DISPATCH(IndexFuncEXT, (func, ref), (F, "glIndexFuncEXT(0x%x, %f);\n", func, ref)); |
} |
KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) |
{ |
DISPATCH(LockArraysEXT, (first, count), (F, "glLockArraysEXT(%d, %d);\n", first, count)); |
} |
KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) |
{ |
DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble * params) |
{ |
DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat * params) |
{ |
DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) |
{ |
DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, "glFragmentColorMaterialSGIX(0x%x, 0x%x);\n", face, mode)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) |
{ |
DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, "glFragmentLightfSGIX(0x%x, 0x%x, %f);\n", light, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, "glFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) |
{ |
DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, "glFragmentLightiSGIX(0x%x, 0x%x, %d);\n", light, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) |
{ |
DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, "glFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) |
{ |
DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, "glFragmentLightModelfSGIX(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, "glFragmentLightModelfvSGIX(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) |
{ |
DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, "glFragmentLightModeliSGIX(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) |
{ |
DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, "glFragmentLightModelivSGIX(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) |
{ |
DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, "glFragmentMaterialfSGIX(0x%x, 0x%x, %f);\n", face, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) |
{ |
DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, "glFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) |
{ |
DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, "glFragmentMaterialiSGIX(0x%x, 0x%x, %d);\n", face, pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) |
{ |
DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, "glFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetFragmentLightfvSGIX, (light, pname, params), (F, "glGetFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) |
{ |
DISPATCH(GetFragmentLightivSGIX, (light, pname, params), (F, "glGetFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetFragmentMaterialfvSGIX, (face, pname, params), (F, "glGetFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) |
{ |
DISPATCH(GetFragmentMaterialivSGIX, (face, pname, params), (F, "glGetFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) |
{ |
DISPATCH(LightEnviSGIX, (pname, param), (F, "glLightEnviSGIX(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) |
{ |
DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (void *) indices)); |
} |
/* No dispatch for ApplyTextureEXT() */ |
/* No dispatch for TextureLightEXT() */ |
/* No dispatch for TextureMaterialEXT() */ |
/* No dispatch for AsyncMarkerSGIX() */ |
/* No dispatch for FinishAsyncSGIX() */ |
/* No dispatch for PollAsyncSGIX() */ |
/* No dispatch for GenAsyncMarkersSGIX() */ |
/* No dispatch for DeleteAsyncMarkersSGIX() */ |
/* No dispatch for IsAsyncMarkerSGIX() */ |
/* No dispatch for VertexPointervINTEL() */ |
/* No dispatch for NormalPointervINTEL() */ |
/* No dispatch for ColorPointervINTEL() */ |
/* No dispatch for TexCoordPointervINTEL() */ |
/* No dispatch for PixelTransformParameteriEXT() */ |
/* No dispatch for PixelTransformParameterfEXT() */ |
/* No dispatch for PixelTransformParameterivEXT() */ |
/* No dispatch for PixelTransformParameterfvEXT() */ |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) |
{ |
DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte * v) |
{ |
DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) |
{ |
DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) |
{ |
DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) |
{ |
DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) |
{ |
DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) |
{ |
DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) |
{ |
DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) |
{ |
DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) |
{ |
DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) |
{ |
DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) |
{ |
DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) |
{ |
DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) |
{ |
DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) |
{ |
DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) |
{ |
DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
/* No dispatch for TextureNormalEXT() */ |
KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) |
{ |
DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (void *) first, (void *) count, primcount)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) |
{ |
DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (void *) count, type, (void *) indices, primcount)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) |
{ |
DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) |
{ |
DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (void *) coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) |
{ |
DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%f);\n", coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) |
{ |
DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);\n", (void *) coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);\n", type, stride, (void *) pointer)); |
} |
/* No dispatch for Tangent3bEXT() */ |
/* No dispatch for Tangent3bvEXT() */ |
/* No dispatch for Tangent3dEXT() */ |
/* No dispatch for Tangent3dvEXT() */ |
/* No dispatch for Tangent3fEXT() */ |
/* No dispatch for Tangent3fvEXT() */ |
/* No dispatch for Tangent3iEXT() */ |
/* No dispatch for Tangent3ivEXT() */ |
/* No dispatch for Tangent3sEXT() */ |
/* No dispatch for Tangent3svEXT() */ |
/* No dispatch for Binormal3bEXT() */ |
/* No dispatch for Binormal3bvEXT() */ |
/* No dispatch for Binormal3dEXT() */ |
/* No dispatch for Binormal3dvEXT() */ |
/* No dispatch for Binormal3fEXT() */ |
/* No dispatch for Binormal3fvEXT() */ |
/* No dispatch for Binormal3iEXT() */ |
/* No dispatch for Binormal3ivEXT() */ |
/* No dispatch for Binormal3sEXT() */ |
/* No dispatch for Binormal3svEXT() */ |
/* No dispatch for TangentPointerEXT() */ |
/* No dispatch for BinormalPointerEXT() */ |
/* No dispatch for FinishTextureSUNX() */ |
/* No dispatch for GlobalAlphaFactorbSUN() */ |
/* No dispatch for GlobalAlphaFactorsSUN() */ |
/* No dispatch for GlobalAlphaFactoriSUN() */ |
/* No dispatch for GlobalAlphaFactorfSUN() */ |
/* No dispatch for GlobalAlphaFactordSUN() */ |
/* No dispatch for GlobalAlphaFactorubSUN() */ |
/* No dispatch for GlobalAlphaFactorusSUN() */ |
/* No dispatch for GlobalAlphaFactoruiSUN() */ |
/* No dispatch for ReplacementCodeuiSUN() */ |
/* No dispatch for ReplacementCodeusSUN() */ |
/* No dispatch for ReplacementCodeubSUN() */ |
/* No dispatch for ReplacementCodeuivSUN() */ |
/* No dispatch for ReplacementCodeusvSUN() */ |
/* No dispatch for ReplacementCodeubvSUN() */ |
/* No dispatch for ReplacementCodePointerSUN() */ |
/* No dispatch for Color4ubVertex2fSUN() */ |
/* No dispatch for Color4ubVertex2fvSUN() */ |
/* No dispatch for Color4ubVertex3fSUN() */ |
/* No dispatch for Color4ubVertex3fvSUN() */ |
/* No dispatch for Color3fVertex3fSUN() */ |
/* No dispatch for Color3fVertex3fvSUN() */ |
/* No dispatch for Normal3fVertex3fSUN() */ |
/* No dispatch for Normal3fVertex3fvSUN() */ |
/* No dispatch for Color4fNormal3fVertex3fSUN() */ |
/* No dispatch for Color4fNormal3fVertex3fvSUN() */ |
/* No dispatch for TexCoord2fVertex3fSUN() */ |
/* No dispatch for TexCoord2fVertex3fvSUN() */ |
/* No dispatch for TexCoord4fVertex4fSUN() */ |
/* No dispatch for TexCoord4fVertex4fvSUN() */ |
/* No dispatch for TexCoord2fColor4ubVertex3fSUN() */ |
/* No dispatch for TexCoord2fColor4ubVertex3fvSUN() */ |
/* No dispatch for TexCoord2fColor3fVertex3fSUN() */ |
/* No dispatch for TexCoord2fColor3fVertex3fvSUN() */ |
/* No dispatch for TexCoord2fNormal3fVertex3fSUN() */ |
/* No dispatch for TexCoord2fNormal3fVertex3fvSUN() */ |
/* No dispatch for TexCoord2fColor4fNormal3fVertex3fSUN() */ |
/* No dispatch for TexCoord2fColor4fNormal3fVertex3fvSUN() */ |
/* No dispatch for TexCoord4fColor4fNormal3fVertex4fSUN() */ |
/* No dispatch for TexCoord4fColor4fNormal3fVertex4fvSUN() */ |
/* No dispatch for ReplacementCodeuiVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiColor4ubVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiColor4ubVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiColor3fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiColor3fVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiNormal3fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiNormal3fVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiColor4fNormal3fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiColor4fNormal3fVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN() */ |
/* No dispatch for ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN() */ |
KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) |
{ |
DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) |
{ |
DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) |
{ |
DISPATCH(VertexWeightfEXT, (weight), (F, "glVertexWeightfEXT(%f);\n", weight)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) |
{ |
DISPATCH(VertexWeightfvEXT, (weight), (F, "glVertexWeightfvEXT(%p);\n", (void *) weight)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, "glVertexWeightPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) |
{ |
DISPATCH(FlushVertexArrayRangeNV, (), (F, "glFlushVertexArrayRangeNV();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer) |
{ |
DISPATCH(VertexArrayRangeNV, (length, pointer), (F, "glVertexArrayRangeNV(%d, %p);\n", length, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(CombinerParameterfvNV, (pname, params), (F, "glCombinerParameterfvNV(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) |
{ |
DISPATCH(CombinerParameterfNV, (pname, param), (F, "glCombinerParameterfNV(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) |
{ |
DISPATCH(CombinerParameterivNV, (pname, params), (F, "glCombinerParameterivNV(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) |
{ |
DISPATCH(CombinerParameteriNV, (pname, param), (F, "glCombinerParameteriNV(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) |
{ |
DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, "glCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\n", stage, portion, variable, input, mapping, componentUsage)); |
} |
KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) |
{ |
DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, "glCombinerOutputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %d, %d, %d);\n", stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum)); |
} |
KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) |
{ |
DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, "glFinalCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x);\n", variable, input, mapping, componentUsage)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterfvNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) |
{ |
DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterivNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterfvNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) |
{ |
DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterivNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterfvNV(0x%x, 0x%x, %p);\n", variable, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) |
{ |
DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterivNV(0x%x, 0x%x, %p);\n", variable, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) |
{ |
DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();\n")); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) |
{ |
DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dMESA(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble * v) |
{ |
DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvMESA(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) |
{ |
DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fMESA(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat * v) |
{ |
DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvMESA(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) |
{ |
DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iMESA(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint * v) |
{ |
DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivMESA(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) |
{ |
DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sMESA(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort * v) |
{ |
DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svMESA(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dMESA(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble * v) |
{ |
DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvMESA(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fMESA(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat * v) |
{ |
DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvMESA(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) |
{ |
DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iMESA(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint * v) |
{ |
DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivMESA(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sMESA(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort * v) |
{ |
DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svMESA(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, "glWindowPos4dMESA(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble * v) |
{ |
DISPATCH(WindowPos4dvMESA, (v), (F, "glWindowPos4dvMESA(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, "glWindowPos4fMESA(%f, %f, %f, %f);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat * v) |
{ |
DISPATCH(WindowPos4fvMESA, (v), (F, "glWindowPos4fvMESA(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) |
{ |
DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, "glWindowPos4iMESA(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint * v) |
{ |
DISPATCH(WindowPos4ivMESA, (v), (F, "glWindowPos4ivMESA(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, "glWindowPos4sMESA(%d, %d, %d, %d);\n", x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) |
{ |
DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (void *) v)); |
} |
/* No dispatch for MultiModeDrawArraysIBM() */ |
/* No dispatch for MultiModeDrawElementsIBM() */ |
/* No dispatch for ColorPointerListIBM() */ |
/* No dispatch for SecondaryColorPointerListIBM() */ |
/* No dispatch for EdgeFlagPointerListIBM() */ |
/* No dispatch for FogCoordPointerListIBM() */ |
/* No dispatch for IndexPointerListIBM() */ |
/* No dispatch for NormalPointerListIBM() */ |
/* No dispatch for TexCoordPointerListIBM() */ |
/* No dispatch for VertexPointerListIBM() */ |
KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) |
{ |
DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(%d);\n", mask)); |
} |
KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) |
{ |
DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskEXT(%f, %d);\n", value, invert)); |
} |
KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) |
{ |
DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternEXT(0x%x);\n", pattern)); |
} |
/* No dispatch for TextureColorMaskSGIS() */ |
/* No dispatch for IglooInterfaceSGIX() */ |
KEYWORD1 void KEYWORD2 NAME(DeleteFencesNV)(GLsizei n, const GLuint * fences) |
{ |
DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (void *) fences)); |
} |
KEYWORD1 void KEYWORD2 NAME(GenFencesNV)(GLsizei n, GLuint * fences) |
{ |
DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (void *) fences)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsFenceNV)(GLuint fence) |
{ |
RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(TestFenceNV)(GLuint fence) |
{ |
RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetFenceivNV)(GLuint fence, GLenum pname, GLint * params) |
{ |
DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(FinishFenceNV)(GLuint fence) |
{ |
DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); |
} |
KEYWORD1 void KEYWORD2 NAME(SetFenceNV)(GLuint fence, GLenum condition) |
{ |
DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); |
} |
/* No dispatch for MapControlPointsNV() */ |
/* No dispatch for MapParameterivNV() */ |
/* No dispatch for MapParameterfvNV() */ |
/* No dispatch for GetMapControlPointsNV() */ |
/* No dispatch for GetMapParameterivNV() */ |
/* No dispatch for GetMapParameterfvNV() */ |
/* No dispatch for GetMapAttribParameterivNV() */ |
/* No dispatch for GetMapAttribParameterfvNV() */ |
/* No dispatch for EvalMapsNV() */ |
/* No dispatch for CombinerStageParameterfvNV() */ |
/* No dispatch for GetCombinerStageParameterfvNV() */ |
KEYWORD1 void KEYWORD2 NAME(WindowPos2dARB)(GLdouble x, GLdouble y) |
{ |
DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dARB(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2fARB)(GLfloat x, GLfloat y) |
{ |
DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fARB(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2iARB)(GLint x, GLint y) |
{ |
DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iARB(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2sARB)(GLshort x, GLshort y) |
{ |
DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sARB(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2dvARB)(const GLdouble * p) |
{ |
DISPATCH(WindowPos2dvMESA, (p), (F, "glWindowPos2dvARB(%p /* %g, %g */);\n", (void *) p, p[0], p[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2fvARB)(const GLfloat * p) |
{ |
DISPATCH(WindowPos2fvMESA, (p), (F, "glWindowPos2fvARB(%p /* %g, %g */);\n", (void *) p, p[0], p[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2ivARB)(const GLint * p) |
{ |
DISPATCH(WindowPos2ivMESA, (p), (F, "glWindowPos2ivARB(%p);\n", (void *) p)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2svARB)(const GLshort * p) |
{ |
DISPATCH(WindowPos2svMESA, (p), (F, "glWindowPos2svARB(%p);\n", (void *) p)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dARB(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fARB(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3iARB)(GLint x, GLint y, GLint z) |
{ |
DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iARB(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3sARB)(GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sARB(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3dvARB)(const GLdouble * p) |
{ |
DISPATCH(WindowPos3dvMESA, (p), (F, "glWindowPos3dvARB(%p /* %g, %g, %g */);\n", (void *) p, p[0], p[1], p[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3fvARB)(const GLfloat * p) |
{ |
DISPATCH(WindowPos3fvMESA, (p), (F, "glWindowPos3fvARB(%p /* %g, %g, %g */);\n", (void *) p, p[0], p[1], p[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3ivARB)(const GLint * p) |
{ |
DISPATCH(WindowPos3ivMESA, (p), (F, "glWindowPos3ivARB(%p);\n", (void *) p)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3svARB)(const GLshort * p) |
{ |
DISPATCH(WindowPos3svMESA, (p), (F, "glWindowPos3svARB(%p);\n", (void *) p)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences) |
{ |
RETURN_DISPATCH(AreProgramsResidentNV, (n, ids, residences), (F, "glAreProgramsResidentNV(%d, %p, %p);\n", n, (void *) ids, (void *) residences)); |
} |
KEYWORD1 void KEYWORD2 NAME(BindProgramNV)(GLenum target, GLuint id) |
{ |
DISPATCH(BindProgramNV, (target, id), (F, "glBindProgramNV(0x%x, %d);\n", target, id)); |
} |
KEYWORD1 void KEYWORD2 NAME(DeleteProgramsNV)(GLsizei n, const GLuint * ids) |
{ |
DISPATCH(DeleteProgramsNV, (n, ids), (F, "glDeleteProgramsNV(%d, %p);\n", n, (void *) ids)); |
} |
KEYWORD1 void KEYWORD2 NAME(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params) |
{ |
DISPATCH(ExecuteProgramNV, (target, id, params), (F, "glExecuteProgramNV(0x%x, %d, %p);\n", target, id, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GenProgramsNV)(GLsizei n, GLuint * ids) |
{ |
DISPATCH(GenProgramsNV, (n, ids), (F, "glGenProgramsNV(%d, %p);\n", n, (void *) ids)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params) |
{ |
DISPATCH(GetProgramParameterdvNV, (target, index, pname, params), (F, "glGetProgramParameterdvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetProgramParameterfvNV, (target, index, pname, params), (F, "glGetProgramParameterfvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetProgramivNV)(GLuint id, GLenum pname, GLint * params) |
{ |
DISPATCH(GetProgramivNV, (id, pname, params), (F, "glGetProgramivNV(%d, 0x%x, %p);\n", id, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program) |
{ |
DISPATCH(GetProgramStringNV, (id, pname, program), (F, "glGetProgramStringNV(%d, 0x%x, %p);\n", id, pname, (void *) program)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params) |
{ |
DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params) |
{ |
DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params) |
{ |
DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params) |
{ |
DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer) |
{ |
DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (void *) pointer)); |
} |
KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramNV)(GLuint id) |
{ |
RETURN_DISPATCH(IsProgramNV, (id), (F, "glIsProgramNV(%d);\n", id)); |
} |
KEYWORD1 void KEYWORD2 NAME(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program) |
{ |
DISPATCH(LoadProgramNV, (target, id, len, program), (F, "glLoadProgramNV(0x%x, %d, %d, %p);\n", target, id, len, (void *) program)); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
DISPATCH(ProgramParameter4dNV, (target, index, x, y, z, w), (F, "glProgramParameter4dNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params) |
{ |
DISPATCH(ProgramParameter4dvNV, (target, index, params), (F, "glProgramParameter4dvNV(0x%x, %d, %p /* %g, %g, %g, %g */);\n", target, index, (void *) params, params[0], params[1], params[2], params[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
DISPATCH(ProgramParameter4fNV, (target, index, x, y, z, w), (F, "glProgramParameter4fNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params) |
{ |
DISPATCH(ProgramParameter4fvNV, (target, index, params), (F, "glProgramParameter4fvNV(0x%x, %d, %p /* %g, %g, %g, %g */);\n", target, index, (void *) params, params[0], params[1], params[2], params[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params) |
{ |
DISPATCH(ProgramParameters4dvNV, (target, index, num, params), (F, "glProgramParameters4dvNV(0x%x, %d, %d, %p /* %g, %g, %g, %g */);\n", target, index, num, (void *) params, params[0], params[1], params[2], params[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params) |
{ |
DISPATCH(ProgramParameters4fvNV, (target, index, num, params), (F, "glProgramParameters4fvNV(0x%x, %d, %d, %p /* %g, %g, %g, %g */);\n", target, index, num, (void *) params, params[0], params[1], params[2], params[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(RequestResidentProgramsNV)(GLsizei n, const GLuint * ids) |
{ |
DISPATCH(RequestResidentProgramsNV, (n, ids), (F, "glRequestResidentProgramsNV(%d, %p);\n", n, (void *) ids)); |
} |
KEYWORD1 void KEYWORD2 NAME(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform) |
{ |
DISPATCH(TrackMatrixNV, (target, address, matrix, transform), (F, "glTrackMatrixNV(0x%x, %d, 0x%x, 0x%x);\n", target, address, matrix, transform)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(VertexAttribPointerNV, (index, size, type, stride, pointer), (F, "glVertexAttribPointerNV(%d, %d, 0x%x, %d, %p);\n", index, size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dNV)(GLuint index, GLdouble x) |
{ |
DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dNV(%d, %f);\n", index, x)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvNV)(GLuint index, const GLdouble * v) |
{ |
DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fNV)(GLuint index, GLfloat x) |
{ |
DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fNV(%d, %f);\n", index, x)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvNV)(GLuint index, const GLfloat * v) |
{ |
DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sNV)(GLuint index, GLshort x) |
{ |
DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sNV(%d, %d);\n", index, x)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svNV)(GLuint index, const GLshort * v) |
{ |
DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y) |
{ |
DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dNV(%d, %f, %f);\n", index, x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvNV)(GLuint index, const GLdouble * v) |
{ |
DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvNV(%d, %p /* %g, %g */);\n", index, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) |
{ |
DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fNV(%d, %f, %f);\n", index, x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvNV)(GLuint index, const GLfloat * v) |
{ |
DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvNV(%d, %p /* %g, %g */);\n", index, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y) |
{ |
DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sNV(%d, %d, %d);\n", index, x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svNV)(GLuint index, const GLshort * v) |
{ |
DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dNV(%d, %f, %f, %f);\n", index, x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvNV)(GLuint index, const GLdouble * v) |
{ |
DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvNV(%d, %p /* %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fNV(%d, %f, %f, %f);\n", index, x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvNV)(GLuint index, const GLfloat * v) |
{ |
DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvNV(%d, %p /* %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sNV(%d, %d, %d, %d);\n", index, x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svNV)(GLuint index, const GLshort * v) |
{ |
DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) |
{ |
DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvNV)(GLuint index, const GLdouble * v) |
{ |
DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvNV(%d, %p /* %g, %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
{ |
DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) |
{ |
DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvNV(%d, %p /* %g, %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) |
{ |
DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svNV)(GLuint index, const GLshort * v) |
{ |
DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) |
{ |
DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4ubNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvNV)(GLuint index, const GLubyte * v) |
{ |
DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4ubvNV(%d, %p);\n", index, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v) |
{ |
DISPATCH(VertexAttribs1dvNV, (index, n, v), (F, "glVertexAttribs1dvNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v) |
{ |
DISPATCH(VertexAttribs1fvNV, (index, n, v), (F, "glVertexAttribs1fvNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v) |
{ |
DISPATCH(VertexAttribs1svNV, (index, n, v), (F, "glVertexAttribs1svNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v) |
{ |
DISPATCH(VertexAttribs2dvNV, (index, n, v), (F, "glVertexAttribs2dvNV(%d, %d, %p /* %g, %g */);\n", index, n, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v) |
{ |
DISPATCH(VertexAttribs2fvNV, (index, n, v), (F, "glVertexAttribs2fvNV(%d, %d, %p /* %g, %g */);\n", index, n, (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v) |
{ |
DISPATCH(VertexAttribs2svNV, (index, n, v), (F, "glVertexAttribs2svNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v) |
{ |
DISPATCH(VertexAttribs3dvNV, (index, n, v), (F, "glVertexAttribs3dvNV(%d, %d, %p /* %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v) |
{ |
DISPATCH(VertexAttribs3fvNV, (index, n, v), (F, "glVertexAttribs3fvNV(%d, %d, %p /* %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v) |
{ |
DISPATCH(VertexAttribs3svNV, (index, n, v), (F, "glVertexAttribs3svNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v) |
{ |
DISPATCH(VertexAttribs4dvNV, (index, n, v), (F, "glVertexAttribs4dvNV(%d, %d, %p /* %g, %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v) |
{ |
DISPATCH(VertexAttribs4fvNV, (index, n, v), (F, "glVertexAttribs4fvNV(%d, %d, %p /* %g, %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2], v[3])); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v) |
{ |
DISPATCH(VertexAttribs4svNV, (index, n, v), (F, "glVertexAttribs4svNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v) |
{ |
DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameteriNV)(GLenum pname, GLint params) |
{ |
DISPATCH(PointParameteriNV, (pname, params), (F, "glPointParameteriNV(0x%x, %d);\n", pname, params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * params) |
{ |
DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) |
{ |
DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordf)(GLfloat coord) |
{ |
DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordf(%f);\n", coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordfv)(const GLfloat * coord) |
{ |
DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfv(%p);\n", (void *) coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordd)(GLdouble coord) |
{ |
DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoordd(%f);\n", coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoorddv)(const GLdouble * coord) |
{ |
DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddv(%p);\n", (void *) coord)); |
} |
KEYWORD1 void KEYWORD2 NAME(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) |
{ |
DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) |
{ |
DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (void *) first, (void *) count, primcount)); |
} |
KEYWORD1 void KEYWORD2 NAME(MultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) |
{ |
DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElements(0x%x, %p, 0x%x, %p, %d);\n", mode, (void *) count, type, (void *) indices, primcount)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterf)(GLenum pname, GLfloat param) |
{ |
DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterf(0x%x, %f);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameterfv)(GLenum pname, const GLfloat * params) |
{ |
DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameteri)(GLenum pname, GLint param) |
{ |
DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteri(0x%x, %d);\n", pname, param)); |
} |
KEYWORD1 void KEYWORD2 NAME(PointParameteriv)(GLenum pname, const GLint * params) |
{ |
DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameteriv(0x%x, %p);\n", pname, (void *) params)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) |
{ |
DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bv)(const GLbyte * v) |
{ |
DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue) |
{ |
DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3d(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dv)(const GLdouble * v) |
{ |
DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue) |
{ |
DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3f(%f, %f, %f);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fv)(const GLfloat * v) |
{ |
DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3i)(GLint red, GLint green, GLint blue) |
{ |
DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3i(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iv)(const GLint * v) |
{ |
DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue) |
{ |
DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3s(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sv)(const GLshort * v) |
{ |
DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue) |
{ |
DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ub(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubv)(const GLubyte * v) |
{ |
DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue) |
{ |
DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3ui(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiv)(const GLuint * v) |
{ |
DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uiv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue) |
{ |
DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3us(%d, %d, %d);\n", red, green, blue)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usv)(const GLushort * v) |
{ |
DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const void * pointer) |
{ |
DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2d)(GLdouble x, GLdouble y) |
{ |
DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2d(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2dv)(const GLdouble * v) |
{ |
DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2f)(GLfloat x, GLfloat y) |
{ |
DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2f(%f, %f);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2fv)(const GLfloat * v) |
{ |
DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2i)(GLint x, GLint y) |
{ |
DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2i(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2iv)(const GLint * v) |
{ |
DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2s)(GLshort x, GLshort y) |
{ |
DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2s(%d, %d);\n", x, y)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos2sv)(const GLshort * v) |
{ |
DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z) |
{ |
DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3d(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3dv)(const GLdouble * v) |
{ |
DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z) |
{ |
DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3f(%f, %f, %f);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3fv)(const GLfloat * v) |
{ |
DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3i)(GLint x, GLint y, GLint z) |
{ |
DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3i(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3iv)(const GLint * v) |
{ |
DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3iv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3s)(GLshort x, GLshort y, GLshort z) |
{ |
DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3s(%d, %d, %d);\n", x, y, z)); |
} |
KEYWORD1 void KEYWORD2 NAME(WindowPos3sv)(const GLshort * v) |
{ |
DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3sv(%p);\n", (void *) v)); |
} |
KEYWORD1 void KEYWORD2 NAME(ActiveStencilFaceEXT)(GLenum face) |
{ |
DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); |
} |
/* |
* This is how a dispatch table can be initialized with all the functions |
* we generated above. |
*/ |
#ifdef DISPATCH_TABLE_NAME |
#ifndef TABLE_ENTRY |
#error TABLE_ENTRY must be defined |
#endif |
void *DISPATCH_TABLE_NAME[] = { |
TABLE_ENTRY(NewList), |
TABLE_ENTRY(EndList), |
TABLE_ENTRY(CallList), |
TABLE_ENTRY(CallLists), |
TABLE_ENTRY(DeleteLists), |
TABLE_ENTRY(GenLists), |
TABLE_ENTRY(ListBase), |
TABLE_ENTRY(Begin), |
TABLE_ENTRY(Bitmap), |
TABLE_ENTRY(Color3b), |
TABLE_ENTRY(Color3bv), |
TABLE_ENTRY(Color3d), |
TABLE_ENTRY(Color3dv), |
TABLE_ENTRY(Color3f), |
TABLE_ENTRY(Color3fv), |
TABLE_ENTRY(Color3i), |
TABLE_ENTRY(Color3iv), |
TABLE_ENTRY(Color3s), |
TABLE_ENTRY(Color3sv), |
TABLE_ENTRY(Color3ub), |
TABLE_ENTRY(Color3ubv), |
TABLE_ENTRY(Color3ui), |
TABLE_ENTRY(Color3uiv), |
TABLE_ENTRY(Color3us), |
TABLE_ENTRY(Color3usv), |
TABLE_ENTRY(Color4b), |
TABLE_ENTRY(Color4bv), |
TABLE_ENTRY(Color4d), |
TABLE_ENTRY(Color4dv), |
TABLE_ENTRY(Color4f), |
TABLE_ENTRY(Color4fv), |
TABLE_ENTRY(Color4i), |
TABLE_ENTRY(Color4iv), |
TABLE_ENTRY(Color4s), |
TABLE_ENTRY(Color4sv), |
TABLE_ENTRY(Color4ub), |
TABLE_ENTRY(Color4ubv), |
TABLE_ENTRY(Color4ui), |
TABLE_ENTRY(Color4uiv), |
TABLE_ENTRY(Color4us), |
TABLE_ENTRY(Color4usv), |
TABLE_ENTRY(EdgeFlag), |
TABLE_ENTRY(EdgeFlagv), |
TABLE_ENTRY(End), |
TABLE_ENTRY(Indexd), |
TABLE_ENTRY(Indexdv), |
TABLE_ENTRY(Indexf), |
TABLE_ENTRY(Indexfv), |
TABLE_ENTRY(Indexi), |
TABLE_ENTRY(Indexiv), |
TABLE_ENTRY(Indexs), |
TABLE_ENTRY(Indexsv), |
TABLE_ENTRY(Normal3b), |
TABLE_ENTRY(Normal3bv), |
TABLE_ENTRY(Normal3d), |
TABLE_ENTRY(Normal3dv), |
TABLE_ENTRY(Normal3f), |
TABLE_ENTRY(Normal3fv), |
TABLE_ENTRY(Normal3i), |
TABLE_ENTRY(Normal3iv), |
TABLE_ENTRY(Normal3s), |
TABLE_ENTRY(Normal3sv), |
TABLE_ENTRY(RasterPos2d), |
TABLE_ENTRY(RasterPos2dv), |
TABLE_ENTRY(RasterPos2f), |
TABLE_ENTRY(RasterPos2fv), |
TABLE_ENTRY(RasterPos2i), |
TABLE_ENTRY(RasterPos2iv), |
TABLE_ENTRY(RasterPos2s), |
TABLE_ENTRY(RasterPos2sv), |
TABLE_ENTRY(RasterPos3d), |
TABLE_ENTRY(RasterPos3dv), |
TABLE_ENTRY(RasterPos3f), |
TABLE_ENTRY(RasterPos3fv), |
TABLE_ENTRY(RasterPos3i), |
TABLE_ENTRY(RasterPos3iv), |
TABLE_ENTRY(RasterPos3s), |
TABLE_ENTRY(RasterPos3sv), |
TABLE_ENTRY(RasterPos4d), |
TABLE_ENTRY(RasterPos4dv), |
TABLE_ENTRY(RasterPos4f), |
TABLE_ENTRY(RasterPos4fv), |
TABLE_ENTRY(RasterPos4i), |
TABLE_ENTRY(RasterPos4iv), |
TABLE_ENTRY(RasterPos4s), |
TABLE_ENTRY(RasterPos4sv), |
TABLE_ENTRY(Rectd), |
TABLE_ENTRY(Rectdv), |
TABLE_ENTRY(Rectf), |
TABLE_ENTRY(Rectfv), |
TABLE_ENTRY(Recti), |
TABLE_ENTRY(Rectiv), |
TABLE_ENTRY(Rects), |
TABLE_ENTRY(Rectsv), |
TABLE_ENTRY(TexCoord1d), |
TABLE_ENTRY(TexCoord1dv), |
TABLE_ENTRY(TexCoord1f), |
TABLE_ENTRY(TexCoord1fv), |
TABLE_ENTRY(TexCoord1i), |
TABLE_ENTRY(TexCoord1iv), |
TABLE_ENTRY(TexCoord1s), |
TABLE_ENTRY(TexCoord1sv), |
TABLE_ENTRY(TexCoord2d), |
TABLE_ENTRY(TexCoord2dv), |
TABLE_ENTRY(TexCoord2f), |
TABLE_ENTRY(TexCoord2fv), |
TABLE_ENTRY(TexCoord2i), |
TABLE_ENTRY(TexCoord2iv), |
TABLE_ENTRY(TexCoord2s), |
TABLE_ENTRY(TexCoord2sv), |
TABLE_ENTRY(TexCoord3d), |
TABLE_ENTRY(TexCoord3dv), |
TABLE_ENTRY(TexCoord3f), |
TABLE_ENTRY(TexCoord3fv), |
TABLE_ENTRY(TexCoord3i), |
TABLE_ENTRY(TexCoord3iv), |
TABLE_ENTRY(TexCoord3s), |
TABLE_ENTRY(TexCoord3sv), |
TABLE_ENTRY(TexCoord4d), |
TABLE_ENTRY(TexCoord4dv), |
TABLE_ENTRY(TexCoord4f), |
TABLE_ENTRY(TexCoord4fv), |
TABLE_ENTRY(TexCoord4i), |
TABLE_ENTRY(TexCoord4iv), |
TABLE_ENTRY(TexCoord4s), |
TABLE_ENTRY(TexCoord4sv), |
TABLE_ENTRY(Vertex2d), |
TABLE_ENTRY(Vertex2dv), |
TABLE_ENTRY(Vertex2f), |
TABLE_ENTRY(Vertex2fv), |
TABLE_ENTRY(Vertex2i), |
TABLE_ENTRY(Vertex2iv), |
TABLE_ENTRY(Vertex2s), |
TABLE_ENTRY(Vertex2sv), |
TABLE_ENTRY(Vertex3d), |
TABLE_ENTRY(Vertex3dv), |
TABLE_ENTRY(Vertex3f), |
TABLE_ENTRY(Vertex3fv), |
TABLE_ENTRY(Vertex3i), |
TABLE_ENTRY(Vertex3iv), |
TABLE_ENTRY(Vertex3s), |
TABLE_ENTRY(Vertex3sv), |
TABLE_ENTRY(Vertex4d), |
TABLE_ENTRY(Vertex4dv), |
TABLE_ENTRY(Vertex4f), |
TABLE_ENTRY(Vertex4fv), |
TABLE_ENTRY(Vertex4i), |
TABLE_ENTRY(Vertex4iv), |
TABLE_ENTRY(Vertex4s), |
TABLE_ENTRY(Vertex4sv), |
TABLE_ENTRY(ClipPlane), |
TABLE_ENTRY(ColorMaterial), |
TABLE_ENTRY(CullFace), |
TABLE_ENTRY(Fogf), |
TABLE_ENTRY(Fogfv), |
TABLE_ENTRY(Fogi), |
TABLE_ENTRY(Fogiv), |
TABLE_ENTRY(FrontFace), |
TABLE_ENTRY(Hint), |
TABLE_ENTRY(Lightf), |
TABLE_ENTRY(Lightfv), |
TABLE_ENTRY(Lighti), |
TABLE_ENTRY(Lightiv), |
TABLE_ENTRY(LightModelf), |
TABLE_ENTRY(LightModelfv), |
TABLE_ENTRY(LightModeli), |
TABLE_ENTRY(LightModeliv), |
TABLE_ENTRY(LineStipple), |
TABLE_ENTRY(LineWidth), |
TABLE_ENTRY(Materialf), |
TABLE_ENTRY(Materialfv), |
TABLE_ENTRY(Materiali), |
TABLE_ENTRY(Materialiv), |
TABLE_ENTRY(PointSize), |
TABLE_ENTRY(PolygonMode), |
TABLE_ENTRY(PolygonStipple), |
TABLE_ENTRY(Scissor), |
TABLE_ENTRY(ShadeModel), |
TABLE_ENTRY(TexParameterf), |
TABLE_ENTRY(TexParameterfv), |
TABLE_ENTRY(TexParameteri), |
TABLE_ENTRY(TexParameteriv), |
TABLE_ENTRY(TexImage1D), |
TABLE_ENTRY(TexImage2D), |
TABLE_ENTRY(TexEnvf), |
TABLE_ENTRY(TexEnvfv), |
TABLE_ENTRY(TexEnvi), |
TABLE_ENTRY(TexEnviv), |
TABLE_ENTRY(TexGend), |
TABLE_ENTRY(TexGendv), |
TABLE_ENTRY(TexGenf), |
TABLE_ENTRY(TexGenfv), |
TABLE_ENTRY(TexGeni), |
TABLE_ENTRY(TexGeniv), |
TABLE_ENTRY(FeedbackBuffer), |
TABLE_ENTRY(SelectBuffer), |
TABLE_ENTRY(RenderMode), |
TABLE_ENTRY(InitNames), |
TABLE_ENTRY(LoadName), |
TABLE_ENTRY(PassThrough), |
TABLE_ENTRY(PopName), |
TABLE_ENTRY(PushName), |
TABLE_ENTRY(DrawBuffer), |
TABLE_ENTRY(Clear), |
TABLE_ENTRY(ClearAccum), |
TABLE_ENTRY(ClearIndex), |
TABLE_ENTRY(ClearColor), |
TABLE_ENTRY(ClearStencil), |
TABLE_ENTRY(ClearDepth), |
TABLE_ENTRY(StencilMask), |
TABLE_ENTRY(ColorMask), |
TABLE_ENTRY(DepthMask), |
TABLE_ENTRY(IndexMask), |
TABLE_ENTRY(Accum), |
TABLE_ENTRY(Disable), |
TABLE_ENTRY(Enable), |
TABLE_ENTRY(Finish), |
TABLE_ENTRY(Flush), |
TABLE_ENTRY(PopAttrib), |
TABLE_ENTRY(PushAttrib), |
TABLE_ENTRY(Map1d), |
TABLE_ENTRY(Map1f), |
TABLE_ENTRY(Map2d), |
TABLE_ENTRY(Map2f), |
TABLE_ENTRY(MapGrid1d), |
TABLE_ENTRY(MapGrid1f), |
TABLE_ENTRY(MapGrid2d), |
TABLE_ENTRY(MapGrid2f), |
TABLE_ENTRY(EvalCoord1d), |
TABLE_ENTRY(EvalCoord1dv), |
TABLE_ENTRY(EvalCoord1f), |
TABLE_ENTRY(EvalCoord1fv), |
TABLE_ENTRY(EvalCoord2d), |
TABLE_ENTRY(EvalCoord2dv), |
TABLE_ENTRY(EvalCoord2f), |
TABLE_ENTRY(EvalCoord2fv), |
TABLE_ENTRY(EvalMesh1), |
TABLE_ENTRY(EvalPoint1), |
TABLE_ENTRY(EvalMesh2), |
TABLE_ENTRY(EvalPoint2), |
TABLE_ENTRY(AlphaFunc), |
TABLE_ENTRY(BlendFunc), |
TABLE_ENTRY(LogicOp), |
TABLE_ENTRY(StencilFunc), |
TABLE_ENTRY(StencilOp), |
TABLE_ENTRY(DepthFunc), |
TABLE_ENTRY(PixelZoom), |
TABLE_ENTRY(PixelTransferf), |
TABLE_ENTRY(PixelTransferi), |
TABLE_ENTRY(PixelStoref), |
TABLE_ENTRY(PixelStorei), |
TABLE_ENTRY(PixelMapfv), |
TABLE_ENTRY(PixelMapuiv), |
TABLE_ENTRY(PixelMapusv), |
TABLE_ENTRY(ReadBuffer), |
TABLE_ENTRY(CopyPixels), |
TABLE_ENTRY(ReadPixels), |
TABLE_ENTRY(DrawPixels), |
TABLE_ENTRY(GetBooleanv), |
TABLE_ENTRY(GetClipPlane), |
TABLE_ENTRY(GetDoublev), |
TABLE_ENTRY(GetError), |
TABLE_ENTRY(GetFloatv), |
TABLE_ENTRY(GetIntegerv), |
TABLE_ENTRY(GetLightfv), |
TABLE_ENTRY(GetLightiv), |
TABLE_ENTRY(GetMapdv), |
TABLE_ENTRY(GetMapfv), |
TABLE_ENTRY(GetMapiv), |
TABLE_ENTRY(GetMaterialfv), |
TABLE_ENTRY(GetMaterialiv), |
TABLE_ENTRY(GetPixelMapfv), |
TABLE_ENTRY(GetPixelMapuiv), |
TABLE_ENTRY(GetPixelMapusv), |
TABLE_ENTRY(GetPolygonStipple), |
TABLE_ENTRY(GetString), |
TABLE_ENTRY(GetTexEnvfv), |
TABLE_ENTRY(GetTexEnviv), |
TABLE_ENTRY(GetTexGendv), |
TABLE_ENTRY(GetTexGenfv), |
TABLE_ENTRY(GetTexGeniv), |
TABLE_ENTRY(GetTexImage), |
TABLE_ENTRY(GetTexParameterfv), |
TABLE_ENTRY(GetTexParameteriv), |
TABLE_ENTRY(GetTexLevelParameterfv), |
TABLE_ENTRY(GetTexLevelParameteriv), |
TABLE_ENTRY(IsEnabled), |
TABLE_ENTRY(IsList), |
TABLE_ENTRY(DepthRange), |
TABLE_ENTRY(Frustum), |
TABLE_ENTRY(LoadIdentity), |
TABLE_ENTRY(LoadMatrixf), |
TABLE_ENTRY(LoadMatrixd), |
TABLE_ENTRY(MatrixMode), |
TABLE_ENTRY(MultMatrixf), |
TABLE_ENTRY(MultMatrixd), |
TABLE_ENTRY(Ortho), |
TABLE_ENTRY(PopMatrix), |
TABLE_ENTRY(PushMatrix), |
TABLE_ENTRY(Rotated), |
TABLE_ENTRY(Rotatef), |
TABLE_ENTRY(Scaled), |
TABLE_ENTRY(Scalef), |
TABLE_ENTRY(Translated), |
TABLE_ENTRY(Translatef), |
TABLE_ENTRY(Viewport), |
TABLE_ENTRY(ArrayElement), |
TABLE_ENTRY(BindTexture), |
TABLE_ENTRY(ColorPointer), |
TABLE_ENTRY(DisableClientState), |
TABLE_ENTRY(DrawArrays), |
TABLE_ENTRY(DrawElements), |
TABLE_ENTRY(EdgeFlagPointer), |
TABLE_ENTRY(EnableClientState), |
TABLE_ENTRY(IndexPointer), |
TABLE_ENTRY(Indexub), |
TABLE_ENTRY(Indexubv), |
TABLE_ENTRY(InterleavedArrays), |
TABLE_ENTRY(NormalPointer), |
TABLE_ENTRY(PolygonOffset), |
TABLE_ENTRY(TexCoordPointer), |
TABLE_ENTRY(VertexPointer), |
TABLE_ENTRY(AreTexturesResident), |
TABLE_ENTRY(CopyTexImage1D), |
TABLE_ENTRY(CopyTexImage2D), |
TABLE_ENTRY(CopyTexSubImage1D), |
TABLE_ENTRY(CopyTexSubImage2D), |
TABLE_ENTRY(DeleteTextures), |
TABLE_ENTRY(GenTextures), |
TABLE_ENTRY(GetPointerv), |
TABLE_ENTRY(IsTexture), |
TABLE_ENTRY(PrioritizeTextures), |
TABLE_ENTRY(TexSubImage1D), |
TABLE_ENTRY(TexSubImage2D), |
TABLE_ENTRY(PopClientAttrib), |
TABLE_ENTRY(PushClientAttrib), |
TABLE_ENTRY(BlendColor), |
TABLE_ENTRY(BlendEquation), |
TABLE_ENTRY(DrawRangeElements), |
TABLE_ENTRY(ColorTable), |
TABLE_ENTRY(ColorTableParameterfv), |
TABLE_ENTRY(ColorTableParameteriv), |
TABLE_ENTRY(CopyColorTable), |
TABLE_ENTRY(GetColorTable), |
TABLE_ENTRY(GetColorTableParameterfv), |
TABLE_ENTRY(GetColorTableParameteriv), |
TABLE_ENTRY(ColorSubTable), |
TABLE_ENTRY(CopyColorSubTable), |
TABLE_ENTRY(ConvolutionFilter1D), |
TABLE_ENTRY(ConvolutionFilter2D), |
TABLE_ENTRY(ConvolutionParameterf), |
TABLE_ENTRY(ConvolutionParameterfv), |
TABLE_ENTRY(ConvolutionParameteri), |
TABLE_ENTRY(ConvolutionParameteriv), |
TABLE_ENTRY(CopyConvolutionFilter1D), |
TABLE_ENTRY(CopyConvolutionFilter2D), |
TABLE_ENTRY(GetConvolutionFilter), |
TABLE_ENTRY(GetConvolutionParameterfv), |
TABLE_ENTRY(GetConvolutionParameteriv), |
TABLE_ENTRY(GetSeparableFilter), |
TABLE_ENTRY(SeparableFilter2D), |
TABLE_ENTRY(GetHistogram), |
TABLE_ENTRY(GetHistogramParameterfv), |
TABLE_ENTRY(GetHistogramParameteriv), |
TABLE_ENTRY(GetMinmax), |
TABLE_ENTRY(GetMinmaxParameterfv), |
TABLE_ENTRY(GetMinmaxParameteriv), |
TABLE_ENTRY(Histogram), |
TABLE_ENTRY(Minmax), |
TABLE_ENTRY(ResetHistogram), |
TABLE_ENTRY(ResetMinmax), |
TABLE_ENTRY(TexImage3D), |
TABLE_ENTRY(TexSubImage3D), |
TABLE_ENTRY(CopyTexSubImage3D), |
TABLE_ENTRY(ActiveTextureARB), |
TABLE_ENTRY(ClientActiveTextureARB), |
TABLE_ENTRY(MultiTexCoord1dARB), |
TABLE_ENTRY(MultiTexCoord1dvARB), |
TABLE_ENTRY(MultiTexCoord1fARB), |
TABLE_ENTRY(MultiTexCoord1fvARB), |
TABLE_ENTRY(MultiTexCoord1iARB), |
TABLE_ENTRY(MultiTexCoord1ivARB), |
TABLE_ENTRY(MultiTexCoord1sARB), |
TABLE_ENTRY(MultiTexCoord1svARB), |
TABLE_ENTRY(MultiTexCoord2dARB), |
TABLE_ENTRY(MultiTexCoord2dvARB), |
TABLE_ENTRY(MultiTexCoord2fARB), |
TABLE_ENTRY(MultiTexCoord2fvARB), |
TABLE_ENTRY(MultiTexCoord2iARB), |
TABLE_ENTRY(MultiTexCoord2ivARB), |
TABLE_ENTRY(MultiTexCoord2sARB), |
TABLE_ENTRY(MultiTexCoord2svARB), |
TABLE_ENTRY(MultiTexCoord3dARB), |
TABLE_ENTRY(MultiTexCoord3dvARB), |
TABLE_ENTRY(MultiTexCoord3fARB), |
TABLE_ENTRY(MultiTexCoord3fvARB), |
TABLE_ENTRY(MultiTexCoord3iARB), |
TABLE_ENTRY(MultiTexCoord3ivARB), |
TABLE_ENTRY(MultiTexCoord3sARB), |
TABLE_ENTRY(MultiTexCoord3svARB), |
TABLE_ENTRY(MultiTexCoord4dARB), |
TABLE_ENTRY(MultiTexCoord4dvARB), |
TABLE_ENTRY(MultiTexCoord4fARB), |
TABLE_ENTRY(MultiTexCoord4fvARB), |
TABLE_ENTRY(MultiTexCoord4iARB), |
TABLE_ENTRY(MultiTexCoord4ivARB), |
TABLE_ENTRY(MultiTexCoord4sARB), |
TABLE_ENTRY(MultiTexCoord4svARB), |
TABLE_ENTRY(LoadTransposeMatrixfARB), |
TABLE_ENTRY(LoadTransposeMatrixdARB), |
TABLE_ENTRY(MultTransposeMatrixfARB), |
TABLE_ENTRY(MultTransposeMatrixdARB), |
TABLE_ENTRY(SampleCoverageARB), |
TABLE_ENTRY(__unused413), |
TABLE_ENTRY(PolygonOffsetEXT), |
TABLE_ENTRY(GetTexFilterFuncSGIS), |
TABLE_ENTRY(TexFilterFuncSGIS), |
TABLE_ENTRY(GetHistogramEXT), |
TABLE_ENTRY(GetHistogramParameterfvEXT), |
TABLE_ENTRY(GetHistogramParameterivEXT), |
TABLE_ENTRY(GetMinmaxEXT), |
TABLE_ENTRY(GetMinmaxParameterfvEXT), |
TABLE_ENTRY(GetMinmaxParameterivEXT), |
TABLE_ENTRY(GetConvolutionFilterEXT), |
TABLE_ENTRY(GetConvolutionParameterfvEXT), |
TABLE_ENTRY(GetConvolutionParameterivEXT), |
TABLE_ENTRY(GetSeparableFilterEXT), |
TABLE_ENTRY(GetColorTableSGI), |
TABLE_ENTRY(GetColorTableParameterfvSGI), |
TABLE_ENTRY(GetColorTableParameterivSGI), |
TABLE_ENTRY(PixelTexGenSGIX), |
TABLE_ENTRY(PixelTexGenParameteriSGIS), |
TABLE_ENTRY(PixelTexGenParameterivSGIS), |
TABLE_ENTRY(PixelTexGenParameterfSGIS), |
TABLE_ENTRY(PixelTexGenParameterfvSGIS), |
TABLE_ENTRY(GetPixelTexGenParameterivSGIS), |
TABLE_ENTRY(GetPixelTexGenParameterfvSGIS), |
TABLE_ENTRY(TexImage4DSGIS), |
TABLE_ENTRY(TexSubImage4DSGIS), |
TABLE_ENTRY(AreTexturesResidentEXT), |
TABLE_ENTRY(GenTexturesEXT), |
TABLE_ENTRY(IsTextureEXT), |
TABLE_ENTRY(DetailTexFuncSGIS), |
TABLE_ENTRY(GetDetailTexFuncSGIS), |
TABLE_ENTRY(SharpenTexFuncSGIS), |
TABLE_ENTRY(GetSharpenTexFuncSGIS), |
TABLE_ENTRY(SampleMaskSGIS), |
TABLE_ENTRY(SamplePatternSGIS), |
TABLE_ENTRY(ColorPointerEXT), |
TABLE_ENTRY(EdgeFlagPointerEXT), |
TABLE_ENTRY(IndexPointerEXT), |
TABLE_ENTRY(NormalPointerEXT), |
TABLE_ENTRY(TexCoordPointerEXT), |
TABLE_ENTRY(VertexPointerEXT), |
TABLE_ENTRY(SpriteParameterfSGIX), |
TABLE_ENTRY(SpriteParameterfvSGIX), |
TABLE_ENTRY(SpriteParameteriSGIX), |
TABLE_ENTRY(SpriteParameterivSGIX), |
TABLE_ENTRY(PointParameterfEXT), |
TABLE_ENTRY(PointParameterfvEXT), |
TABLE_ENTRY(GetInstrumentsSGIX), |
TABLE_ENTRY(InstrumentsBufferSGIX), |
TABLE_ENTRY(PollInstrumentsSGIX), |
TABLE_ENTRY(ReadInstrumentsSGIX), |
TABLE_ENTRY(StartInstrumentsSGIX), |
TABLE_ENTRY(StopInstrumentsSGIX), |
TABLE_ENTRY(FrameZoomSGIX), |
TABLE_ENTRY(TagSampleBufferSGIX), |
TABLE_ENTRY(ReferencePlaneSGIX), |
TABLE_ENTRY(FlushRasterSGIX), |
TABLE_ENTRY(GetListParameterfvSGIX), |
TABLE_ENTRY(GetListParameterivSGIX), |
TABLE_ENTRY(ListParameterfSGIX), |
TABLE_ENTRY(ListParameterfvSGIX), |
TABLE_ENTRY(ListParameteriSGIX), |
TABLE_ENTRY(ListParameterivSGIX), |
TABLE_ENTRY(FragmentColorMaterialSGIX), |
TABLE_ENTRY(FragmentLightfSGIX), |
TABLE_ENTRY(FragmentLightfvSGIX), |
TABLE_ENTRY(FragmentLightiSGIX), |
TABLE_ENTRY(FragmentLightivSGIX), |
TABLE_ENTRY(FragmentLightModelfSGIX), |
TABLE_ENTRY(FragmentLightModelfvSGIX), |
TABLE_ENTRY(FragmentLightModeliSGIX), |
TABLE_ENTRY(FragmentLightModelivSGIX), |
TABLE_ENTRY(FragmentMaterialfSGIX), |
TABLE_ENTRY(FragmentMaterialfvSGIX), |
TABLE_ENTRY(FragmentMaterialiSGIX), |
TABLE_ENTRY(FragmentMaterialivSGIX), |
TABLE_ENTRY(GetFragmentLightfvSGIX), |
TABLE_ENTRY(GetFragmentLightivSGIX), |
TABLE_ENTRY(GetFragmentMaterialfvSGIX), |
TABLE_ENTRY(GetFragmentMaterialivSGIX), |
TABLE_ENTRY(LightEnviSGIX), |
TABLE_ENTRY(VertexWeightfEXT), |
TABLE_ENTRY(VertexWeightfvEXT), |
TABLE_ENTRY(VertexWeightPointerEXT), |
TABLE_ENTRY(FlushVertexArrayRangeNV), |
TABLE_ENTRY(VertexArrayRangeNV), |
TABLE_ENTRY(CombinerParameterfvNV), |
TABLE_ENTRY(CombinerParameterfNV), |
TABLE_ENTRY(CombinerParameterivNV), |
TABLE_ENTRY(CombinerParameteriNV), |
TABLE_ENTRY(CombinerInputNV), |
TABLE_ENTRY(CombinerOutputNV), |
TABLE_ENTRY(FinalCombinerInputNV), |
TABLE_ENTRY(GetCombinerInputParameterfvNV), |
TABLE_ENTRY(GetCombinerInputParameterivNV), |
TABLE_ENTRY(GetCombinerOutputParameterfvNV), |
TABLE_ENTRY(GetCombinerOutputParameterivNV), |
TABLE_ENTRY(GetFinalCombinerInputParameterfvNV), |
TABLE_ENTRY(GetFinalCombinerInputParameterivNV), |
TABLE_ENTRY(ResizeBuffersMESA), |
TABLE_ENTRY(WindowPos2dMESA), |
TABLE_ENTRY(WindowPos2dvMESA), |
TABLE_ENTRY(WindowPos2fMESA), |
TABLE_ENTRY(WindowPos2fvMESA), |
TABLE_ENTRY(WindowPos2iMESA), |
TABLE_ENTRY(WindowPos2ivMESA), |
TABLE_ENTRY(WindowPos2sMESA), |
TABLE_ENTRY(WindowPos2svMESA), |
TABLE_ENTRY(WindowPos3dMESA), |
TABLE_ENTRY(WindowPos3dvMESA), |
TABLE_ENTRY(WindowPos3fMESA), |
TABLE_ENTRY(WindowPos3fvMESA), |
TABLE_ENTRY(WindowPos3iMESA), |
TABLE_ENTRY(WindowPos3ivMESA), |
TABLE_ENTRY(WindowPos3sMESA), |
TABLE_ENTRY(WindowPos3svMESA), |
TABLE_ENTRY(WindowPos4dMESA), |
TABLE_ENTRY(WindowPos4dvMESA), |
TABLE_ENTRY(WindowPos4fMESA), |
TABLE_ENTRY(WindowPos4fvMESA), |
TABLE_ENTRY(WindowPos4iMESA), |
TABLE_ENTRY(WindowPos4ivMESA), |
TABLE_ENTRY(WindowPos4sMESA), |
TABLE_ENTRY(WindowPos4svMESA), |
TABLE_ENTRY(BlendFuncSeparateEXT), |
TABLE_ENTRY(IndexMaterialEXT), |
TABLE_ENTRY(IndexFuncEXT), |
TABLE_ENTRY(LockArraysEXT), |
TABLE_ENTRY(UnlockArraysEXT), |
TABLE_ENTRY(CullParameterdvEXT), |
TABLE_ENTRY(CullParameterfvEXT), |
TABLE_ENTRY(HintPGI), |
TABLE_ENTRY(FogCoordfEXT), |
TABLE_ENTRY(FogCoordfvEXT), |
TABLE_ENTRY(FogCoorddEXT), |
TABLE_ENTRY(FogCoorddvEXT), |
TABLE_ENTRY(FogCoordPointerEXT), |
TABLE_ENTRY(GetColorTableEXT), |
TABLE_ENTRY(GetColorTableParameterivEXT), |
TABLE_ENTRY(GetColorTableParameterfvEXT), |
TABLE_ENTRY(TbufferMask3DFX), |
TABLE_ENTRY(CompressedTexImage3DARB), |
TABLE_ENTRY(CompressedTexImage2DARB), |
TABLE_ENTRY(CompressedTexImage1DARB), |
TABLE_ENTRY(CompressedTexSubImage3DARB), |
TABLE_ENTRY(CompressedTexSubImage2DARB), |
TABLE_ENTRY(CompressedTexSubImage1DARB), |
TABLE_ENTRY(GetCompressedTexImageARB), |
TABLE_ENTRY(SecondaryColor3bEXT), |
TABLE_ENTRY(SecondaryColor3bvEXT), |
TABLE_ENTRY(SecondaryColor3dEXT), |
TABLE_ENTRY(SecondaryColor3dvEXT), |
TABLE_ENTRY(SecondaryColor3fEXT), |
TABLE_ENTRY(SecondaryColor3fvEXT), |
TABLE_ENTRY(SecondaryColor3iEXT), |
TABLE_ENTRY(SecondaryColor3ivEXT), |
TABLE_ENTRY(SecondaryColor3sEXT), |
TABLE_ENTRY(SecondaryColor3svEXT), |
TABLE_ENTRY(SecondaryColor3ubEXT), |
TABLE_ENTRY(SecondaryColor3ubvEXT), |
TABLE_ENTRY(SecondaryColor3uiEXT), |
TABLE_ENTRY(SecondaryColor3uivEXT), |
TABLE_ENTRY(SecondaryColor3usEXT), |
TABLE_ENTRY(SecondaryColor3usvEXT), |
TABLE_ENTRY(SecondaryColorPointerEXT), |
TABLE_ENTRY(AreProgramsResidentNV), |
TABLE_ENTRY(BindProgramNV), |
TABLE_ENTRY(DeleteProgramsNV), |
TABLE_ENTRY(ExecuteProgramNV), |
TABLE_ENTRY(GenProgramsNV), |
TABLE_ENTRY(GetProgramParameterdvNV), |
TABLE_ENTRY(GetProgramParameterfvNV), |
TABLE_ENTRY(GetProgramivNV), |
TABLE_ENTRY(GetProgramStringNV), |
TABLE_ENTRY(GetTrackMatrixivNV), |
TABLE_ENTRY(GetVertexAttribdvNV), |
TABLE_ENTRY(GetVertexAttribfvNV), |
TABLE_ENTRY(GetVertexAttribivNV), |
TABLE_ENTRY(GetVertexAttribPointervNV), |
TABLE_ENTRY(IsProgramNV), |
TABLE_ENTRY(LoadProgramNV), |
TABLE_ENTRY(ProgramParameter4dNV), |
TABLE_ENTRY(ProgramParameter4dvNV), |
TABLE_ENTRY(ProgramParameter4fNV), |
TABLE_ENTRY(ProgramParameter4fvNV), |
TABLE_ENTRY(ProgramParameters4dvNV), |
TABLE_ENTRY(ProgramParameters4fvNV), |
TABLE_ENTRY(RequestResidentProgramsNV), |
TABLE_ENTRY(TrackMatrixNV), |
TABLE_ENTRY(VertexAttribPointerNV), |
TABLE_ENTRY(VertexAttrib1dNV), |
TABLE_ENTRY(VertexAttrib1dvNV), |
TABLE_ENTRY(VertexAttrib1fNV), |
TABLE_ENTRY(VertexAttrib1fvNV), |
TABLE_ENTRY(VertexAttrib1sNV), |
TABLE_ENTRY(VertexAttrib1svNV), |
TABLE_ENTRY(VertexAttrib2dNV), |
TABLE_ENTRY(VertexAttrib2dvNV), |
TABLE_ENTRY(VertexAttrib2fNV), |
TABLE_ENTRY(VertexAttrib2fvNV), |
TABLE_ENTRY(VertexAttrib2sNV), |
TABLE_ENTRY(VertexAttrib2svNV), |
TABLE_ENTRY(VertexAttrib3dNV), |
TABLE_ENTRY(VertexAttrib3dvNV), |
TABLE_ENTRY(VertexAttrib3fNV), |
TABLE_ENTRY(VertexAttrib3fvNV), |
TABLE_ENTRY(VertexAttrib3sNV), |
TABLE_ENTRY(VertexAttrib3svNV), |
TABLE_ENTRY(VertexAttrib4dNV), |
TABLE_ENTRY(VertexAttrib4dvNV), |
TABLE_ENTRY(VertexAttrib4fNV), |
TABLE_ENTRY(VertexAttrib4fvNV), |
TABLE_ENTRY(VertexAttrib4sNV), |
TABLE_ENTRY(VertexAttrib4svNV), |
TABLE_ENTRY(VertexAttrib4ubNV), |
TABLE_ENTRY(VertexAttrib4ubvNV), |
TABLE_ENTRY(VertexAttribs1dvNV), |
TABLE_ENTRY(VertexAttribs1fvNV), |
TABLE_ENTRY(VertexAttribs1svNV), |
TABLE_ENTRY(VertexAttribs2dvNV), |
TABLE_ENTRY(VertexAttribs2fvNV), |
TABLE_ENTRY(VertexAttribs2svNV), |
TABLE_ENTRY(VertexAttribs3dvNV), |
TABLE_ENTRY(VertexAttribs3fvNV), |
TABLE_ENTRY(VertexAttribs3svNV), |
TABLE_ENTRY(VertexAttribs4dvNV), |
TABLE_ENTRY(VertexAttribs4fvNV), |
TABLE_ENTRY(VertexAttribs4svNV), |
TABLE_ENTRY(VertexAttribs4ubvNV), |
TABLE_ENTRY(PointParameteriNV), |
TABLE_ENTRY(PointParameterivNV), |
TABLE_ENTRY(MultiDrawArraysEXT), |
TABLE_ENTRY(MultiDrawElementsEXT), |
TABLE_ENTRY(ActiveStencilFaceEXT), |
TABLE_ENTRY(DeleteFencesNV), |
TABLE_ENTRY(GenFencesNV), |
TABLE_ENTRY(IsFenceNV), |
TABLE_ENTRY(TestFenceNV), |
TABLE_ENTRY(GetFenceivNV), |
TABLE_ENTRY(FinishFenceNV), |
TABLE_ENTRY(SetFenceNV), |
/* A whole bunch of no-op functions. These might be called |
* when someone tries to call a dynamically-registered |
* extension function without a current rendering context. |
*/ |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
TABLE_ENTRY(Unused), |
}; |
#endif /* DISPATCH_TABLE_NAME */ |
/* |
* This is just used to silence compiler warnings. |
* We list the functions which aren't otherwise used. |
*/ |
#ifdef UNUSED_TABLE_NAME |
void *UNUSED_TABLE_NAME[] = { |
TABLE_ENTRY(ActiveTexture), |
TABLE_ENTRY(ClientActiveTexture), |
TABLE_ENTRY(MultiTexCoord1d), |
TABLE_ENTRY(MultiTexCoord1dv), |
TABLE_ENTRY(MultiTexCoord1f), |
TABLE_ENTRY(MultiTexCoord1fv), |
TABLE_ENTRY(MultiTexCoord1i), |
TABLE_ENTRY(MultiTexCoord1iv), |
TABLE_ENTRY(MultiTexCoord1s), |
TABLE_ENTRY(MultiTexCoord1sv), |
TABLE_ENTRY(MultiTexCoord2d), |
TABLE_ENTRY(MultiTexCoord2dv), |
TABLE_ENTRY(MultiTexCoord2f), |
TABLE_ENTRY(MultiTexCoord2fv), |
TABLE_ENTRY(MultiTexCoord2i), |
TABLE_ENTRY(MultiTexCoord2iv), |
TABLE_ENTRY(MultiTexCoord2s), |
TABLE_ENTRY(MultiTexCoord2sv), |
TABLE_ENTRY(MultiTexCoord3d), |
TABLE_ENTRY(MultiTexCoord3dv), |
TABLE_ENTRY(MultiTexCoord3f), |
TABLE_ENTRY(MultiTexCoord3fv), |
TABLE_ENTRY(MultiTexCoord3i), |
TABLE_ENTRY(MultiTexCoord3iv), |
TABLE_ENTRY(MultiTexCoord3s), |
TABLE_ENTRY(MultiTexCoord3sv), |
TABLE_ENTRY(MultiTexCoord4d), |
TABLE_ENTRY(MultiTexCoord4dv), |
TABLE_ENTRY(MultiTexCoord4f), |
TABLE_ENTRY(MultiTexCoord4fv), |
TABLE_ENTRY(MultiTexCoord4i), |
TABLE_ENTRY(MultiTexCoord4iv), |
TABLE_ENTRY(MultiTexCoord4s), |
TABLE_ENTRY(MultiTexCoord4sv), |
TABLE_ENTRY(LoadTransposeMatrixf), |
TABLE_ENTRY(LoadTransposeMatrixd), |
TABLE_ENTRY(MultTransposeMatrixf), |
TABLE_ENTRY(MultTransposeMatrixd), |
TABLE_ENTRY(SampleCoverage), |
TABLE_ENTRY(CompressedTexImage3D), |
TABLE_ENTRY(CompressedTexImage2D), |
TABLE_ENTRY(CompressedTexImage1D), |
TABLE_ENTRY(CompressedTexSubImage3D), |
TABLE_ENTRY(CompressedTexSubImage2D), |
TABLE_ENTRY(CompressedTexSubImage1D), |
TABLE_ENTRY(GetCompressedTexImage), |
TABLE_ENTRY(BlendColorEXT), |
TABLE_ENTRY(TexImage3DEXT), |
TABLE_ENTRY(TexSubImage3DEXT), |
TABLE_ENTRY(TexSubImage1DEXT), |
TABLE_ENTRY(TexSubImage2DEXT), |
TABLE_ENTRY(CopyTexImage1DEXT), |
TABLE_ENTRY(CopyTexImage2DEXT), |
TABLE_ENTRY(CopyTexSubImage1DEXT), |
TABLE_ENTRY(CopyTexSubImage2DEXT), |
TABLE_ENTRY(CopyTexSubImage3DEXT), |
TABLE_ENTRY(HistogramEXT), |
TABLE_ENTRY(MinmaxEXT), |
TABLE_ENTRY(ResetHistogramEXT), |
TABLE_ENTRY(ResetMinmaxEXT), |
TABLE_ENTRY(ConvolutionFilter1DEXT), |
TABLE_ENTRY(ConvolutionFilter2DEXT), |
TABLE_ENTRY(ConvolutionParameterfEXT), |
TABLE_ENTRY(ConvolutionParameterfvEXT), |
TABLE_ENTRY(ConvolutionParameteriEXT), |
TABLE_ENTRY(ConvolutionParameterivEXT), |
TABLE_ENTRY(CopyConvolutionFilter1DEXT), |
TABLE_ENTRY(CopyConvolutionFilter2DEXT), |
TABLE_ENTRY(SeparableFilter2DEXT), |
TABLE_ENTRY(ColorTableSGI), |
TABLE_ENTRY(ColorTableParameterfvSGI), |
TABLE_ENTRY(ColorTableParameterivSGI), |
TABLE_ENTRY(CopyColorTableSGI), |
TABLE_ENTRY(BindTextureEXT), |
TABLE_ENTRY(DeleteTexturesEXT), |
TABLE_ENTRY(PrioritizeTexturesEXT), |
TABLE_ENTRY(ArrayElementEXT), |
TABLE_ENTRY(DrawArraysEXT), |
TABLE_ENTRY(GetPointervEXT), |
TABLE_ENTRY(BlendEquationEXT), |
TABLE_ENTRY(PointParameterfARB), |
TABLE_ENTRY(PointParameterfvARB), |
TABLE_ENTRY(PointParameterfSGIS), |
TABLE_ENTRY(PointParameterfvSGIS), |
TABLE_ENTRY(ColorSubTableEXT), |
TABLE_ENTRY(CopyColorSubTableEXT), |
TABLE_ENTRY(ColorTableEXT), |
TABLE_ENTRY(DrawRangeElementsEXT), |
TABLE_ENTRY(BlendFuncSeparateINGR), |
TABLE_ENTRY(SampleMaskEXT), |
TABLE_ENTRY(SamplePatternEXT), |
TABLE_ENTRY(WindowPos2dARB), |
TABLE_ENTRY(WindowPos2fARB), |
TABLE_ENTRY(WindowPos2iARB), |
TABLE_ENTRY(WindowPos2sARB), |
TABLE_ENTRY(WindowPos2dvARB), |
TABLE_ENTRY(WindowPos2fvARB), |
TABLE_ENTRY(WindowPos2ivARB), |
TABLE_ENTRY(WindowPos2svARB), |
TABLE_ENTRY(WindowPos3dARB), |
TABLE_ENTRY(WindowPos3fARB), |
TABLE_ENTRY(WindowPos3iARB), |
TABLE_ENTRY(WindowPos3sARB), |
TABLE_ENTRY(WindowPos3dvARB), |
TABLE_ENTRY(WindowPos3fvARB), |
TABLE_ENTRY(WindowPos3ivARB), |
TABLE_ENTRY(WindowPos3svARB), |
TABLE_ENTRY(BlendFuncSeparate), |
TABLE_ENTRY(FogCoordf), |
TABLE_ENTRY(FogCoordfv), |
TABLE_ENTRY(FogCoordd), |
TABLE_ENTRY(FogCoorddv), |
TABLE_ENTRY(FogCoordPointer), |
TABLE_ENTRY(MultiDrawArrays), |
TABLE_ENTRY(MultiDrawElements), |
TABLE_ENTRY(PointParameterf), |
TABLE_ENTRY(PointParameterfv), |
TABLE_ENTRY(PointParameteri), |
TABLE_ENTRY(PointParameteriv), |
TABLE_ENTRY(SecondaryColor3b), |
TABLE_ENTRY(SecondaryColor3bv), |
TABLE_ENTRY(SecondaryColor3d), |
TABLE_ENTRY(SecondaryColor3dv), |
TABLE_ENTRY(SecondaryColor3f), |
TABLE_ENTRY(SecondaryColor3fv), |
TABLE_ENTRY(SecondaryColor3i), |
TABLE_ENTRY(SecondaryColor3iv), |
TABLE_ENTRY(SecondaryColor3s), |
TABLE_ENTRY(SecondaryColor3sv), |
TABLE_ENTRY(SecondaryColor3ub), |
TABLE_ENTRY(SecondaryColor3ubv), |
TABLE_ENTRY(SecondaryColor3ui), |
TABLE_ENTRY(SecondaryColor3uiv), |
TABLE_ENTRY(SecondaryColor3us), |
TABLE_ENTRY(SecondaryColor3usv), |
TABLE_ENTRY(SecondaryColorPointer), |
TABLE_ENTRY(WindowPos2d), |
TABLE_ENTRY(WindowPos2dv), |
TABLE_ENTRY(WindowPos2f), |
TABLE_ENTRY(WindowPos2fv), |
TABLE_ENTRY(WindowPos2i), |
TABLE_ENTRY(WindowPos2iv), |
TABLE_ENTRY(WindowPos2s), |
TABLE_ENTRY(WindowPos2sv), |
TABLE_ENTRY(WindowPos3d), |
TABLE_ENTRY(WindowPos3dv), |
TABLE_ENTRY(WindowPos3f), |
TABLE_ENTRY(WindowPos3fv), |
TABLE_ENTRY(WindowPos3i), |
TABLE_ENTRY(WindowPos3iv), |
TABLE_ENTRY(WindowPos3s), |
TABLE_ENTRY(WindowPos3sv), |
}; |
#endif /*UNUSED_TABLE_NAME*/ |
#undef KEYWORD1 |
#undef KEYWORD2 |
#undef NAME |
#undef DISPATCH |
#undef RETURN_DISPATCH |
#undef DISPATCH_TABLE_NAME |
#undef UNUSED_TABLE_NAME |
#undef TABLE_ENTRY |
/shark/tags/rel_0_4/ports/mesa/src/eval.c |
---|
0,0 → 1,799 |
/* $Id: eval.c,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* eval.c was written by |
* Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and |
* Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). |
* |
* My original implementation of evaluators was simplistic and didn't |
* compute surface normal vectors properly. Bernd and Volker applied |
* used more sophisticated methods to get better results. |
* |
* Thanks guys! |
*/ |
#include "glheader.h" |
#include "imports.h" |
#include "colormac.h" |
#include "context.h" |
#include "eval.h" |
#include "macros.h" |
#include "mmath.h" |
#include "mtypes.h" |
/* |
* Return the number of components per control point for any type of |
* evaluator. Return 0 if bad target. |
* See table 5.1 in the OpenGL 1.2 spec. |
*/ |
GLuint _mesa_evaluator_components( GLenum target ) |
{ |
switch (target) { |
case GL_MAP1_VERTEX_3: return 3; |
case GL_MAP1_VERTEX_4: return 4; |
case GL_MAP1_INDEX: return 1; |
case GL_MAP1_COLOR_4: return 4; |
case GL_MAP1_NORMAL: return 3; |
case GL_MAP1_TEXTURE_COORD_1: return 1; |
case GL_MAP1_TEXTURE_COORD_2: return 2; |
case GL_MAP1_TEXTURE_COORD_3: return 3; |
case GL_MAP1_TEXTURE_COORD_4: return 4; |
case GL_MAP2_VERTEX_3: return 3; |
case GL_MAP2_VERTEX_4: return 4; |
case GL_MAP2_INDEX: return 1; |
case GL_MAP2_COLOR_4: return 4; |
case GL_MAP2_NORMAL: return 3; |
case GL_MAP2_TEXTURE_COORD_1: return 1; |
case GL_MAP2_TEXTURE_COORD_2: return 2; |
case GL_MAP2_TEXTURE_COORD_3: return 3; |
case GL_MAP2_TEXTURE_COORD_4: return 4; |
default: break; |
} |
/* XXX need to check for the vertex program extension |
if (!ctx->Extensions.NV_vertex_program) |
return 0; |
*/ |
if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV && |
target <= GL_MAP1_VERTEX_ATTRIB15_4_NV) |
return 4; |
if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV && |
target <= GL_MAP2_VERTEX_ATTRIB15_4_NV) |
return 4; |
return 0; |
} |
/* |
* Return pointer to the gl_1d_map struct for the named target. |
*/ |
static struct gl_1d_map * |
get_1d_map( GLcontext *ctx, GLenum target ) |
{ |
switch (target) { |
case GL_MAP1_VERTEX_3: |
return &ctx->EvalMap.Map1Vertex3; |
case GL_MAP1_VERTEX_4: |
return &ctx->EvalMap.Map1Vertex4; |
case GL_MAP1_INDEX: |
return &ctx->EvalMap.Map1Index; |
case GL_MAP1_COLOR_4: |
return &ctx->EvalMap.Map1Color4; |
case GL_MAP1_NORMAL: |
return &ctx->EvalMap.Map1Normal; |
case GL_MAP1_TEXTURE_COORD_1: |
return &ctx->EvalMap.Map1Texture1; |
case GL_MAP1_TEXTURE_COORD_2: |
return &ctx->EvalMap.Map1Texture2; |
case GL_MAP1_TEXTURE_COORD_3: |
return &ctx->EvalMap.Map1Texture3; |
case GL_MAP1_TEXTURE_COORD_4: |
return &ctx->EvalMap.Map1Texture4; |
case GL_MAP1_VERTEX_ATTRIB0_4_NV: |
case GL_MAP1_VERTEX_ATTRIB1_4_NV: |
case GL_MAP1_VERTEX_ATTRIB2_4_NV: |
case GL_MAP1_VERTEX_ATTRIB3_4_NV: |
case GL_MAP1_VERTEX_ATTRIB4_4_NV: |
case GL_MAP1_VERTEX_ATTRIB5_4_NV: |
case GL_MAP1_VERTEX_ATTRIB6_4_NV: |
case GL_MAP1_VERTEX_ATTRIB7_4_NV: |
case GL_MAP1_VERTEX_ATTRIB8_4_NV: |
case GL_MAP1_VERTEX_ATTRIB9_4_NV: |
case GL_MAP1_VERTEX_ATTRIB10_4_NV: |
case GL_MAP1_VERTEX_ATTRIB11_4_NV: |
case GL_MAP1_VERTEX_ATTRIB12_4_NV: |
case GL_MAP1_VERTEX_ATTRIB13_4_NV: |
case GL_MAP1_VERTEX_ATTRIB14_4_NV: |
case GL_MAP1_VERTEX_ATTRIB15_4_NV: |
if (!ctx->Extensions.NV_vertex_program) |
return NULL; |
return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV]; |
default: |
return NULL; |
} |
} |
/* |
* Return pointer to the gl_2d_map struct for the named target. |
*/ |
static struct gl_2d_map * |
get_2d_map( GLcontext *ctx, GLenum target ) |
{ |
switch (target) { |
case GL_MAP2_VERTEX_3: |
return &ctx->EvalMap.Map2Vertex3; |
case GL_MAP2_VERTEX_4: |
return &ctx->EvalMap.Map2Vertex4; |
case GL_MAP2_INDEX: |
return &ctx->EvalMap.Map2Index; |
case GL_MAP2_COLOR_4: |
return &ctx->EvalMap.Map2Color4; |
case GL_MAP2_NORMAL: |
return &ctx->EvalMap.Map2Normal; |
case GL_MAP2_TEXTURE_COORD_1: |
return &ctx->EvalMap.Map2Texture1; |
case GL_MAP2_TEXTURE_COORD_2: |
return &ctx->EvalMap.Map2Texture2; |
case GL_MAP2_TEXTURE_COORD_3: |
return &ctx->EvalMap.Map2Texture3; |
case GL_MAP2_TEXTURE_COORD_4: |
return &ctx->EvalMap.Map2Texture4; |
case GL_MAP2_VERTEX_ATTRIB0_4_NV: |
case GL_MAP2_VERTEX_ATTRIB1_4_NV: |
case GL_MAP2_VERTEX_ATTRIB2_4_NV: |
case GL_MAP2_VERTEX_ATTRIB3_4_NV: |
case GL_MAP2_VERTEX_ATTRIB4_4_NV: |
case GL_MAP2_VERTEX_ATTRIB5_4_NV: |
case GL_MAP2_VERTEX_ATTRIB6_4_NV: |
case GL_MAP2_VERTEX_ATTRIB7_4_NV: |
case GL_MAP2_VERTEX_ATTRIB8_4_NV: |
case GL_MAP2_VERTEX_ATTRIB9_4_NV: |
case GL_MAP2_VERTEX_ATTRIB10_4_NV: |
case GL_MAP2_VERTEX_ATTRIB11_4_NV: |
case GL_MAP2_VERTEX_ATTRIB12_4_NV: |
case GL_MAP2_VERTEX_ATTRIB13_4_NV: |
case GL_MAP2_VERTEX_ATTRIB14_4_NV: |
case GL_MAP2_VERTEX_ATTRIB15_4_NV: |
if (!ctx->Extensions.NV_vertex_program) |
return NULL; |
return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV]; |
default: |
return NULL; |
} |
} |
/**********************************************************************/ |
/*** Copy and deallocate control points ***/ |
/**********************************************************************/ |
/* |
* Copy 1-parametric evaluator control points from user-specified |
* memory space to a buffer of contiguous control points. |
* Input: see glMap1f for details |
* Return: pointer to buffer of contiguous control points or NULL if out |
* of memory. |
*/ |
GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, |
const GLfloat *points ) |
{ |
GLfloat *buffer, *p; |
GLint i, k, size = _mesa_evaluator_components(target); |
if (!points || !size) |
return NULL; |
buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); |
if (buffer) |
for (i = 0, p = buffer; i < uorder; i++, points += ustride) |
for (k = 0; k < size; k++) |
*p++ = points[k]; |
return buffer; |
} |
/* |
* Same as above but convert doubles to floats. |
*/ |
GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, |
const GLdouble *points ) |
{ |
GLfloat *buffer, *p; |
GLint i, k, size = _mesa_evaluator_components(target); |
if (!points || !size) |
return NULL; |
buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); |
if (buffer) |
for (i = 0, p = buffer; i < uorder; i++, points += ustride) |
for (k = 0; k < size; k++) |
*p++ = (GLfloat) points[k]; |
return buffer; |
} |
/* |
* Copy 2-parametric evaluator control points from user-specified |
* memory space to a buffer of contiguous control points. |
* Additional memory is allocated to be used by the horner and |
* de Casteljau evaluation schemes. |
* |
* Input: see glMap2f for details |
* Return: pointer to buffer of contiguous control points or NULL if out |
* of memory. |
*/ |
GLfloat *_mesa_copy_map_points2f( GLenum target, |
GLint ustride, GLint uorder, |
GLint vstride, GLint vorder, |
const GLfloat *points ) |
{ |
GLfloat *buffer, *p; |
GLint i, j, k, size, dsize, hsize; |
GLint uinc; |
size = _mesa_evaluator_components(target); |
if (!points || size==0) { |
return NULL; |
} |
/* max(uorder, vorder) additional points are used in */ |
/* horner evaluation and uorder*vorder additional */ |
/* values are needed for de Casteljau */ |
dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder; |
hsize = (uorder > vorder ? uorder : vorder)*size; |
if(hsize>dsize) |
buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); |
else |
buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); |
/* compute the increment value for the u-loop */ |
uinc = ustride - vorder*vstride; |
if (buffer) |
for (i=0, p=buffer; i<uorder; i++, points += uinc) |
for (j=0; j<vorder; j++, points += vstride) |
for (k=0; k<size; k++) |
*p++ = points[k]; |
return buffer; |
} |
/* |
* Same as above but convert doubles to floats. |
*/ |
GLfloat *_mesa_copy_map_points2d(GLenum target, |
GLint ustride, GLint uorder, |
GLint vstride, GLint vorder, |
const GLdouble *points ) |
{ |
GLfloat *buffer, *p; |
GLint i, j, k, size, hsize, dsize; |
GLint uinc; |
size = _mesa_evaluator_components(target); |
if (!points || size==0) { |
return NULL; |
} |
/* max(uorder, vorder) additional points are used in */ |
/* horner evaluation and uorder*vorder additional */ |
/* values are needed for de Casteljau */ |
dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder; |
hsize = (uorder > vorder ? uorder : vorder)*size; |
if(hsize>dsize) |
buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); |
else |
buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); |
/* compute the increment value for the u-loop */ |
uinc = ustride - vorder*vstride; |
if (buffer) |
for (i=0, p=buffer; i<uorder; i++, points += uinc) |
for (j=0; j<vorder; j++, points += vstride) |
for (k=0; k<size; k++) |
*p++ = (GLfloat) points[k]; |
return buffer; |
} |
/**********************************************************************/ |
/*** API entry points ***/ |
/**********************************************************************/ |
/* |
* This does the work of glMap1[fd]. |
*/ |
static void |
map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, |
GLint uorder, const GLvoid *points, GLenum type ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint k; |
GLfloat *pnts; |
struct gl_1d_map *map = NULL; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
ASSERT(type == GL_FLOAT || type == GL_DOUBLE); |
if (u1 == u2) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" ); |
return; |
} |
if (uorder < 1 || uorder > MAX_EVAL_ORDER) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" ); |
return; |
} |
if (!points) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" ); |
return; |
} |
k = _mesa_evaluator_components( target ); |
if (k == 0) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); |
} |
if (ustride < k) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" ); |
return; |
} |
if (ctx->Texture.CurrentUnit != 0) { |
/* See OpenGL 1.2.1 spec, section F.2.13 */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); |
return; |
} |
map = get_1d_map(ctx, target); |
if (!map) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); |
return; |
} |
/* make copy of the control points */ |
if (type == GL_FLOAT) |
pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points); |
else |
pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
map->Order = uorder; |
map->u1 = u1; |
map->u2 = u2; |
map->du = 1.0F / (u2 - u1); |
if (map->Points) |
FREE( map->Points ); |
map->Points = pnts; |
} |
void |
_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, |
GLint order, const GLfloat *points ) |
{ |
map1(target, u1, u2, stride, order, points, GL_FLOAT); |
} |
void |
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, |
GLint order, const GLdouble *points ) |
{ |
map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE); |
} |
static void |
map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, |
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, |
const GLvoid *points, GLenum type ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
GLint k; |
GLfloat *pnts; |
struct gl_2d_map *map = NULL; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
ASSERT(type == GL_FLOAT || type == GL_DOUBLE); |
if (u1==u2) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); |
return; |
} |
if (v1==v2) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" ); |
return; |
} |
if (uorder<1 || uorder>MAX_EVAL_ORDER) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" ); |
return; |
} |
if (vorder<1 || vorder>MAX_EVAL_ORDER) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" ); |
return; |
} |
k = _mesa_evaluator_components( target ); |
if (k==0) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); |
} |
if (ustride < k) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" ); |
return; |
} |
if (vstride < k) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" ); |
return; |
} |
if (ctx->Texture.CurrentUnit != 0) { |
/* See OpenGL 1.2.1 spec, section F.2.13 */ |
_mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); |
return; |
} |
map = get_2d_map(ctx, target); |
if (!map) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); |
return; |
} |
/* make copy of the control points */ |
if (type == GL_FLOAT) |
pnts = _mesa_copy_map_points2f(target, ustride, uorder, |
vstride, vorder, (GLfloat*) points); |
else |
pnts = _mesa_copy_map_points2d(target, ustride, uorder, |
vstride, vorder, (GLdouble*) points); |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
map->Uorder = uorder; |
map->u1 = u1; |
map->u2 = u2; |
map->du = 1.0F / (u2 - u1); |
map->Vorder = vorder; |
map->v1 = v1; |
map->v2 = v2; |
map->dv = 1.0F / (v2 - v1); |
if (map->Points) |
FREE( map->Points ); |
map->Points = pnts; |
} |
void |
_mesa_Map2f( GLenum target, |
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, |
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, |
const GLfloat *points) |
{ |
map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, |
points, GL_FLOAT); |
} |
void |
_mesa_Map2d( GLenum target, |
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, |
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, |
const GLdouble *points ) |
{ |
map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, |
(GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE); |
} |
void |
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_1d_map *map1d; |
struct gl_2d_map *map2d; |
GLint i, n; |
GLfloat *data; |
GLuint comps; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
comps = _mesa_evaluator_components(target); |
if (!comps) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); |
return; |
} |
map1d = get_1d_map(ctx, target); |
map2d = get_2d_map(ctx, target); |
ASSERT(map1d || map2d); |
switch (query) { |
case GL_COEFF: |
if (map1d) { |
data = map1d->Points; |
n = map1d->Order * comps; |
} |
else { |
data = map2d->Points; |
n = map2d->Uorder * map2d->Vorder * comps; |
} |
if (data) { |
for (i=0;i<n;i++) { |
v[i] = data[i]; |
} |
} |
break; |
case GL_ORDER: |
if (map1d) { |
v[0] = (GLdouble) map1d->Order; |
} |
else { |
v[0] = (GLdouble) map2d->Uorder; |
v[1] = (GLdouble) map2d->Vorder; |
} |
break; |
case GL_DOMAIN: |
if (map1d) { |
v[0] = (GLdouble) map1d->u1; |
v[1] = (GLdouble) map1d->u2; |
} |
else { |
v[0] = (GLdouble) map2d->u1; |
v[1] = (GLdouble) map2d->u2; |
v[2] = (GLdouble) map2d->v1; |
v[3] = (GLdouble) map2d->v2; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" ); |
} |
} |
void |
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_1d_map *map1d; |
struct gl_2d_map *map2d; |
GLint i, n; |
GLfloat *data; |
GLuint comps; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
comps = _mesa_evaluator_components(target); |
if (!comps) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); |
return; |
} |
map1d = get_1d_map(ctx, target); |
map2d = get_2d_map(ctx, target); |
ASSERT(map1d || map2d); |
switch (query) { |
case GL_COEFF: |
if (map1d) { |
data = map1d->Points; |
n = map1d->Order * comps; |
} |
else { |
data = map2d->Points; |
n = map2d->Uorder * map2d->Vorder * comps; |
} |
if (data) { |
for (i=0;i<n;i++) { |
v[i] = data[i]; |
} |
} |
break; |
case GL_ORDER: |
if (map1d) { |
v[0] = (GLfloat) map1d->Order; |
} |
else { |
v[0] = (GLfloat) map2d->Uorder; |
v[1] = (GLfloat) map2d->Vorder; |
} |
break; |
case GL_DOMAIN: |
if (map1d) { |
v[0] = map1d->u1; |
v[1] = map1d->u2; |
} |
else { |
v[0] = map2d->u1; |
v[1] = map2d->u2; |
v[2] = map2d->v1; |
v[3] = map2d->v2; |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" ); |
} |
} |
void |
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
struct gl_1d_map *map1d; |
struct gl_2d_map *map2d; |
GLuint i, n; |
GLfloat *data; |
GLuint comps; |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
comps = _mesa_evaluator_components(target); |
if (!comps) { |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); |
return; |
} |
map1d = get_1d_map(ctx, target); |
map2d = get_2d_map(ctx, target); |
ASSERT(map1d || map2d); |
switch (query) { |
case GL_COEFF: |
if (map1d) { |
data = map1d->Points; |
n = map1d->Order * comps; |
} |
else { |
data = map2d->Points; |
n = map2d->Uorder * map2d->Vorder * comps; |
} |
if (data) { |
for (i=0;i<n;i++) { |
v[i] = ROUNDF(data[i]); |
} |
} |
break; |
case GL_ORDER: |
if (map1d) { |
v[0] = map1d->Order; |
} |
else { |
v[0] = map2d->Uorder; |
v[1] = map2d->Vorder; |
} |
break; |
case GL_DOMAIN: |
if (map1d) { |
v[0] = ROUNDF(map1d->u1); |
v[1] = ROUNDF(map1d->u2); |
} |
else { |
v[0] = ROUNDF(map2d->u1); |
v[1] = ROUNDF(map2d->u2); |
v[2] = ROUNDF(map2d->v1); |
v[3] = ROUNDF(map2d->v2); |
} |
break; |
default: |
_mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" ); |
} |
} |
void |
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (un<1) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.MapGrid1un = un; |
ctx->Eval.MapGrid1u1 = u1; |
ctx->Eval.MapGrid1u2 = u2; |
ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un; |
} |
void |
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) |
{ |
_mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); |
} |
void |
_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, |
GLint vn, GLfloat v1, GLfloat v2 ) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (un<1) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); |
return; |
} |
if (vn<1) { |
_mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" ); |
return; |
} |
FLUSH_VERTICES(ctx, _NEW_EVAL); |
ctx->Eval.MapGrid2un = un; |
ctx->Eval.MapGrid2u1 = u1; |
ctx->Eval.MapGrid2u2 = u2; |
ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un; |
ctx->Eval.MapGrid2vn = vn; |
ctx->Eval.MapGrid2v1 = v1; |
ctx->Eval.MapGrid2v2 = v2; |
ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn; |
} |
void |
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, |
GLint vn, GLdouble v1, GLdouble v2 ) |
{ |
_mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, |
vn, (GLfloat) v1, (GLfloat) v2 ); |
} |
/shark/tags/rel_0_4/ports/mesa/src/context.h |
---|
0,0 → 1,240 |
/* $Id: context.h,v 1.1 2003-02-28 11:41:59 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef CONTEXT_H |
#define CONTEXT_H |
#include "glapi.h" |
#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. |
*/ |
extern GLvisual * |
_mesa_create_visual( GLboolean rgbFlag, |
GLboolean dbFlag, |
GLboolean stereoFlag, |
GLint redBits, |
GLint greenBits, |
GLint blueBits, |
GLint alphaBits, |
GLint indexBits, |
GLint depthBits, |
GLint stencilBits, |
GLint accumRedBits, |
GLint accumGreenBits, |
GLint accumBlueBits, |
GLint accumAlphaBits, |
GLint numSamples ); |
extern GLboolean |
_mesa_initialize_visual( GLvisual *v, |
GLboolean rgbFlag, |
GLboolean dbFlag, |
GLboolean stereoFlag, |
GLint redBits, |
GLint greenBits, |
GLint blueBits, |
GLint alphaBits, |
GLint indexBits, |
GLint depthBits, |
GLint stencilBits, |
GLint accumRedBits, |
GLint accumGreenBits, |
GLint accumBlueBits, |
GLint accumAlphaBits, |
GLint numSamples ); |
extern void |
_mesa_destroy_visual( GLvisual *vis ); |
/* |
* Create/destroy a GLframebuffer. |
*/ |
extern GLframebuffer * |
_mesa_create_framebuffer( const GLvisual *visual, |
GLboolean softwareDepth, |
GLboolean softwareStencil, |
GLboolean softwareAccum, |
GLboolean softwareAlpha ); |
extern void |
_mesa_initialize_framebuffer( GLframebuffer *fb, |
const GLvisual *visual, |
GLboolean softwareDepth, |
GLboolean softwareStencil, |
GLboolean softwareAccum, |
GLboolean softwareAlpha ); |
extern void |
_mesa_free_framebuffer_data( GLframebuffer *buffer ); |
extern void |
_mesa_destroy_framebuffer( GLframebuffer *buffer ); |
/* |
* Create/destroy a GLcontext. |
*/ |
extern GLcontext * |
_mesa_create_context( const GLvisual *visual, |
GLcontext *share_list, |
void *driver_ctx, |
GLboolean direct ); |
extern GLboolean |
_mesa_initialize_context( GLcontext *ctx, |
const GLvisual *visual, |
GLcontext *share_list, |
void *driver_ctx, |
GLboolean direct ); |
extern void |
_mesa_free_context_data( GLcontext *ctx ); |
extern void |
_mesa_destroy_context( GLcontext *ctx ); |
extern void |
_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); |
extern void |
_mesa_make_current( GLcontext *ctx, GLframebuffer *buffer ); |
extern void |
_mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, |
GLframebuffer *readBuffer ); |
extern GLcontext * |
_mesa_get_current_context(void); |
/* |
* Macros for fetching current context. |
*/ |
#ifdef THREADS |
#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context()) |
#else |
#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context |
#endif |
/* OpenGL SI-style export functions. */ |
extern GLboolean |
_mesa_destroyContext(__GLcontext *gc); |
extern GLboolean |
_mesa_loseCurrent(__GLcontext *gc); |
extern GLboolean |
_mesa_makeCurrent(__GLcontext *gc); |
extern GLboolean |
_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); |
extern GLboolean |
_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); |
extern GLboolean |
_mesa_forceCurrent(__GLcontext *gc); |
extern GLboolean |
_mesa_notifyResize(__GLcontext *gc); |
extern void |
_mesa_notifyDestroy(__GLcontext *gc); |
extern void |
_mesa_notifySwapBuffers(__GLcontext *gc); |
extern struct __GLdispatchStateRec * |
_mesa_dispatchExec(__GLcontext *gc); |
extern void |
_mesa_beginDispatchOverride(__GLcontext *gc); |
extern void |
_mesa_endDispatchOverride(__GLcontext *gc); |
extern struct _glapi_table * |
_mesa_get_dispatch(GLcontext *ctx); |
/* |
* Miscellaneous |
*/ |
extern void |
_mesa_record_error( GLcontext *ctx, GLenum error ); |
extern void |
_mesa_Finish( void ); |
extern void |
_mesa_Flush( void ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/enable.h |
---|
0,0 → 1,54 |
/* $Id: enable.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef ENABLE_H |
#define ENABLE_H |
#include "mtypes.h" |
extern void |
_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state ); |
extern void |
_mesa_Disable( GLenum cap ); |
extern void |
_mesa_Enable( GLenum cap ); |
extern GLboolean |
_mesa_IsEnabled( GLenum cap ); |
extern void |
_mesa_EnableClientState( GLenum cap ); |
extern void |
_mesa_DisableClientState( GLenum cap ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/eval.h |
---|
0,0 → 1,109 |
/* $Id: eval.h,v 1.1 2003-02-28 11:42:00 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef EVAL_H |
#define EVAL_H |
#include "mtypes.h" |
extern void _mesa_init_eval( void ); |
extern GLuint _mesa_evaluator_components( GLenum target ); |
extern void gl_free_control_points( GLcontext *ctx, |
GLenum target, GLfloat *data ); |
extern GLfloat *_mesa_copy_map_points1f( GLenum target, |
GLint ustride, GLint uorder, |
const GLfloat *points ); |
extern GLfloat *_mesa_copy_map_points1d( GLenum target, |
GLint ustride, GLint uorder, |
const GLdouble *points ); |
extern GLfloat *_mesa_copy_map_points2f( GLenum target, |
GLint ustride, GLint uorder, |
GLint vstride, GLint vorder, |
const GLfloat *points ); |
extern GLfloat *_mesa_copy_map_points2d(GLenum target, |
GLint ustride, GLint uorder, |
GLint vstride, GLint vorder, |
const GLdouble *points ); |
extern void |
_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, |
GLint order, const GLfloat *points ); |
extern void |
_mesa_Map2f( GLenum target, |
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, |
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, |
const GLfloat *points ); |
extern void |
_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, |
GLint order, const GLdouble *points ); |
extern void |
_mesa_Map2d( GLenum target, |
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, |
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, |
const GLdouble *points ); |
extern void |
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); |
extern void |
_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); |
extern void |
_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, |
GLint vn, GLfloat v1, GLfloat v2 ); |
extern void |
_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, |
GLint vn, GLdouble v1, GLdouble v2 ); |
extern void |
_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); |
extern void |
_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); |
extern void |
_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src/histogram.c |
---|
0,0 → 1,1031 |
/* $Id: histogram.c,v 1.1 2003-02-28 11:42:02 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* |
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#include "glheader.h" |
#include "colormac.h" |
#include "context.h" |
#include "image.h" |
#include "histogram.h" |
#include "mmath.h" |
/* |
* XXX the packed pixel formats haven't been tested. |
*/ |
static void |
pack_histogram( GLcontext *ctx, |
GLuint n, CONST GLuint rgba[][4], |
GLenum format, GLenum type, GLvoid *destination, |
const struct gl_pixelstore_attrib *packing ) |
{ |
const GLint comps = _mesa_components_in_format(format); |
GLuint luminance[MAX_WIDTH]; |
if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { |
GLuint i; |
for (i = 0; i < n; i++) { |
luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; |
} |
} |
#define PACK_MACRO(TYPE) \ |
{ \ |
GLuint i; \ |
switch (format) { \ |
case GL_RED: \ |
for (i=0;i<n;i++) \ |
dst[i] = (TYPE) rgba[i][RCOMP]; \ |
break; \ |
case GL_GREEN: \ |
for (i=0;i<n;i++) \ |
dst[i] = (TYPE) rgba[i][GCOMP]; \ |
break; \ |
case GL_BLUE: \ |
for (i=0;i<n;i++) \ |
dst[i] = (TYPE) rgba[i][BCOMP]; \ |
break; \ |
case GL_ALPHA: \ |
for (i=0;i<n;i++) \ |
dst[i] = (TYPE) rgba[i][ACOMP]; \ |
break; \ |
case GL_LUMINANCE: \ |
for (i=0;i<n;i++) \ |
dst[i] = (TYPE) luminance[i]; \ |
break; \ |
case GL_LUMINANCE_ALPHA: \ |
for (i=0;i<n;i++) { \ |
dst[i*2+0] = (TYPE) luminance[i]; \ |
dst[i*2+1] = (TYPE) rgba[i][ACOMP]; \ |
} \ |
break; \ |
case GL_RGB: \ |
for (i=0;i<n;i++) { \ |
dst[i*3+0] = (TYPE) rgba[i][RCOMP]; \ |
dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ |
dst[i*3+2] = (TYPE) rgba[i][BCOMP]; \ |
} \ |
break; \ |
case GL_RGBA: \ |
for (i=0;i<n;i++) { \ |
dst[i*4+0] = (TYPE) rgba[i][RCOMP]; \ |
dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ |
dst[i*4+2] = (TYPE) rgba[i][BCOMP]; \ |
dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ |
} \ |
break; \ |
case GL_BGR: \ |
for (i=0;i<n;i++) { \ |
dst[i*3+0] = (TYPE) rgba[i][BCOMP]; \ |
dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ |
dst[i*3+2] = (TYPE) rgba[i][RCOMP]; \ |
} \ |
break; \ |
case GL_BGRA: \ |
for (i=0;i<n;i++) { \ |
dst[i*4+0] = (TYPE) rgba[i][BCOMP]; \ |
dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ |
dst[i*4+2] = (TYPE) rgba[i][RCOMP]; \ |
dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ |
} \ |
break; \ |
case GL_ABGR_EXT: \ |
for (i=0;i<n;i++) { \ |
dst[i*4+0] = (TYPE) rgba[i][ACOMP]; \ |
dst[i*4+1] = (TYPE) rgba[i][BCOMP]; \ |
dst[i*4+2] = (TYPE) rgba[i][GCOMP]; \ |
dst[i*4+3] = (TYPE) rgba[i][RCOMP]; \ |
} \ |
break; \ |
default: \ |
_mesa_problem(ctx, "bad format in pack_histogram"); \ |
} \ |
} |
switch (type) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *dst = (GLubyte *) destination; |
PACK_MACRO(GLubyte); |
} |
break; |
case GL_BYTE: |
{ |
GLbyte *dst = (GLbyte *) destination; |
PACK_MACRO(GLbyte); |
} |
break; |
case GL_UNSIGNED_SHORT: |
{ |
GLushort *dst = (GLushort *) destination; |
PACK_MACRO(GLushort); |
if (packing->SwapBytes) { |
_mesa_swap2(dst, n * comps); |
} |
} |
break; |
case GL_SHORT: |
{ |
GLshort *dst = (GLshort *) destination; |
PACK_MACRO(GLshort); |
if (packing->SwapBytes) { |
_mesa_swap2((GLushort *) dst, n * comps); |
} |
} |
break; |
case GL_UNSIGNED_INT: |
{ |
GLuint *dst = (GLuint *) destination; |
PACK_MACRO(GLuint); |
if (packing->SwapBytes) { |
_mesa_swap4(dst, n * comps); |
} |
} |
break; |
case GL_INT: |
{ |
GLint *dst = (GLint *) destination; |
PACK_MACRO(GLint); |
if (packing->SwapBytes) { |
_mesa_swap4((GLuint *) dst, n * comps); |
} |
} |
break; |
case GL_FLOAT: |
{ |
GLfloat *dst = (GLfloat *) destination; |
PACK_MACRO(GLfloat); |
if (packing->SwapBytes) { |
_mesa_swap4((GLuint *) dst, n * comps); |
} |
} |
break; |
case GL_UNSIGNED_BYTE_3_3_2: |
if (format == GL_RGB) { |
GLubyte *dst = (GLubyte *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x7) << 5) |
| ((rgba[i][GCOMP] & 0x7) << 2) |
| ((rgba[i][BCOMP] & 0x3) ); |
} |
} |
else { |
GLubyte *dst = (GLubyte *) destination; |
GLuint i; |
ASSERT(format == GL_BGR); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x7) << 5) |
| ((rgba[i][GCOMP] & 0x7) << 2) |
| ((rgba[i][RCOMP] & 0x3) ); |
} |
} |
break; |
case GL_UNSIGNED_BYTE_2_3_3_REV: |
if (format == GL_RGB) { |
GLubyte *dst = (GLubyte *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x3) << 6) |
| ((rgba[i][GCOMP] & 0x7) << 3) |
| ((rgba[i][BCOMP] & 0x7) ); |
} |
} |
else { |
GLubyte *dst = (GLubyte *) destination; |
GLuint i; |
ASSERT(format == GL_BGR); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x3) << 6) |
| ((rgba[i][GCOMP] & 0x7) << 3) |
| ((rgba[i][RCOMP] & 0x7) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5: |
if (format == GL_RGB) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x3f) << 5) |
| ((rgba[i][BCOMP] & 0x1f) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_BGR); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x3f) << 5) |
| ((rgba[i][RCOMP] & 0x1f) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_6_5_REV: |
if (format == GL_RGB) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x3f) << 5) |
| ((rgba[i][RCOMP] & 0x1f) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_BGR); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x3f) << 5) |
| ((rgba[i][BCOMP] & 0x1f) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4: |
if (format == GL_RGBA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) |
| ((rgba[i][GCOMP] & 0xf) << 8) |
| ((rgba[i][BCOMP] & 0xf) << 4) |
| ((rgba[i][ACOMP] & 0xf) ); |
} |
} |
else if (format == GL_BGRA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0xf) << 12) |
| ((rgba[i][GCOMP] & 0xf) << 8) |
| ((rgba[i][RCOMP] & 0xf) << 4) |
| ((rgba[i][ACOMP] & 0xf) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) |
| ((rgba[i][BCOMP] & 0xf) << 8) |
| ((rgba[i][GCOMP] & 0xf) << 4) |
| ((rgba[i][RCOMP] & 0xf) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_4_4_4_4_REV: |
if (format == GL_RGBA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) |
| ((rgba[i][BCOMP] & 0xf) << 8) |
| ((rgba[i][GCOMP] & 0xf) << 4) |
| ((rgba[i][RCOMP] & 0xf) ); |
} |
} |
else if (format == GL_BGRA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) |
| ((rgba[i][RCOMP] & 0xf) << 8) |
| ((rgba[i][GCOMP] & 0xf) << 4) |
| ((rgba[i][BCOMP] & 0xf) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) |
| ((rgba[i][GCOMP] & 0xf) << 8) |
| ((rgba[i][BCOMP] & 0xf) << 4) |
| ((rgba[i][ACOMP] & 0xf) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_5_5_5_1: |
if (format == GL_RGBA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x1f) << 6) |
| ((rgba[i][BCOMP] & 0x1f) << 1) |
| ((rgba[i][ACOMP] & 0x1) ); |
} |
} |
else if (format == GL_BGRA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x1f) << 6) |
| ((rgba[i][RCOMP] & 0x1f) << 1) |
| ((rgba[i][ACOMP] & 0x1) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) |
| ((rgba[i][BCOMP] & 0x1f) << 6) |
| ((rgba[i][GCOMP] & 0x1f) << 1) |
| ((rgba[i][RCOMP] & 0x1) ); |
} |
} |
break; |
case GL_UNSIGNED_SHORT_1_5_5_5_REV: |
if (format == GL_RGBA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) |
| ((rgba[i][BCOMP] & 0x1f) << 6) |
| ((rgba[i][GCOMP] & 0x1f) << 1) |
| ((rgba[i][RCOMP] & 0x1) ); |
} |
} |
else if (format == GL_BGRA) { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) |
| ((rgba[i][RCOMP] & 0x1f) << 6) |
| ((rgba[i][GCOMP] & 0x1f) << 1) |
| ((rgba[i][BCOMP] & 0x1) ); |
} |
} |
else { |
GLushort *dst = (GLushort *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) |
| ((rgba[i][GCOMP] & 0x1f) << 6) |
| ((rgba[i][BCOMP] & 0x1f) << 1) |
| ((rgba[i][ACOMP] & 0x1) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8: |
if (format == GL_RGBA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) |
| ((rgba[i][GCOMP] & 0xff) << 16) |
| ((rgba[i][BCOMP] & 0xff) << 8) |
| ((rgba[i][ACOMP] & 0xff) ); |
} |
} |
else if (format == GL_BGRA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0xff) << 24) |
| ((rgba[i][GCOMP] & 0xff) << 16) |
| ((rgba[i][RCOMP] & 0xff) << 8) |
| ((rgba[i][ACOMP] & 0xff) ); |
} |
} |
else { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) |
| ((rgba[i][BCOMP] & 0xff) << 16) |
| ((rgba[i][GCOMP] & 0xff) << 8) |
| ((rgba[i][RCOMP] & 0xff) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_8_8_8_8_REV: |
if (format == GL_RGBA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) |
| ((rgba[i][BCOMP] & 0xff) << 16) |
| ((rgba[i][GCOMP] & 0xff) << 8) |
| ((rgba[i][RCOMP] & 0xff) ); |
} |
} |
else if (format == GL_BGRA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) |
| ((rgba[i][RCOMP] & 0xff) << 16) |
| ((rgba[i][GCOMP] & 0xff) << 8) |
| ((rgba[i][BCOMP] & 0xff) ); |
} |
} |
else { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) |
| ((rgba[i][GCOMP] & 0xff) << 16) |
| ((rgba[i][BCOMP] & 0xff) << 8) |
| ((rgba[i][ACOMP] & 0xff) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_10_10_10_2: |
if (format == GL_RGBA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) |
| ((rgba[i][GCOMP] & 0x3ff) << 12) |
| ((rgba[i][BCOMP] & 0x3ff) << 2) |
| ((rgba[i][ACOMP] & 0x3) ); |
} |
} |
else if (format == GL_BGRA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][BCOMP] & 0x3ff) << 22) |
| ((rgba[i][GCOMP] & 0x3ff) << 12) |
| ((rgba[i][RCOMP] & 0x3ff) << 2) |
| ((rgba[i][ACOMP] & 0x3) ); |
} |
} |
else { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) |
| ((rgba[i][BCOMP] & 0x3ff) << 12) |
| ((rgba[i][GCOMP] & 0x3ff) << 2) |
| ((rgba[i][RCOMP] & 0x3) ); |
} |
} |
break; |
case GL_UNSIGNED_INT_2_10_10_10_REV: |
if (format == GL_RGBA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) |
| ((rgba[i][BCOMP] & 0x3ff) << 12) |
| ((rgba[i][GCOMP] & 0x3ff) << 2) |
| ((rgba[i][RCOMP] & 0x3) ); |
} |
} |
else if (format == GL_BGRA) { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) |
| ((rgba[i][RCOMP] & 0x3ff) << 12) |
| ((rgba[i][GCOMP] & 0x3ff) << 2) |
| ((rgba[i][BCOMP] & 0x3) ); |
} |
} |
else { |
GLuint *dst = (GLuint *) destination; |
GLuint i; |
ASSERT(format == GL_ABGR_EXT); |
for (i = 0; i < n; i++) { |
dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) |
| ((rgba[i][GCOMP] & 0x3ff) << 12) |
| ((rgba[i][BCOMP] & 0x3ff) << 2) |
| ((rgba[i][ACOMP] & 0x3) ); |
} |
} |
break; |
default: |
_mesa_problem(ctx, "Bad type in pack_histogram"); |
} |
#undef PACK_MACRO |
} |
/* |
* Given an internalFormat token passed to glHistogram or glMinMax, |
* return the corresponding base format. |
* Return -1 if invalid token. |
*/ |
static GLint |
base_histogram_format( GLenum format ) |
{ |
switch (format) { |
case GL_ALPHA: |
case GL_ALPHA4: |
case GL_ALPHA8: |
case GL_ALPHA12: |
case GL_ALPHA16: |
return GL_ALPHA; |
case GL_LUMINANCE: |
case GL_LUMINANCE4: |
case GL_LUMINANCE8: |
case GL_LUMINANCE12: |
case GL_LUMINANCE16: |
return GL_LUMINANCE; |
case GL_LUMINANCE_ALPHA: |
case GL_LUMINANCE4_ALPHA4: |
case GL_LUMINANCE6_ALPHA2: |
case GL_LUMINANCE8_ALPHA8: |
case GL_LUMINANCE12_ALPHA4: |
case GL_LUMINANCE12_ALPHA12: |
case GL_LUMINANCE16_ALPHA16: |
return GL_LUMINANCE_ALPHA; |
case GL_RGB: |
case GL_R3_G3_B2: |
case GL_RGB4: |
case GL_RGB5: |
case GL_RGB8: |
case GL_RGB10: |
case GL_RGB12: |
case GL_RGB16: |
return GL_RGB; |
case GL_RGBA: |
case GL_RGBA2: |
case GL_RGBA4: |
case GL_RGB5_A1: |
case GL_RGBA8: |
case GL_RGB10_A2: |
case GL_RGBA12: |
case GL_RGBA16: |
return GL_RGBA; |
default: |
return -1; /* error */ |
} |
} |
void |
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); |
return; |
} |
if (target != GL_MINMAX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)"); |
return; |
} |
if (type != GL_UNSIGNED_BYTE && |
type != GL_BYTE && |
type != GL_UNSIGNED_SHORT && |
type != GL_SHORT && |
type != GL_UNSIGNED_INT && |
type != GL_INT && |
type != GL_FLOAT && |
type != GL_UNSIGNED_BYTE_3_3_2 && |
type != GL_UNSIGNED_BYTE_2_3_3_REV && |
type != GL_UNSIGNED_SHORT_5_6_5 && |
type != GL_UNSIGNED_SHORT_5_6_5_REV && |
type != GL_UNSIGNED_SHORT_4_4_4_4 && |
type != GL_UNSIGNED_SHORT_4_4_4_4_REV && |
type != GL_UNSIGNED_SHORT_5_5_5_1 && |
type != GL_UNSIGNED_SHORT_1_5_5_5_REV && |
type != GL_UNSIGNED_INT_8_8_8_8 && |
type != GL_UNSIGNED_INT_8_8_8_8_REV && |
type != GL_UNSIGNED_INT_10_10_10_2 && |
type != GL_UNSIGNED_INT_2_10_10_10_REV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)"); |
return; |
} |
if (!values) |
return; |
{ |
GLfloat minmax[2][4]; |
minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); |
minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); |
minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); |
minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); |
minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); |
minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); |
minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); |
minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); |
_mesa_pack_float_rgba_span(ctx, 2, (CONST GLfloat (*)[4]) minmax, |
format, type, values, &ctx->Pack, 0); |
} |
if (reset) { |
_mesa_ResetMinmax(GL_MINMAX); |
} |
} |
void |
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); |
return; |
} |
if (target != GL_HISTOGRAM) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); |
return; |
} |
if (!_mesa_is_legal_format_and_type(format, type)) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)"); |
return; |
} |
if (type != GL_UNSIGNED_BYTE && |
type != GL_BYTE && |
type != GL_UNSIGNED_SHORT && |
type != GL_SHORT && |
type != GL_UNSIGNED_INT && |
type != GL_INT && |
type != GL_FLOAT && |
type != GL_UNSIGNED_BYTE_3_3_2 && |
type != GL_UNSIGNED_BYTE_2_3_3_REV && |
type != GL_UNSIGNED_SHORT_5_6_5 && |
type != GL_UNSIGNED_SHORT_5_6_5_REV && |
type != GL_UNSIGNED_SHORT_4_4_4_4 && |
type != GL_UNSIGNED_SHORT_4_4_4_4_REV && |
type != GL_UNSIGNED_SHORT_5_5_5_1 && |
type != GL_UNSIGNED_SHORT_1_5_5_5_REV && |
type != GL_UNSIGNED_INT_8_8_8_8 && |
type != GL_UNSIGNED_INT_8_8_8_8_REV && |
type != GL_UNSIGNED_INT_10_10_10_2 && |
type != GL_UNSIGNED_INT_2_10_10_10_REV) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)"); |
return; |
} |
if (!values) |
return; |
pack_histogram(ctx, ctx->Histogram.Width, |
(CONST GLuint (*)[4]) ctx->Histogram.Count, |
format, type, values, &ctx->Pack); |
if (reset) { |
GLuint i; |
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { |
ctx->Histogram.Count[i][0] = 0; |
ctx->Histogram.Count[i][1] = 0; |
ctx->Histogram.Count[i][2] = 0; |
ctx->Histogram.Count[i][3] = 0; |
} |
} |
} |
void |
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); |
return; |
} |
if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); |
return; |
} |
switch (pname) { |
case GL_HISTOGRAM_WIDTH: |
*params = (GLfloat) ctx->Histogram.Width; |
break; |
case GL_HISTOGRAM_FORMAT: |
*params = (GLfloat) ctx->Histogram.Format; |
break; |
case GL_HISTOGRAM_RED_SIZE: |
*params = (GLfloat) ctx->Histogram.RedSize; |
break; |
case GL_HISTOGRAM_GREEN_SIZE: |
*params = (GLfloat) ctx->Histogram.GreenSize; |
break; |
case GL_HISTOGRAM_BLUE_SIZE: |
*params = (GLfloat) ctx->Histogram.BlueSize; |
break; |
case GL_HISTOGRAM_ALPHA_SIZE: |
*params = (GLfloat) ctx->Histogram.AlphaSize; |
break; |
case GL_HISTOGRAM_LUMINANCE_SIZE: |
*params = (GLfloat) ctx->Histogram.LuminanceSize; |
break; |
case GL_HISTOGRAM_SINK: |
*params = (GLfloat) ctx->Histogram.Sink; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); |
} |
} |
void |
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); |
return; |
} |
if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); |
return; |
} |
switch (pname) { |
case GL_HISTOGRAM_WIDTH: |
*params = (GLint) ctx->Histogram.Width; |
break; |
case GL_HISTOGRAM_FORMAT: |
*params = (GLint) ctx->Histogram.Format; |
break; |
case GL_HISTOGRAM_RED_SIZE: |
*params = (GLint) ctx->Histogram.RedSize; |
break; |
case GL_HISTOGRAM_GREEN_SIZE: |
*params = (GLint) ctx->Histogram.GreenSize; |
break; |
case GL_HISTOGRAM_BLUE_SIZE: |
*params = (GLint) ctx->Histogram.BlueSize; |
break; |
case GL_HISTOGRAM_ALPHA_SIZE: |
*params = (GLint) ctx->Histogram.AlphaSize; |
break; |
case GL_HISTOGRAM_LUMINANCE_SIZE: |
*params = (GLint) ctx->Histogram.LuminanceSize; |
break; |
case GL_HISTOGRAM_SINK: |
*params = (GLint) ctx->Histogram.Sink; |
break; |
default: |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); |
} |
} |
void |
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); |
return; |
} |
if (target != GL_MINMAX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); |
return; |
} |
if (pname == GL_MINMAX_FORMAT) { |
*params = (GLfloat) ctx->MinMax.Format; |
} |
else if (pname == GL_MINMAX_SINK) { |
*params = (GLfloat) ctx->MinMax.Sink; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); |
} |
} |
void |
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); |
return; |
} |
if (target != GL_MINMAX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); |
return; |
} |
if (pname == GL_MINMAX_FORMAT) { |
*params = (GLint) ctx->MinMax.Format; |
} |
else if (pname == GL_MINMAX_SINK) { |
*params = (GLint) ctx->MinMax.Sink; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); |
} |
} |
void |
_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) |
{ |
GLuint i; |
GLboolean error = GL_FALSE; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); |
return; |
} |
if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); |
return; |
} |
if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { |
if (target == GL_PROXY_HISTOGRAM) { |
error = GL_TRUE; |
} |
else { |
if (width < 0) |
_mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); |
else |
_mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); |
return; |
} |
} |
if (width != 0 && _mesa_bitcount(width) != 1) { |
if (target == GL_PROXY_HISTOGRAM) { |
error = GL_TRUE; |
} |
else { |
_mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); |
return; |
} |
} |
if (base_histogram_format(internalFormat) < 0) { |
if (target == GL_PROXY_HISTOGRAM) { |
error = GL_TRUE; |
} |
else { |
_mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); |
return; |
} |
} |
/* reset histograms */ |
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { |
ctx->Histogram.Count[i][0] = 0; |
ctx->Histogram.Count[i][1] = 0; |
ctx->Histogram.Count[i][2] = 0; |
ctx->Histogram.Count[i][3] = 0; |
} |
if (error) { |
ctx->Histogram.Width = 0; |
ctx->Histogram.Format = 0; |
ctx->Histogram.RedSize = 0; |
ctx->Histogram.GreenSize = 0; |
ctx->Histogram.BlueSize = 0; |
ctx->Histogram.AlphaSize = 0; |
ctx->Histogram.LuminanceSize = 0; |
} |
else { |
ctx->Histogram.Width = width; |
ctx->Histogram.Format = internalFormat; |
ctx->Histogram.Sink = sink; |
ctx->Histogram.RedSize = 8 * sizeof(GLuint); |
ctx->Histogram.GreenSize = 8 * sizeof(GLuint); |
ctx->Histogram.BlueSize = 8 * sizeof(GLuint); |
ctx->Histogram.AlphaSize = 8 * sizeof(GLuint); |
ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint); |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); |
return; |
} |
if (target != GL_MINMAX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); |
return; |
} |
if (base_histogram_format(internalFormat) < 0) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); |
return; |
} |
if (ctx->MinMax.Sink == sink) |
return; |
FLUSH_VERTICES(ctx, _NEW_PIXEL); |
ctx->MinMax.Sink = sink; |
} |
void |
_mesa_ResetHistogram(GLenum target) |
{ |
GLuint i; |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); |
return; |
} |
if (target != GL_HISTOGRAM) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); |
return; |
} |
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { |
ctx->Histogram.Count[i][0] = 0; |
ctx->Histogram.Count[i][1] = 0; |
ctx->Histogram.Count[i][2] = 0; |
ctx->Histogram.Count[i][3] = 0; |
} |
ctx->NewState |= _NEW_PIXEL; |
} |
void |
_mesa_ResetMinmax(GLenum target) |
{ |
GET_CURRENT_CONTEXT(ctx); |
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); |
if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { |
_mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); |
return; |
} |
if (target != GL_MINMAX) { |
_mesa_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); |
return; |
} |
ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; |
ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; |
ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; |
ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; |
ctx->NewState |= _NEW_PIXEL; |
} |
/shark/tags/rel_0_4/ports/mesa/include/GL/svgamesa.h |
---|
0,0 → 1,99 |
/* $Id: svgamesa.h,v 1.2 2003-03-13 13:06:03 giacomo Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0 |
* Copyright (C) 1995-2001 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* SVGA/Mesa interface for Linux. |
*/ |
/* |
* Intro to using the VGA/Mesa interface |
* |
* 1. #include the <vga.h> file |
* 2. Call vga_init() to initialize the SVGA library. |
* 3. Call vga_setmode() to specify the screen size and color depth. |
* 4. Call SVGAMesaCreateContext() to setup a Mesa context. If using 8-bit |
* color Mesa assumes color index mode, if using 16-bit or deeper color |
* Mesa assumes RGB mode. |
* 5. Call SVGAMesaMakeCurrent() to activate the Mesa context. |
* 6. You can now use the Mesa API functions. |
* 7. Before exiting, call SVGAMesaDestroyContext() then vga_setmode(TEXT) |
* to restore the original text screen. |
* |
* Notes |
* 1. You must run your executable as root (or use the set UID-bit) because |
* the SVGA library requires it. |
* 2. The SVGA driver is not fully implemented yet. See svgamesa.c for what |
* has to be done yet. |
*/ |
#ifndef SVGAMESA_H |
#define SVGAMESA_H |
#define SVGAMESA_MAJOR_VERSION 4 |
#define SVGAMESA_MINOR_VERSION 0 |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include "GL/gl.h" |
/* |
* This is the SVGAMesa context 'handle': |
*/ |
typedef struct svgamesa_context *SVGAMesaContext; |
/* |
* doubleBuffer flag new in version 2.4 |
*/ |
extern int SVGAMesaInit( int GraphMode ); |
extern int SVGAMesaClose( void ); |
extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ); |
extern void SVGAMesaDestroyContext( SVGAMesaContext ctx ); |
extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx ); |
extern void SVGAMesaSwapBuffers( void ); |
extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue); |
extern SVGAMesaContext SVGAMesaGetCurrentContext( void ); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/dmesa.h |
---|
0,0 → 1,79 |
/* |
* Mesa 3-D graphics library |
* Version: 5.0 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* DOS/DJGPP device driver v1.2 for Mesa 4.1 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#ifndef DMESA_H_included |
#define DMESA_H_included |
#define DMESA_MAJOR_VERSION 5 |
#define DMESA_MINOR_VERSION 0 |
typedef struct dmesa_context *DMesaContext; |
typedef struct dmesa_visual *DMesaVisual; |
typedef struct dmesa_buffer *DMesaBuffer; |
#ifdef __cplusplus |
extern "C" { |
#endif |
DMesaVisual DMesaCreateVisual (GLint width, GLint height, |
GLint colDepth, |
GLboolean dbFlag, |
GLint depthSize, |
GLint stencilSize, |
GLint accumSize); |
void DMesaDestroyVisual (DMesaVisual v); |
DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, |
GLint xpos, GLint ypos, |
GLint width, GLint height); |
void DMesaDestroyBuffer (DMesaBuffer b); |
DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share); |
void DMesaDestroyContext (DMesaContext c); |
GLboolean DMesaViewport (DMesaBuffer b, |
GLint xpos, GLint ypos, |
GLint width, GLint height); |
GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b); |
void DMesaSwapBuffers (DMesaBuffer b); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glx.h |
---|
0,0 → 1,493 |
/* $Id: glx.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef GLX_H |
#define GLX_H |
#ifdef __VMS |
#include <GL/vms_x_fix.h> |
# ifdef __cplusplus |
/* VMS Xlib.h gives problems with C++. |
* this avoids a bunch of trivial warnings */ |
#pragma message disable nosimpint |
#endif |
#endif |
#include <X11/Xlib.h> |
#include <X11/Xutil.h> |
#ifdef __VMS |
# ifdef __cplusplus |
#pragma message enable nosimpint |
#endif |
#endif |
#include <GL/gl.h> |
#if defined(USE_MGL_NAMESPACE) |
#include <GL/glx_mangle.h> |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define GLX_VERSION_1_1 1 |
#define GLX_VERSION_1_2 1 |
#define GLX_VERSION_1_3 1 |
#define GLX_VERSION_1_4 1 |
#define GLX_EXTENSION_NAME "GLX" |
/* |
* Tokens for glXChooseVisual and glXGetConfig: |
*/ |
#define GLX_USE_GL 1 |
#define GLX_BUFFER_SIZE 2 |
#define GLX_LEVEL 3 |
#define GLX_RGBA 4 |
#define GLX_DOUBLEBUFFER 5 |
#define GLX_STEREO 6 |
#define GLX_AUX_BUFFERS 7 |
#define GLX_RED_SIZE 8 |
#define GLX_GREEN_SIZE 9 |
#define GLX_BLUE_SIZE 10 |
#define GLX_ALPHA_SIZE 11 |
#define GLX_DEPTH_SIZE 12 |
#define GLX_STENCIL_SIZE 13 |
#define GLX_ACCUM_RED_SIZE 14 |
#define GLX_ACCUM_GREEN_SIZE 15 |
#define GLX_ACCUM_BLUE_SIZE 16 |
#define GLX_ACCUM_ALPHA_SIZE 17 |
/* |
* Error codes returned by glXGetConfig: |
*/ |
#define GLX_BAD_SCREEN 1 |
#define GLX_BAD_ATTRIBUTE 2 |
#define GLX_NO_EXTENSION 3 |
#define GLX_BAD_VISUAL 4 |
#define GLX_BAD_CONTEXT 5 |
#define GLX_BAD_VALUE 6 |
#define GLX_BAD_ENUM 7 |
/* |
* GLX 1.1 and later: |
*/ |
#define GLX_VENDOR 1 |
#define GLX_VERSION 2 |
#define GLX_EXTENSIONS 3 |
/* |
* GLX 1.3 and later: |
*/ |
#define GLX_CONFIG_CAVEAT 0x20 |
#define GLX_DONT_CARE 0xFFFFFFFF |
#define GLX_SLOW_CONFIG 0x8001 |
#define GLX_NON_CONFORMANT_CONFIG 0x800D |
#define GLX_X_VISUAL_TYPE 0x22 |
#define GLX_TRANSPARENT_TYPE 0x23 |
#define GLX_TRANSPARENT_INDEX_VALUE 0x24 |
#define GLX_TRANSPARENT_RED_VALUE 0x25 |
#define GLX_TRANSPARENT_GREEN_VALUE 0x26 |
#define GLX_TRANSPARENT_BLUE_VALUE 0x27 |
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 |
#define GLX_MAX_PBUFFER_WIDTH 0x8016 |
#define GLX_MAX_PBUFFER_HEIGHT 0x8017 |
#define GLX_MAX_PBUFFER_PIXELS 0x8018 |
#define GLX_PRESERVED_CONTENTS 0x801B |
#define GLX_LARGEST_PBUFFER 0x801C |
#define GLX_WIDTH 0x801D |
#define GLX_HEIGHT 0x801E |
#define GLX_EVENT_MASK 0x801F |
#define GLX_DRAWABLE_TYPE 0x8010 |
#define GLX_FBCONFIG_ID 0x8013 |
#define GLX_VISUAL_ID 0x800B |
#define GLX_WINDOW_BIT 0x00000001 |
#define GLX_PIXMAP_BIT 0x00000002 |
#define GLX_PBUFFER_BIT 0x00000004 |
#define GLX_AUX_BUFFERS_BIT 0x00000010 |
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 |
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 |
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 |
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 |
#define GLX_DEPTH_BUFFER_BIT 0x00000020 |
#define GLX_STENCIL_BUFFER_BIT 0x00000040 |
#define GLX_ACCUM_BUFFER_BIT 0x00000080 |
#define GLX_DRAWABLE_TYPE 0x8010 |
#define GLX_RENDER_TYPE 0x8011 |
#define GLX_X_RENDERABLE 0x8012 |
#define GLX_NONE 0x8000 |
#define GLX_TRUE_COLOR 0x8002 |
#define GLX_DIRECT_COLOR 0x8003 |
#define GLX_PSEUDO_COLOR 0x8004 |
#define GLX_STATIC_COLOR 0x8005 |
#define GLX_GRAY_SCALE 0x8006 |
#define GLX_STATIC_GRAY 0x8007 |
#define GLX_TRANSPARENT_RGB 0x8008 |
#define GLX_TRANSPARENT_INDEX 0x8009 |
#define GLX_RGBA_TYPE 0x8014 |
#define GLX_COLOR_INDEX_TYPE 0x8015 |
#define GLX_COLOR_INDEX_BIT 0x00000002 |
#define GLX_RGBA_BIT 0x00000001 |
#define GLX_SCREEN 0x800C |
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 |
#define GLX_DAMAGED 0x8020 |
#define GLX_SAVED 0x8021 |
#define GLX_WINDOW 0x8022 |
#define GLX_PBUFFER 0x8023 |
#define GLX_PBUFFER_HEIGHT 0x8040 |
#define GLX_PBUFFER_WIDTH 0x8041 |
/* |
* GLX 1.4 and later: |
*/ |
#define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ |
#define GLX_SAMPLES 0x186a1 /*100001*/ |
typedef struct __GLXcontextRec *GLXContext; |
typedef XID GLXPixmap; |
typedef XID GLXDrawable; |
/* GLX 1.3 and later */ |
typedef struct __GLXFBConfigRec *GLXFBConfig; |
typedef XID GLXFBConfigID; |
typedef XID GLXContextID; |
typedef XID GLXWindow; |
typedef XID GLXPbuffer; |
extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, |
int *attribList ); |
extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, |
GLXContext shareList, Bool direct ); |
extern void glXDestroyContext( Display *dpy, GLXContext ctx ); |
extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, |
GLXContext ctx); |
extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, |
unsigned long mask ); |
extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); |
extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, |
Pixmap pixmap ); |
extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); |
extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); |
extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); |
extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); |
extern int glXGetConfig( Display *dpy, XVisualInfo *visual, |
int attrib, int *value ); |
extern GLXContext glXGetCurrentContext( void ); |
extern GLXDrawable glXGetCurrentDrawable( void ); |
extern void glXWaitGL( void ); |
extern void glXWaitX( void ); |
extern void glXUseXFont( Font font, int first, int count, int list ); |
/* GLX 1.1 and later */ |
extern const char *glXQueryExtensionsString( Display *dpy, int screen ); |
extern const char *glXQueryServerString( Display *dpy, int screen, int name ); |
extern const char *glXGetClientString( Display *dpy, int name ); |
/* GLX 1.2 and later */ |
extern Display *glXGetCurrentDisplay( void ); |
/* GLX 1.3 and later */ |
extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, |
const int *attribList, int *nitems ); |
extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, |
int attribute, int *value ); |
extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, |
int *nelements ); |
extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, |
GLXFBConfig config ); |
extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config, |
Window win, const int *attribList ); |
extern void glXDestroyWindow( Display *dpy, GLXWindow window ); |
extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config, |
Pixmap pixmap, const int *attribList ); |
extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ); |
extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config, |
const int *attribList ); |
extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ); |
extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, |
unsigned int *value ); |
extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, |
int renderType, GLXContext shareList, |
Bool direct ); |
extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, |
GLXDrawable read, GLXContext ctx ); |
extern GLXDrawable glXGetCurrentReadDrawable( void ); |
extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute, |
int *value ); |
extern void glXSelectEvent( Display *dpy, GLXDrawable drawable, |
unsigned long mask ); |
extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, |
unsigned long *mask ); |
/* GLX 1.4 and later */ |
extern void (*glXGetProcAddress(const GLubyte *procname))(); |
#ifndef GLX_GLXEXT_LEGACY |
#include <GL/glxext.h> |
#else |
/* |
* 28. GLX_EXT_visual_info extension |
*/ |
#ifndef GLX_EXT_visual_info |
#define GLX_EXT_visual_info 1 |
#define GLX_X_VISUAL_TYPE_EXT 0x22 |
#define GLX_TRANSPARENT_TYPE_EXT 0x23 |
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 |
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 |
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 |
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 |
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 |
#define GLX_TRUE_COLOR_EXT 0x8002 |
#define GLX_DIRECT_COLOR_EXT 0x8003 |
#define GLX_PSEUDO_COLOR_EXT 0x8004 |
#define GLX_STATIC_COLOR_EXT 0x8005 |
#define GLX_GRAY_SCALE_EXT 0x8006 |
#define GLX_STATIC_GRAY_EXT 0x8007 |
#define GLX_NONE_EXT 0x8000 |
#define GLX_TRANSPARENT_RGB_EXT 0x8008 |
#define GLX_TRANSPARENT_INDEX_EXT 0x8009 |
#endif /* 28. GLX_EXT_visual_info extension */ |
/* |
* 41. GLX_SGI_video_sync |
*/ |
#ifndef GLX_SGI_video_sync |
#define GLX_SGI_video_sync 1 |
extern int glXGetVideoSyncSGI(unsigned int *count); |
extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); |
#endif /* GLX_SGI_video_sync */ |
/* |
* 42. GLX_EXT_visual_rating |
*/ |
#ifndef GLX_EXT_visual_rating |
#define GLX_EXT_visual_rating 1 |
#define GLX_VISUAL_CAVEAT_EXT 0x20 |
/*#define GLX_NONE_EXT 0x8000*/ |
#define GLX_SLOW_VISUAL_EXT 0x8001 |
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D |
#endif /* GLX_EXT_visual_rating */ |
/* |
* 47. GLX_EXT_import_context |
*/ |
#ifndef GLX_EXT_import_context |
#define GLX_EXT_import_context 1 |
#define GLX_SHARE_CONTEXT_EXT 0x800A |
#define GLX_VISUAL_ID_EXT 0x800B |
#define GLX_SCREEN_EXT 0x800C |
extern void glXFreeContextEXT(Display *dpy, GLXContext context); |
extern GLXContextID glXGetContextIDEXT(const GLXContext context); |
extern Display *glXGetCurrentDisplayEXT(void); |
extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID); |
extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context, |
int attribute,int *value); |
#endif /* GLX_EXT_import_context */ |
/* |
* 215. GLX_MESA_copy_sub_buffer |
*/ |
#ifndef GLX_MESA_copy_sub_buffer |
#define GLX_MESA_copy_sub_buffer 1 |
extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, |
int x, int y, int width, int height ); |
#endif |
/* |
* 216. GLX_MESA_pixmap_colormap |
*/ |
#ifndef GLX_MESA_pixmap_colormap |
#define GLX_MESA_pixmap_colormap 1 |
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, |
Pixmap pixmap, Colormap cmap ); |
#endif /* GLX_MESA_pixmap_colormap */ |
/* |
* 217. GLX_MESA_release_buffers |
*/ |
#ifndef GLX_MESA_release_buffers |
#define GLX_MESA_release_buffers 1 |
extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); |
#endif /* GLX_MESA_release_buffers */ |
/* |
* 218. GLX_MESA_set_3dfx_mode |
*/ |
#ifndef GLX_MESA_set_3dfx_mode |
#define GLX_MESA_set_3dfx_mode 1 |
#define GLX_3DFX_WINDOW_MODE_MESA 0x1 |
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 |
extern Bool glXSet3DfxModeMESA( int mode ); |
#endif /* GLX_MESA_set_3dfx_mode */ |
/* |
* ARB 2. GLX_ARB_get_proc_address |
*/ |
#ifndef GLX_ARB_get_proc_address |
#define GLX_ARB_get_proc_address 1 |
extern void (*glXGetProcAddressARB(const GLubyte *procName))(); |
#endif /* GLX_ARB_get_proc_address */ |
#endif /* GLX_GLXEXT_LEGACY */ |
/** |
** The following aren't in glxext.h yet. |
**/ |
/* |
* ???. GLX_NV_vertex_array_range |
*/ |
#ifndef GLX_NV_vertex_array_range |
#define GLX_NV_vertex_array_range |
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
extern void glXFreeMemoryNV(GLvoid *pointer); |
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); |
#endif /* GLX_NV_vertex_array_range */ |
/* |
* ???. GLX_MESA_agp_offset |
*/ |
#ifndef GLX_MESA_agp_offset |
#define GLX_MESA_agp_offset 1 |
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); |
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); |
#endif /* GLX_MESA_agp_offset */ |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glutf90.h |
---|
0,0 → 1,81 |
#ifndef __glutf90_h__ |
#define __glutf90_h__ |
/* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */ |
/* This program is freely distributable without licensing fees |
and is provided without guarantee or warrantee expressed or |
implied. This program is -not- in the public domain. */ |
/* This header provides the binding interface for William Mitchell's |
f90gl Fortran 90 GLUT binding. Other GLUT language bindings |
can and should use this interace. */ |
/* I appreciate the guidance from William Mitchell |
(mitchell@cam.nist.gov) in developing this friend interface |
for use by the f90gl package. See ../../README.fortran */ |
#include <GL/glut.h> |
/* Which callback enumerants for the __glutSetFCB/__glutGetFCB routines. */ |
/* NOTE These values are part of a binary interface for the f90gl Fortran |
90 binding and so must NOT changes (additions are allowed). */ |
/* GLUTwindow callbacks. */ |
#define GLUT_FCB_DISPLAY 0 /* GLUTdisplayFCB */ |
#define GLUT_FCB_RESHAPE 1 /* GLUTreshapeFCB */ |
#define GLUT_FCB_MOUSE 2 /* GLUTmouseFCB */ |
#define GLUT_FCB_MOTION 3 /* GLUTmotionFCB */ |
#define GLUT_FCB_PASSIVE 4 /* GLUTpassiveFCB */ |
#define GLUT_FCB_ENTRY 5 /* GLUTentryFCB */ |
#define GLUT_FCB_KEYBOARD 6 /* GLUTkeyboardFCB */ |
#define GLUT_FCB_KEYBOARD_UP 7 /* GLUTkeyboardFCB */ |
#define GLUT_FCB_WINDOW_STATUS 8 /* GLUTwindowStatusFCB */ |
#define GLUT_FCB_VISIBILITY 9 /* GLUTvisibilityFCB */ |
#define GLUT_FCB_SPECIAL 10 /* GLUTspecialFCB */ |
#define GLUT_FCB_SPECIAL_UP 11 /* GLUTspecialFCB */ |
#define GLUT_FCB_BUTTON_BOX 12 /* GLUTbuttonBoxFCB */ |
#define GLUT_FCB_DIALS 13 /* GLUTdialsFCB */ |
#define GLUT_FCB_SPACE_MOTION 14 /* GLUTspaceMotionFCB */ |
#define GLUT_FCB_SPACE_ROTATE 15 /* GLUTspaceRotateFCB */ |
#define GLUT_FCB_SPACE_BUTTON 16 /* GLUTspaceButtonFCB */ |
#define GLUT_FCB_TABLET_MOTION 17 /* GLUTtabletMotionFCB */ |
#define GLUT_FCB_TABLET_BUTTON 18 /* GLUTtabletButtonFCB */ |
#define GLUT_FCB_JOYSTICK 19 /* GLUTjoystickFCB */ |
/* Non-GLUTwindow callbacks. */ |
#define GLUT_FCB_OVERLAY_DISPLAY 100 /* GLUTdisplayFCB */ |
#define GLUT_FCB_SELECT 101 /* GLUTselectFCB */ |
#define GLUT_FCB_TIMER 102 /* GLUTtimerFCB */ |
/* GLUT Fortran callback function types. */ |
typedef void (GLUTCALLBACK *GLUTdisplayFCB) (void); |
typedef void (GLUTCALLBACK *GLUTreshapeFCB) (int *, int *); |
/* NOTE the pressed key is int, not unsigned char for Fortran! */ |
typedef void (GLUTCALLBACK *GLUTkeyboardFCB) (int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTmouseFCB) (int *, int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTmotionFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTpassiveFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTentryFCB) (int *); |
typedef void (GLUTCALLBACK *GLUTwindowStatusFCB) (int *); |
typedef void (GLUTCALLBACK *GLUTvisibilityFCB) (int *); |
typedef void (GLUTCALLBACK *GLUTspecialFCB) (int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTbuttonBoxFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTdialsFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTspaceMotionFCB) (int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTspaceRotateFCB) (int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTspaceButtonFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTtabletMotionFCB) (int *, int *); |
typedef void (GLUTCALLBACK *GLUTtabletButtonFCB) (int *, int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z); |
typedef void (GLUTCALLBACK *GLUTselectFCB) (int *); |
typedef void (GLUTCALLBACK *GLUTtimerFCB) (int *); |
typedef void (GLUTCALLBACK *GLUTmenuStateFCB) (int *); /* DEPRICATED. */ |
typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *); |
typedef void (GLUTCALLBACK *GLUTidleFCB) (void); |
/* Functions that set and return Fortran callback functions. */ |
GLUTAPI void* APIENTRY __glutGetFCB(int which); |
GLUTAPI void APIENTRY __glutSetFCB(int which, void *func); |
#endif /* __glutf90_h__ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/uglmesa.h |
---|
0,0 → 1,155 |
/* uglmesa.h - Public header UGL/Mesa */ |
/* Copyright (C) 2001 by Wind River Systems, Inc */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0 |
* |
* The MIT License |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* THE AUTHORS OR COPYRIGHT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
* DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Author: |
* Stephane Raimbault <stephane.raimbault@windriver.com> |
*/ |
#ifndef UGLMESA_H |
#define UGLMESA_H |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define UGL_MESA_MAJOR_VERSION 4 |
#define UGL_MESA_MINOR_VERSION 0 |
#include <GL/gl.h> |
#include <ugl/ugl.h> |
/* |
* Values for display mode of uglMesaCreateContext () |
*/ |
/* |
* With these mask values, it's possible to test double buffer mode |
* with UGL_MESA_DOUBLE mask |
* |
* SINGLE 0000 0001 |
* DOUBLE 0000 0110 |
* - SOFT 0000 0010 |
* - HARD 0000 0100 |
* WINDML 0001 0000 |
* |
* |
*/ |
#define UGL_MESA_SINGLE 0x01 |
#define UGL_MESA_DOUBLE 0x06 |
#define UGL_MESA_DOUBLE_SOFTWARE 0x02 |
#define UGL_MESA_DOUBLE_HARDWARE 0x04 |
#define UGL_MESA_WINDML_EXCLUSIVE 0x10 |
#define UGL_MESA_FULLSCREEN_WIDTH 0x0 |
#define UGL_MESA_FULLSCREEN_HEIGHT 0x0 |
/* |
* uglMesaPixelStore() parameters: |
*/ |
#define UGL_MESA_ROW_LENGTH 0x20 |
#define UGL_MESA_Y_UP 0x21 |
/* |
* Accepted by uglMesaGetIntegerv: |
*/ |
#define UGL_MESA_LEFT_X 0x01 |
#define UGL_MESA_TOP_Y 0x02 |
#define UGL_MESA_WIDTH 0x03 |
#define UGL_MESA_HEIGHT 0x04 |
#define UGL_MESA_DISPLAY_WIDTH 0x05 |
#define UGL_MESA_DISPLAY_HEIGHT 0x06 |
#define UGL_MESA_COLOR_FORMAT 0x07 |
#define UGL_MESA_COLOR_MODEL 0x08 |
#define UGL_MESA_PIXEL_FORMAT 0x09 |
#define UGL_MESA_TYPE 0x0A |
#define UGL_MESA_RGB 0x0B |
#define UGL_MESA_COLOR_INDEXED 0x0C |
#define UGL_MESA_SINGLE_BUFFER 0x0D |
#define UGL_MESA_DOUBLE_BUFFER 0x0E |
#define UGL_MESA_DOUBLE_BUFFER_SOFTWARE 0x0F |
#define UGL_MESA_DOUBLE_BUFFER_HARDWARE 0x10 |
/* |
* typedefs |
*/ |
typedef struct uglMesaContext * UGL_MESA_CONTEXT; |
UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum mode, |
UGL_MESA_CONTEXT share_list); |
UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode, |
GLint depth_bits, |
GLint stencil_bits, |
GLint accum_red_bits, |
GLint accum_green_bits, |
GLint accum_blue_bits, |
GLint accum_alpha_bits, |
UGL_MESA_CONTEXT share_list); |
GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc, |
GLsizei left, GLsizei top, |
GLsizei width, GLsizei height); |
GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy); |
GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top); |
GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh); |
GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height); |
void uglMesaDestroyContext (void); |
UGL_MESA_CONTEXT uglMesaGetCurrentContext (void); |
void uglMesaSwapBuffers (void); |
void uglMesaPixelStore (GLint pname, GLint value); |
void uglMesaGetIntegerv (GLint pname, GLint *value); |
GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height, |
GLint *bytesPerValue, void **buffer); |
GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height, |
GLint *format, void **buffer); |
GLboolean uglMesaSetColor (GLubyte index, GLfloat red, |
GLfloat green, GLfloat blue); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/mesa_wgl.h |
---|
0,0 → 1,125 |
/* $Id: mesa_wgl.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.1 |
* |
* Copyright (C) 1999 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* prototypes for the Mesa WGL functions */ |
/* relocated here so that I could make GLUT get them properly */ |
#define _mesa_wgl_h_ |
#ifndef _mesa_wgl_h_ |
#define _mesa_wgl_h_ |
#include <gl/gl.h> |
#ifdef __cplusplus |
extern "C" { |
#endif |
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__)) |
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ |
# define GLAPI __declspec(dllexport) |
# define WGLAPI __declspec(dllexport) |
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ |
# define GLAPI __declspec(dllimport) |
# define WGLAPI __declspec(dllimport) |
# else /* for use with static link lib build of Win32 edition only */ |
# define GLAPI extern |
# define WGLAPI __declspec(dllimport) |
# endif /* _STATIC_MESA support */ |
# define GLAPIENTRY __stdcall |
#else |
/* non-Windows compilation */ |
# define GLAPI extern |
# define GLAPIENTRY |
#endif /* WIN32 / CYGWIN32 bracket */ |
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) |
#ifndef _GNU_H_WINDOWS32_FUNCTIONS |
# ifdef UNICODE |
# define wglUseFontBitmaps wglUseFontBitmapsW |
# define wglUseFontOutlines wglUseFontOutlinesW |
# else |
# define wglUseFontBitmaps wglUseFontBitmapsA |
# define wglUseFontOutlines wglUseFontOutlinesA |
# endif /* !UNICODE */ |
#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ |
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; |
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; |
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; |
#endif |
#ifdef _MSC_VER |
# pragma warning( disable : 4615 ) /* pragma warning : unknown user warning type*/ |
# pragma warning( push ) |
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ |
#endif |
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); |
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); |
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); |
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); |
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); |
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); |
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); |
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); |
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); |
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); |
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); |
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); |
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); |
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); |
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC); |
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); |
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); |
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); |
WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); |
WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); |
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); |
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); |
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); |
WGLAPI int GLAPIENTRY SwapBuffers(HDC); |
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); |
WGLAPI int GLAPIENTRY GetPixelFormat(HDC); |
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); |
#ifdef _MSC_VER |
# pragma warning( pop ) |
#endif |
#ifdef __cplusplus |
} |
#endif |
#endif /* _mesa_wgl_h_ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/vms_x_fix.h |
---|
0,0 → 1,880 |
/*************************************************************************** |
* * |
* Repair definitions of Xlib when compileing with /name=(as_is) on VMS * |
* * |
* Author : Jouk Jansen (joukj@hrem.stm.tudelft.nl) * |
* * |
* Last revision : 22 August 2000 * |
* * |
***************************************************************************/ |
#ifndef VMS_X_FIX |
#define VMS_X_FIX |
#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE |
#define XAllocClassHint XALLOCCLASSHINT |
#define XAllocColor XALLOCCOLOR |
#define XAllocColorCells XALLOCCOLORCELLS |
#define XAllocSizeHints XALLOCSIZEHINTS |
#define XAllocWMHints XALLOCWMHINTS |
#define XAutoRepeatOff XAUTOREPEATOFF |
#define XAutoRepeatOn XAUTOREPEATON |
#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET |
#define XBell XBELL |
#define XBitmapPad XBITMAPPAD |
#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB |
#define XChangeGC XCHANGEGC |
#define XChangeProperty XCHANGEPROPERTY |
#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES |
#define XCheckIfEvent XCHECKIFEVENT |
#define XCheckMaskEvent XCHECKMASKEVENT |
#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT |
#define XCheckWindowEvent XCHECKWINDOWEVENT |
#define XClearArea XCLEARAREA |
#define XClearWindow XCLEARWINDOW |
#define XClipBox XCLIPBOX |
#define XCloseDisplay XCLOSEDISPLAY |
#define XCloseIM XCLOSEIM |
#define XConfigureWindow XCONFIGUREWINDOW |
#define XConvertSelection XCONVERTSELECTION |
#define XCopyArea XCOPYAREA |
#define XCopyGC XCOPYGC |
#define XCopyPlane XCOPYPLANE |
#define XCreateBitmapFromData XCREATEBITMAPFROMDATA |
#define XCreateColormap XCREATECOLORMAP |
#define XCreateFontCursor XCREATEFONTCURSOR |
#define XCreateFontSet XCREATEFONTSET |
#define XCreateGC XCREATEGC |
#define XCreateIC XCREATEIC |
#define XCreateImage XCREATEIMAGE |
#define XCreatePixmap XCREATEPIXMAP |
#define XCreatePixmapCursor XCREATEPIXMAPCURSOR |
#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA |
#define XCreateRegion XCREATEREGION |
#define XCreateSimpleWindow XCREATESIMPLEWINDOW |
#define XCreateWindow XCREATEWINDOW |
#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY |
#define XDefineCursor XDEFINECURSOR |
#define XDeleteProperty XDELETEPROPERTY |
#define XDestroyIC XDESTROYIC |
#define XDestroyRegion XDESTROYREGION |
#define XDestroyWindow XDESTROYWINDOW |
#define XDisplayName XDISPLAYNAME |
#define XDisplayOfScreen XDISPLAYOFSCREEN |
#define XDrawArc XDRAWARC |
#define XDrawImageString XDRAWIMAGESTRING |
#define XDrawImageString16 XDRAWIMAGESTRING16 |
#define XDrawLine XDRAWLINE |
#define XDrawLines XDRAWLINES |
#define XDrawPoint XDRAWPOINT |
#define XDrawPoints XDRAWPOINTS |
#define XDrawRectangle XDRAWRECTANGLE |
#define XDrawSegments XDRAWSEGMENTS |
#define XDrawString XDRAWSTRING |
#define XDrawString16 XDRAWSTRING16 |
#define XEmptyRegion XEMPTYREGION |
#define XEqualRegion XEQUALREGION |
#define XEventsQueued XEVENTSQUEUED |
#define XExtentsOfFontSet XEXTENTSOFFONTSET |
#define XFillArc XFILLARC |
#define XFillPolygon XFILLPOLYGON |
#define XFillRectangle XFILLRECTANGLE |
#define XFillRectangles XFILLRECTANGLES |
#define XFilterEvent XFILTEREVENT |
#define XFlush XFLUSH |
#define XFontsOfFontSet XFONTSOFFONTSET |
#define XFree XFREE |
#define XFreeColormap XFREECOLORMAP |
#define XFreeColors XFREECOLORS |
#define XFreeCursor XFREECURSOR |
#define XFreeFont XFREEFONT |
#define XFreeFontInfo XFREEFONTINFO |
#define XFreeFontNames XFREEFONTNAMES |
#define XFreeFontSet XFREEFONTSET |
#define XFreeGC XFREEGC |
#define XFreeModifiermap XFREEMODIFIERMAP |
#define XFreePixmap XFREEPIXMAP |
#define XFreeStringList XFREESTRINGLIST |
#define XGetAtomName XGETATOMNAME |
#define XGetDefault XGETDEFAULT |
#define XGetErrorDatabaseText XGETERRORDATABASETEXT |
#define XGetErrorText XGETERRORTEXT |
#define XGetFontProperty XGETFONTPROPERTY |
#define XGetGCValues XGETGCVALUES |
#define XGetGeometry XGETGEOMETRY |
#define XGetICValues XGETICVALUES |
#define XGetIMValues XGETIMVALUES |
#define XGetImage XGETIMAGE |
#define XGetKeyboardControl XGETKEYBOARDCONTROL |
#define XGetModifierMapping XGETMODIFIERMAPPING |
#define XGetMotionEvents XGETMOTIONEVENTS |
#define XGetNormalHints XGETNORMALHINTS |
#define XGetSelectionOwner XGETSELECTIONOWNER |
#define XGetSubImage XGETSUBIMAGE |
#define XGetVisualInfo XGETVISUALINFO |
#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS |
#define XGetWMHints XGETWMHINTS |
#define XGetWMName XGETWMNAME |
#define XGetWMNormalHints XGETWMNORMALHINTS |
#define XGetWindowAttributes XGETWINDOWATTRIBUTES |
#define XGetWindowProperty XGETWINDOWPROPERTY |
#define XGrabKeyboard XGRABKEYBOARD |
#define XGrabPointer XGRABPOINTER |
#define XGrabServer XGRABSERVER |
#define XHeightOfScreen XHEIGHTOFSCREEN |
#define XIfEvent XIFEVENT |
#define XInternAtom XINTERNATOM |
#define XIntersectRegion XINTERSECTREGION |
#define XKeycodeToKeysym XKEYCODETOKEYSYM |
#define XKeysymToKeycode XKEYSYMTOKEYCODE |
#define XKeysymToString XKEYSYMTOSTRING |
#define XListFonts XLISTFONTS |
#define XListFontsWithInfo XLISTFONTSWITHINFO |
#define XListPixmapFormats XLISTPIXMAPFORMATS |
#define XListProperties XLISTPROPERTIES |
#define XLoadQueryFont XLOADQUERYFONT |
#define XLookupString XLOOKUPSTRING |
#define XLowerWindow XLOWERWINDOW |
#define XMapRaised XMAPRAISED |
#define XMapWindow XMAPWINDOW |
#define XMatchVisualInfo XMATCHVISUALINFO |
#define XMoveResizeWindow XMOVERESIZEWINDOW |
#define XMoveWindow XMOVEWINDOW |
#define XNextEvent XNEXTEVENT |
#define XOffsetRegion XOFFSETREGION |
#define XOpenDisplay XOPENDISPLAY |
#define XOpenIM XOPENIM |
#define XParseColor XPARSECOLOR |
#define XParseGeometry XPARSEGEOMETRY |
#define XPeekEvent XPEEKEVENT |
#define XPending XPENDING |
#define XPointInRegion XPOINTINREGION |
#define XPolygonRegion XPOLYGONREGION |
#define XPutBackEvent XPUTBACKEVENT |
#define XPutImage XPUTIMAGE |
#define XQueryColor XQUERYCOLOR |
#define XQueryColors XQUERYCOLORS |
#define XQueryExtension XQUERYEXTENSION |
#define XQueryPointer XQUERYPOINTER |
#define XQueryTree XQUERYTREE |
#define XRaiseWindow XRAISEWINDOW |
#define XReconfigureWMWindow XRECONFIGUREWMWINDOW |
#define XRectInRegion XRECTINREGION |
#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING |
#define XReparentWindow XREPARENTWINDOW |
#define XResizeWindow XRESIZEWINDOW |
#define XRestackWindows XRESTACKWINDOWS |
#define XRootWindowOfScreen XROOTWINDOWOFSCREEN |
#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN |
#define XSelectAsyncEvent XSELECTASYNCEVENT |
#define XSelectAsyncInput XSELECTASYNCINPUT |
#define XSelectInput XSELECTINPUT |
#define XSendEvent XSENDEVENT |
#define XServerVendor XSERVERVENDOR |
#define XSetBackground XSETBACKGROUND |
#define XSetClassHint XSETCLASSHINT |
#define XSetClipMask XSETCLIPMASK |
#define XSetClipOrigin XSETCLIPORIGIN |
#define XSetClipRectangles XSETCLIPRECTANGLES |
#define XSetCloseDownMode XSETCLOSEDOWNMODE |
#define XSetCommand XSETCOMMAND |
#define XSetDashes XSETDASHES |
#define XSetErrorHandler XSETERRORHANDLER |
#define XSetFillStyle XSETFILLSTYLE |
#define XSetFont XSETFONT |
#define XSetForeground XSETFOREGROUND |
#define XSetFunction XSETFUNCTION |
#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES |
#define XSetICFocus XSETICFOCUS |
#define XSetICValues XSETICVALUES |
#define XSetIOErrorHandler XSETIOERRORHANDLER |
#define XSetInputFocus XSETINPUTFOCUS |
#define XSetLineAttributes XSETLINEATTRIBUTES |
#define XSetLocaleModifiers XSETLOCALEMODIFIERS |
#define XSetNormalHints XSETNORMALHINTS |
#define XSetRegion XSETREGION |
#define XSetSelectionOwner XSETSELECTIONOWNER |
#define XSetStipple XSETSTIPPLE |
#define XSetSubwindowMode XSETSUBWINDOWMODE |
#define XSetTSOrigin XSETTSORIGIN |
#define XSetTile XSETTILE |
#define XSetTransientForHint XSETTRANSIENTFORHINT |
#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS |
#define XSetWMHints XSETWMHINTS |
#define XSetWMIconName XSETWMICONNAME |
#define XSetWMName XSETWMNAME |
#define XSetWMNormalHints XSETWMNORMALHINTS |
#define XSetWMProperties XSETWMPROPERTIES |
#define XSetWMProtocols XSETWMPROTOCOLS |
#define XSetWindowBackground XSETWINDOWBACKGROUND |
#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP |
#define XSetWindowColormap XSETWINDOWCOLORMAP |
#define XShapeCombineMask XSHAPECOMBINEMASK |
#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES |
#define XShapeGetRectangles XSHAPEGETRECTANGLES |
#define XShrinkRegion XSHRINKREGION |
#define XStoreColor XSTORECOLOR |
#define XStoreColors XSTORECOLORS |
#define XStoreName XSTORENAME |
#define XStringToKeysym XSTRINGTOKEYSYM |
#define XSubtractRegion XSUBTRACTREGION |
#define XSupportsLocale XSUPPORTSLOCALE |
#define XSync XSYNC |
#define XSynchronize XSYNCHRONIZE |
#define XTextExtents XTEXTEXTENTS |
#define XTextExtents16 XTEXTEXTENTS16 |
#define XTextWidth XTEXTWIDTH |
#define XTextWidth16 XTEXTWIDTH16 |
#define XTranslateCoordinates XTRANSLATECOORDINATES |
#define XUndefineCursor XUNDEFINECURSOR |
#define XUngrabKeyboard XUNGRABKEYBOARD |
#define XUngrabPointer XUNGRABPOINTER |
#define XUngrabServer XUNGRABSERVER |
#define XUnionRectWithRegion XUNIONRECTWITHREGION |
#define XUnionRegion XUNIONREGION |
#define XUnmapWindow XUNMAPWINDOW |
#define _XUnregisterFilter _XUNREGISTERFILTER |
#define XUnsetICFocus XUNSETICFOCUS |
#define XVaCreateNestedList XVACREATENESTEDLIST |
#define XVisualIDFromVisual XVISUALIDFROMVISUAL |
#define XWidthOfScreen XWIDTHOFSCREEN |
#define XWindowEvent XWINDOWEVENT |
#define XWithdrawWindow XWITHDRAWWINDOW |
#define XXorRegion XXORREGION |
#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK |
#define XmAddProtocols XMADDPROTOCOLS |
#define XmChangeColor XMCHANGECOLOR |
#define XmClipboardCopy XMCLIPBOARDCOPY |
#define XmClipboardEndCopy XMCLIPBOARDENDCOPY |
#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH |
#define XmClipboardLock XMCLIPBOARDLOCK |
#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE |
#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY |
#define XmClipboardUnlock XMCLIPBOARDUNLOCK |
#define XmCreateArrowButton XMCREATEARROWBUTTON |
#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET |
#define XmCreateCascadeButton XMCREATECASCADEBUTTON |
#define XmCreateDialogShell XMCREATEDIALOGSHELL |
#define XmCreateDragIcon XMCREATEDRAGICON |
#define XmCreateDrawingArea XMCREATEDRAWINGAREA |
#define XmCreateDrawnButton XMCREATEDRAWNBUTTON |
#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX |
#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG |
#define XmCreateForm XMCREATEFORM |
#define XmCreateFormDialog XMCREATEFORMDIALOG |
#define XmCreateFrame XMCREATEFRAME |
#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG |
#define XmCreateLabelGadget XMCREATELABELGADGET |
#define XmCreateMainWindow XMCREATEMAINWINDOW |
#define XmCreateMenuBar XMCREATEMENUBAR |
#define XmCreateMessageBox XMCREATEMESSAGEBOX |
#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG |
#define XmCreateOptionMenu XMCREATEOPTIONMENU |
#define XmCreatePanedWindow XMCREATEPANEDWINDOW |
#define XmCreatePopupMenu XMCREATEPOPUPMENU |
#define XmCreatePromptDialog XMCREATEPROMPTDIALOG |
#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU |
#define XmCreatePushButton XMCREATEPUSHBUTTON |
#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET |
#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG |
#define XmCreateRadioBox XMCREATERADIOBOX |
#define XmCreateRowColumn XMCREATEROWCOLUMN |
#define XmCreateScale XMCREATESCALE |
#define XmCreateScrollBar XMCREATESCROLLBAR |
#define XmCreateScrolledList XMCREATESCROLLEDLIST |
#define XmCreateScrolledText XMCREATESCROLLEDTEXT |
#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW |
#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG |
#define XmCreateSeparator XMCREATESEPARATOR |
#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET |
#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG |
#define XmCreateText XMCREATETEXT |
#define XmCreateTextField XMCREATETEXTFIELD |
#define XmCreateToggleButton XMCREATETOGGLEBUTTON |
#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET |
#define XmDragStart XMDRAGSTART |
#define XmDropSiteRegister XMDROPSITEREGISTER |
#define XmDropSiteUnregister XMDROPSITEUNREGISTER |
#define XmDropSiteUpdate XMDROPSITEUPDATE |
#define XmDropTransferStart XMDROPTRANSFERSTART |
#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD |
#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH |
#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY |
#define XmFontListCopy XMFONTLISTCOPY |
#define XmFontListCreate XMFONTLISTCREATE |
#define XmFontListEntryCreate XMFONTLISTENTRYCREATE |
#define XmFontListEntryFree XMFONTLISTENTRYFREE |
#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT |
#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG |
#define XmFontListEntryLoad XMFONTLISTENTRYLOAD |
#define XmFontListFree XMFONTLISTFREE |
#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT |
#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT |
#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT |
#define XmFontListNextEntry XMFONTLISTNEXTENTRY |
#define XmGetColors XMGETCOLORS |
#define XmGetFocusWidget XMGETFOCUSWIDGET |
#define XmGetMenuCursor XMGETMENUCURSOR |
#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH |
#define XmGetTearOffControl XMGETTEAROFFCONTROL |
#define XmGetXmDisplay XMGETXMDISPLAY |
#define XmImMbLookupString XMIMMBLOOKUPSTRING |
#define XmImRegister XMIMREGISTER |
#define XmImSetFocusValues XMIMSETFOCUSVALUES |
#define XmImSetValues XMIMSETVALUES |
#define XmImUnregister XMIMUNREGISTER |
#define XmImUnsetFocus XMIMUNSETFOCUS |
#define XmInternAtom XMINTERNATOM |
#define XmIsMotifWMRunning XMISMOTIFWMRUNNING |
#define XmListAddItem XMLISTADDITEM |
#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED |
#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED |
#define XmListDeleteAllItems XMLISTDELETEALLITEMS |
#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS |
#define XmListDeletePos XMLISTDELETEPOS |
#define XmListDeselectAllItems XMLISTDESELECTALLITEMS |
#define XmListDeselectPos XMLISTDESELECTPOS |
#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS |
#define XmListGetMatchPos XMLISTGETMATCHPOS |
#define XmListGetSelectedPos XMLISTGETSELECTEDPOS |
#define XmListPosSelected XMLISTPOSSELECTED |
#define XmListSelectItem XMLISTSELECTITEM |
#define XmListSelectPos XMLISTSELECTPOS |
#define XmListSetBottomPos XMLISTSETBOTTOMPOS |
#define XmListSetItem XMLISTSETITEM |
#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS |
#define XmListSetPos XMLISTSETPOS |
#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS |
#define XmMenuPosition XMMENUPOSITION |
#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD |
#define XmOptionButtonGadget XMOPTIONBUTTONGADGET |
#define XmOptionLabelGadget XMOPTIONLABELGADGET |
#define XmProcessTraversal XMPROCESSTRAVERSAL |
#define XmQmotif XMQMOTIF |
#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK |
#define XmRepTypeGetId XMREPTYPEGETID |
#define XmRepTypeGetRecord XMREPTYPEGETRECORD |
#define XmRepTypeRegister XMREPTYPEREGISTER |
#define XmRepTypeValidValue XMREPTYPEVALIDVALUE |
#define XmScrollBarSetValues XMSCROLLBARSETVALUES |
#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS |
#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD |
#define XmStringByteCompare XMSTRINGBYTECOMPARE |
#define XmStringCompare XMSTRINGCOMPARE |
#define XmStringConcat XMSTRINGCONCAT |
#define XmStringCopy XMSTRINGCOPY |
#define XmStringCreate XMSTRINGCREATE |
#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED |
#define XmStringCreateLtoR XMSTRINGCREATELTOR |
#define XmStringCreateSimple XMSTRINGCREATESIMPLE |
#define XmStringDraw XMSTRINGDRAW |
#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE |
#define XmStringExtent XMSTRINGEXTENT |
#define XmStringFree XMSTRINGFREE |
#define XmStringFreeContext XMSTRINGFREECONTEXT |
#define XmStringGetLtoR XMSTRINGGETLTOR |
#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT |
#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT |
#define XmStringInitContext XMSTRINGINITCONTEXT |
#define XmStringLength XMSTRINGLENGTH |
#define XmStringLtoRCreate XMSTRINGLTORCREATE |
#define XmStringNConcat XMSTRINGNCONCAT |
#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE |
#define XmStringWidth XMSTRINGWIDTH |
#define XmTextClearSelection XMTEXTCLEARSELECTION |
#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE |
#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION |
#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION |
#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION |
#define XmTextFieldGetString XMTEXTFIELDGETSTRING |
#define XmTextFieldInsert XMTEXTFIELDINSERT |
#define XmTextFieldRemove XMTEXTFIELDREMOVE |
#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION |
#define XmTextFieldSetString XMTEXTFIELDSETSTRING |
#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION |
#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION |
#define XmTextGetLastPosition XMTEXTGETLASTPOSITION |
#define XmTextGetMaxLength XMTEXTGETMAXLENGTH |
#define XmTextGetSelection XMTEXTGETSELECTION |
#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION |
#define XmTextGetString XMTEXTGETSTRING |
#define XmTextInsert XMTEXTINSERT |
#define XmTextRemove XMTEXTREMOVE |
#define XmTextReplace XMTEXTREPLACE |
#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION |
#define XmTextSetHighlight XMTEXTSETHIGHLIGHT |
#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION |
#define XmTextSetSelection XMTEXTSETSELECTION |
#define XmTextSetString XMTEXTSETSTRING |
#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE |
#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE |
#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE |
#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE |
#define XmUpdateDisplay XMUPDATEDISPLAY |
#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX |
#define XmbDrawString XMBDRAWSTRING |
#define XmbLookupString XMBLOOKUPSTRING |
#define XmbResetIC XMBRESETIC |
#define XmbSetWMProperties XMBSETWMPROPERTIES |
#define XmbTextEscapement XMBTEXTESCAPEMENT |
#define XmbTextExtents XMBTEXTEXTENTS |
#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY |
#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST |
#define XmuClientWindow XMUCLIENTWINDOW |
#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE |
#define XrmGetDatabase XRMGETDATABASE |
#define XrmGetResource XRMGETRESOURCE |
#define XrmPutStringResource XRMPUTSTRINGRESOURCE |
#define XrmQuarkToString XRMQUARKTOSTRING |
#define XrmStringToQuark XRMSTRINGTOQUARK |
#define XtAddCallback XTADDCALLBACK |
#define XtAddCallbacks XTADDCALLBACKS |
#define XtAddEventHandler XTADDEVENTHANDLER |
#define XtAddGrab XTADDGRAB |
#define XtAllocateGC XTALLOCATEGC |
#define XtAppAddActions XTAPPADDACTIONS |
#define XtAppAddInput XTAPPADDINPUT |
#define XtAppAddTimeOut XTAPPADDTIMEOUT |
#define XtAppCreateShell XTAPPCREATESHELL |
#define XtAppInitialize XTAPPINITIALIZE |
#define XtAppNextEvent XTAPPNEXTEVENT |
#define XtAppPeekEvent XTAPPPEEKEVENT |
#define XtAppPending XTAPPPENDING |
#define XtAppProcessEvent XTAPPPROCESSEVENT |
#define XtAppSetErrorHandler XTAPPSETERRORHANDLER |
#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES |
#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER |
#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER |
#define XtAppWarning XTAPPWARNING |
#define XtCallActionProc XTCALLACTIONPROC |
#define XtCallCallbackList XTCALLCALLBACKLIST |
#define XtCallCallbacks XTCALLCALLBACKS |
#define XtConfigureWidget XTCONFIGUREWIDGET |
#define XtConvertAndStore XTCONVERTANDSTORE |
#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT |
#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET |
#define XtCreatePopupShell XTCREATEPOPUPSHELL |
#define XtCreateWidget XTCREATEWIDGET |
#define XtDatabase XTDATABASE |
#define XtDestroyWidget XTDESTROYWIDGET |
#define XtDisownSelection XTDISOWNSELECTION |
#define XtDispatchEvent XTDISPATCHEVENT |
#define XtDisplayOfObject XTDISPLAYOFOBJECT |
#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING |
#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT |
#define XtAppAddWorkProc XTAPPADDWORKPROC |
#define XtRemoveWorkProc XTREMOVEWORKPROC |
#define XtFree XTFREE |
#define XtGetActionKeysym XTGETACTIONKEYSYM |
#define XtGetActionList XTGETACTIONLIST |
#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS |
#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES |
#define XtGetGC XTGETGC |
#define XtGetMultiClickTime XTGETMULTICLICKTIME |
#define XtGetSelectionValue XTGETSELECTIONVALUE |
#define XtGetSelectionValues XTGETSELECTIONVALUES |
#define XtGetSubresources XTGETSUBRESOURCES |
#define XtGetValues XTGETVALUES |
#define XtGrabKeyboard XTGRABKEYBOARD |
#define XtGrabPointer XTGRABPOINTER |
#define XtHasCallbacks XTHASCALLBACKS |
#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS |
#define XtInsertEventHandler XTINSERTEVENTHANDLER |
#define XtIsManaged XTISMANAGED |
#define XtIsObject XTISOBJECT |
#define XtIsSensitive XTISSENSITIVE |
#define XtIsSubclass XTISSUBCLASS |
#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED |
#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST |
#define XtMakeResizeRequest XTMAKERESIZEREQUEST |
#define XtMalloc XTMALLOC |
#define XtManageChild XTMANAGECHILD |
#define XtManageChildren XTMANAGECHILDREN |
#define XtMergeArgLists XTMERGEARGLISTS |
#define XtMoveWidget XTMOVEWIDGET |
#define XtName XTNAME |
#define XtNameToWidget XTNAMETOWIDGET |
#define XtOpenDisplay XTOPENDISPLAY |
#define XtOverrideTranslations XTOVERRIDETRANSLATIONS |
#define XtOwnSelection XTOWNSELECTION |
#define XtParseTranslationTable XTPARSETRANSLATIONTABLE |
#define XtPopdown XTPOPDOWN |
#define XtPopup XTPOPUP |
#define XtQueryGeometry XTQUERYGEOMETRY |
#define XtRealizeWidget XTREALIZEWIDGET |
#define XtRealloc XTREALLOC |
#define XtReleaseGC XTRELEASEGC |
#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS |
#define XtRemoveCallback XTREMOVECALLBACK |
#define XtRemoveEventHandler XTREMOVEEVENTHANDLER |
#define XtRemoveGrab XTREMOVEGRAB |
#define XtRemoveInput XTREMOVEINPUT |
#define XtRemoveTimeOut XTREMOVETIMEOUT |
#define XtResizeWidget XTRESIZEWIDGET |
#define XtResolvePathname XTRESOLVEPATHNAME |
#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS |
#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED |
#define XtSetSensitive XTSETSENSITIVE |
#define XtSetTypeConverter XTSETTYPECONVERTER |
#define XtSetValues XTSETVALUES |
#define XtShellStrings XTSHELLSTRINGS |
#define XtStrings XTSTRINGS |
#define XtToolkitInitialize XTTOOLKITINITIALIZE |
#define XtTranslateCoords XTTRANSLATECOORDS |
#define XtTranslateKeycode XTTRANSLATEKEYCODE |
#define XtUngrabKeyboard XTUNGRABKEYBOARD |
#define XtUngrabPointer XTUNGRABPOINTER |
#define XtUnmanageChild XTUNMANAGECHILD |
#define XtUnmanageChildren XTUNMANAGECHILDREN |
#define XtUnrealizeWidget XTUNREALIZEWIDGET |
#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET |
#define XtVaCreateWidget XTVACREATEWIDGET |
#define XtVaGetValues XTVAGETVALUES |
#define XtVaSetValues XTVASETVALUES |
#define XtWarning XTWARNING |
#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT |
#define XtWindowOfObject XTWINDOWOFOBJECT |
#define XtWindowToWidget XTWINDOWTOWIDGET |
#define XwcDrawString XWCDRAWSTRING |
#define XwcFreeStringList XWCFREESTRINGLIST |
#define XwcTextEscapement XWCTEXTESCAPEMENT |
#define XwcTextExtents XWCTEXTEXTENTS |
#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY |
#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST |
#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT |
#define _XmClearBorder _XMCLEARBORDER |
#define _XmConfigureObject _XMCONFIGUREOBJECT |
#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK |
#define _XmDrawArrow _XMDRAWARROW |
#define _XmDrawShadows _XMDRAWSHADOWS |
#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT |
#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS |
#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS |
#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR |
#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST |
#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON |
#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA |
#define _XmGrabKeyboard _XMGRABKEYBOARD |
#define _XmGrabPointer _XMGRABPOINTER |
#define _XmInheritClass _XMINHERITCLASS |
#define _XmInputInGadget _XMINPUTINGADGET |
#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST |
#define _XmMenuPopDown _XMMENUPOPDOWN |
#define _XmMoveObject _XMMOVEOBJECT |
#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED |
#define _XmOSBuildFileList _XMOSBUILDFILELIST |
#define _XmOSFileCompare _XMOSFILECOMPARE |
#define _XmOSFindPatternPart _XMOSFINDPATTERNPART |
#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC |
#define _XmPostPopupMenu _XMPOSTPOPUPMENU |
#define _XmPrimitiveEnter _XMPRIMITIVEENTER |
#define _XmPrimitiveLeave _XMPRIMITIVELEAVE |
#define _XmRedisplayGadgets _XMREDISPLAYGADGETS |
#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE |
#define _XmStringDraw _XMSTRINGDRAW |
#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT |
#define _XmStrings _XMSTRINGS |
#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS |
#define _XmToVerticalPixels _XMTOVERTICALPIXELS |
#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT |
#define _Xm_fastPtr _XM_FASTPTR |
#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG |
#define _XtInherit _XTINHERIT |
#define _XtInheritTranslations _XTINHERITTRANSLATIONS |
#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS |
#define compositeWidgetClass COMPOSITEWIDGETCLASS |
#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS |
#define shellWidgetClass SHELLWIDGETCLASS |
#define topLevelShellClassRec TOPLEVELSHELLCLASSREC |
#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS |
#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS |
#define vendorShellClassRec VENDORSHELLCLASSREC |
#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS |
#define wmShellWidgetClass WMSHELLWIDGETCLASS |
#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS |
#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC |
#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS |
#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS |
#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS |
#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS |
#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS |
#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS |
#define xmFormWidgetClass XMFORMWIDGETCLASS |
#define xmFrameWidgetClass XMFRAMEWIDGETCLASS |
#define xmGadgetClass XMGADGETCLASS |
#define xmLabelGadgetClass XMLABELGADGETCLASS |
#define xmLabelWidgetClass XMLABELWIDGETCLASS |
#define xmListWidgetClass XMLISTWIDGETCLASS |
#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS |
#define xmManagerClassRec XMMANAGERCLASSREC |
#define xmManagerWidgetClass XMMANAGERWIDGETCLASS |
#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS |
#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS |
#define xmPrimitiveClassRec XMPRIMITIVECLASSREC |
#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS |
#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC |
#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS |
#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS |
#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS |
#define xmSashWidgetClass XMSASHWIDGETCLASS |
#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS |
#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC |
#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS |
#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS |
#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS |
#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS |
#define xmTextWidgetClass XMTEXTWIDGETCLASS |
#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS |
#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS |
#define XtRegisterDrawable _XTREGISTERWINDOW |
#define XtUnregisterDrawable _XTUNREGISTERWINDOW |
#define XQueryFont XQUERYFONT |
#define XSetPlaneMask XSETPLANEMASK |
#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL |
#define XDestroySubwindows XDESTROYSUBWINDOWS |
#define XFreeDeviceList XFREEDEVICELIST |
#define XFreeDeviceState XFREEDEVICESTATE |
#define XGetExtensionVersion XGETEXTENSIONVERSION |
#define XGetRGBColormaps XGETRGBCOLORMAPS |
#define XIconifyWindow XICONIFYWINDOW |
#define XInstallColormap XINSTALLCOLORMAP |
#define XListInputDevices XLISTINPUTDEVICES |
#define XLookupKeysym XLOOKUPKEYSYM |
#define XOpenDevice XOPENDEVICE |
#define XQueryDeviceState XQUERYDEVICESTATE |
#define XSelectExtensionEvent XSELECTEXTENSIONEVENT |
#define XWarpPointer XWARPPOINTER |
#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP |
#define XAllocNamedColor XALLOCNAMEDCOLOR |
#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN |
#define XDefaultColormap XDEFAULTCOLORMAP |
#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN |
#define XDefaultDepth XDEFAULTDEPTH |
#define XDefaultScreen XDEFAULTSCREEN |
#define XDefaultVisual XDEFAULTVISUAL |
#define XSetIconName XSETICONNAME |
#define XtInitialize XTINITIALIZE |
#define XtMainLoop XTMAINLOOP |
#define DtSaverGetWindows DTSAVERGETWINDOWS |
#define XAddHosts XADDHOSTS |
#define XDisableAccessControl XDISABLEACCESSCONTROL |
#define XEnableAccessControl XENABLEACCESSCONTROL |
#define XFillArcs XFILLARCS |
#define XForceScreenSaver XFORCESCREENSAVER |
#define XGetScreenSaver XGETSCREENSAVER |
#define XListHosts XLISTHOSTS |
#define XReadBitmapFile XREADBITMAPFILE |
#define XRemoveHosts XREMOVEHOSTS |
#define XResetScreenSaver XRESETSCREENSAVER |
#define XResourceManagerString XRESOURCEMANAGERSTRING |
#define XSetScreenSaver XSETSCREENSAVER |
#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY |
#define XrmDestroyDatabase XRMDESTROYDATABASE |
#define XrmGetFileDatabase XRMGETFILEDATABASE |
#define XrmGetStringDatabase XRMGETSTRINGDATABASE |
#define XrmInitialize XRMINITIALIZE |
#define XrmMergeDatabases XRMMERGEDATABASES |
#define XrmParseCommand XRMPARSECOMMAND |
#define XrmPutLineResource XRMPUTLINERESOURCE |
#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE |
#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST |
#define XrmStringToQuark XRMSTRINGTOQUARK |
#define XmCreateLabel XMCREATELABEL |
#ifdef __cplusplus |
extern "C" { |
#endif |
extern void XtFree(char*); |
#ifdef __cplusplus |
} |
#endif |
#define pthread_attr_create PTHREAD_ATTR_CREATE |
#define pthread_attr_delete PTHREAD_ATTR_DELETE |
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY |
#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP |
#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP |
#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED |
#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO |
#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED |
#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM |
#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE |
#define pthread_attr_init PTHREAD_ATTR_INIT |
#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP |
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE |
#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP |
#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED |
#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO |
#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED |
#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM |
#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY |
#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE |
#define pthread_cancel PTHREAD_CANCEL |
#define pthread_cancel_e PTHREAD_CANCEL_E |
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST |
#define pthread_cond_destroy PTHREAD_COND_DESTROY |
#define pthread_cond_init PTHREAD_COND_INIT |
#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP |
#define pthread_cond_signal PTHREAD_COND_SIGNAL |
#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP |
#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT |
#define pthread_cond_wait PTHREAD_COND_WAIT |
#define pthread_condattr_create PTHREAD_CONDATTR_CREATE |
#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE |
#define pthread_condattr_init PTHREAD_CONDATTR_INIT |
#define pthread_create PTHREAD_CREATE |
#define pthread_delay_np PTHREAD_DELAY_NP |
#define pthread_detach PTHREAD_DETACH |
#define pthread_equal PTHREAD_EQUAL |
#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP |
#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP |
#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP |
#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP |
#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP |
#define pthread_exit PTHREAD_EXIT |
#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP |
#define pthread_getprio PTHREAD_GETPRIO |
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM |
#define pthread_getscheduler PTHREAD_GETSCHEDULER |
#define pthread_getspecific PTHREAD_GETSPECIFIC |
#define pthread_getunique_np PTHREAD_GETUNIQUE_NP |
#define pthread_join PTHREAD_JOIN |
#define pthread_join32 PTHREAD_JOIN32 |
#define pthread_keycreate PTHREAD_KEYCREATE |
#define pthread_key_create PTHREAD_KEY_CREATE |
#define pthread_kill PTHREAD_KILL |
#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP |
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY |
#define pthread_mutex_init PTHREAD_MUTEX_INIT |
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK |
#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK |
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK |
#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE |
#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE |
#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY |
#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP |
#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT |
#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP |
#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP |
#define pthread_once PTHREAD_ONCE |
#define pthread_resume_np PTHREAD_RESUME_NP |
#define pthread_self PTHREAD_SELF |
#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL |
#define pthread_setcancel PTHREAD_SETCANCEL |
#define pthread_setcancelstate PTHREAD_SETCANCELSTATE |
#define pthread_setprio PTHREAD_SETPRIO |
#define pthread_setschedparam PTHREAD_SETSCHEDPARAM |
#define pthread_setscheduler PTHREAD_SETSCHEDULER |
#define pthread_setspecific PTHREAD_SETSPECIFIC |
#define pthread_suspend_np PTHREAD_SUSPEND_NP |
#define pthread_testcancel PTHREAD_TESTCANCEL |
#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP |
#define pthread_yield PTHREAD_YIELD |
#define pthread_yield_np PTHREAD_YIELD_NP |
#define XDefaultRootWindow XDEFAULTROOTWINDOW |
#define XDisplayCells XDISPLAYCELLS |
#define XMaxRequestSize XMAXREQUESTSIZE |
#define XScreenOfDisplay XSCREENOFDISPLAY |
#define XSetFillRule XSETFILLRULE |
#define XmActivateProtocol XMACTIVATEPROTOCOL |
#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG |
#define XmCreateErrorDialog XMCREATEERRORDIALOG |
#define XmCreateWarningDialog XMCREATEWARNINGDIALOG |
#define XmCvtCTToXmString XMCVTCTTOXMSTRING |
#define XmDestroyPixmap XMDESTROYPIXMAP |
#define XmGetPixmap XMGETPIXMAP |
#define XmInstallImage XMINSTALLIMAGE |
#define XmListAddItems XMLISTADDITEMS |
#define XmListDeleteItem XMLISTDELETEITEM |
#define XmListItemExists XMLISTITEMEXISTS |
#define XmListItemPos XMLISTITEMPOS |
#define XmListReplaceItems XMLISTREPLACEITEMS |
#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS |
#define XmRemoveProtocols XMREMOVEPROTOCOLS |
#define XmRemoveTabGroup XMREMOVETABGROUP |
#define XmSetColorCalculation XMSETCOLORCALCULATION |
#define XmTextCopy XMTEXTCOPY |
#define XmTextCut XMTEXTCUT |
#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION |
#define XmTextFieldCopy XMTEXTFIELDCOPY |
#define XmTextFieldCut XMTEXTFIELDCUT |
#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH |
#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION |
#define XmTextFieldPaste XMTEXTFIELDPASTE |
#define XmTextFieldReplace XMTEXTFIELDREPLACE |
#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE |
#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT |
#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION |
#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH |
#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION |
#define XmTextGetEditable XMTEXTGETEDITABLE |
#define XmTextPaste XMTEXTPASTE |
#define XmTextPosToXY XMTEXTPOSTOXY |
#define XmTextSetEditable XMTEXTSETEDITABLE |
#define XmTextShowPosition XMTEXTSHOWPOSITION |
#define XmUninstallImage XMUNINSTALLIMAGE |
#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP |
#define XrmPutFileDatabase XRMPUTFILEDATABASE |
#define XtAddConverter XTADDCONVERTER |
#define XtError XTERROR |
#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL |
#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY |
#define pthread_key_delete PTHREAD_KEY_DELETE |
#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS |
#define xmScaleWidgetClass XMSCALEWIDGETCLASS |
#define XtDisplay XTDISPLAY |
#define XtScreen XTSCREEN |
#define XAllocIconSize XALLOCICONSIZE |
#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP |
#define XAllowEvents XALLOWEVENTS |
#define XBlackPixel XBLACKPIXEL |
#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE |
#define XDefaultGC XDEFAULTGC |
#define XDisplayHeight XDISPLAYHEIGHT |
#define XDisplayWidth XDISPLAYWIDTH |
#define XGetCommand XGETCOMMAND |
#define XGetIconSizes XGETICONSIZES |
#define XKillClient XKILLCLIENT |
#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS |
#define XRootWindow XROOTWINDOW |
#define XWMGeometry XWMGEOMETRY |
#define XWhitePixel XWHITEPIXEL |
#define XrmCombineDatabase XRMCOMBINEDATABASE |
#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE |
#define XSetStandardProperties XSETSTANDARDPROPERTIES |
#define XSetState XSETSTATE |
#define XDrawRectangles XDRAWRECTANGLES |
#define XGrabButton XGRABBUTTON |
#define XLookupColor XLOOKUPCOLOR |
#define XMapSubwindows XMAPSUBWINDOWS |
#define XRecolorCursor XRECOLORCURSOR |
#define XStoreBytes XSTOREBYTES |
#define XUngrabButton XUNGRABBUTTON |
#define XUninstallColormap XUNINSTALLCOLORMAP |
#define lib$wait LIB$WAIT |
#define lib$find_file LIB$FIND_FILE |
#define lib$find_file_end LIB$FIND_FILE_END |
#define lib$set_symbol LIB$SET_SYMBOL |
#define lib$sfree1_dd LIB$SFREE1_DD |
#define lib$spawn LIB$SPAWN |
#define sys$assign SYS$ASSIGN |
#define sys$crembx SYS$CREMBX |
#define sys$dassgn SYS$DASSGN |
#define sys$dclexh SYS$DCLEXH |
#define sys$getdviw SYS$GETDVIW |
#define sys$getsyiw SYS$GETSYIW |
#define sys$qio SYS$QIO |
#define sys$qiow SYS$QIOW |
#define sys$setef SYS$SETEF |
#define sys$synch SYS$SYNCH |
#define XDrawText XDRAWTEXT |
#define XtCloseDisplay XTCLOSEDISPLAY |
#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT |
#define lib$ediv LIB$EDIV |
#define lib$subx LIB$SUBX |
#define sys$bintim SYS$BINTIM |
#define sys$gettim SYS$GETTIM |
#define XFetchName XFETCHNAME |
#define XPeekIfEvent XPEEKIFEVENT |
#define XQueryKeymap XQUERYKEYMAP |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/gl.h |
---|
0,0 → 1,2669 |
/* $Id: gl.h,v 1.1 2003-02-28 11:41:55 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
#ifndef __gl_h_ |
#define __gl_h_ |
#if defined(USE_MGL_NAMESPACE) |
#include "gl_mangle.h" |
#endif |
/********************************************************************** |
* Begin system-specific stuff. |
*/ |
#if defined(__BEOS__) |
#include <stdlib.h> /* to get some BeOS-isms */ |
#endif |
#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) |
#define OPENSTEP |
#endif |
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) |
#define __WIN32__ |
#endif |
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) |
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ |
# define GLAPI __declspec(dllexport) |
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ |
# define GLAPI __declspec(dllimport) |
# else /* for use with static link lib build of Win32 edition only */ |
# define GLAPI extern |
# endif /* _STATIC_MESA support */ |
# define GLAPIENTRY __stdcall |
#else |
/* non-Windows compilation */ |
# define GLAPI extern |
# define GLAPIENTRY |
#endif /* WIN32 / CYGWIN bracket */ |
#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__) |
# define PRAGMA_EXPORT_SUPPORTED 1 |
#endif |
/* |
* WINDOWS: Include windows.h here to define APIENTRY. |
* It is also useful when applications include this file by |
* including only glut.h, since glut.h depends on windows.h. |
* Applications needing to include windows.h with parms other |
* than "WIN32_LEAN_AND_MEAN" may include windows.h before |
* glut.h or gl.h. |
*/ |
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) |
#define WIN32_LEAN_AND_MEAN 1 |
#include <windows.h> |
#endif |
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) |
#include <gl/mesa_wgl.h> |
#endif |
#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED |
#pragma import on |
#endif |
#ifndef APIENTRY |
#define APIENTRY GLAPIENTRY |
#endif |
#ifdef CENTERLINE_CLPP |
#define signed |
#endif |
#if defined(PRAGMA_EXPORT_SUPPORTED) |
#pragma export on |
#endif |
/* |
* End system-specific stuff. |
**********************************************************************/ |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define getenv(x) 0 |
#define GL_VERSION_1_1 1 |
#define GL_VERSION_1_2 1 |
#define GL_VERSION_1_3 1 |
#define GL_ARB_imaging 1 |
/* |
* Datatypes |
*/ |
typedef unsigned int GLenum; |
typedef unsigned char GLboolean; |
typedef unsigned int GLbitfield; |
typedef void GLvoid; |
typedef signed char GLbyte; /* 1-byte signed */ |
typedef short GLshort; /* 2-byte signed */ |
typedef int GLint; /* 4-byte signed */ |
typedef unsigned char GLubyte; /* 1-byte unsigned */ |
typedef unsigned short GLushort; /* 2-byte unsigned */ |
typedef unsigned int GLuint; /* 4-byte unsigned */ |
typedef int GLsizei; /* 4-byte signed */ |
typedef float GLfloat; /* single precision float */ |
typedef float GLclampf; /* single precision float in [0,1] */ |
typedef double GLdouble; /* double precision float */ |
typedef double GLclampd; /* double precision float in [0,1] */ |
/* |
* Constants |
*/ |
/* Boolean values */ |
#define GL_FALSE 0x0 |
#define GL_TRUE 0x1 |
/* Data types */ |
#define GL_BYTE 0x1400 |
#define GL_UNSIGNED_BYTE 0x1401 |
#define GL_SHORT 0x1402 |
#define GL_UNSIGNED_SHORT 0x1403 |
#define GL_INT 0x1404 |
#define GL_UNSIGNED_INT 0x1405 |
#define GL_FLOAT 0x1406 |
#define GL_DOUBLE 0x140A |
#define GL_2_BYTES 0x1407 |
#define GL_3_BYTES 0x1408 |
#define GL_4_BYTES 0x1409 |
/* Primitives */ |
#define GL_POINTS 0x0000 |
#define GL_LINES 0x0001 |
#define GL_LINE_LOOP 0x0002 |
#define GL_LINE_STRIP 0x0003 |
#define GL_TRIANGLES 0x0004 |
#define GL_TRIANGLE_STRIP 0x0005 |
#define GL_TRIANGLE_FAN 0x0006 |
#define GL_QUADS 0x0007 |
#define GL_QUAD_STRIP 0x0008 |
#define GL_POLYGON 0x0009 |
/* Vertex Arrays */ |
#define GL_VERTEX_ARRAY 0x8074 |
#define GL_NORMAL_ARRAY 0x8075 |
#define GL_COLOR_ARRAY 0x8076 |
#define GL_INDEX_ARRAY 0x8077 |
#define GL_TEXTURE_COORD_ARRAY 0x8078 |
#define GL_EDGE_FLAG_ARRAY 0x8079 |
#define GL_VERTEX_ARRAY_SIZE 0x807A |
#define GL_VERTEX_ARRAY_TYPE 0x807B |
#define GL_VERTEX_ARRAY_STRIDE 0x807C |
#define GL_NORMAL_ARRAY_TYPE 0x807E |
#define GL_NORMAL_ARRAY_STRIDE 0x807F |
#define GL_COLOR_ARRAY_SIZE 0x8081 |
#define GL_COLOR_ARRAY_TYPE 0x8082 |
#define GL_COLOR_ARRAY_STRIDE 0x8083 |
#define GL_INDEX_ARRAY_TYPE 0x8085 |
#define GL_INDEX_ARRAY_STRIDE 0x8086 |
#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 |
#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 |
#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A |
#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C |
#define GL_VERTEX_ARRAY_POINTER 0x808E |
#define GL_NORMAL_ARRAY_POINTER 0x808F |
#define GL_COLOR_ARRAY_POINTER 0x8090 |
#define GL_INDEX_ARRAY_POINTER 0x8091 |
#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 |
#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 |
#define GL_V2F 0x2A20 |
#define GL_V3F 0x2A21 |
#define GL_C4UB_V2F 0x2A22 |
#define GL_C4UB_V3F 0x2A23 |
#define GL_C3F_V3F 0x2A24 |
#define GL_N3F_V3F 0x2A25 |
#define GL_C4F_N3F_V3F 0x2A26 |
#define GL_T2F_V3F 0x2A27 |
#define GL_T4F_V4F 0x2A28 |
#define GL_T2F_C4UB_V3F 0x2A29 |
#define GL_T2F_C3F_V3F 0x2A2A |
#define GL_T2F_N3F_V3F 0x2A2B |
#define GL_T2F_C4F_N3F_V3F 0x2A2C |
#define GL_T4F_C4F_N3F_V4F 0x2A2D |
/* Matrix Mode */ |
#define GL_MATRIX_MODE 0x0BA0 |
#define GL_MODELVIEW 0x1700 |
#define GL_PROJECTION 0x1701 |
#define GL_TEXTURE 0x1702 |
/* Points */ |
#define GL_POINT_SMOOTH 0x0B10 |
#define GL_POINT_SIZE 0x0B11 |
#define GL_POINT_SIZE_GRANULARITY 0x0B13 |
#define GL_POINT_SIZE_RANGE 0x0B12 |
/* Lines */ |
#define GL_LINE_SMOOTH 0x0B20 |
#define GL_LINE_STIPPLE 0x0B24 |
#define GL_LINE_STIPPLE_PATTERN 0x0B25 |
#define GL_LINE_STIPPLE_REPEAT 0x0B26 |
#define GL_LINE_WIDTH 0x0B21 |
#define GL_LINE_WIDTH_GRANULARITY 0x0B23 |
#define GL_LINE_WIDTH_RANGE 0x0B22 |
/* Polygons */ |
#define GL_POINT 0x1B00 |
#define GL_LINE 0x1B01 |
#define GL_FILL 0x1B02 |
#define GL_CW 0x0900 |
#define GL_CCW 0x0901 |
#define GL_FRONT 0x0404 |
#define GL_BACK 0x0405 |
#define GL_POLYGON_MODE 0x0B40 |
#define GL_POLYGON_SMOOTH 0x0B41 |
#define GL_POLYGON_STIPPLE 0x0B42 |
#define GL_EDGE_FLAG 0x0B43 |
#define GL_CULL_FACE 0x0B44 |
#define GL_CULL_FACE_MODE 0x0B45 |
#define GL_FRONT_FACE 0x0B46 |
#define GL_POLYGON_OFFSET_FACTOR 0x8038 |
#define GL_POLYGON_OFFSET_UNITS 0x2A00 |
#define GL_POLYGON_OFFSET_POINT 0x2A01 |
#define GL_POLYGON_OFFSET_LINE 0x2A02 |
#define GL_POLYGON_OFFSET_FILL 0x8037 |
/* Display Lists */ |
#define GL_COMPILE 0x1300 |
#define GL_COMPILE_AND_EXECUTE 0x1301 |
#define GL_LIST_BASE 0x0B32 |
#define GL_LIST_INDEX 0x0B33 |
#define GL_LIST_MODE 0x0B30 |
/* Depth buffer */ |
#define GL_NEVER 0x0200 |
#define GL_LESS 0x0201 |
#define GL_EQUAL 0x0202 |
#define GL_LEQUAL 0x0203 |
#define GL_GREATER 0x0204 |
#define GL_NOTEQUAL 0x0205 |
#define GL_GEQUAL 0x0206 |
#define GL_ALWAYS 0x0207 |
#define GL_DEPTH_TEST 0x0B71 |
#define GL_DEPTH_BITS 0x0D56 |
#define GL_DEPTH_CLEAR_VALUE 0x0B73 |
#define GL_DEPTH_FUNC 0x0B74 |
#define GL_DEPTH_RANGE 0x0B70 |
#define GL_DEPTH_WRITEMASK 0x0B72 |
#define GL_DEPTH_COMPONENT 0x1902 |
/* Lighting */ |
#define GL_LIGHTING 0x0B50 |
#define GL_LIGHT0 0x4000 |
#define GL_LIGHT1 0x4001 |
#define GL_LIGHT2 0x4002 |
#define GL_LIGHT3 0x4003 |
#define GL_LIGHT4 0x4004 |
#define GL_LIGHT5 0x4005 |
#define GL_LIGHT6 0x4006 |
#define GL_LIGHT7 0x4007 |
#define GL_SPOT_EXPONENT 0x1205 |
#define GL_SPOT_CUTOFF 0x1206 |
#define GL_CONSTANT_ATTENUATION 0x1207 |
#define GL_LINEAR_ATTENUATION 0x1208 |
#define GL_QUADRATIC_ATTENUATION 0x1209 |
#define GL_AMBIENT 0x1200 |
#define GL_DIFFUSE 0x1201 |
#define GL_SPECULAR 0x1202 |
#define GL_SHININESS 0x1601 |
#define GL_EMISSION 0x1600 |
#define GL_POSITION 0x1203 |
#define GL_SPOT_DIRECTION 0x1204 |
#define GL_AMBIENT_AND_DIFFUSE 0x1602 |
#define GL_COLOR_INDEXES 0x1603 |
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 |
#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 |
#define GL_LIGHT_MODEL_AMBIENT 0x0B53 |
#define GL_FRONT_AND_BACK 0x0408 |
#define GL_SHADE_MODEL 0x0B54 |
#define GL_FLAT 0x1D00 |
#define GL_SMOOTH 0x1D01 |
#define GL_COLOR_MATERIAL 0x0B57 |
#define GL_COLOR_MATERIAL_FACE 0x0B55 |
#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 |
#define GL_NORMALIZE 0x0BA1 |
/* User clipping planes */ |
#define GL_CLIP_PLANE0 0x3000 |
#define GL_CLIP_PLANE1 0x3001 |
#define GL_CLIP_PLANE2 0x3002 |
#define GL_CLIP_PLANE3 0x3003 |
#define GL_CLIP_PLANE4 0x3004 |
#define GL_CLIP_PLANE5 0x3005 |
/* Accumulation buffer */ |
#define GL_ACCUM_RED_BITS 0x0D58 |
#define GL_ACCUM_GREEN_BITS 0x0D59 |
#define GL_ACCUM_BLUE_BITS 0x0D5A |
#define GL_ACCUM_ALPHA_BITS 0x0D5B |
#define GL_ACCUM_CLEAR_VALUE 0x0B80 |
#define GL_ACCUM 0x0100 |
#define GL_ADD 0x0104 |
#define GL_LOAD 0x0101 |
#define GL_MULT 0x0103 |
#define GL_RETURN 0x0102 |
/* Alpha testing */ |
#define GL_ALPHA_TEST 0x0BC0 |
#define GL_ALPHA_TEST_REF 0x0BC2 |
#define GL_ALPHA_TEST_FUNC 0x0BC1 |
/* Blending */ |
#define GL_BLEND 0x0BE2 |
#define GL_BLEND_SRC 0x0BE1 |
#define GL_BLEND_DST 0x0BE0 |
#define GL_ZERO 0x0 |
#define GL_ONE 0x1 |
#define GL_SRC_COLOR 0x0300 |
#define GL_ONE_MINUS_SRC_COLOR 0x0301 |
#define GL_SRC_ALPHA 0x0302 |
#define GL_ONE_MINUS_SRC_ALPHA 0x0303 |
#define GL_DST_ALPHA 0x0304 |
#define GL_ONE_MINUS_DST_ALPHA 0x0305 |
#define GL_DST_COLOR 0x0306 |
#define GL_ONE_MINUS_DST_COLOR 0x0307 |
#define GL_SRC_ALPHA_SATURATE 0x0308 |
/* Render Mode */ |
#define GL_FEEDBACK 0x1C01 |
#define GL_RENDER 0x1C00 |
#define GL_SELECT 0x1C02 |
/* Feedback */ |
#define GL_2D 0x0600 |
#define GL_3D 0x0601 |
#define GL_3D_COLOR 0x0602 |
#define GL_3D_COLOR_TEXTURE 0x0603 |
#define GL_4D_COLOR_TEXTURE 0x0604 |
#define GL_POINT_TOKEN 0x0701 |
#define GL_LINE_TOKEN 0x0702 |
#define GL_LINE_RESET_TOKEN 0x0707 |
#define GL_POLYGON_TOKEN 0x0703 |
#define GL_BITMAP_TOKEN 0x0704 |
#define GL_DRAW_PIXEL_TOKEN 0x0705 |
#define GL_COPY_PIXEL_TOKEN 0x0706 |
#define GL_PASS_THROUGH_TOKEN 0x0700 |
#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 |
#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 |
#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 |
/* Selection */ |
#define GL_SELECTION_BUFFER_POINTER 0x0DF3 |
#define GL_SELECTION_BUFFER_SIZE 0x0DF4 |
/* Fog */ |
#define GL_FOG 0x0B60 |
#define GL_FOG_MODE 0x0B65 |
#define GL_FOG_DENSITY 0x0B62 |
#define GL_FOG_COLOR 0x0B66 |
#define GL_FOG_INDEX 0x0B61 |
#define GL_FOG_START 0x0B63 |
#define GL_FOG_END 0x0B64 |
#define GL_LINEAR 0x2601 |
#define GL_EXP 0x0800 |
#define GL_EXP2 0x0801 |
/* Logic Ops */ |
#define GL_LOGIC_OP 0x0BF1 |
#define GL_INDEX_LOGIC_OP 0x0BF1 |
#define GL_COLOR_LOGIC_OP 0x0BF2 |
#define GL_LOGIC_OP_MODE 0x0BF0 |
#define GL_CLEAR 0x1500 |
#define GL_SET 0x150F |
#define GL_COPY 0x1503 |
#define GL_COPY_INVERTED 0x150C |
#define GL_NOOP 0x1505 |
#define GL_INVERT 0x150A |
#define GL_AND 0x1501 |
#define GL_NAND 0x150E |
#define GL_OR 0x1507 |
#define GL_NOR 0x1508 |
#define GL_XOR 0x1506 |
#define GL_EQUIV 0x1509 |
#define GL_AND_REVERSE 0x1502 |
#define GL_AND_INVERTED 0x1504 |
#define GL_OR_REVERSE 0x150B |
#define GL_OR_INVERTED 0x150D |
/* Stencil */ |
#define GL_STENCIL_TEST 0x0B90 |
#define GL_STENCIL_WRITEMASK 0x0B98 |
#define GL_STENCIL_BITS 0x0D57 |
#define GL_STENCIL_FUNC 0x0B92 |
#define GL_STENCIL_VALUE_MASK 0x0B93 |
#define GL_STENCIL_REF 0x0B97 |
#define GL_STENCIL_FAIL 0x0B94 |
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 |
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 |
#define GL_STENCIL_CLEAR_VALUE 0x0B91 |
#define GL_STENCIL_INDEX 0x1901 |
#define GL_KEEP 0x1E00 |
#define GL_REPLACE 0x1E01 |
#define GL_INCR 0x1E02 |
#define GL_DECR 0x1E03 |
/* Buffers, Pixel Drawing/Reading */ |
#define GL_NONE 0x0 |
#define GL_LEFT 0x0406 |
#define GL_RIGHT 0x0407 |
/*GL_FRONT 0x0404 */ |
/*GL_BACK 0x0405 */ |
/*GL_FRONT_AND_BACK 0x0408 */ |
#define GL_FRONT_LEFT 0x0400 |
#define GL_FRONT_RIGHT 0x0401 |
#define GL_BACK_LEFT 0x0402 |
#define GL_BACK_RIGHT 0x0403 |
#define GL_AUX0 0x0409 |
#define GL_AUX1 0x040A |
#define GL_AUX2 0x040B |
#define GL_AUX3 0x040C |
#define GL_COLOR_INDEX 0x1900 |
#define GL_RED 0x1903 |
#define GL_GREEN 0x1904 |
#define GL_BLUE 0x1905 |
#define GL_ALPHA 0x1906 |
#define GL_LUMINANCE 0x1909 |
#define GL_LUMINANCE_ALPHA 0x190A |
#define GL_ALPHA_BITS 0x0D55 |
#define GL_RED_BITS 0x0D52 |
#define GL_GREEN_BITS 0x0D53 |
#define GL_BLUE_BITS 0x0D54 |
#define GL_INDEX_BITS 0x0D51 |
#define GL_SUBPIXEL_BITS 0x0D50 |
#define GL_AUX_BUFFERS 0x0C00 |
#define GL_READ_BUFFER 0x0C02 |
#define GL_DRAW_BUFFER 0x0C01 |
#define GL_DOUBLEBUFFER 0x0C32 |
#define GL_STEREO 0x0C33 |
#define GL_BITMAP 0x1A00 |
#define GL_COLOR 0x1800 |
#define GL_DEPTH 0x1801 |
#define GL_STENCIL 0x1802 |
#define GL_DITHER 0x0BD0 |
#define GL_RGB 0x1907 |
#define GL_RGBA 0x1908 |
/* Implementation limits */ |
#define GL_MAX_LIST_NESTING 0x0B31 |
#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 |
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 |
#define GL_MAX_NAME_STACK_DEPTH 0x0D37 |
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 |
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 |
#define GL_MAX_EVAL_ORDER 0x0D30 |
#define GL_MAX_LIGHTS 0x0D31 |
#define GL_MAX_CLIP_PLANES 0x0D32 |
#define GL_MAX_TEXTURE_SIZE 0x0D33 |
#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 |
#define GL_MAX_VIEWPORT_DIMS 0x0D3A |
#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B |
/* Gets */ |
#define GL_ATTRIB_STACK_DEPTH 0x0BB0 |
#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 |
#define GL_COLOR_CLEAR_VALUE 0x0C22 |
#define GL_COLOR_WRITEMASK 0x0C23 |
#define GL_CURRENT_INDEX 0x0B01 |
#define GL_CURRENT_COLOR 0x0B00 |
#define GL_CURRENT_NORMAL 0x0B02 |
#define GL_CURRENT_RASTER_COLOR 0x0B04 |
#define GL_CURRENT_RASTER_DISTANCE 0x0B09 |
#define GL_CURRENT_RASTER_INDEX 0x0B05 |
#define GL_CURRENT_RASTER_POSITION 0x0B07 |
#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 |
#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 |
#define GL_CURRENT_TEXTURE_COORDS 0x0B03 |
#define GL_INDEX_CLEAR_VALUE 0x0C20 |
#define GL_INDEX_MODE 0x0C30 |
#define GL_INDEX_WRITEMASK 0x0C21 |
#define GL_MODELVIEW_MATRIX 0x0BA6 |
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 |
#define GL_NAME_STACK_DEPTH 0x0D70 |
#define GL_PROJECTION_MATRIX 0x0BA7 |
#define GL_PROJECTION_STACK_DEPTH 0x0BA4 |
#define GL_RENDER_MODE 0x0C40 |
#define GL_RGBA_MODE 0x0C31 |
#define GL_TEXTURE_MATRIX 0x0BA8 |
#define GL_TEXTURE_STACK_DEPTH 0x0BA5 |
#define GL_VIEWPORT 0x0BA2 |
/* Evaluators */ |
#define GL_AUTO_NORMAL 0x0D80 |
#define GL_MAP1_COLOR_4 0x0D90 |
#define GL_MAP1_INDEX 0x0D91 |
#define GL_MAP1_NORMAL 0x0D92 |
#define GL_MAP1_TEXTURE_COORD_1 0x0D93 |
#define GL_MAP1_TEXTURE_COORD_2 0x0D94 |
#define GL_MAP1_TEXTURE_COORD_3 0x0D95 |
#define GL_MAP1_TEXTURE_COORD_4 0x0D96 |
#define GL_MAP1_VERTEX_3 0x0D97 |
#define GL_MAP1_VERTEX_4 0x0D98 |
#define GL_MAP2_COLOR_4 0x0DB0 |
#define GL_MAP2_INDEX 0x0DB1 |
#define GL_MAP2_NORMAL 0x0DB2 |
#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 |
#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 |
#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 |
#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 |
#define GL_MAP2_VERTEX_3 0x0DB7 |
#define GL_MAP2_VERTEX_4 0x0DB8 |
#define GL_MAP1_GRID_DOMAIN 0x0DD0 |
#define GL_MAP1_GRID_SEGMENTS 0x0DD1 |
#define GL_MAP2_GRID_DOMAIN 0x0DD2 |
#define GL_MAP2_GRID_SEGMENTS 0x0DD3 |
#define GL_COEFF 0x0A00 |
#define GL_DOMAIN 0x0A02 |
#define GL_ORDER 0x0A01 |
/* Hints */ |
#define GL_FOG_HINT 0x0C54 |
#define GL_LINE_SMOOTH_HINT 0x0C52 |
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 |
#define GL_POINT_SMOOTH_HINT 0x0C51 |
#define GL_POLYGON_SMOOTH_HINT 0x0C53 |
#define GL_DONT_CARE 0x1100 |
#define GL_FASTEST 0x1101 |
#define GL_NICEST 0x1102 |
/* Scissor box */ |
#define GL_SCISSOR_TEST 0x0C11 |
#define GL_SCISSOR_BOX 0x0C10 |
/* Pixel Mode / Transfer */ |
#define GL_MAP_COLOR 0x0D10 |
#define GL_MAP_STENCIL 0x0D11 |
#define GL_INDEX_SHIFT 0x0D12 |
#define GL_INDEX_OFFSET 0x0D13 |
#define GL_RED_SCALE 0x0D14 |
#define GL_RED_BIAS 0x0D15 |
#define GL_GREEN_SCALE 0x0D18 |
#define GL_GREEN_BIAS 0x0D19 |
#define GL_BLUE_SCALE 0x0D1A |
#define GL_BLUE_BIAS 0x0D1B |
#define GL_ALPHA_SCALE 0x0D1C |
#define GL_ALPHA_BIAS 0x0D1D |
#define GL_DEPTH_SCALE 0x0D1E |
#define GL_DEPTH_BIAS 0x0D1F |
#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 |
#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 |
#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 |
#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 |
#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 |
#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 |
#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 |
#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 |
#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 |
#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 |
#define GL_PIXEL_MAP_S_TO_S 0x0C71 |
#define GL_PIXEL_MAP_I_TO_I 0x0C70 |
#define GL_PIXEL_MAP_I_TO_R 0x0C72 |
#define GL_PIXEL_MAP_I_TO_G 0x0C73 |
#define GL_PIXEL_MAP_I_TO_B 0x0C74 |
#define GL_PIXEL_MAP_I_TO_A 0x0C75 |
#define GL_PIXEL_MAP_R_TO_R 0x0C76 |
#define GL_PIXEL_MAP_G_TO_G 0x0C77 |
#define GL_PIXEL_MAP_B_TO_B 0x0C78 |
#define GL_PIXEL_MAP_A_TO_A 0x0C79 |
#define GL_PACK_ALIGNMENT 0x0D05 |
#define GL_PACK_LSB_FIRST 0x0D01 |
#define GL_PACK_ROW_LENGTH 0x0D02 |
#define GL_PACK_SKIP_PIXELS 0x0D04 |
#define GL_PACK_SKIP_ROWS 0x0D03 |
#define GL_PACK_SWAP_BYTES 0x0D00 |
#define GL_UNPACK_ALIGNMENT 0x0CF5 |
#define GL_UNPACK_LSB_FIRST 0x0CF1 |
#define GL_UNPACK_ROW_LENGTH 0x0CF2 |
#define GL_UNPACK_SKIP_PIXELS 0x0CF4 |
#define GL_UNPACK_SKIP_ROWS 0x0CF3 |
#define GL_UNPACK_SWAP_BYTES 0x0CF0 |
#define GL_ZOOM_X 0x0D16 |
#define GL_ZOOM_Y 0x0D17 |
/* Texture mapping */ |
#define GL_TEXTURE_ENV 0x2300 |
#define GL_TEXTURE_ENV_MODE 0x2200 |
#define GL_TEXTURE_1D 0x0DE0 |
#define GL_TEXTURE_2D 0x0DE1 |
#define GL_TEXTURE_WRAP_S 0x2802 |
#define GL_TEXTURE_WRAP_T 0x2803 |
#define GL_TEXTURE_MAG_FILTER 0x2800 |
#define GL_TEXTURE_MIN_FILTER 0x2801 |
#define GL_TEXTURE_ENV_COLOR 0x2201 |
#define GL_TEXTURE_GEN_S 0x0C60 |
#define GL_TEXTURE_GEN_T 0x0C61 |
#define GL_TEXTURE_GEN_MODE 0x2500 |
#define GL_TEXTURE_BORDER_COLOR 0x1004 |
#define GL_TEXTURE_WIDTH 0x1000 |
#define GL_TEXTURE_HEIGHT 0x1001 |
#define GL_TEXTURE_BORDER 0x1005 |
#define GL_TEXTURE_COMPONENTS 0x1003 |
#define GL_TEXTURE_RED_SIZE 0x805C |
#define GL_TEXTURE_GREEN_SIZE 0x805D |
#define GL_TEXTURE_BLUE_SIZE 0x805E |
#define GL_TEXTURE_ALPHA_SIZE 0x805F |
#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 |
#define GL_TEXTURE_INTENSITY_SIZE 0x8061 |
#define GL_NEAREST_MIPMAP_NEAREST 0x2700 |
#define GL_NEAREST_MIPMAP_LINEAR 0x2702 |
#define GL_LINEAR_MIPMAP_NEAREST 0x2701 |
#define GL_LINEAR_MIPMAP_LINEAR 0x2703 |
#define GL_OBJECT_LINEAR 0x2401 |
#define GL_OBJECT_PLANE 0x2501 |
#define GL_EYE_LINEAR 0x2400 |
#define GL_EYE_PLANE 0x2502 |
#define GL_SPHERE_MAP 0x2402 |
#define GL_DECAL 0x2101 |
#define GL_MODULATE 0x2100 |
#define GL_NEAREST 0x2600 |
#define GL_REPEAT 0x2901 |
#define GL_CLAMP 0x2900 |
#define GL_S 0x2000 |
#define GL_T 0x2001 |
#define GL_R 0x2002 |
#define GL_Q 0x2003 |
#define GL_TEXTURE_GEN_R 0x0C62 |
#define GL_TEXTURE_GEN_Q 0x0C63 |
/* Utility */ |
#define GL_VENDOR 0x1F00 |
#define GL_RENDERER 0x1F01 |
#define GL_VERSION 0x1F02 |
#define GL_EXTENSIONS 0x1F03 |
/* Errors */ |
#define GL_NO_ERROR 0x0 |
#define GL_INVALID_VALUE 0x0501 |
#define GL_INVALID_ENUM 0x0500 |
#define GL_INVALID_OPERATION 0x0502 |
#define GL_STACK_OVERFLOW 0x0503 |
#define GL_STACK_UNDERFLOW 0x0504 |
#define GL_OUT_OF_MEMORY 0x0505 |
/* glPush/PopAttrib bits */ |
#define GL_CURRENT_BIT 0x00000001 |
#define GL_POINT_BIT 0x00000002 |
#define GL_LINE_BIT 0x00000004 |
#define GL_POLYGON_BIT 0x00000008 |
#define GL_POLYGON_STIPPLE_BIT 0x00000010 |
#define GL_PIXEL_MODE_BIT 0x00000020 |
#define GL_LIGHTING_BIT 0x00000040 |
#define GL_FOG_BIT 0x00000080 |
#define GL_DEPTH_BUFFER_BIT 0x00000100 |
#define GL_ACCUM_BUFFER_BIT 0x00000200 |
#define GL_STENCIL_BUFFER_BIT 0x00000400 |
#define GL_VIEWPORT_BIT 0x00000800 |
#define GL_TRANSFORM_BIT 0x00001000 |
#define GL_ENABLE_BIT 0x00002000 |
#define GL_COLOR_BUFFER_BIT 0x00004000 |
#define GL_HINT_BIT 0x00008000 |
#define GL_EVAL_BIT 0x00010000 |
#define GL_LIST_BIT 0x00020000 |
#define GL_TEXTURE_BIT 0x00040000 |
#define GL_SCISSOR_BIT 0x00080000 |
#define GL_ALL_ATTRIB_BITS 0x000FFFFF |
/* OpenGL 1.1 */ |
#define GL_PROXY_TEXTURE_1D 0x8063 |
#define GL_PROXY_TEXTURE_2D 0x8064 |
#define GL_TEXTURE_PRIORITY 0x8066 |
#define GL_TEXTURE_RESIDENT 0x8067 |
#define GL_TEXTURE_BINDING_1D 0x8068 |
#define GL_TEXTURE_BINDING_2D 0x8069 |
#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 |
#define GL_ALPHA4 0x803B |
#define GL_ALPHA8 0x803C |
#define GL_ALPHA12 0x803D |
#define GL_ALPHA16 0x803E |
#define GL_LUMINANCE4 0x803F |
#define GL_LUMINANCE8 0x8040 |
#define GL_LUMINANCE12 0x8041 |
#define GL_LUMINANCE16 0x8042 |
#define GL_LUMINANCE4_ALPHA4 0x8043 |
#define GL_LUMINANCE6_ALPHA2 0x8044 |
#define GL_LUMINANCE8_ALPHA8 0x8045 |
#define GL_LUMINANCE12_ALPHA4 0x8046 |
#define GL_LUMINANCE12_ALPHA12 0x8047 |
#define GL_LUMINANCE16_ALPHA16 0x8048 |
#define GL_INTENSITY 0x8049 |
#define GL_INTENSITY4 0x804A |
#define GL_INTENSITY8 0x804B |
#define GL_INTENSITY12 0x804C |
#define GL_INTENSITY16 0x804D |
#define GL_R3_G3_B2 0x2A10 |
#define GL_RGB4 0x804F |
#define GL_RGB5 0x8050 |
#define GL_RGB8 0x8051 |
#define GL_RGB10 0x8052 |
#define GL_RGB12 0x8053 |
#define GL_RGB16 0x8054 |
#define GL_RGBA2 0x8055 |
#define GL_RGBA4 0x8056 |
#define GL_RGB5_A1 0x8057 |
#define GL_RGBA8 0x8058 |
#define GL_RGB10_A2 0x8059 |
#define GL_RGBA12 0x805A |
#define GL_RGBA16 0x805B |
#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 |
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 |
#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF |
#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF |
/* |
* Miscellaneous |
*/ |
GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); |
GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); |
GLAPI void GLAPIENTRY glClear( GLbitfield mask ); |
GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); |
GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); |
GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); |
GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); |
GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); |
GLAPI void GLAPIENTRY glCullFace( GLenum mode ); |
GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); |
GLAPI void GLAPIENTRY glPointSize( GLfloat size ); |
GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); |
GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); |
GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); |
GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); |
GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); |
GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); |
GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); |
GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); |
GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height); |
GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); |
GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); |
GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); |
GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); |
GLAPI void GLAPIENTRY glEnable( GLenum cap ); |
GLAPI void GLAPIENTRY glDisable( GLenum cap ); |
GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); |
GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ |
GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ |
GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); |
GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); |
GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); |
GLAPI void GLAPIENTRY glPopAttrib( void ); |
GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ |
GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ |
GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); |
GLAPI GLenum GLAPIENTRY glGetError( void ); |
GLAPI const GLubyte* GLAPIENTRY glGetString( GLenum name ); |
GLAPI void GLAPIENTRY glFinish( void ); |
GLAPI void GLAPIENTRY glFlush( void ); |
GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); |
/* |
* Depth Buffer |
*/ |
GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); |
GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); |
GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); |
GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); |
/* |
* Accumulation Buffer |
*/ |
GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); |
GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); |
/* |
* Transformation |
*/ |
GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); |
GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble near_val, GLdouble far_val ); |
GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble near_val, GLdouble far_val ); |
GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, |
GLsizei width, GLsizei height ); |
GLAPI void GLAPIENTRY glPushMatrix( void ); |
GLAPI void GLAPIENTRY glPopMatrix( void ); |
GLAPI void GLAPIENTRY glLoadIdentity( void ); |
GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); |
GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); |
GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); |
GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); |
GLAPI void GLAPIENTRY glRotated( GLdouble angle, |
GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glRotatef( GLfloat angle, |
GLfloat x, GLfloat y, GLfloat z ); |
GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); |
GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); |
/* |
* Display Lists |
*/ |
GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); |
GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); |
GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); |
GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); |
GLAPI void GLAPIENTRY glEndList( void ); |
GLAPI void GLAPIENTRY glCallList( GLuint list ); |
GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, |
const GLvoid *lists ); |
GLAPI void GLAPIENTRY glListBase( GLuint base ); |
/* |
* Drawing Functions |
*/ |
GLAPI void GLAPIENTRY glBegin( GLenum mode ); |
GLAPI void GLAPIENTRY glEnd( void ); |
GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); |
GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); |
GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); |
GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); |
GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); |
GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); |
GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); |
GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); |
GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); |
GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); |
GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); |
GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); |
GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); |
GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); |
GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); |
GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); |
GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); |
GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); |
GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); |
GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); |
GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); |
GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glIndexd( GLdouble c ); |
GLAPI void GLAPIENTRY glIndexf( GLfloat c ); |
GLAPI void GLAPIENTRY glIndexi( GLint c ); |
GLAPI void GLAPIENTRY glIndexs( GLshort c ); |
GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ |
GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); |
GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); |
GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); |
GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); |
GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ |
GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); |
GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); |
GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); |
GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); |
GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); |
GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); |
GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); |
GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); |
GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, |
GLbyte blue, GLbyte alpha ); |
GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, |
GLdouble blue, GLdouble alpha ); |
GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, |
GLfloat blue, GLfloat alpha ); |
GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, |
GLint blue, GLint alpha ); |
GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, |
GLshort blue, GLshort alpha ); |
GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, |
GLubyte blue, GLubyte alpha ); |
GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, |
GLuint blue, GLuint alpha ); |
GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, |
GLushort blue, GLushort alpha ); |
GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); |
GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); |
GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); |
GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); |
GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); |
GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); |
GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); |
GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); |
GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); |
GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); |
GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); |
GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); |
GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); |
GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); |
GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); |
GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); |
GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); |
GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); |
GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); |
GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); |
GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); |
GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); |
GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); |
GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); |
GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); |
GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); |
GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); |
GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); |
GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); |
GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); |
GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); |
GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); |
GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); |
GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); |
GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); |
GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); |
GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); |
GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); |
GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); |
GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); |
GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); |
GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); |
GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); |
GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); |
GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); |
GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); |
GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); |
GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); |
GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); |
GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); |
GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); |
GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); |
GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); |
GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); |
GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); |
/* |
* Vertex Arrays (1.1) |
*/ |
GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, |
const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, |
const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, |
GLsizei stride, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ); |
GLAPI void GLAPIENTRY glArrayElement( GLint i ); |
GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); |
GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, |
GLenum type, const GLvoid *indices ); |
GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, |
const GLvoid *pointer ); |
/* |
* Lighting |
*/ |
GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); |
GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, |
const GLfloat *params ); |
GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, |
const GLint *params ); |
GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, |
GLfloat *params ); |
GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, |
GLint *params ); |
GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); |
GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); |
GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); |
/* |
* Raster functions |
*/ |
GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); |
GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLint mapsize, |
const GLfloat *values ); |
GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLint mapsize, |
const GLuint *values ); |
GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLint mapsize, |
const GLushort *values ); |
GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); |
GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); |
GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); |
GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, |
GLfloat xorig, GLfloat yorig, |
GLfloat xmove, GLfloat ymove, |
const GLubyte *bitmap ); |
GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
GLvoid *pixels ); |
GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLenum type ); |
/* |
* Stenciling |
*/ |
GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); |
GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); |
GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); |
GLAPI void GLAPIENTRY glClearStencil( GLint s ); |
/* |
* Texture mapping |
*/ |
GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); |
GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); |
GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); |
GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); |
GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); |
GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, |
const GLfloat *params ); |
GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, |
const GLint *params ); |
GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, |
GLenum pname, GLfloat *params); |
GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, |
GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, |
GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, |
GLenum pname, GLint *params ); |
GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, |
GLint internalFormat, |
GLsizei width, GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, |
GLint internalFormat, |
GLsizei width, GLsizei height, |
GLint border, GLenum format, GLenum type, |
const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, |
GLenum format, GLenum type, |
GLvoid *pixels ); |
/* 1.1 functions */ |
GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); |
GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); |
GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); |
GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, |
const GLuint *textures, |
const GLclampf *priorities ); |
GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, |
const GLuint *textures, |
GLboolean *residences ); |
GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); |
GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, |
GLint xoffset, |
GLsizei width, GLenum format, |
GLenum type, const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLsizei width, GLsizei height, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, |
GLenum internalformat, |
GLint x, GLint y, |
GLsizei width, GLint border ); |
GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, |
GLenum internalformat, |
GLint x, GLint y, |
GLsizei width, GLsizei height, |
GLint border ); |
GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, |
GLint xoffset, GLint x, GLint y, |
GLsizei width ); |
GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint x, GLint y, |
GLsizei width, GLsizei height ); |
/* |
* Evaluators |
*/ |
GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, |
GLint stride, |
GLint order, const GLdouble *points ); |
GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, |
GLint stride, |
GLint order, const GLfloat *points ); |
GLAPI void GLAPIENTRY glMap2d( GLenum target, |
GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, |
GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, |
const GLdouble *points ); |
GLAPI void GLAPIENTRY glMap2f( GLenum target, |
GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, |
GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, |
const GLfloat *points ); |
GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); |
GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); |
GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); |
GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); |
GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); |
GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); |
GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); |
GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); |
GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); |
GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); |
GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); |
GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); |
GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); |
GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, |
GLint vn, GLdouble v1, GLdouble v2 ); |
GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, |
GLint vn, GLfloat v1, GLfloat v2 ); |
GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); |
GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); |
GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); |
GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); |
/* |
* Fog |
*/ |
GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); |
GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); |
/* |
* Selection and Feedback |
*/ |
GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); |
GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); |
GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); |
GLAPI void GLAPIENTRY glInitNames( void ); |
GLAPI void GLAPIENTRY glLoadName( GLuint name ); |
GLAPI void GLAPIENTRY glPushName( GLuint name ); |
GLAPI void GLAPIENTRY glPopName( void ); |
/* |
* OpenGL 1.2 |
*/ |
#define GL_RESCALE_NORMAL 0x803A |
#define GL_CLAMP_TO_EDGE 0x812F |
#define GL_MAX_ELEMENTS_VERTICES 0x80E8 |
#define GL_MAX_ELEMENTS_INDICES 0x80E9 |
#define GL_BGR 0x80E0 |
#define GL_BGRA 0x80E1 |
#define GL_UNSIGNED_BYTE_3_3_2 0x8032 |
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 |
#define GL_UNSIGNED_SHORT_5_6_5 0x8363 |
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 |
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 |
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 |
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 |
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 |
#define GL_UNSIGNED_INT_8_8_8_8 0x8035 |
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 |
#define GL_UNSIGNED_INT_10_10_10_2 0x8036 |
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 |
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 |
#define GL_SINGLE_COLOR 0x81F9 |
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA |
#define GL_TEXTURE_MIN_LOD 0x813A |
#define GL_TEXTURE_MAX_LOD 0x813B |
#define GL_TEXTURE_BASE_LEVEL 0x813C |
#define GL_TEXTURE_MAX_LEVEL 0x813D |
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 |
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 |
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 |
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 |
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D |
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E |
#define GL_PACK_SKIP_IMAGES 0x806B |
#define GL_PACK_IMAGE_HEIGHT 0x806C |
#define GL_UNPACK_SKIP_IMAGES 0x806D |
#define GL_UNPACK_IMAGE_HEIGHT 0x806E |
#define GL_TEXTURE_3D 0x806F |
#define GL_PROXY_TEXTURE_3D 0x8070 |
#define GL_TEXTURE_DEPTH 0x8071 |
#define GL_TEXTURE_WRAP_R 0x8072 |
#define GL_MAX_3D_TEXTURE_SIZE 0x8073 |
#define GL_TEXTURE_BINDING_3D 0x806A |
GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, |
GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); |
GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, |
GLint internalFormat, |
GLsizei width, GLsizei height, |
GLsizei depth, GLint border, |
GLenum format, GLenum type, |
const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint zoffset, GLsizei width, |
GLsizei height, GLsizei depth, |
GLenum format, |
GLenum type, const GLvoid *pixels); |
GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, |
GLint xoffset, GLint yoffset, |
GLint zoffset, GLint x, |
GLint y, GLsizei width, |
GLsizei height ); |
typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); |
typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
/* |
* GL_ARB_imaging |
*/ |
#define GL_CONSTANT_COLOR 0x8001 |
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 |
#define GL_CONSTANT_ALPHA 0x8003 |
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 |
#define GL_COLOR_TABLE 0x80D0 |
#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 |
#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 |
#define GL_PROXY_COLOR_TABLE 0x80D3 |
#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 |
#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 |
#define GL_COLOR_TABLE_SCALE 0x80D6 |
#define GL_COLOR_TABLE_BIAS 0x80D7 |
#define GL_COLOR_TABLE_FORMAT 0x80D8 |
#define GL_COLOR_TABLE_WIDTH 0x80D9 |
#define GL_COLOR_TABLE_RED_SIZE 0x80DA |
#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB |
#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC |
#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD |
#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE |
#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF |
#define GL_CONVOLUTION_1D 0x8010 |
#define GL_CONVOLUTION_2D 0x8011 |
#define GL_SEPARABLE_2D 0x8012 |
#define GL_CONVOLUTION_BORDER_MODE 0x8013 |
#define GL_CONVOLUTION_FILTER_SCALE 0x8014 |
#define GL_CONVOLUTION_FILTER_BIAS 0x8015 |
#define GL_REDUCE 0x8016 |
#define GL_CONVOLUTION_FORMAT 0x8017 |
#define GL_CONVOLUTION_WIDTH 0x8018 |
#define GL_CONVOLUTION_HEIGHT 0x8019 |
#define GL_MAX_CONVOLUTION_WIDTH 0x801A |
#define GL_MAX_CONVOLUTION_HEIGHT 0x801B |
#define GL_POST_CONVOLUTION_RED_SCALE 0x801C |
#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D |
#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E |
#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F |
#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 |
#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 |
#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 |
#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 |
#define GL_CONSTANT_BORDER 0x8151 |
#define GL_REPLICATE_BORDER 0x8153 |
#define GL_CONVOLUTION_BORDER_COLOR 0x8154 |
#define GL_COLOR_MATRIX 0x80B1 |
#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 |
#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 |
#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 |
#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 |
#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 |
#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 |
#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 |
#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 |
#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA |
#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB |
#define GL_HISTOGRAM 0x8024 |
#define GL_PROXY_HISTOGRAM 0x8025 |
#define GL_HISTOGRAM_WIDTH 0x8026 |
#define GL_HISTOGRAM_FORMAT 0x8027 |
#define GL_HISTOGRAM_RED_SIZE 0x8028 |
#define GL_HISTOGRAM_GREEN_SIZE 0x8029 |
#define GL_HISTOGRAM_BLUE_SIZE 0x802A |
#define GL_HISTOGRAM_ALPHA_SIZE 0x802B |
#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C |
#define GL_HISTOGRAM_SINK 0x802D |
#define GL_MINMAX 0x802E |
#define GL_MINMAX_FORMAT 0x802F |
#define GL_MINMAX_SINK 0x8030 |
#define GL_TABLE_TOO_LARGE 0x8031 |
#define GL_BLEND_EQUATION 0x8009 |
#define GL_MIN 0x8007 |
#define GL_MAX 0x8008 |
#define GL_FUNC_ADD 0x8006 |
#define GL_FUNC_SUBTRACT 0x800A |
#define GL_FUNC_REVERSE_SUBTRACT 0x800B |
#define GL_BLEND_COLOR 0x8005 |
GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, |
GLsizei width, GLenum format, |
GLenum type, const GLvoid *table ); |
GLAPI void GLAPIENTRY glColorSubTable( GLenum target, |
GLsizei start, GLsizei count, |
GLenum format, GLenum type, |
const GLvoid *data ); |
GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, |
const GLint *params); |
GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, |
const GLfloat *params); |
GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, |
GLint x, GLint y, GLsizei width ); |
GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, |
GLint x, GLint y, GLsizei width ); |
GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, |
GLenum type, GLvoid *table ); |
GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, |
GLfloat *params ); |
GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, |
GLint *params ); |
GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); |
GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, |
GLclampf blue, GLclampf alpha ); |
GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, |
GLenum internalformat, GLboolean sink ); |
GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); |
GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, |
GLenum format, GLenum type, |
GLvoid *values ); |
GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, |
GLfloat *params ); |
GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, |
GLint *params ); |
GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, |
GLboolean sink ); |
GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); |
GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, |
GLenum format, GLenum types, |
GLvoid *values ); |
GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, |
GLfloat *params ); |
GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, |
GLint *params ); |
GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, |
GLenum internalformat, GLsizei width, GLenum format, GLenum type, |
const GLvoid *image ); |
GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, |
GLenum internalformat, GLsizei width, GLsizei height, GLenum format, |
GLenum type, const GLvoid *image ); |
GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, |
GLfloat params ); |
GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, |
const GLfloat *params ); |
GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, |
GLint params ); |
GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, |
const GLint *params ); |
GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, |
GLenum internalformat, GLint x, GLint y, GLsizei width ); |
GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, |
GLenum internalformat, GLint x, GLint y, GLsizei width, |
GLsizei height); |
GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, |
GLenum type, GLvoid *image ); |
GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, |
GLfloat *params ); |
GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, |
GLint *params ); |
GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, |
GLenum internalformat, GLsizei width, GLsizei height, GLenum format, |
GLenum type, const GLvoid *row, const GLvoid *column ); |
GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, |
GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); |
typedef void (APIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
typedef void (APIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); |
typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); |
typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); |
typedef void (APIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); |
/* |
* OpenGL 1.3 |
*/ |
/* multitexture */ |
#define GL_TEXTURE0 0x84C0 |
#define GL_TEXTURE1 0x84C1 |
#define GL_TEXTURE2 0x84C2 |
#define GL_TEXTURE3 0x84C3 |
#define GL_TEXTURE4 0x84C4 |
#define GL_TEXTURE5 0x84C5 |
#define GL_TEXTURE6 0x84C6 |
#define GL_TEXTURE7 0x84C7 |
#define GL_TEXTURE8 0x84C8 |
#define GL_TEXTURE9 0x84C9 |
#define GL_TEXTURE10 0x84CA |
#define GL_TEXTURE11 0x84CB |
#define GL_TEXTURE12 0x84CC |
#define GL_TEXTURE13 0x84CD |
#define GL_TEXTURE14 0x84CE |
#define GL_TEXTURE15 0x84CF |
#define GL_TEXTURE16 0x84D0 |
#define GL_TEXTURE17 0x84D1 |
#define GL_TEXTURE18 0x84D2 |
#define GL_TEXTURE19 0x84D3 |
#define GL_TEXTURE20 0x84D4 |
#define GL_TEXTURE21 0x84D5 |
#define GL_TEXTURE22 0x84D6 |
#define GL_TEXTURE23 0x84D7 |
#define GL_TEXTURE24 0x84D8 |
#define GL_TEXTURE25 0x84D9 |
#define GL_TEXTURE26 0x84DA |
#define GL_TEXTURE27 0x84DB |
#define GL_TEXTURE28 0x84DC |
#define GL_TEXTURE29 0x84DD |
#define GL_TEXTURE30 0x84DE |
#define GL_TEXTURE31 0x84DF |
#define GL_ACTIVE_TEXTURE 0x84E0 |
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 |
#define GL_MAX_TEXTURE_UNITS 0x84E2 |
/* texture_cube_map */ |
#define GL_NORMAL_MAP 0x8511 |
#define GL_REFLECTION_MAP 0x8512 |
#define GL_TEXTURE_CUBE_MAP 0x8513 |
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A |
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B |
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C |
/* texture_compression */ |
#define GL_COMPRESSED_ALPHA 0x84E9 |
#define GL_COMPRESSED_LUMINANCE 0x84EA |
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB |
#define GL_COMPRESSED_INTENSITY 0x84EC |
#define GL_COMPRESSED_RGB 0x84ED |
#define GL_COMPRESSED_RGBA 0x84EE |
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF |
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 |
#define GL_TEXTURE_COMPRESSED 0x86A1 |
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 |
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 |
/* multisample */ |
#define GL_MULTISAMPLE 0x809D |
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E |
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F |
#define GL_SAMPLE_COVERAGE 0x80A0 |
#define GL_SAMPLE_BUFFERS 0x80A8 |
#define GL_SAMPLES 0x80A9 |
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA |
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB |
#define GL_MULTISAMPLE_BIT 0x20000000 |
/* transpose_matrix */ |
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 |
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 |
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 |
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 |
/* texture_env_combine */ |
#define GL_COMBINE 0x8570 |
#define GL_COMBINE_RGB 0x8571 |
#define GL_COMBINE_ALPHA 0x8572 |
#define GL_SOURCE0_RGB 0x8580 |
#define GL_SOURCE1_RGB 0x8581 |
#define GL_SOURCE2_RGB 0x8582 |
#define GL_SOURCE0_ALPHA 0x8588 |
#define GL_SOURCE1_ALPHA 0x8589 |
#define GL_SOURCE2_ALPHA 0x858A |
#define GL_OPERAND0_RGB 0x8590 |
#define GL_OPERAND1_RGB 0x8591 |
#define GL_OPERAND2_RGB 0x8592 |
#define GL_OPERAND0_ALPHA 0x8598 |
#define GL_OPERAND1_ALPHA 0x8599 |
#define GL_OPERAND2_ALPHA 0x859A |
#define GL_RGB_SCALE 0x8573 |
#define GL_ADD_SIGNED 0x8574 |
#define GL_INTERPOLATE 0x8575 |
#define GL_SUBTRACT 0x84E7 |
#define GL_CONSTANT 0x8576 |
#define GL_PRIMARY_COLOR 0x8577 |
#define GL_PREVIOUS 0x8578 |
/* texture_env_dot3 */ |
#define GL_DOT3_RGB 0x86AE |
#define GL_DOT3_RGBA 0x86AF |
/* texture_border_clamp */ |
#define GL_CLAMP_TO_BORDER 0x812D |
GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); |
GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture ); |
GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); |
GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); |
GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s ); |
GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s ); |
GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s ); |
GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s ); |
GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); |
GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); |
GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t ); |
GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); |
GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); |
GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); |
GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); |
GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); |
GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); |
GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); |
GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); |
GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v ); |
GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); |
GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v ); |
GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] ); |
GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] ); |
GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] ); |
GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); |
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); |
typedef void (APIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); |
typedef void (APIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); |
/* |
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) |
*/ |
#ifndef GL_ARB_multitexture |
#define GL_ARB_multitexture 1 |
#define GL_TEXTURE0_ARB 0x84C0 |
#define GL_TEXTURE1_ARB 0x84C1 |
#define GL_TEXTURE2_ARB 0x84C2 |
#define GL_TEXTURE3_ARB 0x84C3 |
#define GL_TEXTURE4_ARB 0x84C4 |
#define GL_TEXTURE5_ARB 0x84C5 |
#define GL_TEXTURE6_ARB 0x84C6 |
#define GL_TEXTURE7_ARB 0x84C7 |
#define GL_TEXTURE8_ARB 0x84C8 |
#define GL_TEXTURE9_ARB 0x84C9 |
#define GL_TEXTURE10_ARB 0x84CA |
#define GL_TEXTURE11_ARB 0x84CB |
#define GL_TEXTURE12_ARB 0x84CC |
#define GL_TEXTURE13_ARB 0x84CD |
#define GL_TEXTURE14_ARB 0x84CE |
#define GL_TEXTURE15_ARB 0x84CF |
#define GL_TEXTURE16_ARB 0x84D0 |
#define GL_TEXTURE17_ARB 0x84D1 |
#define GL_TEXTURE18_ARB 0x84D2 |
#define GL_TEXTURE19_ARB 0x84D3 |
#define GL_TEXTURE20_ARB 0x84D4 |
#define GL_TEXTURE21_ARB 0x84D5 |
#define GL_TEXTURE22_ARB 0x84D6 |
#define GL_TEXTURE23_ARB 0x84D7 |
#define GL_TEXTURE24_ARB 0x84D8 |
#define GL_TEXTURE25_ARB 0x84D9 |
#define GL_TEXTURE26_ARB 0x84DA |
#define GL_TEXTURE27_ARB 0x84DB |
#define GL_TEXTURE28_ARB 0x84DC |
#define GL_TEXTURE29_ARB 0x84DD |
#define GL_TEXTURE30_ARB 0x84DE |
#define GL_TEXTURE31_ARB 0x84DF |
#define GL_ACTIVE_TEXTURE_ARB 0x84E0 |
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 |
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 |
GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); |
GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); |
GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); |
GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); |
GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); |
GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); |
GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); |
GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); |
GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); |
GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); |
GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); |
GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); |
GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); |
GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); |
GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); |
GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); |
GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); |
GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); |
GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); |
GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); |
GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); |
GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); |
GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); |
GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); |
GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); |
GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); |
GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); |
GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); |
GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); |
GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); |
GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); |
GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); |
GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); |
GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); |
#endif /* GL_ARB_multitexture */ |
/* |
* Define this token if you want "old-style" header file behaviour (extensions |
* defined in gl.h). Otherwise, extensions will be included from glext.h. |
*/ |
#if defined(GL_GLEXT_LEGACY) |
/* |
* 1. GL_EXT_abgr |
*/ |
#ifndef GL_EXT_abgr |
#define GL_EXT_abgr 1 |
#define GL_ABGR_EXT 0x8000 |
#endif /* GL_EXT_abgr */ |
/* |
* 2. GL_EXT_blend_color |
*/ |
#ifndef GL_EXT_blend_color |
#define GL_EXT_blend_color 1 |
#define GL_CONSTANT_COLOR_EXT 0x8001 |
#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 |
#define GL_CONSTANT_ALPHA_EXT 0x8003 |
#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 |
#define GL_BLEND_COLOR_EXT 0x8005 |
GLAPI void GLAPIENTRY glBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); |
#endif /* GL_EXT_blend_color */ |
/* |
* 3. GL_EXT_polygon_offset |
*/ |
#ifndef GL_EXT_polygon_offset |
#define GL_EXT_polygon_offset 1 |
#define GL_POLYGON_OFFSET_EXT 0x8037 |
#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 |
#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 |
GLAPI void GLAPIENTRY glPolygonOffsetEXT( GLfloat factor, GLfloat bias ); |
#endif /* GL_EXT_polygon_offset */ |
/* |
* 6. GL_EXT_texture3D |
*/ |
#ifndef GL_EXT_texture3D |
#define GL_EXT_texture3D 1 |
#define GL_PACK_SKIP_IMAGES_EXT 0x806B |
#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C |
#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D |
#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E |
#define GL_TEXTURE_3D_EXT 0x806F |
#define GL_PROXY_TEXTURE_3D_EXT 0x8070 |
#define GL_TEXTURE_DEPTH_EXT 0x8071 |
#define GL_TEXTURE_WRAP_R_EXT 0x8072 |
#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 |
#define GL_TEXTURE_3D_BINDING_EXT 0x806A |
GLAPI void GLAPIENTRY glTexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); |
GLAPI void GLAPIENTRY glTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); |
GLAPI void GLAPIENTRY glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); |
#endif /* GL_EXT_texture3D */ |
/* |
* 20. GL_EXT_texture_object |
*/ |
#ifndef GL_EXT_texture_object |
#define GL_EXT_texture_object 1 |
#define GL_TEXTURE_PRIORITY_EXT 0x8066 |
#define GL_TEXTURE_RESIDENT_EXT 0x8067 |
#define GL_TEXTURE_1D_BINDING_EXT 0x8068 |
#define GL_TEXTURE_2D_BINDING_EXT 0x8069 |
GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures ); |
GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures); |
GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture ); |
GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ); |
GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ); |
GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); |
#endif /* GL_EXT_texture_object */ |
/* |
* 27. GL_EXT_rescale_normal |
*/ |
#ifndef GL_EXT_rescale_normal |
#define GL_EXT_rescale_normal 1 |
#define GL_RESCALE_NORMAL_EXT 0x803A |
#endif /* GL_EXT_rescale_normal */ |
/* |
* 30. GL_EXT_vertex_array |
*/ |
#ifndef GL_EXT_vertex_array |
#define GL_EXT_vertex_array 1 |
#define GL_VERTEX_ARRAY_EXT 0x8074 |
#define GL_NORMAL_ARRAY_EXT 0x8075 |
#define GL_COLOR_ARRAY_EXT 0x8076 |
#define GL_INDEX_ARRAY_EXT 0x8077 |
#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 |
#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 |
#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A |
#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B |
#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C |
#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D |
#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E |
#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F |
#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 |
#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 |
#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 |
#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 |
#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 |
#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 |
#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 |
#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 |
#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 |
#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 |
#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A |
#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B |
#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C |
#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D |
#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E |
#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F |
#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 |
#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 |
#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 |
#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 |
GLAPI void GLAPIENTRY glVertexPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glNormalPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glColorPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glIndexPointerEXT( GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glTexCoordPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr ); |
GLAPI void GLAPIENTRY glEdgeFlagPointerEXT( GLsizei stride, GLsizei count, const GLboolean *ptr ); |
GLAPI void GLAPIENTRY glGetPointervEXT( GLenum pname, GLvoid **params ); |
GLAPI void GLAPIENTRY glArrayElementEXT( GLint i ); |
GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ); |
#endif /* GL_EXT_vertex_array */ |
/* |
* 35. GL_SGIS_texture_edge_clamp |
*/ |
#ifndef GL_SGIS_texture_edge_clamp |
#define GL_SGIS_texture_edge_clamp 1 |
#define GL_CLAMP_TO_EDGE_SGIS 0x812F |
#endif /* GL_SGIS_texture_edge_clamp */ |
/* |
* 37. GL_EXT_blend_minmax |
*/ |
#ifndef GL_EXT_blend_minmax |
#define GL_EXT_blend_minmax 1 |
#define GL_FUNC_ADD_EXT 0x8006 |
#define GL_MIN_EXT 0x8007 |
#define GL_MAX_EXT 0x8008 |
#define GL_BLEND_EQUATION_EXT 0x8009 |
GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); |
#endif /* GL_EXT_blend_minmax */ |
/* |
* 38. GL_EXT_blend_subtract (requires GL_EXT_blend_max ) |
*/ |
#ifndef GL_EXT_blend_subtract |
#define GL_EXT_blend_subtract 1 |
#define GL_FUNC_SUBTRACT_EXT 0x800A |
#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B |
#endif /* GL_EXT_blend_subtract */ |
/* |
* 39. GL_EXT_blend_logic_op |
*/ |
#ifndef GL_EXT_blend_logic_op |
#define GL_EXT_blend_logic_op 1 |
/* No new tokens or functions */ |
#endif /* GL_EXT_blend_logic_op */ |
/* |
* 54. GL_EXT_point_parameters |
*/ |
#ifndef GL_EXT_point_parameters |
#define GL_EXT_point_parameters 1 |
#define GL_POINT_SIZE_MIN_EXT 0x8126 |
#define GL_POINT_SIZE_MAX_EXT 0x8127 |
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 |
#define GL_DISTANCE_ATTENUATION_EXT 0x8129 |
GLAPI void GLAPIENTRY glPointParameterfEXT( GLenum pname, GLfloat param ); |
GLAPI void GLAPIENTRY glPointParameterfvEXT( GLenum pname, const GLfloat *params ); |
GLAPI void GLAPIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); |
GLAPI void GLAPIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); |
#endif /* GL_EXT_point_parameters */ |
/* |
* 78. GL_EXT_paletted_texture |
*/ |
#ifndef GL_EXT_paletted_texture |
#define GL_EXT_paletted_texture 1 |
#define GL_TABLE_TOO_LARGE_EXT 0x8031 |
#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 |
#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 |
#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA |
#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB |
#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC |
#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD |
#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE |
#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF |
#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED |
#define GL_COLOR_INDEX1_EXT 0x80E2 |
#define GL_COLOR_INDEX2_EXT 0x80E3 |
#define GL_COLOR_INDEX4_EXT 0x80E4 |
#define GL_COLOR_INDEX8_EXT 0x80E5 |
#define GL_COLOR_INDEX12_EXT 0x80E6 |
#define GL_COLOR_INDEX16_EXT 0x80E7 |
GLAPI void GLAPIENTRY glColorTableEXT( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); |
GLAPI void GLAPIENTRY glColorSubTableEXT( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ); |
GLAPI void GLAPIENTRY glGetColorTableEXT( GLenum target, GLenum format, GLenum type, GLvoid *table ); |
GLAPI void GLAPIENTRY glGetColorTableParameterfvEXT( GLenum target, GLenum pname, GLfloat *params ); |
GLAPI void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname, GLint *params ); |
#endif /* GL_EXT_paletted_texture */ |
/* |
* 79. GL_EXT_clip_volume_hint |
*/ |
#ifndef GL_EXT_clip_volume_hint |
#define GL_EXT_clip_volume_hint 1 |
#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 |
#endif /* GL_EXT_clip_volume_hint */ |
/* |
* 97. GL_EXT_compiled_vertex_array |
*/ |
#ifndef GL_EXT_compiled_vertex_array |
#define GL_EXT_compiled_vertex_array 1 |
#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 |
#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 |
GLAPI void GLAPIENTRY glLockArraysEXT( GLint first, GLsizei count ); |
GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); |
#endif /* GL_EXT_compiled_vertex_array */ |
/* |
* 137. GL_HP_occlusion_test |
*/ |
#ifndef GL_HP_occlusion_test |
#define GL_HP_occlusion_test 1 |
#define GL_OCCLUSION_TEST_HP 0x8165 |
#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 |
#endif /* GL_HP_occlusion_test */ |
/* |
* 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) |
*/ |
#ifndef GL_EXT_shared_texture_palette |
#define GL_EXT_shared_texture_palette 1 |
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB |
#endif /* GL_EXT_shared_texture_palette */ |
/* |
* 176. GL_EXT_stencil_wrap |
*/ |
#ifndef GL_EXT_stencil_wrap |
#define GL_EXT_stencil_wrap 1 |
#define GL_INCR_WRAP_EXT 0x8507 |
#define GL_DECR_WRAP_EXT 0x8508 |
#endif /* GL_EXT_stencil_wrap */ |
/* |
* 179. GL_NV_texgen_reflection |
*/ |
#ifndef GL_NV_texgen_reflection |
#define GL_NV_texgen_reflection 1 |
#define GL_NORMAL_MAP_NV 0x8511 |
#define GL_REFLECTION_MAP_NV 0x8512 |
#endif /* GL_NV_texgen_reflection */ |
/* |
* 185. GL_EXT_texture_env_add |
*/ |
#ifndef GL_EXT_texture_env_add |
#define GL_EXT_texture_env_add 1 |
/* No new tokens or functions */ |
#endif /* GL_EXT_texture_env_add */ |
/* |
* 197. GL_MESA_window_pos |
*/ |
#ifndef GL_MESA_window_pos |
#define GL_MESA_window_pos 1 |
GLAPI void GLAPIENTRY glWindowPos2iMESA( GLint x, GLint y ); |
GLAPI void GLAPIENTRY glWindowPos2sMESA( GLshort x, GLshort y ); |
GLAPI void GLAPIENTRY glWindowPos2fMESA( GLfloat x, GLfloat y ); |
GLAPI void GLAPIENTRY glWindowPos2dMESA( GLdouble x, GLdouble y ); |
GLAPI void GLAPIENTRY glWindowPos2ivMESA( const GLint *p ); |
GLAPI void GLAPIENTRY glWindowPos2svMESA( const GLshort *p ); |
GLAPI void GLAPIENTRY glWindowPos2fvMESA( const GLfloat *p ); |
GLAPI void GLAPIENTRY glWindowPos2dvMESA( const GLdouble *p ); |
GLAPI void GLAPIENTRY glWindowPos3iMESA( GLint x, GLint y, GLint z ); |
GLAPI void GLAPIENTRY glWindowPos3sMESA( GLshort x, GLshort y, GLshort z ); |
GLAPI void GLAPIENTRY glWindowPos3fMESA( GLfloat x, GLfloat y, GLfloat z ); |
GLAPI void GLAPIENTRY glWindowPos3dMESA( GLdouble x, GLdouble y, GLdouble z ); |
GLAPI void GLAPIENTRY glWindowPos3ivMESA( const GLint *p ); |
GLAPI void GLAPIENTRY glWindowPos3svMESA( const GLshort *p ); |
GLAPI void GLAPIENTRY glWindowPos3fvMESA( const GLfloat *p ); |
GLAPI void GLAPIENTRY glWindowPos3dvMESA( const GLdouble *p ); |
GLAPI void GLAPIENTRY glWindowPos4iMESA( GLint x, GLint y, GLint z, GLint w ); |
GLAPI void GLAPIENTRY glWindowPos4sMESA( GLshort x, GLshort y, GLshort z, GLshort w ); |
GLAPI void GLAPIENTRY glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); |
GLAPI void GLAPIENTRY glWindowPos4dMESA( GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
GLAPI void GLAPIENTRY glWindowPos4ivMESA( const GLint *p ); |
GLAPI void GLAPIENTRY glWindowPos4svMESA( const GLshort *p ); |
GLAPI void GLAPIENTRY glWindowPos4fvMESA( const GLfloat *p ); |
GLAPI void GLAPIENTRY glWindowPos4dvMESA( const GLdouble *p ); |
#endif /* GL_MESA_window_pos */ |
/* |
* 196. GL_MESA_resize_bufffers |
*/ |
#ifndef GL_MESA_resize_bufffers |
#define GL_MESA_resize_buffers 1 |
GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); |
#endif /* GL_MESA_resize_bufffers */ |
/* |
* 220. GL_EXT_texture_env_dot3 |
*/ |
#ifndef GL_EXT_texture_env_dot3 |
#define GL_EXT_texture_env_dot3 1 |
#define GL_DOT3_RGB_EXT 0x8740 |
#define GL_DOT3_RGBA_EXT 0x8741 |
#endif /* GL_EXT_texture_env_dot3 */ |
#else /* GL_GLEXT_LEGACY */ |
#include <GL/glext.h> |
#endif /* GL_GLEXT_LEGACY */ |
/* |
* ???. GL_MESA_trace |
* XXX obsolete |
*/ |
#ifndef GL_MESA_trace |
#define GL_MESA_trace 1 |
#define GL_TRACE_ALL_BITS_MESA 0xFFFF |
#define GL_TRACE_OPERATIONS_BIT_MESA 0x0001 |
#define GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 |
#define GL_TRACE_ARRAYS_BIT_MESA 0x0004 |
#define GL_TRACE_TEXTURES_BIT_MESA 0x0008 |
#define GL_TRACE_PIXELS_BIT_MESA 0x0010 |
#define GL_TRACE_ERRORS_BIT_MESA 0x0020 |
#define GL_TRACE_MASK_MESA 0x8755 |
#define GL_TRACE_NAME_MESA 0x8756 |
GLAPI void GLAPIENTRY glEnableTraceMESA( GLbitfield mask ); |
GLAPI void GLAPIENTRY glDisableTraceMESA( GLbitfield mask ); |
GLAPI void GLAPIENTRY glNewTraceMESA( GLbitfield mask, const GLubyte * traceName ); |
GLAPI void GLAPIENTRY glEndTraceMESA( void ); |
GLAPI void GLAPIENTRY glTraceAssertAttribMESA( GLbitfield attribMask ); |
GLAPI void GLAPIENTRY glTraceCommentMESA( const GLubyte * comment ); |
GLAPI void GLAPIENTRY glTraceTextureMESA( GLuint name, const GLubyte* comment ); |
GLAPI void GLAPIENTRY glTraceListMESA( GLuint name, const GLubyte* comment ); |
GLAPI void GLAPIENTRY glTracePointerMESA( GLvoid* pointer, const GLubyte* comment ); |
GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid* last, const GLubyte* comment ); |
#endif /* GL_MESA_trace */ |
/* |
* ???. GL_MESA_packed_depth_stencil |
* XXX obsolete |
*/ |
#ifndef GL_MESA_packed_depth_stencil |
#define GL_MESA_packed_depth_stencil 1 |
#define GL_DEPTH_STENCIL_MESA 0x8750 |
#define GL_UNSIGNED_INT_24_8_MESA 0x8751 |
#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 |
#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 |
#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 |
#endif /* GL_MESA_packed_depth_stencil */ |
#ifndef GL_MESA_ycbcr_texture |
#define GL_MESA_ycbcr_texture 1 |
#define GL_YCBCR_MESA 0x8757 |
#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple */ |
#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple */ |
#endif /* GL_MESA_texture_ycbcr */ |
#ifndef GL_MESA_pack_invert |
#define GL_MESA_pack_invert 1 |
#define GL_PACK_INVERT_MESA 0x8758 |
#endif /* GL_MESA_pack_invert */ |
#ifndef GL_APPLE_client_storage |
#define GL_APPLE_client_storage 1 |
#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 |
#endif /* GL_APPLE_client_storage */ |
#ifndef GL_APPLE_ycbcr_422 |
#define GL_APPLE_ycbcr_422 1 |
#define GL_YCBCR_422_APPLE 0x85B9 |
#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA |
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB |
#endif /* GL_APPLE_ycbcr_422 */ |
/********************************************************************** |
* Begin system-specific stuff |
*/ |
#if defined(PRAGMA_EXPORT_SUPPORTED) |
#pragma export off |
#endif |
#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED |
#pragma import off |
#endif |
/* |
* End system-specific stuff |
**********************************************************************/ |
#ifdef __cplusplus |
} |
#endif |
#endif /* __gl_h_ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/xmesa_x.h |
---|
0,0 → 1,91 |
/************************************************************************** |
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the |
"Software"), to deal in the Software without restriction, including |
without limitation the rights to use, copy, modify, merge, publish, |
distribute, sub license, and/or sell copies of the Software, and to |
permit persons to whom the Software is furnished to do so, subject to |
the following conditions: |
The above copyright notice and this permission notice (including the |
next paragraph) shall be included in all copies or substantial portions |
of the Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Kevin E. Martin <kevin@precisioninsight.com> |
* |
* $Header: /home/fabio/w/shark/sharkcvs/CVSROOT/shark/ports/mesa/include/GL/xmesa_x.h,v 1.1 2003-02-28 11:41:57 pj Exp $ |
*/ |
#ifndef _XMESA_X_H_ |
#define _XMESA_X_H_ |
typedef Display XMesaDisplay; |
typedef Pixmap XMesaPixmap; |
typedef Colormap XMesaColormap; |
typedef Drawable XMesaDrawable; |
typedef Window XMesaWindow; |
typedef GC XMesaGC; |
typedef XVisualInfo *XMesaVisualInfo; |
typedef XImage XMesaImage; |
typedef XPoint XMesaPoint; |
typedef XColor XMesaColor; |
#define XMesaDestroyImage XDestroyImage |
#define XMesaPutPixel XPutPixel |
#define XMesaGetPixel XGetPixel |
#define XMesaSetForeground XSetForeground |
#define XMesaSetBackground XSetBackground |
#define XMesaSetPlaneMask XSetPlaneMask |
#define XMesaSetFunction XSetFunction |
#define XMesaSetDashes XSetDashes |
#define XMesaSetLineAttributes XSetLineAttributes |
#define XMesaSetFillStyle XSetFillStyle |
#define XMesaSetTile XSetTile |
#define XMesaSetStipple XSetStipple |
#define XMesaDrawPoint XDrawPoint |
#define XMesaDrawPoints XDrawPoints |
#define XMesaDrawLine XDrawLine |
#define XMesaFillRectangle XFillRectangle |
#define XMesaPutImage XPutImage |
#define XMesaCopyArea XCopyArea |
#define XMesaFillPolygon XFillPolygon |
#define XMesaCreatePixmap XCreatePixmap |
#define XMesaFreePixmap XFreePixmap |
#define XMesaFreeGC XFreeGC |
#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size |
#define GET_REDMASK(__v) __v->visinfo->red_mask |
#define GET_GREENMASK(__v) __v->visinfo->green_mask |
#define GET_BLUEMASK(__v) __v->visinfo->blue_mask |
#if defined(__cplusplus) || defined(c_plusplus) |
#define GET_VISUAL_CLASS(__v) __v->visinfo->c_class |
#else |
#define GET_VISUAL_CLASS(__v) __v->visinfo->class |
#endif |
#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth |
#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->visinfo->screen) |
#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display) |
#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True) |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glu_mangle.h |
---|
0,0 → 1,105 |
/* $Id: glu_mangle.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.0 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* $Log: not supported by cvs2svn $ |
* Revision 1.3 2001/09/20 22:18:47 kschultz |
* add mangling for new entry points |
* |
* Revision 1.2 1999/09/10 02:08:19 gareth |
* Added GLU 1.3 tessellation (except winding rule code). |
* |
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg |
* Imported sources |
* |
* Revision 3.1 1999/06/21 22:00:42 brianp |
* added #ifndef GLU_MANGLE_H stuff |
* |
* Revision 3.0 1998/02/20 05:04:45 brianp |
* initial rev |
* |
*/ |
#ifndef GLU_MANGLE_H |
#define GLU_MANGLE_H |
#define gluLookAt mgluLookAt |
#define gluOrtho2D mgluOrtho2D |
#define gluPerspective mgluPerspective |
#define gluPickMatrix mgluPickMatrix |
#define gluProject mgluProject |
#define gluUnProject mgluUnProject |
#define gluErrorString mgluErrorString |
#define gluScaleImage mgluScaleImage |
#define gluBuild1DMipmaps mgluBuild1DMipmaps |
#define gluBuild2DMipmaps mgluBuild2DMipmaps |
#define gluNewQuadric mgluNewQuadric |
#define gluDeleteQuadric mgluDeleteQuadric |
#define gluQuadricDrawStyle mgluQuadricDrawStyle |
#define gluQuadricOrientation mgluQuadricOrientation |
#define gluQuadricNormals mgluQuadricNormals |
#define gluQuadricTexture mgluQuadricTexture |
#define gluQuadricCallback mgluQuadricCallback |
#define gluCylinder mgluCylinder |
#define gluSphere mgluSphere |
#define gluDisk mgluDisk |
#define gluPartialDisk mgluPartialDisk |
#define gluNewNurbsRenderer mgluNewNurbsRenderer |
#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer |
#define gluLoadSamplingMatrices mgluLoadSamplingMatrices |
#define gluNurbsProperty mgluNurbsProperty |
#define gluGetNurbsProperty mgluGetNurbsProperty |
#define gluBeginCurve mgluBeginCurve |
#define gluEndCurve mgluEndCurve |
#define gluNurbsCurve mgluNurbsCurve |
#define gluBeginSurface mgluBeginSurface |
#define gluEndSurface mgluEndSurface |
#define gluNurbsSurface mgluNurbsSurface |
#define gluBeginTrim mgluBeginTrim |
#define gluEndTrim mgluEndTrim |
#define gluPwlCurve mgluPwlCurve |
#define gluNurbsCallback mgluNurbsCallback |
#define gluNewTess mgluNewTess |
#define gluDeleteTess mgluDeleteTess |
#define gluTessBeginPolygon mgluTessBeginPolygon |
#define gluTessBeginContour mgluTessBeginContour |
#define gluTessVertex mgluTessVertex |
#define gluTessEndPolygon mgluTessEndPolygon |
#define gluTessEndContour mgluTessEndContour |
#define gluTessProperty mgluTessProperty |
#define gluTessNormal mgluTessNormal |
#define gluTessCallback mgluTessCallback |
#define gluGetTessProperty mgluGetTessProperty |
#define gluBeginPolygon mgluBeginPolygon |
#define gluNextContour mgluNextContour |
#define gluEndPolygon mgluEndPolygon |
#define gluGetString mgluGetString |
#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels |
#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels |
#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels |
#define gluBuild3DMipmaps mgluBuild3DMipmaps |
#define gluCheckExtension mgluCheckExtension |
#define gluUnProject4 mgluUnProject4 |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glxext.h |
---|
0,0 → 1,607 |
#ifndef __glxext_h_ |
#define __glxext_h_ |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* |
** License Applicability. Except to the extent portions of this file are |
** made subject to an alternative license as permitted in the SGI Free |
** Software License B, Version 1.1 (the "License"), the contents of this |
** file are subject only to the provisions of the License. You may not use |
** this file except in compliance with the License. You may obtain a copy |
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
** |
** http://oss.sgi.com/projects/FreeB |
** |
** Note that, as provided in the License, the Software is distributed on an |
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
** |
** Original Code. The Original Code is: OpenGL Sample Implementation, |
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
** Copyright in any portions created by third parties is as indicated |
** elsewhere herein. All Rights Reserved. |
** |
** Additional Notice Provisions: This software was created using the |
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has |
** not been independently verified as being compliant with the OpenGL(R) |
** version 1.2.1 Specification. |
*/ |
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) |
#define WIN32_LEAN_AND_MEAN 1 |
#include <windows.h> |
#endif |
#ifndef APIENTRY |
#define APIENTRY |
#endif |
#ifndef GLAPI |
#define GLAPI extern |
#endif |
/*************************************************************/ |
/* Header file version number, required by OpenGL ABI for Linux */ |
/* glxext.h last updated 2002/03/22 */ |
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ |
#define GLX_GLXEXT_VERSION 5 |
#ifndef GLX_VERSION_1_3 |
#define GLX_WINDOW_BIT 0x00000001 |
#define GLX_PIXMAP_BIT 0x00000002 |
#define GLX_PBUFFER_BIT 0x00000004 |
#define GLX_RGBA_BIT 0x00000001 |
#define GLX_COLOR_INDEX_BIT 0x00000002 |
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 |
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 |
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 |
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 |
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 |
#define GLX_AUX_BUFFERS_BIT 0x00000010 |
#define GLX_DEPTH_BUFFER_BIT 0x00000020 |
#define GLX_STENCIL_BUFFER_BIT 0x00000040 |
#define GLX_ACCUM_BUFFER_BIT 0x00000080 |
#define GLX_CONFIG_CAVEAT 0x20 |
#define GLX_X_VISUAL_TYPE 0x22 |
#define GLX_TRANSPARENT_TYPE 0x23 |
#define GLX_TRANSPARENT_INDEX_VALUE 0x24 |
#define GLX_TRANSPARENT_RED_VALUE 0x25 |
#define GLX_TRANSPARENT_GREEN_VALUE 0x26 |
#define GLX_TRANSPARENT_BLUE_VALUE 0x27 |
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 |
#define GLX_DONT_CARE 0xFFFFFFFF |
#define GLX_NONE 0x8000 |
#define GLX_SLOW_CONFIG 0x8001 |
#define GLX_TRUE_COLOR 0x8002 |
#define GLX_DIRECT_COLOR 0x8003 |
#define GLX_PSEUDO_COLOR 0x8004 |
#define GLX_STATIC_COLOR 0x8005 |
#define GLX_GRAY_SCALE 0x8006 |
#define GLX_STATIC_GRAY 0x8007 |
#define GLX_TRANSPARENT_RGB 0x8008 |
#define GLX_TRANSPARENT_INDEX 0x8009 |
#define GLX_VISUAL_ID 0x800B |
#define GLX_SCREEN 0x800C |
#define GLX_NON_CONFORMANT_CONFIG 0x800D |
#define GLX_DRAWABLE_TYPE 0x8010 |
#define GLX_RENDER_TYPE 0x8011 |
#define GLX_X_RENDERABLE 0x8012 |
#define GLX_FBCONFIG_ID 0x8013 |
#define GLX_RGBA_TYPE 0x8014 |
#define GLX_COLOR_INDEX_TYPE 0x8015 |
#define GLX_MAX_PBUFFER_WIDTH 0x8016 |
#define GLX_MAX_PBUFFER_HEIGHT 0x8017 |
#define GLX_MAX_PBUFFER_PIXELS 0x8018 |
#define GLX_PRESERVED_CONTENTS 0x801B |
#define GLX_LARGEST_PBUFFER 0x801C |
#define GLX_WIDTH 0x801D |
#define GLX_HEIGHT 0x801E |
#define GLX_EVENT_MASK 0x801F |
#define GLX_DAMAGED 0x8020 |
#define GLX_SAVED 0x8021 |
#define GLX_WINDOW 0x8022 |
#define GLX_PBUFFER 0x8023 |
#define GLX_PBUFFER_HEIGHT 0x8040 |
#define GLX_PBUFFER_WIDTH 0x8041 |
#endif |
#ifndef GLX_VERSION_1_4 |
#define GLX_SAMPLE_BUFFERS 100000 |
#define GLX_SAMPLES 100001 |
#endif |
#ifndef GLX_ARB_get_proc_address |
#endif |
#ifndef GLX_ARB_multisample |
#define GLX_SAMPLE_BUFFERS_ARB 100000 |
#define GLX_SAMPLES_ARB 100001 |
#endif |
#ifndef GLX_SGIS_multisample |
#define GLX_SAMPLE_BUFFERS_SGIS 100000 |
#define GLX_SAMPLES_SGIS 100001 |
#endif |
#ifndef GLX_EXT_visual_info |
#define GLX_X_VISUAL_TYPE_EXT 0x22 |
#define GLX_TRANSPARENT_TYPE_EXT 0x23 |
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 |
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 |
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 |
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 |
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 |
#define GLX_NONE_EXT 0x8000 |
#define GLX_TRUE_COLOR_EXT 0x8002 |
#define GLX_DIRECT_COLOR_EXT 0x8003 |
#define GLX_PSEUDO_COLOR_EXT 0x8004 |
#define GLX_STATIC_COLOR_EXT 0x8005 |
#define GLX_GRAY_SCALE_EXT 0x8006 |
#define GLX_STATIC_GRAY_EXT 0x8007 |
#define GLX_TRANSPARENT_RGB_EXT 0x8008 |
#define GLX_TRANSPARENT_INDEX_EXT 0x8009 |
#endif |
#ifndef GLX_SGI_swap_control |
#endif |
#ifndef GLX_SGI_video_sync |
#endif |
#ifndef GLX_SGI_make_current_read |
#endif |
#ifndef GLX_SGIX_video_source |
#endif |
#ifndef GLX_EXT_visual_rating |
#define GLX_VISUAL_CAVEAT_EXT 0x20 |
#define GLX_SLOW_VISUAL_EXT 0x8001 |
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D |
/* reuse GLX_NONE_EXT */ |
#endif |
#ifndef GLX_EXT_import_context |
#define GLX_SHARE_CONTEXT_EXT 0x800A |
#define GLX_VISUAL_ID_EXT 0x800B |
#define GLX_SCREEN_EXT 0x800C |
#endif |
#ifndef GLX_SGIX_fbconfig |
#define GLX_WINDOW_BIT_SGIX 0x00000001 |
#define GLX_PIXMAP_BIT_SGIX 0x00000002 |
#define GLX_RGBA_BIT_SGIX 0x00000001 |
#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 |
#define GLX_DRAWABLE_TYPE_SGIX 0x8010 |
#define GLX_RENDER_TYPE_SGIX 0x8011 |
#define GLX_X_RENDERABLE_SGIX 0x8012 |
#define GLX_FBCONFIG_ID_SGIX 0x8013 |
#define GLX_RGBA_TYPE_SGIX 0x8014 |
#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 |
/* reuse GLX_SCREEN_EXT */ |
#endif |
#ifndef GLX_SGIX_pbuffer |
#define GLX_PBUFFER_BIT_SGIX 0x00000004 |
#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 |
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 |
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 |
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 |
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 |
#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 |
#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 |
#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 |
#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 |
#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 |
#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 |
#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 |
#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 |
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 |
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A |
#define GLX_PRESERVED_CONTENTS_SGIX 0x801B |
#define GLX_LARGEST_PBUFFER_SGIX 0x801C |
#define GLX_WIDTH_SGIX 0x801D |
#define GLX_HEIGHT_SGIX 0x801E |
#define GLX_EVENT_MASK_SGIX 0x801F |
#define GLX_DAMAGED_SGIX 0x8020 |
#define GLX_SAVED_SGIX 0x8021 |
#define GLX_WINDOW_SGIX 0x8022 |
#define GLX_PBUFFER_SGIX 0x8023 |
#endif |
#ifndef GLX_SGI_cushion |
#endif |
#ifndef GLX_SGIX_video_resize |
#define GLX_SYNC_FRAME_SGIX 0x00000000 |
#define GLX_SYNC_SWAP_SGIX 0x00000001 |
#endif |
#ifndef GLX_SGIX_dmbuffer |
#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 |
#endif |
#ifndef GLX_SGIX_swap_group |
#endif |
#ifndef GLX_SGIX_swap_barrier |
#endif |
#ifndef GLX_SGIS_blended_overlay |
#define GLX_BLENDED_RGBA_SGIS 0x8025 |
#endif |
#ifndef GLX_SGIS_shared_multisample |
#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 |
#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 |
#endif |
#ifndef GLX_SUN_get_transparent_index |
#endif |
#ifndef GLX_3DFX_multisample |
#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 |
#define GLX_SAMPLES_3DFX 0x8051 |
#endif |
#ifndef GLX_MESA_copy_sub_buffer |
#endif |
#ifndef GLX_MESA_pixmap_colormap |
#endif |
#ifndef GLX_MESA_release_buffers |
#endif |
#ifndef GLX_MESA_set_3dfx_mode |
#define GLX_3DFX_WINDOW_MODE_MESA 0x1 |
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 |
#endif |
#ifndef GLX_SGIX_visual_select_group |
#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 |
#endif |
#ifndef GLX_OML_swap_method |
#define GLX_SWAP_METHOD_OML 0x8060 |
#define GLX_SWAP_EXCHANGE_OML 0x8061 |
#define GLX_SWAP_COPY_OML 0x8062 |
#define GLX_SWAP_UNDEFINED_OML 0x8063 |
#endif |
#ifndef GLX_OML_sync_control |
#endif |
/*************************************************************/ |
#ifndef GLX_ARB_get_proc_address |
typedef void (*__GLXextFuncPtr)(void); |
#endif |
#ifndef GLX_SGIX_video_source |
typedef XID GLXVideoSourceSGIX; |
#endif |
#ifndef GLX_SGIX_fbconfig |
typedef XID GLXFBConfigIDSGIX; |
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; |
#endif |
#ifndef GLX_SGIX_pbuffer |
typedef XID GLXPbufferSGIX; |
typedef struct { |
int type; |
unsigned long serial; /* # of last request processed by server */ |
Bool send_event; /* true if this came for SendEvent request */ |
Display *display; /* display the event was read from */ |
GLXDrawable drawable; /* i.d. of Drawable */ |
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ |
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ |
unsigned int mask; /* mask indicating which buffers are affected*/ |
int x, y; |
int width, height; |
int count; /* if nonzero, at least this many more */ |
} GLXBufferClobberEventSGIX; |
#endif |
#ifndef GLX_VERSION_1_3 |
#define GLX_VERSION_1_3 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); |
extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); |
extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); |
extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); |
extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); |
extern void glXDestroyWindow (Display *, GLXWindow); |
extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); |
extern void glXDestroyPixmap (Display *, GLXPixmap); |
extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); |
extern void glXDestroyPbuffer (Display *, GLXPbuffer); |
extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); |
extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); |
extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); |
extern GLXDrawable glXGetCurrentReadDrawable (void); |
extern Display * glXGetCurrentDisplay (void); |
extern int glXQueryContext (Display *, GLXContext, int, int *); |
extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); |
extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); |
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); |
typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); |
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); |
typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); |
typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); |
typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); |
typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); |
typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); |
typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); |
typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); |
typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); |
typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); |
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); |
typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); |
typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); |
typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); |
typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); |
#endif |
#ifndef GLX_VERSION_1_4 |
#define GLX_VERSION_1_4 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); |
#endif |
#ifndef GLX_ARB_get_proc_address |
#define GLX_ARB_get_proc_address 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); |
#endif |
#ifndef GLX_ARB_multisample |
#define GLX_ARB_multisample 1 |
#endif |
#ifndef GLX_SGIS_multisample |
#define GLX_SGIS_multisample 1 |
#endif |
#ifndef GLX_EXT_visual_info |
#define GLX_EXT_visual_info 1 |
#endif |
#ifndef GLX_SGI_swap_control |
#define GLX_SGI_swap_control 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern int glXSwapIntervalSGI (int); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); |
#endif |
#ifndef GLX_SGI_video_sync |
#define GLX_SGI_video_sync 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern int glXGetVideoSyncSGI (unsigned int *); |
extern int glXWaitVideoSyncSGI (int, int, unsigned int *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); |
typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); |
#endif |
#ifndef GLX_SGI_make_current_read |
#define GLX_SGI_make_current_read 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); |
extern GLXDrawable glXGetCurrentReadDrawableSGI (void); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); |
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); |
#endif |
#ifdef _VL_H |
#ifndef GLX_SGIX_video_source |
#define GLX_SGIX_video_source 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); |
extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); |
typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); |
#endif |
#endif /* _VL_H */ |
#ifndef GLX_EXT_visual_rating |
#define GLX_EXT_visual_rating 1 |
#endif |
#ifndef GLX_EXT_import_context |
#define GLX_EXT_import_context 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Display * glXGetCurrentDisplayEXT (void); |
extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); |
extern GLXContextID glXGetContextIDEXT (const GLXContext); |
extern GLXContext glXImportContextEXT (Display *, GLXContextID); |
extern void glXFreeContextEXT (Display *, GLXContext); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); |
typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); |
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); |
typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); |
typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); |
#endif |
#ifndef GLX_SGIX_fbconfig |
#define GLX_SGIX_fbconfig 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); |
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); |
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); |
extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); |
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); |
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); |
typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); |
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); |
typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); |
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); |
typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); |
#endif |
#ifndef GLX_SGIX_pbuffer |
#define GLX_SGIX_pbuffer 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); |
extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); |
extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); |
extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); |
extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); |
typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); |
typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); |
typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); |
typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); |
#endif |
#ifndef GLX_SGI_cushion |
#define GLX_SGI_cushion 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern void glXCushionSGI (Display *, Window, float); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); |
#endif |
#ifndef GLX_SGIX_video_resize |
#define GLX_SGIX_video_resize 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); |
extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); |
extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); |
extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); |
extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); |
typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); |
typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); |
typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); |
typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); |
#endif |
#ifdef _DM_BUFFER_H_ |
#ifndef GLX_SGIX_dmbuffer |
#define GLX_SGIX_dmbuffer 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); |
#endif |
#endif /* _DM_BUFFER_H_ */ |
#ifndef GLX_SGIX_swap_group |
#define GLX_SGIX_swap_group 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); |
#endif |
#ifndef GLX_SGIX_swap_barrier |
#define GLX_SGIX_swap_barrier 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); |
extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); |
typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); |
#endif |
#ifndef GLX_SUN_get_transparent_index |
#define GLX_SUN_get_transparent_index 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); |
#endif |
#ifndef GLX_MESA_copy_sub_buffer |
#define GLX_MESA_copy_sub_buffer 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); |
#endif |
#ifndef GLX_MESA_pixmap_colormap |
#define GLX_MESA_pixmap_colormap 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); |
#endif |
#ifndef GLX_MESA_release_buffers |
#define GLX_MESA_release_buffers 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); |
#endif |
#ifndef GLX_MESA_set_3dfx_mode |
#define GLX_MESA_set_3dfx_mode 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Bool glXSet3DfxModeMESA (int); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); |
#endif |
#ifndef GLX_SGIX_visual_select_group |
#define GLX_SGIX_visual_select_group 1 |
#endif |
#ifndef GLX_OML_swap_method |
#define GLX_OML_swap_method 1 |
#endif |
#if defined(__STDC_VERSION__) |
#if __STDC_VERSION__ >= 199901L |
/* Include ISO C99 integer types for OML_sync_control; need a better test */ |
#include <inttypes.h> |
#ifndef GLX_OML_sync_control |
#define GLX_OML_sync_control 1 |
#ifdef GLX_GLXEXT_PROTOTYPES |
extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); |
extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); |
extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); |
extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); |
extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); |
#endif /* GLX_GLXEXT_PROTOTYPES */ |
typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); |
typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); |
typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); |
typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); |
typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); |
#endif |
#endif /* C99 version test */ |
#endif /* STDC test */ |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glut.h |
---|
0,0 → 1,771 |
#ifndef __glut_h__ |
#define __glut_h__ |
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ |
/* This program is freely distributable without licensing fees and is |
provided without guarantee or warrantee expressed or implied. This |
program is -not- in the public domain. */ |
#include <GL/gl.h> |
#include <GL/glu.h> |
#ifdef __cplusplus |
extern "C" { |
#endif |
#if defined(_WIN32) |
/* GLUT 3.7 now tries to avoid including <windows.h> |
to avoid name space pollution, but Win32's <GL/gl.h> |
needs APIENTRY and WINGDIAPI defined properly. |
tjump@spgs.com contributes: |
If users are building glut code on MS Windows, then they should |
make sure they include windows.h early, let's not get into a |
header definitions war since MS has proven it's capability to |
change header dependencies w/o publishing they have done so. |
So, let's not include windows.h here, as it's not really required and |
MS own gl/gl.h *should* include it if the dependency is there. */ |
/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA |
in your compile preprocessor options. */ |
# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) |
# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */ |
/* To enable automatic SGI OpenGL for Windows library usage for GLUT, |
define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */ |
# ifdef GLUT_USE_SGI_OPENGL |
# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */ |
# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */ |
# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */ |
# else |
# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */ |
# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */ |
# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */ |
# endif |
# endif |
/* To disable supression of annoying warnings about floats being promoted |
to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor |
options. */ |
# ifndef GLUT_NO_WARNING_DISABLE |
# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */ |
# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ |
# endif |
/* Win32 has an annoying issue where there are multiple C run-time |
libraries (CRTs). If the executable is linked with a different CRT |
from the GLUT DLL, the GLUT DLL will not share the same CRT static |
data seen by the executable. In particular, atexit callbacks registered |
in the executable will not be called if GLUT calls its (different) |
exit routine). GLUT is typically built with the |
"/MD" option (the CRT with multithreading DLL support), but the Visual |
C++ linker default is "/ML" (the single threaded CRT). |
One workaround to this issue is requiring users to always link with |
the same CRT as GLUT is compiled with. That requires users supply a |
non-standard option. GLUT 3.7 has its own built-in workaround where |
the executable's "exit" function pointer is covertly passed to GLUT. |
GLUT then calls the executable's exit function pointer to ensure that |
any "atexit" calls registered by the application are called if GLUT |
needs to exit. |
Note that the __glut*WithExit routines should NEVER be called directly. |
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */ |
/* XXX This is from Win32's <process.h> */ |
# if !defined(_MSC_VER) && !defined(__cdecl) |
/* Define __cdecl for non-Microsoft compilers. */ |
# define __cdecl |
# define GLUT_DEFINED___CDECL |
# endif |
# ifndef _CRTIMP |
# ifdef _NTSDK |
/* Definition compatible with NT SDK */ |
# define _CRTIMP |
# else |
/* Current definition */ |
# ifdef _DLL |
# define _CRTIMP __declspec(dllimport) |
# else |
# define _CRTIMP |
# endif |
# endif |
# define GLUT_DEFINED__CRTIMP |
# endif |
# ifndef GLUT_BUILDING_LIB |
extern _CRTIMP void __cdecl exit(int); |
# endif |
/* GLUT callback calling convention for Win32. */ |
# define GLUTCALLBACK __cdecl |
/* for callback/function pointer defs */ |
# define GLUTAPIENTRYV __cdecl |
/* glut-win32 specific macros, defined to prevent collision with |
and redifinition of Windows system defs, also removes requirement of |
pretty much any standard windows header from this file */ |
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__) |
# define GLUTAPIENTRY __stdcall |
#else |
# define GLUTAPIENTRY |
#endif |
/* GLUT API entry point declarations for Win32. */ |
#if defined(GLUT_BUILDING_LIB) && defined(_DLL) |
# define GLUTAPI __declspec(dllexport) |
#elif defined(_DLL) |
# define GLUTAPI __declspec(dllimport) |
#else |
# define GLUTAPI extern |
#endif |
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(MESA) |
# if !defined(MESA_MINWARN) |
# pragma message( "note: WINDOWS.H not included, providing Mesa definition of CALLBACK macro" ) |
# pragma message( "----: and PROC typedef. If you receive compiler warnings about either ") |
# pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" ) |
# endif |
# define CALLBACK __stdcall |
typedef int (GLUTAPIENTRY *PROC)(); |
typedef void *HGLRC; |
typedef void *HDC; |
typedef unsigned long COLORREF; |
#endif |
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(MESA) |
# if !defined(MESA_MINWARN) |
# pragma message( "note: WINDOWS.H not included, providing Mesa definition of wgl functions" ) |
# pragma message( "----: and macros. If you receive compiler warnings about any being multiply ") |
# pragma message( "----: defined you should include WINDOWS.H priot to gl/glut.h" ) |
# endif |
# define WGL_FONT_LINES 0 |
# define WGL_FONT_POLYGONS 1 |
# ifdef UNICODE |
# define wglUseFontBitmaps wglUseFontBitmapsW |
# define wglUseFontOutlines wglUseFontOutlinesW |
# else |
# define wglUseFontBitmaps wglUseFontBitmapsA |
# define wglUseFontOutlines wglUseFontOutlinesA |
# endif /* !UNICODE */ |
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; |
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; |
# pragma warning( push ) |
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ |
# define WGLAPI __declspec(dllimport) |
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); |
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); |
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); |
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); |
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); |
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); |
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); |
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); |
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); |
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); |
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); |
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); |
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); |
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); |
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC); |
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); |
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); |
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); |
WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); |
WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); |
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); |
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); |
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); |
WGLAPI int GLAPIENTRY SwapBuffers(HDC); |
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); |
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); |
WGLAPI int GLAPIENTRY GetPixelFormat(HDC); |
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); |
# undef WGLAPI |
# pragma warning( pop ) |
#endif |
#else /* _WIN32 not defined */ |
/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */ |
# define GLUTAPIENTRY |
# define GLUTAPIENTRYV |
# define GLUT_APIENTRY_DEFINED |
# define GLUTCALLBACK |
# define GLUTAPI extern |
/* Prototype exit for the non-Win32 case (see above). */ |
/*extern void exit(int); this screws up gcc -ansi -pedantic! */ |
#endif |
/** |
GLUT API revision history: |
GLUT_API_VERSION is updated to reflect incompatible GLUT |
API changes (interface changes, semantic changes, deletions, |
or additions). |
GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 |
GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling, |
extension. Supports new input devices like tablet, dial and button |
box, and Spaceball. Easy to query OpenGL extensions. |
GLUT_API_VERSION=3 glutMenuStatus added. |
GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer, |
glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic |
video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc, |
glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat, |
glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). |
GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP) |
**/ |
#ifndef GLUT_API_VERSION /* allow this to be overriden */ |
#define GLUT_API_VERSION 5 |
#endif |
/** |
GLUT implementation revision history: |
GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT |
API revisions and implementation revisions (ie, bug fixes). |
GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of |
GLUT Xlib-based implementation. 11/29/94 |
GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of |
GLUT Xlib-based implementation providing GLUT version 2 |
interfaces. |
GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95 |
GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95 |
GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95 |
GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96 |
GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner |
and video resize. 1/3/97 |
GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines. |
GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release. |
GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling. |
GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support. |
GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface. |
GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h> |
**/ |
#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */ |
#define GLUT_XLIB_IMPLEMENTATION 15 |
#endif |
/* Display mode bit masks. */ |
#define GLUT_RGB 0 |
#define GLUT_RGBA GLUT_RGB |
#define GLUT_INDEX 1 |
#define GLUT_SINGLE 0 |
#define GLUT_DOUBLE 2 |
#define GLUT_ACCUM 4 |
#define GLUT_ALPHA 8 |
#define GLUT_DEPTH 16 |
#define GLUT_STENCIL 32 |
#if (GLUT_API_VERSION >= 2) |
#define GLUT_MULTISAMPLE 128 |
#define GLUT_STEREO 256 |
#endif |
#if (GLUT_API_VERSION >= 3) |
#define GLUT_LUMINANCE 512 |
#endif |
/* Mouse buttons. */ |
#define GLUT_LEFT_BUTTON 0 |
#define GLUT_MIDDLE_BUTTON 1 |
#define GLUT_RIGHT_BUTTON 2 |
/* Mouse button state. */ |
#define GLUT_DOWN 0 |
#define GLUT_UP 1 |
#if (GLUT_API_VERSION >= 2) |
/* function keys */ |
#define GLUT_KEY_F1 1 |
#define GLUT_KEY_F2 2 |
#define GLUT_KEY_F3 3 |
#define GLUT_KEY_F4 4 |
#define GLUT_KEY_F5 5 |
#define GLUT_KEY_F6 6 |
#define GLUT_KEY_F7 7 |
#define GLUT_KEY_F8 8 |
#define GLUT_KEY_F9 9 |
#define GLUT_KEY_F10 10 |
#define GLUT_KEY_F11 11 |
#define GLUT_KEY_F12 12 |
/* directional keys */ |
#define GLUT_KEY_LEFT 100 |
#define GLUT_KEY_UP 101 |
#define GLUT_KEY_RIGHT 102 |
#define GLUT_KEY_DOWN 103 |
#define GLUT_KEY_PAGE_UP 104 |
#define GLUT_KEY_PAGE_DOWN 105 |
#define GLUT_KEY_HOME 106 |
#define GLUT_KEY_END 107 |
#define GLUT_KEY_INSERT 108 |
#endif |
/* Entry/exit state. */ |
#define GLUT_LEFT 0 |
#define GLUT_ENTERED 1 |
/* Menu usage state. */ |
#define GLUT_MENU_NOT_IN_USE 0 |
#define GLUT_MENU_IN_USE 1 |
/* Visibility state. */ |
#define GLUT_NOT_VISIBLE 0 |
#define GLUT_VISIBLE 1 |
/* Window status state. */ |
#define GLUT_HIDDEN 0 |
#define GLUT_FULLY_RETAINED 1 |
#define GLUT_PARTIALLY_RETAINED 2 |
#define GLUT_FULLY_COVERED 3 |
/* Color index component selection values. */ |
#define GLUT_RED 0 |
#define GLUT_GREEN 1 |
#define GLUT_BLUE 2 |
/* Layers for use. */ |
#define GLUT_NORMAL 0 |
#define GLUT_OVERLAY 1 |
#if defined(_WIN32) |
/* Stroke font constants (use these in GLUT program). */ |
#define GLUT_STROKE_ROMAN ((void*)0) |
#define GLUT_STROKE_MONO_ROMAN ((void*)1) |
/* Bitmap font constants (use these in GLUT program). */ |
#define GLUT_BITMAP_9_BY_15 ((void*)2) |
#define GLUT_BITMAP_8_BY_13 ((void*)3) |
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) |
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) |
#if (GLUT_API_VERSION >= 3) |
#define GLUT_BITMAP_HELVETICA_10 ((void*)6) |
#define GLUT_BITMAP_HELVETICA_12 ((void*)7) |
#define GLUT_BITMAP_HELVETICA_18 ((void*)8) |
#endif |
#else |
/* Stroke font opaque addresses (use constants instead in source code). */ |
GLUTAPI void *glutStrokeRoman; |
GLUTAPI void *glutStrokeMonoRoman; |
/* Stroke font constants (use these in GLUT program). */ |
#define GLUT_STROKE_ROMAN (&glutStrokeRoman) |
#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) |
/* Bitmap font opaque addresses (use constants instead in source code). */ |
GLUTAPI void *glutBitmap9By15; |
GLUTAPI void *glutBitmap8By13; |
GLUTAPI void *glutBitmapTimesRoman10; |
GLUTAPI void *glutBitmapTimesRoman24; |
GLUTAPI void *glutBitmapHelvetica10; |
GLUTAPI void *glutBitmapHelvetica12; |
GLUTAPI void *glutBitmapHelvetica18; |
/* Bitmap font constants (use these in GLUT program). */ |
#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) |
#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) |
#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) |
#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) |
#if (GLUT_API_VERSION >= 3) |
#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) |
#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) |
#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) |
#endif |
#endif |
/* glutGet parameters. */ |
#define GLUT_WINDOW_X 100 |
#define GLUT_WINDOW_Y 101 |
#define GLUT_WINDOW_WIDTH 102 |
#define GLUT_WINDOW_HEIGHT 103 |
#define GLUT_WINDOW_BUFFER_SIZE 104 |
#define GLUT_WINDOW_STENCIL_SIZE 105 |
#define GLUT_WINDOW_DEPTH_SIZE 106 |
#define GLUT_WINDOW_RED_SIZE 107 |
#define GLUT_WINDOW_GREEN_SIZE 108 |
#define GLUT_WINDOW_BLUE_SIZE 109 |
#define GLUT_WINDOW_ALPHA_SIZE 110 |
#define GLUT_WINDOW_ACCUM_RED_SIZE 111 |
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112 |
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113 |
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114 |
#define GLUT_WINDOW_DOUBLEBUFFER 115 |
#define GLUT_WINDOW_RGBA 116 |
#define GLUT_WINDOW_PARENT 117 |
#define GLUT_WINDOW_NUM_CHILDREN 118 |
#define GLUT_WINDOW_COLORMAP_SIZE 119 |
#if (GLUT_API_VERSION >= 2) |
#define GLUT_WINDOW_NUM_SAMPLES 120 |
#define GLUT_WINDOW_STEREO 121 |
#endif |
#if (GLUT_API_VERSION >= 3) |
#define GLUT_WINDOW_CURSOR 122 |
#endif |
#define GLUT_SCREEN_WIDTH 200 |
#define GLUT_SCREEN_HEIGHT 201 |
#define GLUT_SCREEN_WIDTH_MM 202 |
#define GLUT_SCREEN_HEIGHT_MM 203 |
#define GLUT_MENU_NUM_ITEMS 300 |
#define GLUT_DISPLAY_MODE_POSSIBLE 400 |
#define GLUT_INIT_WINDOW_X 500 |
#define GLUT_INIT_WINDOW_Y 501 |
#define GLUT_INIT_WINDOW_WIDTH 502 |
#define GLUT_INIT_WINDOW_HEIGHT 503 |
#define GLUT_INIT_DISPLAY_MODE 504 |
#if (GLUT_API_VERSION >= 2) |
#define GLUT_ELAPSED_TIME 700 |
#endif |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) |
#define GLUT_WINDOW_FORMAT_ID 123 |
#endif |
#if (GLUT_API_VERSION >= 2) |
/* glutDeviceGet parameters. */ |
#define GLUT_HAS_KEYBOARD 600 |
#define GLUT_HAS_MOUSE 601 |
#define GLUT_HAS_SPACEBALL 602 |
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603 |
#define GLUT_HAS_TABLET 604 |
#define GLUT_NUM_MOUSE_BUTTONS 605 |
#define GLUT_NUM_SPACEBALL_BUTTONS 606 |
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607 |
#define GLUT_NUM_DIALS 608 |
#define GLUT_NUM_TABLET_BUTTONS 609 |
#endif |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) |
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610 |
#define GLUT_DEVICE_KEY_REPEAT 611 |
#define GLUT_HAS_JOYSTICK 612 |
#define GLUT_OWNS_JOYSTICK 613 |
#define GLUT_JOYSTICK_BUTTONS 614 |
#define GLUT_JOYSTICK_AXES 615 |
#define GLUT_JOYSTICK_POLL_RATE 616 |
#endif |
#if (GLUT_API_VERSION >= 3) |
/* glutLayerGet parameters. */ |
#define GLUT_OVERLAY_POSSIBLE 800 |
#define GLUT_LAYER_IN_USE 801 |
#define GLUT_HAS_OVERLAY 802 |
#define GLUT_TRANSPARENT_INDEX 803 |
#define GLUT_NORMAL_DAMAGED 804 |
#define GLUT_OVERLAY_DAMAGED 805 |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
/* glutVideoResizeGet parameters. */ |
#define GLUT_VIDEO_RESIZE_POSSIBLE 900 |
#define GLUT_VIDEO_RESIZE_IN_USE 901 |
#define GLUT_VIDEO_RESIZE_X_DELTA 902 |
#define GLUT_VIDEO_RESIZE_Y_DELTA 903 |
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904 |
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905 |
#define GLUT_VIDEO_RESIZE_X 906 |
#define GLUT_VIDEO_RESIZE_Y 907 |
#define GLUT_VIDEO_RESIZE_WIDTH 908 |
#define GLUT_VIDEO_RESIZE_HEIGHT 909 |
#endif |
/* glutUseLayer parameters. */ |
#define GLUT_NORMAL 0 |
#define GLUT_OVERLAY 1 |
/* glutGetModifiers return mask. */ |
#define GLUT_ACTIVE_SHIFT 1 |
#define GLUT_ACTIVE_CTRL 2 |
#define GLUT_ACTIVE_ALT 4 |
/* glutSetCursor parameters. */ |
/* Basic arrows. */ |
#define GLUT_CURSOR_RIGHT_ARROW 0 |
#define GLUT_CURSOR_LEFT_ARROW 1 |
/* Symbolic cursor shapes. */ |
#define GLUT_CURSOR_INFO 2 |
#define GLUT_CURSOR_DESTROY 3 |
#define GLUT_CURSOR_HELP 4 |
#define GLUT_CURSOR_CYCLE 5 |
#define GLUT_CURSOR_SPRAY 6 |
#define GLUT_CURSOR_WAIT 7 |
#define GLUT_CURSOR_TEXT 8 |
#define GLUT_CURSOR_CROSSHAIR 9 |
/* Directional cursors. */ |
#define GLUT_CURSOR_UP_DOWN 10 |
#define GLUT_CURSOR_LEFT_RIGHT 11 |
/* Sizing cursors. */ |
#define GLUT_CURSOR_TOP_SIDE 12 |
#define GLUT_CURSOR_BOTTOM_SIDE 13 |
#define GLUT_CURSOR_LEFT_SIDE 14 |
#define GLUT_CURSOR_RIGHT_SIDE 15 |
#define GLUT_CURSOR_TOP_LEFT_CORNER 16 |
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17 |
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 |
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 |
/* Inherit from parent window. */ |
#define GLUT_CURSOR_INHERIT 100 |
/* Blank cursor. */ |
#define GLUT_CURSOR_NONE 101 |
/* Fullscreen crosshair (if available). */ |
#define GLUT_CURSOR_FULL_CROSSHAIR 102 |
#endif |
/* GLUT initialization sub-API. */ |
GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv); |
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) |
GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); |
#ifndef GLUT_BUILDING_LIB |
static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } |
#define glutInit glutInit_ATEXIT_HACK |
#endif |
#endif |
GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string); |
#endif |
GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y); |
GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height); |
GLUTAPI void GLUTAPIENTRY glutMainLoop(void); |
/* GLUT window sub-API. */ |
GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title); |
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) |
GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)); |
#ifndef GLUT_BUILDING_LIB |
static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); } |
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK |
#endif |
#endif |
GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); |
GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win); |
GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) |
GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win); |
#endif |
GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void); |
GLUTAPI int GLUTAPIENTRY glutGetWindow(void); |
GLUTAPI void GLUTAPIENTRY glutSetWindow(int win); |
GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title); |
GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title); |
GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y); |
GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height); |
GLUTAPI void GLUTAPIENTRY glutPopWindow(void); |
GLUTAPI void GLUTAPIENTRY glutPushWindow(void); |
GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void); |
GLUTAPI void GLUTAPIENTRY glutShowWindow(void); |
GLUTAPI void GLUTAPIENTRY glutHideWindow(void); |
#if (GLUT_API_VERSION >= 3) |
GLUTAPI void GLUTAPIENTRY glutFullScreen(void); |
GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y); |
#endif |
/* GLUT overlay sub-API. */ |
GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void); |
GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void); |
GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer); |
GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) |
GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win); |
#endif |
GLUTAPI void GLUTAPIENTRY glutShowOverlay(void); |
GLUTAPI void GLUTAPIENTRY glutHideOverlay(void); |
#endif |
/* GLUT menu sub-API. */ |
GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int)); |
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) |
GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int)); |
#ifndef GLUT_BUILDING_LIB |
static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); } |
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK |
#endif |
#endif |
GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu); |
GLUTAPI int GLUTAPIENTRY glutGetMenu(void); |
GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu); |
GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value); |
GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu); |
GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value); |
GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); |
GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item); |
GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button); |
GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button); |
/* GLUT window callback sub-API. */ |
GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void)); |
GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height)); |
GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state)); |
GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state)); |
GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void)); |
GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value); |
GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state)); |
#if (GLUT_API_VERSION >= 2) |
GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); |
GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); |
GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state)); |
GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state)); |
GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value)); |
GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); |
#if (GLUT_API_VERSION >= 3) |
GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void)); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state)); |
#endif |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) |
GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); |
GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval); |
#endif |
#endif |
#endif |
/* GLUT color index sub-API. */ |
GLUTAPI void GLUTAPIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); |
GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component); |
GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win); |
/* GLUT state retrieval sub-API. */ |
GLUTAPI int GLUTAPIENTRY glutGet(GLenum type); |
GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type); |
#if (GLUT_API_VERSION >= 2) |
/* GLUT extension support sub-API */ |
GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name); |
#endif |
#if (GLUT_API_VERSION >= 3) |
GLUTAPI int GLUTAPIENTRY glutGetModifiers(void); |
GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type); |
#endif |
#if (GLUT_API_VERSION >= 5) |
GLUTAPI void * GLUTAPIENTRY glutGetProcAddress(const char *procName); |
#endif |
/* GLUT font sub-API */ |
GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character); |
GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character); |
GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character); |
GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string); |
GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string); |
#endif |
/* GLUT pre-built models sub-API */ |
GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); |
GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); |
GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); |
GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); |
GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size); |
GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size); |
GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); |
GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); |
GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void); |
GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void); |
GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size); |
GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size); |
GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void); |
GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void); |
GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void); |
GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void); |
GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void); |
GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void); |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) |
/* GLUT video resize sub-API. */ |
GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param); |
GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void); |
GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void); |
GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height); |
GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height); |
/* GLUT debugging sub-API. */ |
GLUTAPI void GLUTAPIENTRY glutReportErrors(void); |
#endif |
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) |
/* GLUT device control sub-API. */ |
/* glutSetKeyRepeat modes. */ |
#define GLUT_KEY_REPEAT_OFF 0 |
#define GLUT_KEY_REPEAT_ON 1 |
#define GLUT_KEY_REPEAT_DEFAULT 2 |
/* Joystick button masks. */ |
#define GLUT_JOYSTICK_BUTTON_A 1 |
#define GLUT_JOYSTICK_BUTTON_B 2 |
#define GLUT_JOYSTICK_BUTTON_C 4 |
#define GLUT_JOYSTICK_BUTTON_D 8 |
GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore); |
GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode); |
GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void); |
/* GLUT game mode sub-API. */ |
/* glutGameModeGet. */ |
#define GLUT_GAME_MODE_ACTIVE 0 |
#define GLUT_GAME_MODE_POSSIBLE 1 |
#define GLUT_GAME_MODE_WIDTH 2 |
#define GLUT_GAME_MODE_HEIGHT 3 |
#define GLUT_GAME_MODE_PIXEL_DEPTH 4 |
#define GLUT_GAME_MODE_REFRESH_RATE 5 |
#define GLUT_GAME_MODE_DISPLAY_CHANGED 6 |
GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string); |
GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void); |
GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void); |
GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode); |
#endif |
#ifdef __cplusplus |
} |
#endif |
#if 0 |
#ifdef GLUT_APIENTRY_DEFINED |
# undef GLUT_APIENTRY_DEFINED |
# undef APIENTRY |
#endif |
#ifdef GLUT_WINGDIAPI_DEFINED |
# undef GLUT_WINGDIAPI_DEFINED |
# undef WINGDIAPI |
#endif |
#ifdef GLUT_DEFINED___CDECL |
# undef GLUT_DEFINED___CDECL |
# undef __cdecl |
#endif |
#ifdef GLUT_DEFINED__CRTIMP |
# undef GLUT_DEFINED__CRTIMP |
# undef _CRTIMP |
#endif |
#endif |
#endif /* __glut_h__ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/wmesa.h |
---|
0,0 → 1,168 |
/* $Id: wmesa.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.0 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* |
*/ |
/* |
* $Log: not supported by cvs2svn $ |
* Revision 1.2 2002/04/23 18:23:32 kschultz |
* Fix up alpha buffer handling for Windows. |
* - add two new Pixel Format Descriptors that do not have alpha bits to |
* mirror the two that do. |
* - add logic to wglChoosePixelFormat to match PFD's with respect to alpha. |
* - Create/clear software alpha buffer as required. |
* Now a wgl or GLUT program can control the creation of a software alpha |
* buffer via the PFD or GLUT parms, respectively. |
* |
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg |
* Imported sources |
* |
* Revision 3.2 1999/01/03 02:54:45 brianp |
* updated per Ted Jump |
* |
* Revision 3.1 1998/12/01 02:34:27 brianp |
* applied Mark Kilgard's patches from November 30, 1998 |
* |
* Revision 3.0 1998/02/20 05:06:59 brianp |
* initial rev |
* |
*/ |
/* |
* Windows driver by: Mark E. Peterson (markp@ic.mankato.mn.us) |
* Updated by Li Wei (liwei@aiar.xjtu.edu.cn) |
* |
* |
*************************************************************** |
* WMesa * |
* version 2.3 * |
* * |
* By * |
* Li Wei * |
* Institute of Artificial Intelligence & Robotics * |
* Xi'an Jiaotong University * |
* Email: liwei@aiar.xjtu.edu.cn * |
* Web page: http://sun.aiar.xjtu.edu.cn * |
* * |
* July 7th, 1997 * |
*************************************************************** |
*/ |
#ifndef WMESA_H |
#define WMESA_H |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include "gl\gl.h" |
#pragma warning (disable:4273) |
#pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ |
#pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ |
#pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ |
#pragma warning( disable : 4013 ) /* 'function' undefined; assuming extern returning int */ |
#pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ |
#pragma warning( disable : 4273 ) /* 'identifier' : inconsistent DLL linkage. dllexport assumed */ |
#if (MESA_WARNQUIET>1) |
# pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */ |
#endif |
/* |
* This is the WMesa context 'handle': |
*/ |
typedef struct wmesa_context *WMesaContext; |
/* |
* Create a new WMesaContext for rendering into a window. You must |
* have already created the window of correct visual type and with an |
* appropriate colormap. |
* |
* Input: |
* hWnd - Window handle |
* Pal - Palette to use |
* rgb_flag - GL_TRUE = RGB mode, |
* GL_FALSE = color index mode |
* db_flag - GL_TRUE = double-buffered, |
* GL_FALSE = single buffered |
* alpha_flag - GL_TRUE = create software alpha buffer, |
* GL_FALSE = no software alpha buffer |
* |
* Note: Indexed mode requires double buffering under Windows. |
* |
* Return: a WMesa_context or NULL if error. |
*/ |
extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal, |
GLboolean rgb_flag, |
GLboolean db_flag, |
GLboolean alpha_flag); |
/* |
* Destroy a rendering context as returned by WMesaCreateContext() |
*/ |
/*extern void WMesaDestroyContext( WMesaContext ctx );*/ |
extern void WMesaDestroyContext( void ); |
/* |
* Make the specified context the current one. |
*/ |
extern void WMesaMakeCurrent( WMesaContext ctx ); |
/* |
* Return a handle to the current context. |
*/ |
extern WMesaContext WMesaGetCurrentContext( void ); |
/* |
* Swap the front and back buffers for the current context. No action |
* taken if the context is not double buffered. |
*/ |
extern void WMesaSwapBuffers(void); |
/* |
* In indexed color mode we need to know when the palette changes. |
*/ |
extern void WMesaPaletteChange(HPALETTE Pal); |
extern void WMesaMove(void); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/ggimesa.h |
---|
0,0 → 1,87 |
/* $Id: ggimesa.h,v 1.1 2003-02-28 11:41:55 pj Exp $ */ |
/* |
* Mesa 3-D graphics library GGI bindings (GGIGL [giggle]) |
* Version: 4.0 |
* Copyright (C) 1995-2000 Brian Paul |
* Copyright (C) 1998 Uwe Maurer |
* Copyrigth (C) 2001 Filip Spacek |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
#ifndef GGIMESA_H |
#define GGIMESA_H |
#define GGIMESA_MAJOR_VERSION 4 |
#define GGIMESA_MINOR_VERSION 0 |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include <ggi/ggi.h> |
#include "GL/gl.h" |
typedef struct ggi_mesa_context *ggi_mesa_context_t; |
/* |
* Initialize Mesa GGI extension |
*/ |
int ggiMesaInit(void); |
/* |
* Clean up Mesa GGI exension |
*/ |
int ggiMesaExit(void); |
/* |
* Attach Mesa GGI extension to the visual 'vis' |
*/ |
int ggiMesaAttach(ggi_visual_t vis); |
/* |
* Detach Mesa GGI extension from the visual 'vis' |
*/ |
int ggiMesaDetach(ggi_visual_t vis); |
int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag, |
GLboolean stereo_flag, GLint depth_size, |
GLint stencil_size, GLint accum_red_size, |
GLint accum_green_size, GLint accum_blue_size, |
GLint accum_alpha_size, GLint num_samples); |
/* |
* Create a new context capable of displaying on the visual vis. |
*/ |
ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis); |
/* |
* Destroy the context 'ctx' |
*/ |
void ggiMesaDestroyContext(ggi_mesa_context_t ctx); |
/* |
* Make context 'ctx' the current context and bind it to visual 'vis'. |
* Note that the context must have been created with respect to that visual. |
*/ |
void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis); |
void ggiMesaSwapBuffers(void); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glx_mangle.h |
---|
0,0 → 1,57 |
/* $Id: glx_mangle.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
#ifndef GLX_MANGLE_H |
#define GLX_MANGLE_H |
#define glXChooseVisual mglXChooseVisual |
#define glXCreateContext mglXCreateContext |
#define glXDestroyContext mglXDestroyContext |
#define glXMakeCurrent mglXMakeCurrent |
#define glXCopyContext mglXCopyContext |
#define glXSwapBuffers mglXSwapBuffers |
#define glXCreateGLXPixmap mglXCreateGLXPixmap |
#define glXDestroyGLXPixmap mglXDestroyGLXPixmap |
#define glXQueryExtension mglXQueryExtension |
#define glXQueryVersion mglXQueryVersion |
#define glXIsDirect mglXIsDirect |
#define glXGetConfig mglXGetConfig |
#define glXGetCurrentContext mglXGetCurrentContext |
#define glXGetCurrentDrawable mglXGetCurrentDrawable |
#define glXWaitGL mglXWaitGL |
#define glXWaitX mglXWaitX |
#define glXUseXFont mglXUseXFont |
#define glXQueryExtensionsString mglXQueryExtensionsString |
#define glXQueryServerString mglXQueryServerString |
#define glXGetClientString mglXGetClientString |
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA |
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA |
#define glXCopySubBufferMESA mglXCopySubBufferMESA |
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI |
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI |
/* GLX 1.4 */ |
#define glXGetProcAddress mglXGetProcAddress |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/xmesa.h |
---|
0,0 → 1,392 |
/* $Id: xmesa.h,v 1.1 2003-02-28 11:41:57 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Mesa/X11 interface. This header file serves as the documentation for |
* the Mesa/X11 interface functions. |
* |
* Note: this interface isn't intended for user programs. It's primarily |
* just for implementing the pseudo-GLX interface. |
*/ |
/* Sample Usage: |
In addition to the usual X calls to select a visual, create a colormap |
and create a window, you must do the following to use the X/Mesa interface: |
1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo. |
2. Call XMesaCreateContext() to create an X/Mesa rendering context, given |
the XMesaVisual. |
3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window |
and XMesaVisual. |
4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and |
to make the context the current one. |
5. Make gl* calls to render your graphics. |
6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers. |
7. Before the X window is destroyed, call XMesaDestroyBuffer(). |
8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext. |
*/ |
#ifndef XMESA_H |
#define XMESA_H |
#ifdef __VMS |
#include <GL/vms_x_fix.h> |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
#ifdef XFree86Server |
#include "xmesa_xf86.h" |
#else |
#include <X11/Xlib.h> |
#include <X11/Xutil.h> |
#include "xmesa_x.h" |
#endif |
#include "GL/gl.h" |
#ifdef AMIWIN |
#include <pragmas/xlib_pragmas.h> |
extern struct Library *XLibBase; |
#endif |
#define XMESA_MAJOR_VERSION 4 |
#define XMESA_MINOR_VERSION 1 |
/* |
* Values passed to XMesaGetString: |
*/ |
#define XMESA_VERSION 1 |
#define XMESA_EXTENSIONS 2 |
/* |
* Values passed to XMesaSetFXmode: |
*/ |
#define XMESA_FX_WINDOW 1 |
#define XMESA_FX_FULLSCREEN 2 |
typedef struct xmesa_context *XMesaContext; |
typedef struct xmesa_visual *XMesaVisual; |
typedef struct xmesa_buffer *XMesaBuffer; |
/* |
* Create a new X/Mesa visual. |
* Input: display - X11 display |
* visinfo - an XVisualInfo pointer |
* rgb_flag - GL_TRUE = RGB mode, |
* GL_FALSE = color index mode |
* alpha_flag - alpha buffer requested? |
* db_flag - GL_TRUE = double-buffered, |
* GL_FALSE = single buffered |
* stereo_flag - stereo visual? |
* ximage_flag - GL_TRUE = use an XImage for back buffer, |
* GL_FALSE = use an off-screen pixmap for back buffer |
* depth_size - requested bits/depth values, or zero |
* stencil_size - requested bits/stencil values, or zero |
* accum_red_size - requested bits/red accum values, or zero |
* accum_green_size - requested bits/green accum values, or zero |
* accum_blue_size - requested bits/blue accum values, or zero |
* accum_alpha_size - requested bits/alpha accum values, or zero |
* num_samples - number of samples/pixel if multisampling, or zero |
* level - visual level, usually 0 |
* visualCaveat - ala the GLX extension, usually GLX_NONE_EXT |
* Return; a new XMesaVisual or 0 if error. |
*/ |
extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display, |
XMesaVisualInfo visinfo, |
GLboolean rgb_flag, |
GLboolean alpha_flag, |
GLboolean db_flag, |
GLboolean stereo_flag, |
GLboolean ximage_flag, |
GLint depth_size, |
GLint stencil_size, |
GLint accum_red_size, |
GLint accum_green_size, |
GLint accum_blue_size, |
GLint accum_alpha_size, |
GLint num_samples, |
GLint level, |
GLint visualCaveat ); |
/* |
* Destroy an XMesaVisual, but not the associated XVisualInfo. |
*/ |
extern void XMesaDestroyVisual( XMesaVisual v ); |
/* |
* Create a new XMesaContext for rendering into an X11 window. |
* |
* Input: visual - an XMesaVisual |
* share_list - another XMesaContext with which to share display |
* lists or NULL if no sharing is wanted. |
* Return: an XMesaContext or NULL if error. |
*/ |
extern XMesaContext XMesaCreateContext( XMesaVisual v, |
XMesaContext share_list ); |
/* |
* Destroy a rendering context as returned by XMesaCreateContext() |
*/ |
extern void XMesaDestroyContext( XMesaContext c ); |
/* |
* Create an XMesaBuffer from an X window. |
*/ |
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w ); |
/* |
* Create an XMesaBuffer from an X pixmap. |
*/ |
extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, |
XMesaPixmap p, |
XMesaColormap cmap ); |
/* |
* Destroy an XMesaBuffer, but not the corresponding window or pixmap. |
*/ |
extern void XMesaDestroyBuffer( XMesaBuffer b ); |
/* |
* Return the XMesaBuffer handle which corresponds to an X drawable, if any. |
* |
* New in Mesa 2.3. |
*/ |
extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, |
XMesaDrawable d ); |
/* |
* Bind a buffer to a context and make the context the current one. |
*/ |
extern GLboolean XMesaMakeCurrent( XMesaContext c, |
XMesaBuffer b ); |
/* |
* Bind two buffers (read and draw) to a context and make the |
* context the current one. |
* New in Mesa 3.3 |
*/ |
extern GLboolean XMesaMakeCurrent2( XMesaContext c, |
XMesaBuffer drawBuffer, |
XMesaBuffer readBuffer ); |
/* |
* Unbind the current context from its buffer. |
*/ |
extern GLboolean XMesaUnbindContext( XMesaContext c ); |
/* |
* Return a handle to the current context. |
*/ |
extern XMesaContext XMesaGetCurrentContext( void ); |
/* |
* Return handle to the current (draw) buffer. |
*/ |
extern XMesaBuffer XMesaGetCurrentBuffer( void ); |
/* |
* Return handle to the current read buffer. |
* New in Mesa 3.3 |
*/ |
extern XMesaBuffer XMesaGetCurrentReadBuffer( void ); |
/* |
* Swap the front and back buffers for the given buffer. No action is |
* taken if the buffer is not double buffered. |
*/ |
extern void XMesaSwapBuffers( XMesaBuffer b ); |
/* |
* Copy a sub-region of the back buffer to the front buffer. |
* |
* New in Mesa 2.6 |
*/ |
extern void XMesaCopySubBuffer( XMesaBuffer b, |
int x, |
int y, |
int width, |
int height ); |
/* |
* Return a pointer to the the Pixmap or XImage being used as the back |
* color buffer of an XMesaBuffer. This function is a way to get "under |
* the hood" of X/Mesa so one can manipulate the back buffer directly. |
* Input: b - the XMesaBuffer |
* Output: pixmap - pointer to back buffer's Pixmap, or 0 |
* ximage - pointer to back buffer's XImage, or NULL |
* Return: GL_TRUE = context is double buffered |
* GL_FALSE = context is single buffered |
*/ |
extern GLboolean XMesaGetBackBuffer( XMesaBuffer b, |
XMesaPixmap *pixmap, |
XMesaImage **ximage ); |
/* |
* Return the depth buffer associated with an XMesaBuffer. |
* Input: b - the XMesa buffer handle |
* Output: width, height - size of buffer in pixels |
* bytesPerValue - bytes per depth value (2 or 4) |
* buffer - pointer to depth buffer values |
* Return: GL_TRUE or GL_FALSE to indicate success or failure. |
* |
* New in Mesa 2.4. |
*/ |
extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b, |
GLint *width, |
GLint *height, |
GLint *bytesPerValue, |
void **buffer ); |
/* |
* Flush/sync a context |
*/ |
extern void XMesaFlush( XMesaContext c ); |
/* |
* Get an X/Mesa-specific string. |
* Input: name - either XMESA_VERSION or XMESA_EXTENSIONS |
*/ |
extern const char *XMesaGetString( XMesaContext c, int name ); |
/* |
* Scan for XMesaBuffers whose window/pixmap has been destroyed, then free |
* any memory used by that buffer. |
* |
* New in Mesa 2.3. |
*/ |
extern void XMesaGarbageCollect( void ); |
/* |
* Return a dithered pixel value. |
* Input: c - XMesaContext |
* x, y - window coordinate |
* red, green, blue, alpha - color components in [0,1] |
* Return: pixel value |
* |
* New in Mesa 2.3. |
*/ |
extern unsigned long XMesaDitherColor( XMesaContext xmesa, |
GLint x, |
GLint y, |
GLfloat red, |
GLfloat green, |
GLfloat blue, |
GLfloat alpha ); |
/* |
* 3Dfx Glide driver only! |
* Set 3Dfx/Glide full-screen or window rendering mode. |
* Input: mode - either XMESA_FX_WINDOW (window rendering mode) or |
* XMESA_FX_FULLSCREEN (full-screen rendering mode) |
* Return: GL_TRUE if success |
* GL_FALSE if invalid mode or if not using 3Dfx driver |
* |
* New in Mesa 2.6. |
*/ |
extern GLboolean XMesaSetFXmode( GLint mode ); |
/* |
* Reallocate the back/depth/stencil/accum/etc/ buffers associated with |
* buffer <b> if its size has changed. |
* |
* New in Mesa 4.0.2 |
*/ |
extern void XMesaResizeBuffers( XMesaBuffer b ); |
/* |
* Create a pbuffer. |
* New in Mesa 4.1 |
*/ |
extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, |
unsigned int width, unsigned int height); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/fxmesa.h |
---|
0,0 → 1,103 |
/* $Id: fxmesa.h,v 1.1 2003-02-28 11:41:55 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.0 |
* Copyright (C) 1995-2001 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* FXMesa - 3Dfx Glide driver for Mesa. Contributed by David Bucciarelli |
* |
* NOTE: This version requires Glide 2.3 or later. |
*/ |
#ifndef FXMESA_H |
#define FXMESA_H |
#include <glide.h> |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define FXMESA_MAJOR_VERSION 4 |
#define FXMESA_MINOR_VERSION 0 |
/* |
* Values for attribList parameter to fxMesaCreateContext(): |
*/ |
#define FXMESA_NONE 0 /* to terminate attribList */ |
#define FXMESA_DOUBLEBUFFER 10 |
#define FXMESA_ALPHA_SIZE 11 /* followed by an integer */ |
#define FXMESA_DEPTH_SIZE 12 /* followed by an integer */ |
#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */ |
#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */ |
typedef struct tfxMesaContext *fxMesaContext; |
#if defined (__BEOS__) |
#pragma export on |
#endif |
GLAPI fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GrScreenResolution_t, |
GrScreenRefresh_t, |
const GLint attribList[]); |
GLAPI fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win, |
GLint width, GLint height, |
const GLint attribList[]); |
GLAPI void GLAPIENTRY fxMesaDestroyContext(fxMesaContext ctx); |
GLAPI GLboolean GLAPIENTRY fxMesaSelectCurrentBoard(int n); |
GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx); |
GLAPI fxMesaContext GLAPIENTRY fxMesaGetCurrentContext(void); |
GLAPI void GLAPIENTRY fxMesaSwapBuffers(void); |
GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal); |
GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx); |
GLAPI int GLAPIENTRY fxQueryHardware(void); |
GLAPI void GLAPIENTRY fxCloseHardware(void); |
#if defined (__BEOS__) |
#pragma export off |
#endif |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/glext.h |
---|
0,0 → 1,5024 |
#ifndef __glext_h_ |
#define __glext_h_ |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* |
** License Applicability. Except to the extent portions of this file are |
** made subject to an alternative license as permitted in the SGI Free |
** Software License B, Version 1.1 (the "License"), the contents of this |
** file are subject only to the provisions of the License. You may not use |
** this file except in compliance with the License. You may obtain a copy |
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
** |
** http://oss.sgi.com/projects/FreeB |
** |
** Note that, as provided in the License, the Software is distributed on an |
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
** |
** Original Code. The Original Code is: OpenGL Sample Implementation, |
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc. |
** Copyright in any portions created by third parties is as indicated |
** elsewhere herein. All Rights Reserved. |
** |
** Additional Notice Provisions: This software was created using the |
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has |
** not been independently verified as being compliant with the OpenGL(R) |
** version 1.2.1 Specification. |
*/ |
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) |
#define WIN32_LEAN_AND_MEAN 1 |
#include <windows.h> |
#endif |
#ifndef APIENTRY |
#define APIENTRY |
#endif |
#ifndef GLAPI |
#define GLAPI extern |
#endif |
/*************************************************************/ |
/* Header file version number, required by OpenGL ABI for Linux */ |
/* glext.h last updated 2002/08/21 */ |
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ |
#define GL_GLEXT_VERSION 17 |
#ifndef GL_VERSION_1_2 |
#define GL_UNSIGNED_BYTE_3_3_2 0x8032 |
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 |
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 |
#define GL_UNSIGNED_INT_8_8_8_8 0x8035 |
#define GL_UNSIGNED_INT_10_10_10_2 0x8036 |
#define GL_RESCALE_NORMAL 0x803A |
#define GL_TEXTURE_BINDING_3D 0x806A |
#define GL_PACK_SKIP_IMAGES 0x806B |
#define GL_PACK_IMAGE_HEIGHT 0x806C |
#define GL_UNPACK_SKIP_IMAGES 0x806D |
#define GL_UNPACK_IMAGE_HEIGHT 0x806E |
#define GL_TEXTURE_3D 0x806F |
#define GL_PROXY_TEXTURE_3D 0x8070 |
#define GL_TEXTURE_DEPTH 0x8071 |
#define GL_TEXTURE_WRAP_R 0x8072 |
#define GL_MAX_3D_TEXTURE_SIZE 0x8073 |
#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 |
#define GL_UNSIGNED_SHORT_5_6_5 0x8363 |
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 |
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 |
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 |
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 |
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 |
#define GL_BGR 0x80E0 |
#define GL_BGRA 0x80E1 |
#define GL_MAX_ELEMENTS_VERTICES 0x80E8 |
#define GL_MAX_ELEMENTS_INDICES 0x80E9 |
#define GL_CLAMP_TO_EDGE 0x812F |
#define GL_TEXTURE_MIN_LOD 0x813A |
#define GL_TEXTURE_MAX_LOD 0x813B |
#define GL_TEXTURE_BASE_LEVEL 0x813C |
#define GL_TEXTURE_MAX_LEVEL 0x813D |
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 |
#define GL_SINGLE_COLOR 0x81F9 |
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA |
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 |
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 |
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 |
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 |
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D |
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E |
#endif |
#ifndef GL_ARB_imaging |
#define GL_CONSTANT_COLOR 0x8001 |
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 |
#define GL_CONSTANT_ALPHA 0x8003 |
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 |
#define GL_BLEND_COLOR 0x8005 |
#define GL_FUNC_ADD 0x8006 |
#define GL_MIN 0x8007 |
#define GL_MAX 0x8008 |
#define GL_BLEND_EQUATION 0x8009 |
#define GL_FUNC_SUBTRACT 0x800A |
#define GL_FUNC_REVERSE_SUBTRACT 0x800B |
#define GL_CONVOLUTION_1D 0x8010 |
#define GL_CONVOLUTION_2D 0x8011 |
#define GL_SEPARABLE_2D 0x8012 |
#define GL_CONVOLUTION_BORDER_MODE 0x8013 |
#define GL_CONVOLUTION_FILTER_SCALE 0x8014 |
#define GL_CONVOLUTION_FILTER_BIAS 0x8015 |
#define GL_REDUCE 0x8016 |
#define GL_CONVOLUTION_FORMAT 0x8017 |
#define GL_CONVOLUTION_WIDTH 0x8018 |
#define GL_CONVOLUTION_HEIGHT 0x8019 |
#define GL_MAX_CONVOLUTION_WIDTH 0x801A |
#define GL_MAX_CONVOLUTION_HEIGHT 0x801B |
#define GL_POST_CONVOLUTION_RED_SCALE 0x801C |
#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D |
#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E |
#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F |
#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 |
#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 |
#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 |
#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 |
#define GL_HISTOGRAM 0x8024 |
#define GL_PROXY_HISTOGRAM 0x8025 |
#define GL_HISTOGRAM_WIDTH 0x8026 |
#define GL_HISTOGRAM_FORMAT 0x8027 |
#define GL_HISTOGRAM_RED_SIZE 0x8028 |
#define GL_HISTOGRAM_GREEN_SIZE 0x8029 |
#define GL_HISTOGRAM_BLUE_SIZE 0x802A |
#define GL_HISTOGRAM_ALPHA_SIZE 0x802B |
#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C |
#define GL_HISTOGRAM_SINK 0x802D |
#define GL_MINMAX 0x802E |
#define GL_MINMAX_FORMAT 0x802F |
#define GL_MINMAX_SINK 0x8030 |
#define GL_TABLE_TOO_LARGE 0x8031 |
#define GL_COLOR_MATRIX 0x80B1 |
#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 |
#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 |
#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 |
#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 |
#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 |
#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 |
#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 |
#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 |
#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA |
#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB |
#define GL_COLOR_TABLE 0x80D0 |
#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 |
#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 |
#define GL_PROXY_COLOR_TABLE 0x80D3 |
#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 |
#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 |
#define GL_COLOR_TABLE_SCALE 0x80D6 |
#define GL_COLOR_TABLE_BIAS 0x80D7 |
#define GL_COLOR_TABLE_FORMAT 0x80D8 |
#define GL_COLOR_TABLE_WIDTH 0x80D9 |
#define GL_COLOR_TABLE_RED_SIZE 0x80DA |
#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB |
#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC |
#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD |
#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE |
#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF |
#define GL_CONSTANT_BORDER 0x8151 |
#define GL_REPLICATE_BORDER 0x8153 |
#define GL_CONVOLUTION_BORDER_COLOR 0x8154 |
#endif |
#ifndef GL_VERSION_1_3 |
#define GL_TEXTURE0 0x84C0 |
#define GL_TEXTURE1 0x84C1 |
#define GL_TEXTURE2 0x84C2 |
#define GL_TEXTURE3 0x84C3 |
#define GL_TEXTURE4 0x84C4 |
#define GL_TEXTURE5 0x84C5 |
#define GL_TEXTURE6 0x84C6 |
#define GL_TEXTURE7 0x84C7 |
#define GL_TEXTURE8 0x84C8 |
#define GL_TEXTURE9 0x84C9 |
#define GL_TEXTURE10 0x84CA |
#define GL_TEXTURE11 0x84CB |
#define GL_TEXTURE12 0x84CC |
#define GL_TEXTURE13 0x84CD |
#define GL_TEXTURE14 0x84CE |
#define GL_TEXTURE15 0x84CF |
#define GL_TEXTURE16 0x84D0 |
#define GL_TEXTURE17 0x84D1 |
#define GL_TEXTURE18 0x84D2 |
#define GL_TEXTURE19 0x84D3 |
#define GL_TEXTURE20 0x84D4 |
#define GL_TEXTURE21 0x84D5 |
#define GL_TEXTURE22 0x84D6 |
#define GL_TEXTURE23 0x84D7 |
#define GL_TEXTURE24 0x84D8 |
#define GL_TEXTURE25 0x84D9 |
#define GL_TEXTURE26 0x84DA |
#define GL_TEXTURE27 0x84DB |
#define GL_TEXTURE28 0x84DC |
#define GL_TEXTURE29 0x84DD |
#define GL_TEXTURE30 0x84DE |
#define GL_TEXTURE31 0x84DF |
#define GL_ACTIVE_TEXTURE 0x84E0 |
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 |
#define GL_MAX_TEXTURE_UNITS 0x84E2 |
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 |
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 |
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 |
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 |
#define GL_MULTISAMPLE 0x809D |
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E |
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F |
#define GL_SAMPLE_COVERAGE 0x80A0 |
#define GL_SAMPLE_BUFFERS 0x80A8 |
#define GL_SAMPLES 0x80A9 |
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA |
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB |
#define GL_MULTISAMPLE_BIT 0x20000000 |
#define GL_NORMAL_MAP 0x8511 |
#define GL_REFLECTION_MAP 0x8512 |
#define GL_TEXTURE_CUBE_MAP 0x8513 |
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A |
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B |
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C |
#define GL_COMPRESSED_ALPHA 0x84E9 |
#define GL_COMPRESSED_LUMINANCE 0x84EA |
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB |
#define GL_COMPRESSED_INTENSITY 0x84EC |
#define GL_COMPRESSED_RGB 0x84ED |
#define GL_COMPRESSED_RGBA 0x84EE |
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF |
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 |
#define GL_TEXTURE_COMPRESSED 0x86A1 |
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 |
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 |
#define GL_CLAMP_TO_BORDER 0x812D |
#define GL_CLAMP_TO_BORDER_SGIS 0x812D |
#define GL_COMBINE 0x8570 |
#define GL_COMBINE_RGB 0x8571 |
#define GL_COMBINE_ALPHA 0x8572 |
#define GL_SOURCE0_RGB 0x8580 |
#define GL_SOURCE1_RGB 0x8581 |
#define GL_SOURCE2_RGB 0x8582 |
#define GL_SOURCE0_ALPHA 0x8588 |
#define GL_SOURCE1_ALPHA 0x8589 |
#define GL_SOURCE2_ALPHA 0x858A |
#define GL_OPERAND0_RGB 0x8590 |
#define GL_OPERAND1_RGB 0x8591 |
#define GL_OPERAND2_RGB 0x8592 |
#define GL_OPERAND0_ALPHA 0x8598 |
#define GL_OPERAND1_ALPHA 0x8599 |
#define GL_OPERAND2_ALPHA 0x859A |
#define GL_RGB_SCALE 0x8573 |
#define GL_ADD_SIGNED 0x8574 |
#define GL_INTERPOLATE 0x8575 |
#define GL_SUBTRACT 0x84E7 |
#define GL_CONSTANT 0x8576 |
#define GL_PRIMARY_COLOR 0x8577 |
#define GL_PREVIOUS 0x8578 |
#define GL_DOT3_RGB 0x86AE |
#define GL_DOT3_RGBA 0x86AF |
#endif |
#ifndef GL_VERSION_1_4 |
#define GL_BLEND_DST_RGB 0x80C8 |
#define GL_BLEND_SRC_RGB 0x80C9 |
#define GL_BLEND_DST_ALPHA 0x80CA |
#define GL_BLEND_SRC_ALPHA 0x80CB |
#define GL_POINT_SIZE_MIN 0x8126 |
#define GL_POINT_SIZE_MAX 0x8127 |
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 |
#define GL_POINT_DISTANCE_ATTENUATION 0x8129 |
#define GL_GENERATE_MIPMAP 0x8191 |
#define GL_GENERATE_MIPMAP_HINT 0x8192 |
#define GL_DEPTH_COMPONENT16 0x81A5 |
#define GL_DEPTH_COMPONENT24 0x81A6 |
#define GL_DEPTH_COMPONENT32 0x81A7 |
#define GL_MIRRORED_REPEAT 0x8370 |
#define GL_FOG_COORDINATE_SOURCE 0x8450 |
#define GL_FOG_COORDINATE 0x8451 |
#define GL_FRAGMENT_DEPTH 0x8452 |
#define GL_CURRENT_FOG_COORDINATE 0x8453 |
#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 |
#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 |
#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 |
#define GL_FOG_COORDINATE_ARRAY 0x8457 |
#define GL_COLOR_SUM 0x8458 |
#define GL_CURRENT_SECONDARY_COLOR 0x8459 |
#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A |
#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B |
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C |
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D |
#define GL_SECONDARY_COLOR_ARRAY 0x845E |
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD |
#define GL_TEXTURE_FILTER_CONTROL 0x8500 |
#define GL_TEXTURE_LOD_BIAS 0x8501 |
#define GL_INCR_WRAP 0x8507 |
#define GL_DECR_WRAP 0x8508 |
#define GL_TEXTURE_DEPTH_SIZE 0x884A |
#define GL_DEPTH_TEXTURE_MODE 0x884B |
#define GL_TEXTURE_COMPARE_MODE 0x884C |
#define GL_TEXTURE_COMPARE_FUNC 0x884D |
#define GL_COMPARE_R_TO_TEXTURE 0x884E |
#endif |
#ifndef GL_ARB_multitexture |
#define GL_TEXTURE0_ARB 0x84C0 |
#define GL_TEXTURE1_ARB 0x84C1 |
#define GL_TEXTURE2_ARB 0x84C2 |
#define GL_TEXTURE3_ARB 0x84C3 |
#define GL_TEXTURE4_ARB 0x84C4 |
#define GL_TEXTURE5_ARB 0x84C5 |
#define GL_TEXTURE6_ARB 0x84C6 |
#define GL_TEXTURE7_ARB 0x84C7 |
#define GL_TEXTURE8_ARB 0x84C8 |
#define GL_TEXTURE9_ARB 0x84C9 |
#define GL_TEXTURE10_ARB 0x84CA |
#define GL_TEXTURE11_ARB 0x84CB |
#define GL_TEXTURE12_ARB 0x84CC |
#define GL_TEXTURE13_ARB 0x84CD |
#define GL_TEXTURE14_ARB 0x84CE |
#define GL_TEXTURE15_ARB 0x84CF |
#define GL_TEXTURE16_ARB 0x84D0 |
#define GL_TEXTURE17_ARB 0x84D1 |
#define GL_TEXTURE18_ARB 0x84D2 |
#define GL_TEXTURE19_ARB 0x84D3 |
#define GL_TEXTURE20_ARB 0x84D4 |
#define GL_TEXTURE21_ARB 0x84D5 |
#define GL_TEXTURE22_ARB 0x84D6 |
#define GL_TEXTURE23_ARB 0x84D7 |
#define GL_TEXTURE24_ARB 0x84D8 |
#define GL_TEXTURE25_ARB 0x84D9 |
#define GL_TEXTURE26_ARB 0x84DA |
#define GL_TEXTURE27_ARB 0x84DB |
#define GL_TEXTURE28_ARB 0x84DC |
#define GL_TEXTURE29_ARB 0x84DD |
#define GL_TEXTURE30_ARB 0x84DE |
#define GL_TEXTURE31_ARB 0x84DF |
#define GL_ACTIVE_TEXTURE_ARB 0x84E0 |
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 |
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 |
#endif |
#ifndef GL_ARB_transpose_matrix |
#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 |
#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 |
#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 |
#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 |
#endif |
#ifndef GL_ARB_multisample |
#define GL_MULTISAMPLE_ARB 0x809D |
#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E |
#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F |
#define GL_SAMPLE_COVERAGE_ARB 0x80A0 |
#define GL_SAMPLE_BUFFERS_ARB 0x80A8 |
#define GL_SAMPLES_ARB 0x80A9 |
#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA |
#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB |
#define GL_MULTISAMPLE_BIT_ARB 0x20000000 |
#endif |
#ifndef GL_ARB_texture_env_add |
#endif |
#ifndef GL_ARB_texture_cube_map |
#define GL_NORMAL_MAP_ARB 0x8511 |
#define GL_REFLECTION_MAP_ARB 0x8512 |
#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 |
#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A |
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B |
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C |
#endif |
#ifndef GL_ARB_texture_compression |
#define GL_COMPRESSED_ALPHA_ARB 0x84E9 |
#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA |
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB |
#define GL_COMPRESSED_INTENSITY_ARB 0x84EC |
#define GL_COMPRESSED_RGB_ARB 0x84ED |
#define GL_COMPRESSED_RGBA_ARB 0x84EE |
#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF |
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 |
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 |
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 |
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 |
#endif |
#ifndef GL_ARB_texture_border_clamp |
#define GL_CLAMP_TO_BORDER_ARB 0x812D |
#endif |
#ifndef GL_ARB_point_parameters |
#define GL_POINT_SIZE_MIN_ARB 0x8126 |
#define GL_POINT_SIZE_MAX_ARB 0x8127 |
#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 |
#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 |
#endif |
#ifndef GL_ARB_vertex_blend |
#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 |
#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 |
#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 |
#define GL_VERTEX_BLEND_ARB 0x86A7 |
#define GL_CURRENT_WEIGHT_ARB 0x86A8 |
#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 |
#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA |
#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB |
#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC |
#define GL_WEIGHT_ARRAY_ARB 0x86AD |
#define GL_MODELVIEW0_ARB 0x1700 |
#define GL_MODELVIEW1_ARB 0x850A |
#define GL_MODELVIEW2_ARB 0x8722 |
#define GL_MODELVIEW3_ARB 0x8723 |
#define GL_MODELVIEW4_ARB 0x8724 |
#define GL_MODELVIEW5_ARB 0x8725 |
#define GL_MODELVIEW6_ARB 0x8726 |
#define GL_MODELVIEW7_ARB 0x8727 |
#define GL_MODELVIEW8_ARB 0x8728 |
#define GL_MODELVIEW9_ARB 0x8729 |
#define GL_MODELVIEW10_ARB 0x872A |
#define GL_MODELVIEW11_ARB 0x872B |
#define GL_MODELVIEW12_ARB 0x872C |
#define GL_MODELVIEW13_ARB 0x872D |
#define GL_MODELVIEW14_ARB 0x872E |
#define GL_MODELVIEW15_ARB 0x872F |
#define GL_MODELVIEW16_ARB 0x8730 |
#define GL_MODELVIEW17_ARB 0x8731 |
#define GL_MODELVIEW18_ARB 0x8732 |
#define GL_MODELVIEW19_ARB 0x8733 |
#define GL_MODELVIEW20_ARB 0x8734 |
#define GL_MODELVIEW21_ARB 0x8735 |
#define GL_MODELVIEW22_ARB 0x8736 |
#define GL_MODELVIEW23_ARB 0x8737 |
#define GL_MODELVIEW24_ARB 0x8738 |
#define GL_MODELVIEW25_ARB 0x8739 |
#define GL_MODELVIEW26_ARB 0x873A |
#define GL_MODELVIEW27_ARB 0x873B |
#define GL_MODELVIEW28_ARB 0x873C |
#define GL_MODELVIEW29_ARB 0x873D |
#define GL_MODELVIEW30_ARB 0x873E |
#define GL_MODELVIEW31_ARB 0x873F |
#endif |
#ifndef GL_ARB_matrix_palette |
#define GL_MATRIX_PALETTE_ARB 0x8840 |
#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 |
#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 |
#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 |
#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 |
#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 |
#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 |
#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 |
#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 |
#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 |
#endif |
#ifndef GL_ARB_texture_env_combine |
#define GL_COMBINE_ARB 0x8570 |
#define GL_COMBINE_RGB_ARB 0x8571 |
#define GL_COMBINE_ALPHA_ARB 0x8572 |
#define GL_SOURCE0_RGB_ARB 0x8580 |
#define GL_SOURCE1_RGB_ARB 0x8581 |
#define GL_SOURCE2_RGB_ARB 0x8582 |
#define GL_SOURCE0_ALPHA_ARB 0x8588 |
#define GL_SOURCE1_ALPHA_ARB 0x8589 |
#define GL_SOURCE2_ALPHA_ARB 0x858A |
#define GL_OPERAND0_RGB_ARB 0x8590 |
#define GL_OPERAND1_RGB_ARB 0x8591 |
#define GL_OPERAND2_RGB_ARB 0x8592 |
#define GL_OPERAND0_ALPHA_ARB 0x8598 |
#define GL_OPERAND1_ALPHA_ARB 0x8599 |
#define GL_OPERAND2_ALPHA_ARB 0x859A |
#define GL_RGB_SCALE_ARB 0x8573 |
#define GL_ADD_SIGNED_ARB 0x8574 |
#define GL_INTERPOLATE_ARB 0x8575 |
#define GL_SUBTRACT_ARB 0x84E7 |
#define GL_CONSTANT_ARB 0x8576 |
#define GL_PRIMARY_COLOR_ARB 0x8577 |
#define GL_PREVIOUS_ARB 0x8578 |
#endif |
#ifndef GL_ARB_texture_env_crossbar |
#endif |
#ifndef GL_ARB_texture_env_dot3 |
#define GL_DOT3_RGB_ARB 0x86AE |
#define GL_DOT3_RGBA_ARB 0x86AF |
#endif |
#ifndef GL_ARB_texture_mirrored_repeat |
#define GL_MIRRORED_REPEAT_ARB 0x8370 |
#endif |
#ifndef GL_ARB_depth_texture |
#define GL_DEPTH_COMPONENT16_ARB 0x81A5 |
#define GL_DEPTH_COMPONENT24_ARB 0x81A6 |
#define GL_DEPTH_COMPONENT32_ARB 0x81A7 |
#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A |
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B |
#endif |
#ifndef GL_ARB_shadow |
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C |
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D |
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E |
#endif |
#ifndef GL_ARB_shadow_ambient |
#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF |
#endif |
#ifndef GL_ARB_window_pos |
#endif |
#ifndef GL_ARB_vertex_program |
#define GL_VERTEX_PROGRAM_ARB 0x8620 |
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 |
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 |
#define GL_COLOR_SUM_ARB 0x8458 |
#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 |
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 |
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 |
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 |
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 |
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A |
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 |
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 |
#define GL_PROGRAM_LENGTH_ARB 0x8627 |
#define GL_PROGRAM_FORMAT_ARB 0x8876 |
#define GL_PROGRAM_BINDING_ARB 0x8677 |
#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 |
#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 |
#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 |
#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 |
#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 |
#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 |
#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 |
#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 |
#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 |
#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 |
#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA |
#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB |
#define GL_PROGRAM_ATTRIBS_ARB 0x88AC |
#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD |
#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE |
#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF |
#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 |
#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 |
#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 |
#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 |
#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 |
#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 |
#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 |
#define GL_PROGRAM_STRING_ARB 0x8628 |
#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B |
#define GL_CURRENT_MATRIX_ARB 0x8641 |
#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 |
#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 |
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 |
#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F |
#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E |
#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 |
#define GL_MATRIX0_ARB 0x88C0 |
#define GL_MATRIX1_ARB 0x88C1 |
#define GL_MATRIX2_ARB 0x88C2 |
#define GL_MATRIX3_ARB 0x88C3 |
#define GL_MATRIX4_ARB 0x88C4 |
#define GL_MATRIX5_ARB 0x88C5 |
#define GL_MATRIX6_ARB 0x88C6 |
#define GL_MATRIX7_ARB 0x88C7 |
#define GL_MATRIX8_ARB 0x88C8 |
#define GL_MATRIX9_ARB 0x88C9 |
#define GL_MATRIX10_ARB 0x88CA |
#define GL_MATRIX11_ARB 0x88CB |
#define GL_MATRIX12_ARB 0x88CC |
#define GL_MATRIX13_ARB 0x88CD |
#define GL_MATRIX14_ARB 0x88CE |
#define GL_MATRIX15_ARB 0x88CF |
#define GL_MATRIX16_ARB 0x88D0 |
#define GL_MATRIX17_ARB 0x88D1 |
#define GL_MATRIX18_ARB 0x88D2 |
#define GL_MATRIX19_ARB 0x88D3 |
#define GL_MATRIX20_ARB 0x88D4 |
#define GL_MATRIX21_ARB 0x88D5 |
#define GL_MATRIX22_ARB 0x88D6 |
#define GL_MATRIX23_ARB 0x88D7 |
#define GL_MATRIX24_ARB 0x88D8 |
#define GL_MATRIX25_ARB 0x88D9 |
#define GL_MATRIX26_ARB 0x88DA |
#define GL_MATRIX27_ARB 0x88DB |
#define GL_MATRIX28_ARB 0x88DC |
#define GL_MATRIX29_ARB 0x88DD |
#define GL_MATRIX30_ARB 0x88DE |
#define GL_MATRIX31_ARB 0x88DF |
#endif |
#ifndef GL_EXT_abgr |
#define GL_ABGR_EXT 0x8000 |
#endif |
#ifndef GL_EXT_blend_color |
#define GL_CONSTANT_COLOR_EXT 0x8001 |
#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 |
#define GL_CONSTANT_ALPHA_EXT 0x8003 |
#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 |
#define GL_BLEND_COLOR_EXT 0x8005 |
#endif |
#ifndef GL_EXT_polygon_offset |
#define GL_POLYGON_OFFSET_EXT 0x8037 |
#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 |
#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 |
#endif |
#ifndef GL_EXT_texture |
#define GL_ALPHA4_EXT 0x803B |
#define GL_ALPHA8_EXT 0x803C |
#define GL_ALPHA12_EXT 0x803D |
#define GL_ALPHA16_EXT 0x803E |
#define GL_LUMINANCE4_EXT 0x803F |
#define GL_LUMINANCE8_EXT 0x8040 |
#define GL_LUMINANCE12_EXT 0x8041 |
#define GL_LUMINANCE16_EXT 0x8042 |
#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 |
#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 |
#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 |
#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 |
#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 |
#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 |
#define GL_INTENSITY_EXT 0x8049 |
#define GL_INTENSITY4_EXT 0x804A |
#define GL_INTENSITY8_EXT 0x804B |
#define GL_INTENSITY12_EXT 0x804C |
#define GL_INTENSITY16_EXT 0x804D |
#define GL_RGB2_EXT 0x804E |
#define GL_RGB4_EXT 0x804F |
#define GL_RGB5_EXT 0x8050 |
#define GL_RGB8_EXT 0x8051 |
#define GL_RGB10_EXT 0x8052 |
#define GL_RGB12_EXT 0x8053 |
#define GL_RGB16_EXT 0x8054 |
#define GL_RGBA2_EXT 0x8055 |
#define GL_RGBA4_EXT 0x8056 |
#define GL_RGB5_A1_EXT 0x8057 |
#define GL_RGBA8_EXT 0x8058 |
#define GL_RGB10_A2_EXT 0x8059 |
#define GL_RGBA12_EXT 0x805A |
#define GL_RGBA16_EXT 0x805B |
#define GL_TEXTURE_RED_SIZE_EXT 0x805C |
#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D |
#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E |
#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F |
#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 |
#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 |
#define GL_REPLACE_EXT 0x8062 |
#define GL_PROXY_TEXTURE_1D_EXT 0x8063 |
#define GL_PROXY_TEXTURE_2D_EXT 0x8064 |
#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 |
#endif |
#ifndef GL_EXT_texture3D |
#define GL_PACK_SKIP_IMAGES_EXT 0x806B |
#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C |
#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D |
#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E |
#define GL_TEXTURE_3D_EXT 0x806F |
#define GL_PROXY_TEXTURE_3D_EXT 0x8070 |
#define GL_TEXTURE_DEPTH_EXT 0x8071 |
#define GL_TEXTURE_WRAP_R_EXT 0x8072 |
#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 |
#endif |
#ifndef GL_SGIS_texture_filter4 |
#define GL_FILTER4_SGIS 0x8146 |
#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 |
#endif |
#ifndef GL_EXT_subtexture |
#endif |
#ifndef GL_EXT_copy_texture |
#endif |
#ifndef GL_EXT_histogram |
#define GL_HISTOGRAM_EXT 0x8024 |
#define GL_PROXY_HISTOGRAM_EXT 0x8025 |
#define GL_HISTOGRAM_WIDTH_EXT 0x8026 |
#define GL_HISTOGRAM_FORMAT_EXT 0x8027 |
#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 |
#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 |
#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A |
#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B |
#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C |
#define GL_HISTOGRAM_SINK_EXT 0x802D |
#define GL_MINMAX_EXT 0x802E |
#define GL_MINMAX_FORMAT_EXT 0x802F |
#define GL_MINMAX_SINK_EXT 0x8030 |
#define GL_TABLE_TOO_LARGE_EXT 0x8031 |
#endif |
#ifndef GL_EXT_convolution |
#define GL_CONVOLUTION_1D_EXT 0x8010 |
#define GL_CONVOLUTION_2D_EXT 0x8011 |
#define GL_SEPARABLE_2D_EXT 0x8012 |
#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 |
#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 |
#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 |
#define GL_REDUCE_EXT 0x8016 |
#define GL_CONVOLUTION_FORMAT_EXT 0x8017 |
#define GL_CONVOLUTION_WIDTH_EXT 0x8018 |
#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 |
#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A |
#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B |
#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C |
#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D |
#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E |
#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F |
#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 |
#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 |
#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 |
#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 |
#endif |
#ifndef GL_SGI_color_matrix |
#define GL_COLOR_MATRIX_SGI 0x80B1 |
#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 |
#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 |
#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 |
#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 |
#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 |
#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 |
#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 |
#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 |
#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA |
#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB |
#endif |
#ifndef GL_SGI_color_table |
#define GL_COLOR_TABLE_SGI 0x80D0 |
#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 |
#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 |
#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 |
#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 |
#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 |
#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 |
#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 |
#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 |
#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 |
#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA |
#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB |
#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC |
#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD |
#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE |
#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF |
#endif |
#ifndef GL_SGIS_pixel_texture |
#define GL_PIXEL_TEXTURE_SGIS 0x8353 |
#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 |
#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 |
#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 |
#endif |
#ifndef GL_SGIX_pixel_texture |
#define GL_PIXEL_TEX_GEN_SGIX 0x8139 |
#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B |
#endif |
#ifndef GL_SGIS_texture4D |
#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 |
#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 |
#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 |
#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 |
#define GL_TEXTURE_4D_SGIS 0x8134 |
#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 |
#define GL_TEXTURE_4DSIZE_SGIS 0x8136 |
#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 |
#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 |
#define GL_TEXTURE_4D_BINDING_SGIS 0x814F |
#endif |
#ifndef GL_SGI_texture_color_table |
#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC |
#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD |
#endif |
#ifndef GL_EXT_cmyka |
#define GL_CMYK_EXT 0x800C |
#define GL_CMYKA_EXT 0x800D |
#define GL_PACK_CMYK_HINT_EXT 0x800E |
#define GL_UNPACK_CMYK_HINT_EXT 0x800F |
#endif |
#ifndef GL_EXT_texture_object |
#define GL_TEXTURE_PRIORITY_EXT 0x8066 |
#define GL_TEXTURE_RESIDENT_EXT 0x8067 |
#define GL_TEXTURE_1D_BINDING_EXT 0x8068 |
#define GL_TEXTURE_2D_BINDING_EXT 0x8069 |
#define GL_TEXTURE_3D_BINDING_EXT 0x806A |
#endif |
#ifndef GL_SGIS_detail_texture |
#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 |
#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 |
#define GL_LINEAR_DETAIL_SGIS 0x8097 |
#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 |
#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 |
#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A |
#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B |
#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C |
#endif |
#ifndef GL_SGIS_sharpen_texture |
#define GL_LINEAR_SHARPEN_SGIS 0x80AD |
#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE |
#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF |
#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 |
#endif |
#ifndef GL_EXT_packed_pixels |
#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 |
#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 |
#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 |
#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 |
#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 |
#endif |
#ifndef GL_SGIS_texture_lod |
#define GL_TEXTURE_MIN_LOD_SGIS 0x813A |
#define GL_TEXTURE_MAX_LOD_SGIS 0x813B |
#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C |
#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D |
#endif |
#ifndef GL_SGIS_multisample |
#define GL_MULTISAMPLE_SGIS 0x809D |
#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E |
#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F |
#define GL_SAMPLE_MASK_SGIS 0x80A0 |
#define GL_1PASS_SGIS 0x80A1 |
#define GL_2PASS_0_SGIS 0x80A2 |
#define GL_2PASS_1_SGIS 0x80A3 |
#define GL_4PASS_0_SGIS 0x80A4 |
#define GL_4PASS_1_SGIS 0x80A5 |
#define GL_4PASS_2_SGIS 0x80A6 |
#define GL_4PASS_3_SGIS 0x80A7 |
#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 |
#define GL_SAMPLES_SGIS 0x80A9 |
#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA |
#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB |
#define GL_SAMPLE_PATTERN_SGIS 0x80AC |
#endif |
#ifndef GL_EXT_rescale_normal |
#define GL_RESCALE_NORMAL_EXT 0x803A |
#endif |
#ifndef GL_EXT_vertex_array |
#define GL_VERTEX_ARRAY_EXT 0x8074 |
#define GL_NORMAL_ARRAY_EXT 0x8075 |
#define GL_COLOR_ARRAY_EXT 0x8076 |
#define GL_INDEX_ARRAY_EXT 0x8077 |
#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 |
#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 |
#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A |
#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B |
#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C |
#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D |
#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E |
#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F |
#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 |
#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 |
#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 |
#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 |
#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 |
#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 |
#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 |
#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 |
#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 |
#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 |
#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A |
#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B |
#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C |
#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D |
#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E |
#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F |
#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 |
#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 |
#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 |
#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 |
#endif |
#ifndef GL_EXT_misc_attribute |
#endif |
#ifndef GL_SGIS_generate_mipmap |
#define GL_GENERATE_MIPMAP_SGIS 0x8191 |
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 |
#endif |
#ifndef GL_SGIX_clipmap |
#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 |
#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 |
#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 |
#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 |
#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 |
#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 |
#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 |
#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 |
#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 |
#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D |
#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E |
#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F |
#endif |
#ifndef GL_SGIX_shadow |
#define GL_TEXTURE_COMPARE_SGIX 0x819A |
#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B |
#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C |
#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D |
#endif |
#ifndef GL_SGIS_texture_edge_clamp |
#define GL_CLAMP_TO_EDGE_SGIS 0x812F |
#endif |
#ifndef GL_EXT_blend_minmax |
#define GL_FUNC_ADD_EXT 0x8006 |
#define GL_MIN_EXT 0x8007 |
#define GL_MAX_EXT 0x8008 |
#define GL_BLEND_EQUATION_EXT 0x8009 |
#endif |
#ifndef GL_EXT_blend_subtract |
#define GL_FUNC_SUBTRACT_EXT 0x800A |
#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B |
#endif |
#ifndef GL_EXT_blend_logic_op |
#endif |
#ifndef GL_SGIX_interlace |
#define GL_INTERLACE_SGIX 0x8094 |
#endif |
#ifndef GL_SGIX_pixel_tiles |
#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E |
#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F |
#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 |
#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 |
#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 |
#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 |
#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 |
#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 |
#endif |
#ifndef GL_SGIS_texture_select |
#define GL_DUAL_ALPHA4_SGIS 0x8110 |
#define GL_DUAL_ALPHA8_SGIS 0x8111 |
#define GL_DUAL_ALPHA12_SGIS 0x8112 |
#define GL_DUAL_ALPHA16_SGIS 0x8113 |
#define GL_DUAL_LUMINANCE4_SGIS 0x8114 |
#define GL_DUAL_LUMINANCE8_SGIS 0x8115 |
#define GL_DUAL_LUMINANCE12_SGIS 0x8116 |
#define GL_DUAL_LUMINANCE16_SGIS 0x8117 |
#define GL_DUAL_INTENSITY4_SGIS 0x8118 |
#define GL_DUAL_INTENSITY8_SGIS 0x8119 |
#define GL_DUAL_INTENSITY12_SGIS 0x811A |
#define GL_DUAL_INTENSITY16_SGIS 0x811B |
#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C |
#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D |
#define GL_QUAD_ALPHA4_SGIS 0x811E |
#define GL_QUAD_ALPHA8_SGIS 0x811F |
#define GL_QUAD_LUMINANCE4_SGIS 0x8120 |
#define GL_QUAD_LUMINANCE8_SGIS 0x8121 |
#define GL_QUAD_INTENSITY4_SGIS 0x8122 |
#define GL_QUAD_INTENSITY8_SGIS 0x8123 |
#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 |
#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 |
#endif |
#ifndef GL_SGIX_sprite |
#define GL_SPRITE_SGIX 0x8148 |
#define GL_SPRITE_MODE_SGIX 0x8149 |
#define GL_SPRITE_AXIS_SGIX 0x814A |
#define GL_SPRITE_TRANSLATION_SGIX 0x814B |
#define GL_SPRITE_AXIAL_SGIX 0x814C |
#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D |
#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E |
#endif |
#ifndef GL_SGIX_texture_multi_buffer |
#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E |
#endif |
#ifndef GL_EXT_point_parameters |
#define GL_POINT_SIZE_MIN_EXT 0x8126 |
#define GL_POINT_SIZE_MAX_EXT 0x8127 |
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 |
#define GL_DISTANCE_ATTENUATION_EXT 0x8129 |
#endif |
#ifndef GL_SGIS_point_parameters |
#define GL_POINT_SIZE_MIN_SGIS 0x8126 |
#define GL_POINT_SIZE_MAX_SGIS 0x8127 |
#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 |
#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 |
#endif |
#ifndef GL_SGIX_instruments |
#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 |
#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 |
#endif |
#ifndef GL_SGIX_texture_scale_bias |
#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 |
#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A |
#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B |
#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C |
#endif |
#ifndef GL_SGIX_framezoom |
#define GL_FRAMEZOOM_SGIX 0x818B |
#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C |
#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D |
#endif |
#ifndef GL_SGIX_tag_sample_buffer |
#endif |
#ifndef GL_FfdMaskSGIX |
#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 |
#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 |
#endif |
#ifndef GL_SGIX_polynomial_ffd |
#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 |
#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 |
#define GL_DEFORMATIONS_MASK_SGIX 0x8196 |
#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 |
#endif |
#ifndef GL_SGIX_reference_plane |
#define GL_REFERENCE_PLANE_SGIX 0x817D |
#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E |
#endif |
#ifndef GL_SGIX_flush_raster |
#endif |
#ifndef GL_SGIX_depth_texture |
#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 |
#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 |
#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 |
#endif |
#ifndef GL_SGIS_fog_function |
#define GL_FOG_FUNC_SGIS 0x812A |
#define GL_FOG_FUNC_POINTS_SGIS 0x812B |
#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C |
#endif |
#ifndef GL_SGIX_fog_offset |
#define GL_FOG_OFFSET_SGIX 0x8198 |
#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 |
#endif |
#ifndef GL_HP_image_transform |
#define GL_IMAGE_SCALE_X_HP 0x8155 |
#define GL_IMAGE_SCALE_Y_HP 0x8156 |
#define GL_IMAGE_TRANSLATE_X_HP 0x8157 |
#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 |
#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 |
#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A |
#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B |
#define GL_IMAGE_MAG_FILTER_HP 0x815C |
#define GL_IMAGE_MIN_FILTER_HP 0x815D |
#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E |
#define GL_CUBIC_HP 0x815F |
#define GL_AVERAGE_HP 0x8160 |
#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 |
#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 |
#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 |
#endif |
#ifndef GL_HP_convolution_border_modes |
#define GL_IGNORE_BORDER_HP 0x8150 |
#define GL_CONSTANT_BORDER_HP 0x8151 |
#define GL_REPLICATE_BORDER_HP 0x8153 |
#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 |
#endif |
#ifndef GL_INGR_palette_buffer |
#endif |
#ifndef GL_SGIX_texture_add_env |
#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE |
#endif |
#ifndef GL_EXT_color_subtable |
#endif |
#ifndef GL_PGI_vertex_hints |
#define GL_VERTEX_DATA_HINT_PGI 0x1A22A |
#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B |
#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C |
#define GL_MAX_VERTEX_HINT_PGI 0x1A22D |
#define GL_COLOR3_BIT_PGI 0x00010000 |
#define GL_COLOR4_BIT_PGI 0x00020000 |
#define GL_EDGEFLAG_BIT_PGI 0x00040000 |
#define GL_INDEX_BIT_PGI 0x00080000 |
#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 |
#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 |
#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 |
#define GL_MAT_EMISSION_BIT_PGI 0x00800000 |
#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 |
#define GL_MAT_SHININESS_BIT_PGI 0x02000000 |
#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 |
#define GL_NORMAL_BIT_PGI 0x08000000 |
#define GL_TEXCOORD1_BIT_PGI 0x10000000 |
#define GL_TEXCOORD2_BIT_PGI 0x20000000 |
#define GL_TEXCOORD3_BIT_PGI 0x40000000 |
#define GL_TEXCOORD4_BIT_PGI 0x80000000 |
#define GL_VERTEX23_BIT_PGI 0x00000004 |
#define GL_VERTEX4_BIT_PGI 0x00000008 |
#endif |
#ifndef GL_PGI_misc_hints |
#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 |
#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD |
#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE |
#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 |
#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 |
#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 |
#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C |
#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D |
#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E |
#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F |
#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 |
#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 |
#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 |
#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 |
#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 |
#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 |
#define GL_CLIP_NEAR_HINT_PGI 0x1A220 |
#define GL_CLIP_FAR_HINT_PGI 0x1A221 |
#define GL_WIDE_LINE_HINT_PGI 0x1A222 |
#define GL_BACK_NORMALS_HINT_PGI 0x1A223 |
#endif |
#ifndef GL_EXT_paletted_texture |
#define GL_COLOR_INDEX1_EXT 0x80E2 |
#define GL_COLOR_INDEX2_EXT 0x80E3 |
#define GL_COLOR_INDEX4_EXT 0x80E4 |
#define GL_COLOR_INDEX8_EXT 0x80E5 |
#define GL_COLOR_INDEX12_EXT 0x80E6 |
#define GL_COLOR_INDEX16_EXT 0x80E7 |
#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED |
#endif |
#ifndef GL_EXT_clip_volume_hint |
#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 |
#endif |
#ifndef GL_SGIX_list_priority |
#define GL_LIST_PRIORITY_SGIX 0x8182 |
#endif |
#ifndef GL_SGIX_ir_instrument1 |
#define GL_IR_INSTRUMENT1_SGIX 0x817F |
#endif |
#ifndef GL_SGIX_calligraphic_fragment |
#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 |
#endif |
#ifndef GL_SGIX_texture_lod_bias |
#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E |
#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F |
#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 |
#endif |
#ifndef GL_SGIX_shadow_ambient |
#define GL_SHADOW_AMBIENT_SGIX 0x80BF |
#endif |
#ifndef GL_EXT_index_texture |
#endif |
#ifndef GL_EXT_index_material |
#define GL_INDEX_MATERIAL_EXT 0x81B8 |
#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 |
#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA |
#endif |
#ifndef GL_EXT_index_func |
#define GL_INDEX_TEST_EXT 0x81B5 |
#define GL_INDEX_TEST_FUNC_EXT 0x81B6 |
#define GL_INDEX_TEST_REF_EXT 0x81B7 |
#endif |
#ifndef GL_EXT_index_array_formats |
#define GL_IUI_V2F_EXT 0x81AD |
#define GL_IUI_V3F_EXT 0x81AE |
#define GL_IUI_N3F_V2F_EXT 0x81AF |
#define GL_IUI_N3F_V3F_EXT 0x81B0 |
#define GL_T2F_IUI_V2F_EXT 0x81B1 |
#define GL_T2F_IUI_V3F_EXT 0x81B2 |
#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 |
#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 |
#endif |
#ifndef GL_EXT_compiled_vertex_array |
#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 |
#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 |
#endif |
#ifndef GL_EXT_cull_vertex |
#define GL_CULL_VERTEX_EXT 0x81AA |
#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB |
#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC |
#endif |
#ifndef GL_SGIX_ycrcb |
#define GL_YCRCB_422_SGIX 0x81BB |
#define GL_YCRCB_444_SGIX 0x81BC |
#endif |
#ifndef GL_SGIX_fragment_lighting |
#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 |
#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 |
#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 |
#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 |
#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 |
#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 |
#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 |
#define GL_LIGHT_ENV_MODE_SGIX 0x8407 |
#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 |
#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 |
#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A |
#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B |
#define GL_FRAGMENT_LIGHT0_SGIX 0x840C |
#define GL_FRAGMENT_LIGHT1_SGIX 0x840D |
#define GL_FRAGMENT_LIGHT2_SGIX 0x840E |
#define GL_FRAGMENT_LIGHT3_SGIX 0x840F |
#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 |
#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 |
#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 |
#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 |
#endif |
#ifndef GL_IBM_rasterpos_clip |
#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 |
#endif |
#ifndef GL_HP_texture_lighting |
#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 |
#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 |
#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 |
#endif |
#ifndef GL_EXT_draw_range_elements |
#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 |
#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 |
#endif |
#ifndef GL_WIN_phong_shading |
#define GL_PHONG_WIN 0x80EA |
#define GL_PHONG_HINT_WIN 0x80EB |
#endif |
#ifndef GL_WIN_specular_fog |
#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC |
#endif |
#ifndef GL_EXT_light_texture |
#define GL_FRAGMENT_MATERIAL_EXT 0x8349 |
#define GL_FRAGMENT_NORMAL_EXT 0x834A |
#define GL_FRAGMENT_COLOR_EXT 0x834C |
#define GL_ATTENUATION_EXT 0x834D |
#define GL_SHADOW_ATTENUATION_EXT 0x834E |
#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F |
#define GL_TEXTURE_LIGHT_EXT 0x8350 |
#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 |
#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 |
/* reuse GL_FRAGMENT_DEPTH_EXT */ |
#endif |
#ifndef GL_SGIX_blend_alpha_minmax |
#define GL_ALPHA_MIN_SGIX 0x8320 |
#define GL_ALPHA_MAX_SGIX 0x8321 |
#endif |
#ifndef GL_SGIX_impact_pixel_texture |
#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 |
#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 |
#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 |
#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 |
#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 |
#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 |
#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A |
#endif |
#ifndef GL_EXT_bgra |
#define GL_BGR_EXT 0x80E0 |
#define GL_BGRA_EXT 0x80E1 |
#endif |
#ifndef GL_SGIX_async |
#define GL_ASYNC_MARKER_SGIX 0x8329 |
#endif |
#ifndef GL_SGIX_async_pixel |
#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C |
#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D |
#define GL_ASYNC_READ_PIXELS_SGIX 0x835E |
#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F |
#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 |
#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 |
#endif |
#ifndef GL_SGIX_async_histogram |
#define GL_ASYNC_HISTOGRAM_SGIX 0x832C |
#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D |
#endif |
#ifndef GL_INTEL_texture_scissor |
#endif |
#ifndef GL_INTEL_parallel_arrays |
#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 |
#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 |
#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 |
#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 |
#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 |
#endif |
#ifndef GL_HP_occlusion_test |
#define GL_OCCLUSION_TEST_HP 0x8165 |
#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 |
#endif |
#ifndef GL_EXT_pixel_transform |
#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 |
#define GL_PIXEL_MAG_FILTER_EXT 0x8331 |
#define GL_PIXEL_MIN_FILTER_EXT 0x8332 |
#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 |
#define GL_CUBIC_EXT 0x8334 |
#define GL_AVERAGE_EXT 0x8335 |
#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 |
#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 |
#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 |
#endif |
#ifndef GL_EXT_pixel_transform_color_table |
#endif |
#ifndef GL_EXT_shared_texture_palette |
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB |
#endif |
#ifndef GL_EXT_separate_specular_color |
#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 |
#define GL_SINGLE_COLOR_EXT 0x81F9 |
#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA |
#endif |
#ifndef GL_EXT_secondary_color |
#define GL_COLOR_SUM_EXT 0x8458 |
#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 |
#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A |
#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B |
#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C |
#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D |
#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E |
#endif |
#ifndef GL_EXT_texture_perturb_normal |
#define GL_PERTURB_EXT 0x85AE |
#define GL_TEXTURE_NORMAL_EXT 0x85AF |
#endif |
#ifndef GL_EXT_multi_draw_arrays |
#endif |
#ifndef GL_EXT_fog_coord |
#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 |
#define GL_FOG_COORDINATE_EXT 0x8451 |
#define GL_FRAGMENT_DEPTH_EXT 0x8452 |
#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 |
#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 |
#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 |
#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 |
#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 |
#endif |
#ifndef GL_REND_screen_coordinates |
#define GL_SCREEN_COORDINATES_REND 0x8490 |
#define GL_INVERTED_SCREEN_W_REND 0x8491 |
#endif |
#ifndef GL_EXT_coordinate_frame |
#define GL_TANGENT_ARRAY_EXT 0x8439 |
#define GL_BINORMAL_ARRAY_EXT 0x843A |
#define GL_CURRENT_TANGENT_EXT 0x843B |
#define GL_CURRENT_BINORMAL_EXT 0x843C |
#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E |
#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F |
#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 |
#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 |
#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 |
#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 |
#define GL_MAP1_TANGENT_EXT 0x8444 |
#define GL_MAP2_TANGENT_EXT 0x8445 |
#define GL_MAP1_BINORMAL_EXT 0x8446 |
#define GL_MAP2_BINORMAL_EXT 0x8447 |
#endif |
#ifndef GL_EXT_texture_env_combine |
#define GL_COMBINE_EXT 0x8570 |
#define GL_COMBINE_RGB_EXT 0x8571 |
#define GL_COMBINE_ALPHA_EXT 0x8572 |
#define GL_RGB_SCALE_EXT 0x8573 |
#define GL_ADD_SIGNED_EXT 0x8574 |
#define GL_INTERPOLATE_EXT 0x8575 |
#define GL_CONSTANT_EXT 0x8576 |
#define GL_PRIMARY_COLOR_EXT 0x8577 |
#define GL_PREVIOUS_EXT 0x8578 |
#define GL_SOURCE0_RGB_EXT 0x8580 |
#define GL_SOURCE1_RGB_EXT 0x8581 |
#define GL_SOURCE2_RGB_EXT 0x8582 |
#define GL_SOURCE0_ALPHA_EXT 0x8588 |
#define GL_SOURCE1_ALPHA_EXT 0x8589 |
#define GL_SOURCE2_ALPHA_EXT 0x858A |
#define GL_OPERAND0_RGB_EXT 0x8590 |
#define GL_OPERAND1_RGB_EXT 0x8591 |
#define GL_OPERAND2_RGB_EXT 0x8592 |
#define GL_OPERAND0_ALPHA_EXT 0x8598 |
#define GL_OPERAND1_ALPHA_EXT 0x8599 |
#define GL_OPERAND2_ALPHA_EXT 0x859A |
#endif |
#ifndef GL_APPLE_specular_vector |
#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 |
#endif |
#ifndef GL_APPLE_transform_hint |
#define GL_TRANSFORM_HINT_APPLE 0x85B1 |
#endif |
#ifndef GL_SGIX_fog_scale |
#define GL_FOG_SCALE_SGIX 0x81FC |
#define GL_FOG_SCALE_VALUE_SGIX 0x81FD |
#endif |
#ifndef GL_SUNX_constant_data |
#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 |
#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 |
#endif |
#ifndef GL_SUN_global_alpha |
#define GL_GLOBAL_ALPHA_SUN 0x81D9 |
#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA |
#endif |
#ifndef GL_SUN_triangle_list |
#define GL_RESTART_SUN 0x0001 |
#define GL_REPLACE_MIDDLE_SUN 0x0002 |
#define GL_REPLACE_OLDEST_SUN 0x0003 |
#define GL_TRIANGLE_LIST_SUN 0x81D7 |
#define GL_REPLACEMENT_CODE_SUN 0x81D8 |
#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 |
#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 |
#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 |
#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 |
#define GL_R1UI_V3F_SUN 0x85C4 |
#define GL_R1UI_C4UB_V3F_SUN 0x85C5 |
#define GL_R1UI_C3F_V3F_SUN 0x85C6 |
#define GL_R1UI_N3F_V3F_SUN 0x85C7 |
#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 |
#define GL_R1UI_T2F_V3F_SUN 0x85C9 |
#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA |
#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB |
#endif |
#ifndef GL_SUN_vertex |
#endif |
#ifndef GL_EXT_blend_func_separate |
#define GL_BLEND_DST_RGB_EXT 0x80C8 |
#define GL_BLEND_SRC_RGB_EXT 0x80C9 |
#define GL_BLEND_DST_ALPHA_EXT 0x80CA |
#define GL_BLEND_SRC_ALPHA_EXT 0x80CB |
#endif |
#ifndef GL_INGR_color_clamp |
#define GL_RED_MIN_CLAMP_INGR 0x8560 |
#define GL_GREEN_MIN_CLAMP_INGR 0x8561 |
#define GL_BLUE_MIN_CLAMP_INGR 0x8562 |
#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 |
#define GL_RED_MAX_CLAMP_INGR 0x8564 |
#define GL_GREEN_MAX_CLAMP_INGR 0x8565 |
#define GL_BLUE_MAX_CLAMP_INGR 0x8566 |
#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 |
#endif |
#ifndef GL_INGR_interlace_read |
#define GL_INTERLACE_READ_INGR 0x8568 |
#endif |
#ifndef GL_EXT_stencil_wrap |
#define GL_INCR_WRAP_EXT 0x8507 |
#define GL_DECR_WRAP_EXT 0x8508 |
#endif |
#ifndef GL_EXT_422_pixels |
#define GL_422_EXT 0x80CC |
#define GL_422_REV_EXT 0x80CD |
#define GL_422_AVERAGE_EXT 0x80CE |
#define GL_422_REV_AVERAGE_EXT 0x80CF |
#endif |
#ifndef GL_NV_texgen_reflection |
#define GL_NORMAL_MAP_NV 0x8511 |
#define GL_REFLECTION_MAP_NV 0x8512 |
#endif |
#ifndef GL_EXT_texture_cube_map |
#define GL_NORMAL_MAP_EXT 0x8511 |
#define GL_REFLECTION_MAP_EXT 0x8512 |
#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 |
#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 |
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A |
#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B |
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C |
#endif |
#ifndef GL_SUN_convolution_border_modes |
#define GL_WRAP_BORDER_SUN 0x81D4 |
#endif |
#ifndef GL_EXT_texture_env_add |
#endif |
#ifndef GL_EXT_texture_lod_bias |
#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD |
#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 |
#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 |
#endif |
#ifndef GL_EXT_texture_filter_anisotropic |
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE |
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF |
#endif |
#ifndef GL_EXT_vertex_weighting |
#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH |
#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 |
#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX |
#define GL_MODELVIEW1_MATRIX_EXT 0x8506 |
#define GL_VERTEX_WEIGHTING_EXT 0x8509 |
#define GL_MODELVIEW0_EXT GL_MODELVIEW |
#define GL_MODELVIEW1_EXT 0x850A |
#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B |
#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C |
#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D |
#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E |
#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F |
#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 |
#endif |
#ifndef GL_NV_light_max_exponent |
#define GL_MAX_SHININESS_NV 0x8504 |
#define GL_MAX_SPOT_EXPONENT_NV 0x8505 |
#endif |
#ifndef GL_NV_vertex_array_range |
#define GL_VERTEX_ARRAY_RANGE_NV 0x851D |
#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E |
#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F |
#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 |
#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 |
#endif |
#ifndef GL_NV_register_combiners |
#define GL_REGISTER_COMBINERS_NV 0x8522 |
#define GL_VARIABLE_A_NV 0x8523 |
#define GL_VARIABLE_B_NV 0x8524 |
#define GL_VARIABLE_C_NV 0x8525 |
#define GL_VARIABLE_D_NV 0x8526 |
#define GL_VARIABLE_E_NV 0x8527 |
#define GL_VARIABLE_F_NV 0x8528 |
#define GL_VARIABLE_G_NV 0x8529 |
#define GL_CONSTANT_COLOR0_NV 0x852A |
#define GL_CONSTANT_COLOR1_NV 0x852B |
#define GL_PRIMARY_COLOR_NV 0x852C |
#define GL_SECONDARY_COLOR_NV 0x852D |
#define GL_SPARE0_NV 0x852E |
#define GL_SPARE1_NV 0x852F |
#define GL_DISCARD_NV 0x8530 |
#define GL_E_TIMES_F_NV 0x8531 |
#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 |
#define GL_UNSIGNED_IDENTITY_NV 0x8536 |
#define GL_UNSIGNED_INVERT_NV 0x8537 |
#define GL_EXPAND_NORMAL_NV 0x8538 |
#define GL_EXPAND_NEGATE_NV 0x8539 |
#define GL_HALF_BIAS_NORMAL_NV 0x853A |
#define GL_HALF_BIAS_NEGATE_NV 0x853B |
#define GL_SIGNED_IDENTITY_NV 0x853C |
#define GL_SIGNED_NEGATE_NV 0x853D |
#define GL_SCALE_BY_TWO_NV 0x853E |
#define GL_SCALE_BY_FOUR_NV 0x853F |
#define GL_SCALE_BY_ONE_HALF_NV 0x8540 |
#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 |
#define GL_COMBINER_INPUT_NV 0x8542 |
#define GL_COMBINER_MAPPING_NV 0x8543 |
#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 |
#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 |
#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 |
#define GL_COMBINER_MUX_SUM_NV 0x8547 |
#define GL_COMBINER_SCALE_NV 0x8548 |
#define GL_COMBINER_BIAS_NV 0x8549 |
#define GL_COMBINER_AB_OUTPUT_NV 0x854A |
#define GL_COMBINER_CD_OUTPUT_NV 0x854B |
#define GL_COMBINER_SUM_OUTPUT_NV 0x854C |
#define GL_MAX_GENERAL_COMBINERS_NV 0x854D |
#define GL_NUM_GENERAL_COMBINERS_NV 0x854E |
#define GL_COLOR_SUM_CLAMP_NV 0x854F |
#define GL_COMBINER0_NV 0x8550 |
#define GL_COMBINER1_NV 0x8551 |
#define GL_COMBINER2_NV 0x8552 |
#define GL_COMBINER3_NV 0x8553 |
#define GL_COMBINER4_NV 0x8554 |
#define GL_COMBINER5_NV 0x8555 |
#define GL_COMBINER6_NV 0x8556 |
#define GL_COMBINER7_NV 0x8557 |
/* reuse GL_TEXTURE0_ARB */ |
/* reuse GL_TEXTURE1_ARB */ |
/* reuse GL_ZERO */ |
/* reuse GL_NONE */ |
/* reuse GL_FOG */ |
#endif |
#ifndef GL_NV_fog_distance |
#define GL_FOG_DISTANCE_MODE_NV 0x855A |
#define GL_EYE_RADIAL_NV 0x855B |
#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C |
/* reuse GL_EYE_PLANE */ |
#endif |
#ifndef GL_NV_texgen_emboss |
#define GL_EMBOSS_LIGHT_NV 0x855D |
#define GL_EMBOSS_CONSTANT_NV 0x855E |
#define GL_EMBOSS_MAP_NV 0x855F |
#endif |
#ifndef GL_NV_blend_square |
#endif |
#ifndef GL_NV_texture_env_combine4 |
#define GL_COMBINE4_NV 0x8503 |
#define GL_SOURCE3_RGB_NV 0x8583 |
#define GL_SOURCE3_ALPHA_NV 0x858B |
#define GL_OPERAND3_RGB_NV 0x8593 |
#define GL_OPERAND3_ALPHA_NV 0x859B |
#endif |
#ifndef GL_MESA_resize_buffers |
#endif |
#ifndef GL_MESA_window_pos |
#endif |
#ifndef GL_EXT_texture_compression_s3tc |
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 |
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 |
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 |
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 |
#endif |
#ifndef GL_IBM_cull_vertex |
#define GL_CULL_VERTEX_IBM 103050 |
#endif |
#ifndef GL_IBM_multimode_draw_arrays |
#endif |
#ifndef GL_IBM_vertex_array_lists |
#define GL_VERTEX_ARRAY_LIST_IBM 103070 |
#define GL_NORMAL_ARRAY_LIST_IBM 103071 |
#define GL_COLOR_ARRAY_LIST_IBM 103072 |
#define GL_INDEX_ARRAY_LIST_IBM 103073 |
#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 |
#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 |
#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 |
#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 |
#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 |
#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 |
#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 |
#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 |
#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 |
#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 |
#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 |
#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 |
#endif |
#ifndef GL_SGIX_subsample |
#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 |
#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 |
#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 |
#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 |
#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 |
#endif |
#ifndef GL_SGIX_ycrcb_subsample |
#endif |
#ifndef GL_SGIX_ycrcba |
#define GL_YCRCB_SGIX 0x8318 |
#define GL_YCRCBA_SGIX 0x8319 |
#endif |
#ifndef GL_SGI_depth_pass_instrument |
#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 |
#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 |
#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 |
#endif |
#ifndef GL_3DFX_texture_compression_FXT1 |
#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 |
#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 |
#endif |
#ifndef GL_3DFX_multisample |
#define GL_MULTISAMPLE_3DFX 0x86B2 |
#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 |
#define GL_SAMPLES_3DFX 0x86B4 |
#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 |
#endif |
#ifndef GL_3DFX_tbuffer |
#endif |
#ifndef GL_EXT_multisample |
#define GL_MULTISAMPLE_EXT 0x809D |
#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E |
#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F |
#define GL_SAMPLE_MASK_EXT 0x80A0 |
#define GL_1PASS_EXT 0x80A1 |
#define GL_2PASS_0_EXT 0x80A2 |
#define GL_2PASS_1_EXT 0x80A3 |
#define GL_4PASS_0_EXT 0x80A4 |
#define GL_4PASS_1_EXT 0x80A5 |
#define GL_4PASS_2_EXT 0x80A6 |
#define GL_4PASS_3_EXT 0x80A7 |
#define GL_SAMPLE_BUFFERS_EXT 0x80A8 |
#define GL_SAMPLES_EXT 0x80A9 |
#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA |
#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB |
#define GL_SAMPLE_PATTERN_EXT 0x80AC |
#define GL_MULTISAMPLE_BIT_EXT 0x20000000 |
#endif |
#ifndef GL_SGIX_vertex_preclip |
#define GL_VERTEX_PRECLIP_SGIX 0x83EE |
#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF |
#endif |
#ifndef GL_SGIX_convolution_accuracy |
#define GL_CONVOLUTION_HINT_SGIX 0x8316 |
#endif |
#ifndef GL_SGIX_resample |
#define GL_PACK_RESAMPLE_SGIX 0x842C |
#define GL_UNPACK_RESAMPLE_SGIX 0x842D |
#define GL_RESAMPLE_REPLICATE_SGIX 0x842E |
#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F |
#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 |
#endif |
#ifndef GL_SGIS_point_line_texgen |
#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 |
#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 |
#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 |
#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 |
#define GL_EYE_POINT_SGIS 0x81F4 |
#define GL_OBJECT_POINT_SGIS 0x81F5 |
#define GL_EYE_LINE_SGIS 0x81F6 |
#define GL_OBJECT_LINE_SGIS 0x81F7 |
#endif |
#ifndef GL_SGIS_texture_color_mask |
#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF |
#endif |
#ifndef GL_EXT_texture_env_dot3 |
#define GL_DOT3_RGB_EXT 0x8740 |
#define GL_DOT3_RGBA_EXT 0x8741 |
#endif |
#ifndef GL_ATI_texture_mirror_once |
#define GL_MIRROR_CLAMP_ATI 0x8742 |
#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 |
#endif |
#ifndef GL_NV_fence |
#define GL_ALL_COMPLETED_NV 0x84F2 |
#define GL_FENCE_STATUS_NV 0x84F3 |
#define GL_FENCE_CONDITION_NV 0x84F4 |
#endif |
#ifndef GL_IBM_texture_mirrored_repeat |
#define GL_MIRRORED_REPEAT_IBM 0x8370 |
#endif |
#ifndef GL_NV_evaluators |
#define GL_EVAL_2D_NV 0x86C0 |
#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 |
#define GL_MAP_TESSELLATION_NV 0x86C2 |
#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 |
#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 |
#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 |
#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 |
#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 |
#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 |
#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 |
#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA |
#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB |
#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC |
#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD |
#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE |
#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF |
#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 |
#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 |
#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 |
#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 |
#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 |
#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 |
#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 |
#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 |
#endif |
#ifndef GL_NV_packed_depth_stencil |
#define GL_DEPTH_STENCIL_NV 0x84F9 |
#define GL_UNSIGNED_INT_24_8_NV 0x84FA |
#endif |
#ifndef GL_NV_register_combiners2 |
#define GL_PER_STAGE_CONSTANTS_NV 0x8535 |
#endif |
#ifndef GL_NV_texture_compression_vtc |
#endif |
#ifndef GL_NV_texture_rectangle |
#define GL_TEXTURE_RECTANGLE_NV 0x84F5 |
#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 |
#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 |
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 |
#endif |
#ifndef GL_NV_texture_shader |
#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C |
#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D |
#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E |
#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 |
#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA |
#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB |
#define GL_DSDT_MAG_INTENSITY_NV 0x86DC |
#define GL_SHADER_CONSISTENT_NV 0x86DD |
#define GL_TEXTURE_SHADER_NV 0x86DE |
#define GL_SHADER_OPERATION_NV 0x86DF |
#define GL_CULL_MODES_NV 0x86E0 |
#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 |
#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 |
#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 |
#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV |
#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV |
#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV |
#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 |
#define GL_CONST_EYE_NV 0x86E5 |
#define GL_PASS_THROUGH_NV 0x86E6 |
#define GL_CULL_FRAGMENT_NV 0x86E7 |
#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 |
#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 |
#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA |
#define GL_DOT_PRODUCT_NV 0x86EC |
#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED |
#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE |
#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 |
#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 |
#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 |
#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 |
#define GL_HILO_NV 0x86F4 |
#define GL_DSDT_NV 0x86F5 |
#define GL_DSDT_MAG_NV 0x86F6 |
#define GL_DSDT_MAG_VIB_NV 0x86F7 |
#define GL_HILO16_NV 0x86F8 |
#define GL_SIGNED_HILO_NV 0x86F9 |
#define GL_SIGNED_HILO16_NV 0x86FA |
#define GL_SIGNED_RGBA_NV 0x86FB |
#define GL_SIGNED_RGBA8_NV 0x86FC |
#define GL_SIGNED_RGB_NV 0x86FE |
#define GL_SIGNED_RGB8_NV 0x86FF |
#define GL_SIGNED_LUMINANCE_NV 0x8701 |
#define GL_SIGNED_LUMINANCE8_NV 0x8702 |
#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 |
#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 |
#define GL_SIGNED_ALPHA_NV 0x8705 |
#define GL_SIGNED_ALPHA8_NV 0x8706 |
#define GL_SIGNED_INTENSITY_NV 0x8707 |
#define GL_SIGNED_INTENSITY8_NV 0x8708 |
#define GL_DSDT8_NV 0x8709 |
#define GL_DSDT8_MAG8_NV 0x870A |
#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B |
#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C |
#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D |
#define GL_HI_SCALE_NV 0x870E |
#define GL_LO_SCALE_NV 0x870F |
#define GL_DS_SCALE_NV 0x8710 |
#define GL_DT_SCALE_NV 0x8711 |
#define GL_MAGNITUDE_SCALE_NV 0x8712 |
#define GL_VIBRANCE_SCALE_NV 0x8713 |
#define GL_HI_BIAS_NV 0x8714 |
#define GL_LO_BIAS_NV 0x8715 |
#define GL_DS_BIAS_NV 0x8716 |
#define GL_DT_BIAS_NV 0x8717 |
#define GL_MAGNITUDE_BIAS_NV 0x8718 |
#define GL_VIBRANCE_BIAS_NV 0x8719 |
#define GL_TEXTURE_BORDER_VALUES_NV 0x871A |
#define GL_TEXTURE_HI_SIZE_NV 0x871B |
#define GL_TEXTURE_LO_SIZE_NV 0x871C |
#define GL_TEXTURE_DS_SIZE_NV 0x871D |
#define GL_TEXTURE_DT_SIZE_NV 0x871E |
#define GL_TEXTURE_MAG_SIZE_NV 0x871F |
#endif |
#ifndef GL_NV_texture_shader2 |
#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF |
#endif |
#ifndef GL_NV_vertex_array_range2 |
#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 |
#endif |
#ifndef GL_NV_vertex_program |
#define GL_VERTEX_PROGRAM_NV 0x8620 |
#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 |
#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 |
#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 |
#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 |
#define GL_CURRENT_ATTRIB_NV 0x8626 |
#define GL_PROGRAM_LENGTH_NV 0x8627 |
#define GL_PROGRAM_STRING_NV 0x8628 |
#define GL_MODELVIEW_PROJECTION_NV 0x8629 |
#define GL_IDENTITY_NV 0x862A |
#define GL_INVERSE_NV 0x862B |
#define GL_TRANSPOSE_NV 0x862C |
#define GL_INVERSE_TRANSPOSE_NV 0x862D |
#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E |
#define GL_MAX_TRACK_MATRICES_NV 0x862F |
#define GL_MATRIX0_NV 0x8630 |
#define GL_MATRIX1_NV 0x8631 |
#define GL_MATRIX2_NV 0x8632 |
#define GL_MATRIX3_NV 0x8633 |
#define GL_MATRIX4_NV 0x8634 |
#define GL_MATRIX5_NV 0x8635 |
#define GL_MATRIX6_NV 0x8636 |
#define GL_MATRIX7_NV 0x8637 |
#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 |
#define GL_CURRENT_MATRIX_NV 0x8641 |
#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 |
#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 |
#define GL_PROGRAM_PARAMETER_NV 0x8644 |
#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 |
#define GL_PROGRAM_TARGET_NV 0x8646 |
#define GL_PROGRAM_RESIDENT_NV 0x8647 |
#define GL_TRACK_MATRIX_NV 0x8648 |
#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 |
#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A |
#define GL_PROGRAM_ERROR_POSITION_NV 0x864B |
#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 |
#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 |
#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 |
#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 |
#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 |
#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 |
#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 |
#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 |
#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 |
#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 |
#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A |
#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B |
#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C |
#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D |
#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E |
#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F |
#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 |
#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 |
#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 |
#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 |
#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 |
#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 |
#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 |
#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 |
#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 |
#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 |
#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A |
#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B |
#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C |
#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D |
#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E |
#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F |
#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 |
#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 |
#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 |
#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 |
#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 |
#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 |
#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 |
#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 |
#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 |
#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 |
#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A |
#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B |
#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C |
#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D |
#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E |
#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F |
#endif |
#ifndef GL_SGIX_texture_coordinate_clamp |
#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 |
#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A |
#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B |
#endif |
#ifndef GL_SGIX_scalebias_hint |
#define GL_SCALEBIAS_HINT_SGIX 0x8322 |
#endif |
#ifndef GL_OML_interlace |
#define GL_INTERLACE_OML 0x8980 |
#define GL_INTERLACE_READ_OML 0x8981 |
#endif |
#ifndef GL_OML_subsample |
#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 |
#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 |
#endif |
#ifndef GL_OML_resample |
#define GL_PACK_RESAMPLE_OML 0x8984 |
#define GL_UNPACK_RESAMPLE_OML 0x8985 |
#define GL_RESAMPLE_REPLICATE_OML 0x8986 |
#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 |
#define GL_RESAMPLE_AVERAGE_OML 0x8988 |
#define GL_RESAMPLE_DECIMATE_OML 0x8989 |
#endif |
#ifndef GL_NV_copy_depth_to_color |
#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E |
#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F |
#endif |
#ifndef GL_ATI_envmap_bumpmap |
#define GL_BUMP_ROT_MATRIX_ATI 0x8775 |
#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 |
#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 |
#define GL_BUMP_TEX_UNITS_ATI 0x8778 |
#define GL_DUDV_ATI 0x8779 |
#define GL_DU8DV8_ATI 0x877A |
#define GL_BUMP_ENVMAP_ATI 0x877B |
#define GL_BUMP_TARGET_ATI 0x877C |
#endif |
#ifndef GL_ATI_fragment_shader |
#define GL_FRAGMENT_SHADER_ATI 0x8920 |
#define GL_REG_0_ATI 0x8921 |
#define GL_REG_1_ATI 0x8922 |
#define GL_REG_2_ATI 0x8923 |
#define GL_REG_3_ATI 0x8924 |
#define GL_REG_4_ATI 0x8925 |
#define GL_REG_5_ATI 0x8926 |
#define GL_REG_6_ATI 0x8927 |
#define GL_REG_7_ATI 0x8928 |
#define GL_REG_8_ATI 0x8929 |
#define GL_REG_9_ATI 0x892A |
#define GL_REG_10_ATI 0x892B |
#define GL_REG_11_ATI 0x892C |
#define GL_REG_12_ATI 0x892D |
#define GL_REG_13_ATI 0x892E |
#define GL_REG_14_ATI 0x892F |
#define GL_REG_15_ATI 0x8930 |
#define GL_REG_16_ATI 0x8931 |
#define GL_REG_17_ATI 0x8932 |
#define GL_REG_18_ATI 0x8933 |
#define GL_REG_19_ATI 0x8934 |
#define GL_REG_20_ATI 0x8935 |
#define GL_REG_21_ATI 0x8936 |
#define GL_REG_22_ATI 0x8937 |
#define GL_REG_23_ATI 0x8938 |
#define GL_REG_24_ATI 0x8939 |
#define GL_REG_25_ATI 0x893A |
#define GL_REG_26_ATI 0x893B |
#define GL_REG_27_ATI 0x893C |
#define GL_REG_28_ATI 0x893D |
#define GL_REG_29_ATI 0x893E |
#define GL_REG_30_ATI 0x893F |
#define GL_REG_31_ATI 0x8940 |
#define GL_CON_0_ATI 0x8941 |
#define GL_CON_1_ATI 0x8942 |
#define GL_CON_2_ATI 0x8943 |
#define GL_CON_3_ATI 0x8944 |
#define GL_CON_4_ATI 0x8945 |
#define GL_CON_5_ATI 0x8946 |
#define GL_CON_6_ATI 0x8947 |
#define GL_CON_7_ATI 0x8948 |
#define GL_CON_8_ATI 0x8949 |
#define GL_CON_9_ATI 0x894A |
#define GL_CON_10_ATI 0x894B |
#define GL_CON_11_ATI 0x894C |
#define GL_CON_12_ATI 0x894D |
#define GL_CON_13_ATI 0x894E |
#define GL_CON_14_ATI 0x894F |
#define GL_CON_15_ATI 0x8950 |
#define GL_CON_16_ATI 0x8951 |
#define GL_CON_17_ATI 0x8952 |
#define GL_CON_18_ATI 0x8953 |
#define GL_CON_19_ATI 0x8954 |
#define GL_CON_20_ATI 0x8955 |
#define GL_CON_21_ATI 0x8956 |
#define GL_CON_22_ATI 0x8957 |
#define GL_CON_23_ATI 0x8958 |
#define GL_CON_24_ATI 0x8959 |
#define GL_CON_25_ATI 0x895A |
#define GL_CON_26_ATI 0x895B |
#define GL_CON_27_ATI 0x895C |
#define GL_CON_28_ATI 0x895D |
#define GL_CON_29_ATI 0x895E |
#define GL_CON_30_ATI 0x895F |
#define GL_CON_31_ATI 0x8960 |
#define GL_MOV_ATI 0x8961 |
#define GL_ADD_ATI 0x8963 |
#define GL_MUL_ATI 0x8964 |
#define GL_SUB_ATI 0x8965 |
#define GL_DOT3_ATI 0x8966 |
#define GL_DOT4_ATI 0x8967 |
#define GL_MAD_ATI 0x8968 |
#define GL_LERP_ATI 0x8969 |
#define GL_CND_ATI 0x896A |
#define GL_CND0_ATI 0x896B |
#define GL_DOT2_ADD_ATI 0x896C |
#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D |
#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E |
#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F |
#define GL_NUM_PASSES_ATI 0x8970 |
#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 |
#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 |
#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 |
#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 |
#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 |
#define GL_SWIZZLE_STR_ATI 0x8976 |
#define GL_SWIZZLE_STQ_ATI 0x8977 |
#define GL_SWIZZLE_STR_DR_ATI 0x8978 |
#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 |
#define GL_SWIZZLE_STRQ_ATI 0x897A |
#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B |
#define GL_RED_BIT_ATI 0x00000001 |
#define GL_GREEN_BIT_ATI 0x00000002 |
#define GL_BLUE_BIT_ATI 0x00000004 |
#define GL_2X_BIT_ATI 0x00000001 |
#define GL_4X_BIT_ATI 0x00000002 |
#define GL_8X_BIT_ATI 0x00000004 |
#define GL_HALF_BIT_ATI 0x00000008 |
#define GL_QUARTER_BIT_ATI 0x00000010 |
#define GL_EIGHTH_BIT_ATI 0x00000020 |
#define GL_SATURATE_BIT_ATI 0x00000040 |
#define GL_COMP_BIT_ATI 0x00000002 |
#define GL_NEGATE_BIT_ATI 0x00000004 |
#define GL_BIAS_BIT_ATI 0x00000008 |
#endif |
#ifndef GL_ATI_pn_triangles |
#define GL_PN_TRIANGLES_ATI 0x87F0 |
#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 |
#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 |
#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 |
#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 |
#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 |
#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 |
#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 |
#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 |
#endif |
#ifndef GL_ATI_vertex_array_object |
#define GL_STATIC_ATI 0x8760 |
#define GL_DYNAMIC_ATI 0x8761 |
#define GL_PRESERVE_ATI 0x8762 |
#define GL_DISCARD_ATI 0x8763 |
#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 |
#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 |
#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 |
#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 |
#endif |
#ifndef GL_EXT_vertex_shader |
#define GL_VERTEX_SHADER_EXT 0x8780 |
#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 |
#define GL_OP_INDEX_EXT 0x8782 |
#define GL_OP_NEGATE_EXT 0x8783 |
#define GL_OP_DOT3_EXT 0x8784 |
#define GL_OP_DOT4_EXT 0x8785 |
#define GL_OP_MUL_EXT 0x8786 |
#define GL_OP_ADD_EXT 0x8787 |
#define GL_OP_MADD_EXT 0x8788 |
#define GL_OP_FRAC_EXT 0x8789 |
#define GL_OP_MAX_EXT 0x878A |
#define GL_OP_MIN_EXT 0x878B |
#define GL_OP_SET_GE_EXT 0x878C |
#define GL_OP_SET_LT_EXT 0x878D |
#define GL_OP_CLAMP_EXT 0x878E |
#define GL_OP_FLOOR_EXT 0x878F |
#define GL_OP_ROUND_EXT 0x8790 |
#define GL_OP_EXP_BASE_2_EXT 0x8791 |
#define GL_OP_LOG_BASE_2_EXT 0x8792 |
#define GL_OP_POWER_EXT 0x8793 |
#define GL_OP_RECIP_EXT 0x8794 |
#define GL_OP_RECIP_SQRT_EXT 0x8795 |
#define GL_OP_SUB_EXT 0x8796 |
#define GL_OP_CROSS_PRODUCT_EXT 0x8797 |
#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 |
#define GL_OP_MOV_EXT 0x8799 |
#define GL_OUTPUT_VERTEX_EXT 0x879A |
#define GL_OUTPUT_COLOR0_EXT 0x879B |
#define GL_OUTPUT_COLOR1_EXT 0x879C |
#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D |
#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E |
#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F |
#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 |
#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 |
#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 |
#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 |
#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 |
#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 |
#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 |
#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 |
#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 |
#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 |
#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA |
#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB |
#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC |
#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD |
#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE |
#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF |
#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 |
#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 |
#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 |
#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 |
#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 |
#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 |
#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 |
#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 |
#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 |
#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 |
#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA |
#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB |
#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC |
#define GL_OUTPUT_FOG_EXT 0x87BD |
#define GL_SCALAR_EXT 0x87BE |
#define GL_VECTOR_EXT 0x87BF |
#define GL_MATRIX_EXT 0x87C0 |
#define GL_VARIANT_EXT 0x87C1 |
#define GL_INVARIANT_EXT 0x87C2 |
#define GL_LOCAL_CONSTANT_EXT 0x87C3 |
#define GL_LOCAL_EXT 0x87C4 |
#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 |
#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 |
#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 |
#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 |
#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 |
#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA |
#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB |
#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC |
#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INARIANTS_EXT 0x87CD |
#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE |
#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF |
#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 |
#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 |
#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 |
#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 |
#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 |
#define GL_X_EXT 0x87D5 |
#define GL_Y_EXT 0x87D6 |
#define GL_Z_EXT 0x87D7 |
#define GL_W_EXT 0x87D8 |
#define GL_NEGATIVE_X_EXT 0x87D9 |
#define GL_NEGATIVE_Y_EXT 0x87DA |
#define GL_NEGATIVE_Z_EXT 0x87DB |
#define GL_NEGATIVE_W_EXT 0x87DC |
#define GL_ZERO_EXT 0x87DD |
#define GL_ONE_EXT 0x87DE |
#define GL_NEGATIVE_ONE_EXT 0x87DF |
#define GL_NORMALIZED_RANGE_EXT 0x87E0 |
#define GL_FULL_RANGE_EXT 0x87E1 |
#define GL_CURRENT_VERTEX_EXT 0x87E2 |
#define GL_MVP_MATRIX_EXT 0x87E3 |
#define GL_VARIANT_VALUE_EXT 0x87E4 |
#define GL_VARIANT_DATATYPE_EXT 0x87E5 |
#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 |
#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 |
#define GL_VARIANT_ARRAY_EXT 0x87E8 |
#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 |
#define GL_INVARIANT_VALUE_EXT 0x87EA |
#define GL_INVARIANT_DATATYPE_EXT 0x87EB |
#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC |
#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED |
#endif |
#ifndef GL_ATI_vertex_streams |
#define GL_MAX_VERTEX_STREAMS_ATI 0x876B |
#define GL_VERTEX_STREAM0_ATI 0x876C |
#define GL_VERTEX_STREAM1_ATI 0x876D |
#define GL_VERTEX_STREAM2_ATI 0x876E |
#define GL_VERTEX_STREAM3_ATI 0x876F |
#define GL_VERTEX_STREAM4_ATI 0x8770 |
#define GL_VERTEX_STREAM5_ATI 0x8771 |
#define GL_VERTEX_STREAM6_ATI 0x8772 |
#define GL_VERTEX_STREAM7_ATI 0x8773 |
#define GL_VERTEX_SOURCE_ATI 0x8774 |
#endif |
#ifndef GL_ATI_element_array |
#define GL_ELEMENT_ARRAY_ATI 0x8768 |
#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 |
#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A |
#endif |
#ifndef GL_SUN_mesh_array |
#define GL_QUAD_MESH_SUN 0x8614 |
#define GL_TRIANGLE_MESH_SUN 0x8615 |
#endif |
#ifndef GL_SUN_slice_accum |
#define GL_SLICE_ACCUM_SUN 0x85CC |
#endif |
#ifndef GL_NV_multisample_filter_hint |
#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 |
#endif |
#ifndef GL_NV_depth_clamp |
#define GL_DEPTH_CLAMP_NV 0x864F |
#endif |
#ifndef GL_NV_occlusion_query |
#define GL_PIXEL_COUNTER_BITS_NV 0x8864 |
#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 |
#define GL_PIXEL_COUNT_NV 0x8866 |
#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 |
#endif |
#ifndef GL_NV_point_sprite |
#define GL_POINT_SPRITE_NV 0x8861 |
#define GL_COORD_REPLACE_NV 0x8862 |
#define GL_POINT_SPRITE_R_MODE_NV 0x8863 |
#endif |
#ifndef GL_NV_texture_shader3 |
#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 |
#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 |
#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 |
#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 |
#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 |
#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 |
#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 |
#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 |
#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 |
#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 |
#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A |
#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B |
#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C |
#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D |
#define GL_HILO8_NV 0x885E |
#define GL_SIGNED_HILO8_NV 0x885F |
#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 |
#endif |
#ifndef GL_NV_vertex_program1_1 |
#endif |
#ifndef GL_EXT_shadow_funcs |
#endif |
#ifndef GL_EXT_stencil_two_side |
#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 |
#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 |
#endif |
/*************************************************************/ |
#ifndef GL_VERSION_1_2 |
#define GL_VERSION_1_2 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); |
GLAPI void APIENTRY glBlendEquation (GLenum); |
GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); |
GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); |
GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); |
GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); |
GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); |
GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); |
GLAPI void APIENTRY glResetHistogram (GLenum); |
GLAPI void APIENTRY glResetMinmax (GLenum); |
GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
typedef void (APIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); |
typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); |
typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); |
typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLRESETHISTOGRAMPROC) (GLenum target); |
typedef void (APIENTRY * PFNGLRESETMINMAXPROC) (GLenum target); |
typedef void (APIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
#endif |
#ifndef GL_VERSION_1_3 |
#define GL_VERSION_1_3 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glActiveTexture (GLenum); |
GLAPI void APIENTRY glClientActiveTexture (GLenum); |
GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); |
GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); |
GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); |
GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); |
GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); |
GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); |
GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); |
GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); |
GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, void *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); |
typedef void (APIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); |
#endif |
#ifndef GL_VERSION_1_4 |
#define GL_VERSION_1_4 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); |
GLAPI void APIENTRY glFogCoordf (GLfloat); |
GLAPI void APIENTRY glFogCoordfv (const GLfloat *); |
GLAPI void APIENTRY glFogCoordd (GLdouble); |
GLAPI void APIENTRY glFogCoorddv (const GLdouble *); |
GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); |
GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); |
GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); |
GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); |
GLAPI void APIENTRY glPointParameteri (GLenum, GLint); |
GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); |
GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); |
GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); |
GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); |
GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); |
GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); |
GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); |
GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); |
GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); |
GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); |
GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); |
GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); |
GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); |
GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); |
GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); |
GLAPI void APIENTRY glWindowPos2i (GLint, GLint); |
GLAPI void APIENTRY glWindowPos2iv (const GLint *); |
GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos2sv (const GLshort *); |
GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); |
GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); |
GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); |
GLAPI void APIENTRY glWindowPos3iv (const GLint *); |
GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos3sv (const GLshort *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
typedef void (APIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord); |
typedef void (APIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord); |
typedef void (APIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord); |
typedef void (APIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord); |
typedef void (APIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); |
typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *v); |
#endif |
#ifndef GL_ARB_multitexture |
#define GL_ARB_multitexture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glActiveTextureARB (GLenum); |
GLAPI void APIENTRY glClientActiveTextureARB (GLenum); |
GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); |
GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); |
GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); |
GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); |
GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); |
GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); |
GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); |
GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); |
typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); |
#endif |
#ifndef GL_ARB_transpose_matrix |
#define GL_ARB_transpose_matrix 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); |
GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); |
GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); |
GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); |
typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); |
#endif |
#ifndef GL_ARB_multisample |
#define GL_ARB_multisample 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); |
#endif |
#ifndef GL_ARB_texture_env_add |
#define GL_ARB_texture_env_add 1 |
#endif |
#ifndef GL_ARB_texture_cube_map |
#define GL_ARB_texture_cube_map 1 |
#endif |
#ifndef GL_ARB_texture_compression |
#define GL_ARB_texture_compression 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, void *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); |
typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); |
#endif |
#ifndef GL_ARB_texture_border_clamp |
#define GL_ARB_texture_border_clamp 1 |
#endif |
#ifndef GL_ARB_point_parameters |
#define GL_ARB_point_parameters 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); |
GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); |
#endif |
#ifndef GL_ARB_vertex_blend |
#define GL_ARB_vertex_blend 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); |
GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); |
GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); |
GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); |
GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); |
GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); |
GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); |
GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); |
GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glVertexBlendARB (GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); |
typedef void (APIENTRY * PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); |
typedef void (APIENTRY * PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); |
typedef void (APIENTRY * PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); |
typedef void (APIENTRY * PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); |
typedef void (APIENTRY * PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); |
typedef void (APIENTRY * PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); |
typedef void (APIENTRY * PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); |
typedef void (APIENTRY * PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLVERTEXBLENDARBPROC) (GLint count); |
#endif |
#ifndef GL_ARB_matrix_palette |
#define GL_ARB_matrix_palette 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); |
GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); |
GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); |
GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); |
GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); |
typedef void (APIENTRY * PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); |
typedef void (APIENTRY * PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); |
typedef void (APIENTRY * PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); |
typedef void (APIENTRY * PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); |
#endif |
#ifndef GL_ARB_texture_env_combine |
#define GL_ARB_texture_env_combine 1 |
#endif |
#ifndef GL_ARB_texture_env_crossbar |
#define GL_ARB_texture_env_crossbar 1 |
#endif |
#ifndef GL_ARB_texture_env_dot3 |
#define GL_ARB_texture_env_dot3 1 |
#endif |
#ifndef GL_ARB_texture_mirror_repeat |
#define GL_ARB_texture_mirror_repeat 1 |
#endif |
#ifndef GL_ARB_depth_texture |
#define GL_ARB_depth_texture 1 |
#endif |
#ifndef GL_ARB_shadow |
#define GL_ARB_shadow 1 |
#endif |
#ifndef GL_ARB_shadow_ambient |
#define GL_ARB_shadow_ambient 1 |
#endif |
#ifndef GL_ARB_window_pos |
#define GL_ARB_window_pos 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); |
GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); |
GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); |
GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); |
GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); |
GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); |
GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); |
GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); |
GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); |
GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); |
#endif |
#ifndef GL_ARB_vertex_program |
#define GL_ARB_vertex_program 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); |
GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); |
GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); |
GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); |
GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); |
GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); |
GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); |
GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); |
GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); |
GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); |
GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); |
GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); |
GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); |
GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); |
GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); |
GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); |
GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); |
GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); |
GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); |
GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); |
GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); |
GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); |
GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); |
GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); |
GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); |
GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); |
GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); |
GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); |
GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); |
GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); |
typedef void (APIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); |
typedef void (APIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); |
typedef void (APIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); |
typedef void (APIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); |
typedef void (APIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); |
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); |
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); |
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); |
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); |
typedef GLboolean (APIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program); |
#endif |
#ifndef GL_EXT_abgr |
#define GL_EXT_abgr 1 |
#endif |
#ifndef GL_EXT_blend_color |
#define GL_EXT_blend_color 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); |
#endif |
#ifndef GL_EXT_polygon_offset |
#define GL_EXT_polygon_offset 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); |
#endif |
#ifndef GL_EXT_texture |
#define GL_EXT_texture 1 |
#endif |
#ifndef GL_EXT_texture3D |
#define GL_EXT_texture3D 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); |
#endif |
#ifndef GL_SGIS_texture_filter4 |
#define GL_SGIS_texture_filter4 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); |
typedef void (APIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); |
#endif |
#ifndef GL_EXT_subtexture |
#define GL_EXT_subtexture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); |
#endif |
#ifndef GL_EXT_copy_texture |
#define GL_EXT_copy_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); |
GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); |
GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); |
GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); |
typedef void (APIENTRY * PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); |
typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); |
#endif |
#ifndef GL_EXT_histogram |
#define GL_EXT_histogram 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); |
GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); |
GLAPI void APIENTRY glResetHistogramEXT (GLenum); |
GLAPI void APIENTRY glResetMinmaxEXT (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); |
typedef void (APIENTRY * PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); |
typedef void (APIENTRY * PFNGLRESETMINMAXEXTPROC) (GLenum target); |
#endif |
#ifndef GL_EXT_convolution |
#define GL_EXT_convolution 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); |
GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); |
GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); |
typedef void (APIENTRY * PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); |
typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); |
#endif |
#ifndef GL_EXT_color_matrix |
#define GL_EXT_color_matrix 1 |
#endif |
#ifndef GL_SGI_color_table |
#define GL_SGI_color_table 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); |
GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); |
typedef void (APIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); |
#endif |
#ifndef GL_SGIX_pixel_texture |
#define GL_SGIX_pixel_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); |
#endif |
#ifndef GL_SGIS_pixel_texture |
#define GL_SGIS_pixel_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); |
GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); |
GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); |
GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); |
GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); |
GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); |
#endif |
#ifndef GL_SGIS_texture4D |
#define GL_SGIS_texture4D 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); |
typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); |
#endif |
#ifndef GL_SGI_texture_color_table |
#define GL_SGI_texture_color_table 1 |
#endif |
#ifndef GL_EXT_cmyka |
#define GL_EXT_cmyka 1 |
#endif |
#ifndef GL_EXT_texture_object |
#define GL_EXT_texture_object 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); |
GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); |
GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); |
GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); |
GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); |
GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef GLboolean (APIENTRY * PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); |
typedef void (APIENTRY * PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); |
typedef void (APIENTRY * PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); |
typedef void (APIENTRY * PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); |
typedef GLboolean (APIENTRY * PFNGLISTEXTUREEXTPROC) (GLuint texture); |
typedef void (APIENTRY * PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); |
#endif |
#ifndef GL_SGIS_detail_texture |
#define GL_SGIS_detail_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); |
typedef void (APIENTRY * PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); |
#endif |
#ifndef GL_SGIS_sharpen_texture |
#define GL_SGIS_sharpen_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); |
typedef void (APIENTRY * PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); |
#endif |
#ifndef GL_EXT_packed_pixels |
#define GL_EXT_packed_pixels 1 |
#endif |
#ifndef GL_SGIS_texture_lod |
#define GL_SGIS_texture_lod 1 |
#endif |
#ifndef GL_SGIS_multisample |
#define GL_SGIS_multisample 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); |
GLAPI void APIENTRY glSamplePatternSGIS (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); |
typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); |
#endif |
#ifndef GL_EXT_rescale_normal |
#define GL_EXT_rescale_normal 1 |
#endif |
#ifndef GL_EXT_vertex_array |
#define GL_EXT_vertex_array 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glArrayElementEXT (GLint); |
GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); |
GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); |
GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); |
GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i); |
typedef void (APIENTRY * PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); |
typedef void (APIENTRY * PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); |
typedef void (APIENTRY * PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); |
typedef void (APIENTRY * PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); |
#endif |
#ifndef GL_EXT_misc_attribute |
#define GL_EXT_misc_attribute 1 |
#endif |
#ifndef GL_SGIS_generate_mipmap |
#define GL_SGIS_generate_mipmap 1 |
#endif |
#ifndef GL_SGIX_clipmap |
#define GL_SGIX_clipmap 1 |
#endif |
#ifndef GL_SGIX_shadow |
#define GL_SGIX_shadow 1 |
#endif |
#ifndef GL_SGIS_texture_edge_clamp |
#define GL_SGIS_texture_edge_clamp 1 |
#endif |
#ifndef GL_SGIS_texture_border_clamp |
#define GL_SGIS_texture_border_clamp 1 |
#endif |
#ifndef GL_EXT_blend_minmax |
#define GL_EXT_blend_minmax 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendEquationEXT (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); |
#endif |
#ifndef GL_EXT_blend_subtract |
#define GL_EXT_blend_subtract 1 |
#endif |
#ifndef GL_EXT_blend_logic_op |
#define GL_EXT_blend_logic_op 1 |
#endif |
#ifndef GL_SGIX_interlace |
#define GL_SGIX_interlace 1 |
#endif |
#ifndef GL_SGIX_pixel_tiles |
#define GL_SGIX_pixel_tiles 1 |
#endif |
#ifndef GL_SGIX_texture_select |
#define GL_SGIX_texture_select 1 |
#endif |
#ifndef GL_SGIX_sprite |
#define GL_SGIX_sprite 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); |
GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); |
GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); |
GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); |
#endif |
#ifndef GL_SGIX_texture_multi_buffer |
#define GL_SGIX_texture_multi_buffer 1 |
#endif |
#ifndef GL_EXT_point_parameters |
#define GL_EXT_point_parameters 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); |
GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); |
#endif |
#ifndef GL_SGIS_point_parameters |
#define GL_SGIS_point_parameters 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); |
GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); |
#endif |
#ifndef GL_SGIX_instruments |
#define GL_SGIX_instruments 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); |
GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); |
GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); |
GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); |
GLAPI void APIENTRY glStartInstrumentsSGIX (void); |
GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef GLint (APIENTRY * PFNGLGETINSTRUMENTSSGIXPROC) (void); |
typedef void (APIENTRY * PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); |
typedef GLint (APIENTRY * PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); |
typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); |
typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void); |
typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); |
#endif |
#ifndef GL_SGIX_texture_scale_bias |
#define GL_SGIX_texture_scale_bias 1 |
#endif |
#ifndef GL_SGIX_framezoom |
#define GL_SGIX_framezoom 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFrameZoomSGIX (GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFRAMEZOOMSGIXPROC) (GLint factor); |
#endif |
#ifndef GL_SGIX_tag_sample_buffer |
#define GL_SGIX_tag_sample_buffer 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTagSampleBufferSGIX (void); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); |
#endif |
#ifndef GL_SGIX_polynomial_ffd |
#define GL_SGIX_polynomial_ffd 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); |
GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); |
GLAPI void APIENTRY glDeformSGIX (GLbitfield); |
GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); |
typedef void (APIENTRY * PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); |
typedef void (APIENTRY * PFNGLDEFORMSGIXPROC) (GLbitfield mask); |
typedef void (APIENTRY * PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); |
#endif |
#ifndef GL_SGIX_reference_plane |
#define GL_SGIX_reference_plane 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); |
#endif |
#ifndef GL_SGIX_flush_raster |
#define GL_SGIX_flush_raster 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFlushRasterSGIX (void); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); |
#endif |
#ifndef GL_SGIX_depth_texture |
#define GL_SGIX_depth_texture 1 |
#endif |
#ifndef GL_SGIS_fog_function |
#define GL_SGIS_fog_function 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); |
GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); |
typedef void (APIENTRY * PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); |
#endif |
#ifndef GL_SGIX_fog_offset |
#define GL_SGIX_fog_offset 1 |
#endif |
#ifndef GL_HP_image_transform |
#define GL_HP_image_transform 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); |
#endif |
#ifndef GL_HP_convolution_border_modes |
#define GL_HP_convolution_border_modes 1 |
#endif |
#ifndef GL_SGIX_texture_add_env |
#define GL_SGIX_texture_add_env 1 |
#endif |
#ifndef GL_EXT_color_subtable |
#define GL_EXT_color_subtable 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); |
typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); |
#endif |
#ifndef GL_PGI_vertex_hints |
#define GL_PGI_vertex_hints 1 |
#endif |
#ifndef GL_PGI_misc_hints |
#define GL_PGI_misc_hints 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glHintPGI (GLenum, GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLHINTPGIPROC) (GLenum target, GLint mode); |
#endif |
#ifndef GL_EXT_paletted_texture |
#define GL_EXT_paletted_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); |
GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); |
GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); |
#endif |
#ifndef GL_EXT_clip_volume_hint |
#define GL_EXT_clip_volume_hint 1 |
#endif |
#ifndef GL_SGIX_list_priority |
#define GL_SGIX_list_priority 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); |
GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); |
GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); |
GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); |
#endif |
#ifndef GL_SGIX_ir_instrument1 |
#define GL_SGIX_ir_instrument1 1 |
#endif |
#ifndef GL_SGIX_calligraphic_fragment |
#define GL_SGIX_calligraphic_fragment 1 |
#endif |
#ifndef GL_SGIX_texture_lod_bias |
#define GL_SGIX_texture_lod_bias 1 |
#endif |
#ifndef GL_SGIX_shadow_ambient |
#define GL_SGIX_shadow_ambient 1 |
#endif |
#ifndef GL_EXT_index_texture |
#define GL_EXT_index_texture 1 |
#endif |
#ifndef GL_EXT_index_material |
#define GL_EXT_index_material 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); |
#endif |
#ifndef GL_EXT_index_func |
#define GL_EXT_index_func 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); |
#endif |
#ifndef GL_EXT_index_array_formats |
#define GL_EXT_index_array_formats 1 |
#endif |
#ifndef GL_EXT_compiled_vertex_array |
#define GL_EXT_compiled_vertex_array 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); |
GLAPI void APIENTRY glUnlockArraysEXT (void); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); |
typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void); |
#endif |
#ifndef GL_EXT_cull_vertex |
#define GL_EXT_cull_vertex 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); |
GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); |
typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); |
#endif |
#ifndef GL_SGIX_ycrcb |
#define GL_SGIX_ycrcb 1 |
#endif |
#ifndef GL_SGIX_fragment_lighting |
#define GL_SGIX_fragment_lighting 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); |
GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); |
GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); |
GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); |
GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); |
GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); |
#endif |
#ifndef GL_IBM_rasterpos_clip |
#define GL_IBM_rasterpos_clip 1 |
#endif |
#ifndef GL_HP_texture_lighting |
#define GL_HP_texture_lighting 1 |
#endif |
#ifndef GL_EXT_draw_range_elements |
#define GL_EXT_draw_range_elements 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); |
#endif |
#ifndef GL_WIN_phong_shading |
#define GL_WIN_phong_shading 1 |
#endif |
#ifndef GL_WIN_specular_fog |
#define GL_WIN_specular_fog 1 |
#endif |
#ifndef GL_EXT_light_texture |
#define GL_EXT_light_texture 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glApplyTextureEXT (GLenum); |
GLAPI void APIENTRY glTextureLightEXT (GLenum); |
GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); |
typedef void (APIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); |
typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); |
#endif |
#ifndef GL_SGIX_blend_alpha_minmax |
#define GL_SGIX_blend_alpha_minmax 1 |
#endif |
#ifndef GL_EXT_bgra |
#define GL_EXT_bgra 1 |
#endif |
#ifndef GL_SGIX_async |
#define GL_SGIX_async 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); |
GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); |
GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); |
GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); |
GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); |
GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLASYNCMARKERSGIXPROC) (GLuint marker); |
typedef GLint (APIENTRY * PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); |
typedef GLint (APIENTRY * PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); |
typedef GLuint (APIENTRY * PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); |
typedef void (APIENTRY * PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); |
typedef GLboolean (APIENTRY * PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); |
#endif |
#ifndef GL_SGIX_async_pixel |
#define GL_SGIX_async_pixel 1 |
#endif |
#ifndef GL_SGIX_async_histogram |
#define GL_SGIX_async_histogram 1 |
#endif |
#ifndef GL_INTEL_parallel_arrays |
#define GL_INTEL_parallel_arrays 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); |
GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); |
GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); |
GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); |
typedef void (APIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); |
typedef void (APIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); |
typedef void (APIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); |
#endif |
#ifndef GL_HP_occlusion_test |
#define GL_HP_occlusion_test 1 |
#endif |
#ifndef GL_EXT_pixel_transform |
#define GL_EXT_pixel_transform 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); |
GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); |
GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); |
#endif |
#ifndef GL_EXT_pixel_transform_color_table |
#define GL_EXT_pixel_transform_color_table 1 |
#endif |
#ifndef GL_EXT_shared_texture_palette |
#define GL_EXT_shared_texture_palette 1 |
#endif |
#ifndef GL_EXT_separate_specular_color |
#define GL_EXT_separate_specular_color 1 |
#endif |
#ifndef GL_EXT_secondary_color |
#define GL_EXT_secondary_color 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); |
GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); |
GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); |
GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); |
GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); |
GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); |
GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); |
GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); |
GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); |
GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); |
GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); |
GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); |
GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); |
typedef void (APIENTRY * PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); |
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); |
#endif |
#ifndef GL_EXT_texture_perturb_normal |
#define GL_EXT_texture_perturb_normal 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTextureNormalEXT (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); |
#endif |
#ifndef GL_EXT_multi_draw_arrays |
#define GL_EXT_multi_draw_arrays 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); |
GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); |
typedef void (APIENTRY * PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); |
#endif |
#ifndef GL_EXT_fog_coord |
#define GL_EXT_fog_coord 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFogCoordfEXT (GLfloat); |
GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); |
GLAPI void APIENTRY glFogCoorddEXT (GLdouble); |
GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); |
GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord); |
typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); |
typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord); |
typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); |
typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); |
#endif |
#ifndef GL_REND_screen_coordinates |
#define GL_REND_screen_coordinates 1 |
#endif |
#ifndef GL_EXT_coordinate_frame |
#define GL_EXT_coordinate_frame 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); |
GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); |
GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); |
GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); |
GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); |
GLAPI void APIENTRY glTangent3ivEXT (const GLint *); |
GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glTangent3svEXT (const GLshort *); |
GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); |
GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); |
GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); |
GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); |
GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); |
GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); |
GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); |
GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); |
typedef void (APIENTRY * PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); |
typedef void (APIENTRY * PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); |
typedef void (APIENTRY * PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); |
typedef void (APIENTRY * PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); |
typedef void (APIENTRY * PFNGLTANGENT3IVEXTPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); |
typedef void (APIENTRY * PFNGLTANGENT3SVEXTPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); |
typedef void (APIENTRY * PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); |
typedef void (APIENTRY * PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); |
typedef void (APIENTRY * PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); |
typedef void (APIENTRY * PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); |
typedef void (APIENTRY * PFNGLBINORMAL3IVEXTPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); |
typedef void (APIENTRY * PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); |
#endif |
#ifndef GL_EXT_texture_env_combine |
#define GL_EXT_texture_env_combine 1 |
#endif |
#ifndef GL_APPLE_specular_vector |
#define GL_APPLE_specular_vector 1 |
#endif |
#ifndef GL_APPLE_transform_hint |
#define GL_APPLE_transform_hint 1 |
#endif |
#ifndef GL_SGIX_fog_scale |
#define GL_SGIX_fog_scale 1 |
#endif |
#ifndef GL_SUNX_constant_data |
#define GL_SUNX_constant_data 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFinishTextureSUNX (void); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFINISHTEXTURESUNXPROC) (void); |
#endif |
#ifndef GL_SUN_global_alpha |
#define GL_SUN_global_alpha 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); |
GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); |
GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); |
GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); |
GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); |
GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); |
GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); |
GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); |
typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); |
#endif |
#ifndef GL_SUN_triangle_list |
#define GL_SUN_triangle_list 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); |
GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); |
GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); |
GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); |
GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); |
GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); |
GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); |
#endif |
#ifndef GL_SUN_vertex |
#define GL_SUN_vertex 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); |
GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); |
GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); |
GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); |
#endif |
#ifndef GL_EXT_blend_func_separate |
#define GL_EXT_blend_func_separate 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
#endif |
#ifndef GL_INGR_blend_func_separate |
#define GL_INGR_blend_func_separate 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
#endif |
#ifndef GL_INGR_color_clamp |
#define GL_INGR_color_clamp 1 |
#endif |
#ifndef GL_INGR_interlace_read |
#define GL_INGR_interlace_read 1 |
#endif |
#ifndef GL_EXT_stencil_wrap |
#define GL_EXT_stencil_wrap 1 |
#endif |
#ifndef GL_EXT_422_pixels |
#define GL_EXT_422_pixels 1 |
#endif |
#ifndef GL_NV_texgen_reflection |
#define GL_NV_texgen_reflection 1 |
#endif |
#ifndef GL_SUN_convolution_border_modes |
#define GL_SUN_convolution_border_modes 1 |
#endif |
#ifndef GL_EXT_texture_env_add |
#define GL_EXT_texture_env_add 1 |
#endif |
#ifndef GL_EXT_texture_lod_bias |
#define GL_EXT_texture_lod_bias 1 |
#endif |
#ifndef GL_EXT_texture_filter_anisotropic |
#define GL_EXT_texture_filter_anisotropic 1 |
#endif |
#ifndef GL_EXT_vertex_weighting |
#define GL_EXT_vertex_weighting 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); |
GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); |
GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); |
typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); |
typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); |
#endif |
#ifndef GL_NV_light_max_exponent |
#define GL_NV_light_max_exponent 1 |
#endif |
#ifndef GL_NV_vertex_array_range |
#define GL_NV_vertex_array_range 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); |
GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); |
typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); |
#endif |
#ifndef GL_NV_register_combiners |
#define GL_NV_register_combiners 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); |
GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); |
GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); |
GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); |
GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); |
GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); |
GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); |
GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); |
typedef void (APIENTRY * PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); |
typedef void (APIENTRY * PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); |
typedef void (APIENTRY * PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); |
typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); |
#endif |
#ifndef GL_NV_fog_distance |
#define GL_NV_fog_distance 1 |
#endif |
#ifndef GL_NV_texgen_emboss |
#define GL_NV_texgen_emboss 1 |
#endif |
#ifndef GL_NV_blend_square |
#define GL_NV_blend_square 1 |
#endif |
#ifndef GL_NV_texture_env_combine4 |
#define GL_NV_texture_env_combine4 1 |
#endif |
#ifndef GL_MESA_resize_buffers |
#define GL_MESA_resize_buffers 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glResizeBuffersMESA (void); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); |
#endif |
#ifndef GL_MESA_window_pos |
#define GL_MESA_window_pos 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); |
GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); |
GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); |
GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); |
GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); |
GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); |
GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); |
GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); |
GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); |
GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); |
GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); |
GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); |
GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); |
GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); |
GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); |
typedef void (APIENTRY * PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); |
typedef void (APIENTRY * PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); |
typedef void (APIENTRY * PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); |
#endif |
#ifndef GL_IBM_cull_vertex |
#define GL_IBM_cull_vertex 1 |
#endif |
#ifndef GL_IBM_multimode_draw_arrays |
#define GL_IBM_multimode_draw_arrays 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glMultiModeDrawArraysIBM (GLenum, const GLint *, const GLsizei *, GLsizei, GLint); |
GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* *, GLsizei, GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLMULTIMODEDRAWARRAYSIBMPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); |
typedef void (APIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, GLint modestride); |
#endif |
#ifndef GL_IBM_vertex_array_lists |
#define GL_IBM_vertex_array_lists 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); |
GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); |
GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
typedef void (APIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); |
#endif |
#ifndef GL_SGIX_subsample |
#define GL_SGIX_subsample 1 |
#endif |
#ifndef GL_SGIX_ycrcba |
#define GL_SGIX_ycrcba 1 |
#endif |
#ifndef GL_SGIX_ycrcb_subsample |
#define GL_SGIX_ycrcb_subsample 1 |
#endif |
#ifndef GL_SGIX_depth_pass_instrument |
#define GL_SGIX_depth_pass_instrument 1 |
#endif |
#ifndef GL_3DFX_texture_compression_FXT1 |
#define GL_3DFX_texture_compression_FXT1 1 |
#endif |
#ifndef GL_3DFX_multisample |
#define GL_3DFX_multisample 1 |
#endif |
#ifndef GL_3DFX_tbuffer |
#define GL_3DFX_tbuffer 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTbufferMask3DFX (GLuint); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); |
#endif |
#ifndef GL_EXT_multisample |
#define GL_EXT_multisample 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); |
GLAPI void APIENTRY glSamplePatternEXT (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); |
typedef void (APIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); |
#endif |
#ifndef GL_SGIX_vertex_preclip |
#define GL_SGIX_vertex_preclip 1 |
#endif |
#ifndef GL_SGIX_convolution_accuracy |
#define GL_SGIX_convolution_accuracy 1 |
#endif |
#ifndef GL_SGIX_resample |
#define GL_SGIX_resample 1 |
#endif |
#ifndef GL_SGIS_point_line_texgen |
#define GL_SGIS_point_line_texgen 1 |
#endif |
#ifndef GL_SGIS_texture_color_mask |
#define GL_SGIS_texture_color_mask 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); |
#endif |
#ifndef GL_SGIX_igloo_interface |
#define GL_SGIX_igloo_interface 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); |
#endif |
#ifndef GL_EXT_texture_env_dot3 |
#define GL_EXT_texture_env_dot3 1 |
#endif |
#ifndef GL_ATI_texture_mirror_once |
#define GL_ATI_texture_mirror_once 1 |
#endif |
#ifndef GL_NV_fence |
#define GL_NV_fence 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); |
GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); |
GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); |
GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); |
GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glFinishFenceNV (GLuint); |
GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); |
typedef void (APIENTRY * PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); |
typedef GLboolean (APIENTRY * PFNGLISFENCENVPROC) (GLuint fence); |
typedef GLboolean (APIENTRY * PFNGLTESTFENCENVPROC) (GLuint fence); |
typedef void (APIENTRY * PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLFINISHFENCENVPROC) (GLuint fence); |
typedef void (APIENTRY * PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); |
#endif |
#ifndef GL_NV_evaluators |
#define GL_NV_evaluators 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); |
GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); |
GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); |
GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); |
typedef void (APIENTRY * PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); |
typedef void (APIENTRY * PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); |
typedef void (APIENTRY * PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); |
#endif |
#ifndef GL_NV_packed_depth_stencil |
#define GL_NV_packed_depth_stencil 1 |
#endif |
#ifndef GL_NV_register_combiners2 |
#define GL_NV_register_combiners2 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); |
GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); |
#endif |
#ifndef GL_NV_texture_compression_vtc |
#define GL_NV_texture_compression_vtc 1 |
#endif |
#ifndef GL_NV_texture_rectangle |
#define GL_NV_texture_rectangle 1 |
#endif |
#ifndef GL_NV_texture_shader |
#define GL_NV_texture_shader 1 |
#endif |
#ifndef GL_NV_texture_shader2 |
#define GL_NV_texture_shader2 1 |
#endif |
#ifndef GL_NV_vertex_array_range2 |
#define GL_NV_vertex_array_range2 1 |
#endif |
#ifndef GL_NV_vertex_program |
#define GL_NV_vertex_program 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); |
GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); |
GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); |
GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); |
GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); |
GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); |
GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); |
GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); |
GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); |
GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); |
GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); |
GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); |
GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); |
GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); |
GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); |
GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); |
GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); |
GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); |
GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); |
GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); |
GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); |
GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); |
GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); |
GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); |
GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); |
GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); |
GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); |
GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); |
GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); |
GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); |
GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); |
GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); |
GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); |
GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef GLboolean (APIENTRY * PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); |
typedef void (APIENTRY * PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); |
typedef void (APIENTRY * PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); |
typedef void (APIENTRY * PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); |
typedef void (APIENTRY * PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); |
typedef void (APIENTRY * PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); |
typedef void (APIENTRY * PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); |
typedef GLboolean (APIENTRY * PFNGLISPROGRAMNVPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); |
typedef void (APIENTRY * PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); |
typedef void (APIENTRY * PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); |
typedef void (APIENTRY * PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); |
typedef void (APIENTRY * PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); |
typedef void (APIENTRY * PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); |
#endif |
#ifndef GL_SGIX_texture_coordinate_clamp |
#define GL_SGIX_texture_coordinate_clamp 1 |
#endif |
#ifndef GL_SGIX_scalebias_hint |
#define GL_SGIX_scalebias_hint 1 |
#endif |
#ifndef GL_OML_interlace |
#define GL_OML_interlace 1 |
#endif |
#ifndef GL_OML_subsample |
#define GL_OML_subsample 1 |
#endif |
#ifndef GL_OML_resample |
#define GL_OML_resample 1 |
#endif |
#ifndef GL_NV_copy_depth_to_color |
#define GL_NV_copy_depth_to_color 1 |
#endif |
#ifndef GL_ATI_envmap_bumpmap |
#define GL_ATI_envmap_bumpmap 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); |
GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); |
typedef void (APIENTRY * PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); |
typedef void (APIENTRY * PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); |
typedef void (APIENTRY * PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); |
#endif |
#ifndef GL_ATI_fragment_shader |
#define GL_ATI_fragment_shader 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); |
GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); |
GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); |
GLAPI void APIENTRY glBeginFragmentShaderATI (void); |
GLAPI void APIENTRY glEndFragmentShaderATI (void); |
GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); |
GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); |
GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef GLuint (APIENTRY * PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); |
typedef void (APIENTRY * PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLBEGINFRAGMENTSHADERATIPROC) (void); |
typedef void (APIENTRY * PFNGLENDFRAGMENTSHADERATIPROC) (void); |
typedef void (APIENTRY * PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); |
typedef void (APIENTRY * PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); |
typedef void (APIENTRY * PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); |
typedef void (APIENTRY * PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); |
typedef void (APIENTRY * PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); |
typedef void (APIENTRY * PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); |
typedef void (APIENTRY * PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); |
typedef void (APIENTRY * PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); |
typedef void (APIENTRY * PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); |
#endif |
#ifndef GL_ATI_pn_triangles |
#define GL_ATI_pn_triangles 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); |
GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); |
#endif |
#ifndef GL_ATI_vertex_array_object |
#define GL_ATI_vertex_array_object 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); |
GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); |
GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); |
GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glDeleteObjectBufferATI (GLuint); |
GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); |
GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); |
GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); |
GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef GLuint (APIENTRY * PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); |
typedef GLboolean (APIENTRY * PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); |
typedef void (APIENTRY * PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); |
typedef void (APIENTRY * PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLDELETEOBJECTBUFFERATIPROC) (GLuint buffer); |
typedef void (APIENTRY * PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); |
typedef void (APIENTRY * PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); |
typedef void (APIENTRY * PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); |
typedef void (APIENTRY * PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); |
#endif |
#ifndef GL_EXT_vertex_shader |
#define GL_EXT_vertex_shader 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glBeginVertexShaderEXT (void); |
GLAPI void APIENTRY glEndVertexShaderEXT (void); |
GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); |
GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); |
GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); |
GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); |
GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); |
GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); |
GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); |
GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); |
GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); |
GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const void *); |
GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const void *); |
GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); |
GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); |
GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); |
GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); |
GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); |
GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); |
GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); |
GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); |
GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const void *); |
GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); |
GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); |
GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); |
GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); |
GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); |
GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); |
GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); |
GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); |
GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); |
GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); |
GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); |
GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); |
GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); |
GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLBEGINVERTEXSHADEREXTPROC) (void); |
typedef void (APIENTRY * PFNGLENDVERTEXSHADEREXTPROC) (void); |
typedef void (APIENTRY * PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); |
typedef GLuint (APIENTRY * PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); |
typedef void (APIENTRY * PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); |
typedef void (APIENTRY * PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); |
typedef void (APIENTRY * PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); |
typedef void (APIENTRY * PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); |
typedef void (APIENTRY * PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); |
typedef void (APIENTRY * PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); |
typedef void (APIENTRY * PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); |
typedef GLuint (APIENTRY * PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); |
typedef void (APIENTRY * PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr); |
typedef void (APIENTRY * PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr); |
typedef void (APIENTRY * PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); |
typedef void (APIENTRY * PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); |
typedef void (APIENTRY * PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); |
typedef void (APIENTRY * PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); |
typedef void (APIENTRY * PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); |
typedef void (APIENTRY * PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); |
typedef void (APIENTRY * PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); |
typedef void (APIENTRY * PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); |
typedef void (APIENTRY * PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr); |
typedef void (APIENTRY * PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); |
typedef GLuint (APIENTRY * PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); |
typedef GLuint (APIENTRY * PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); |
typedef GLuint (APIENTRY * PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); |
typedef GLuint (APIENTRY * PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); |
typedef GLuint (APIENTRY * PFNGLBINDPARAMETEREXTPROC) (GLenum value); |
typedef GLboolean (APIENTRY * PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); |
typedef void (APIENTRY * PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); |
typedef void (APIENTRY * PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); |
typedef void (APIENTRY * PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); |
typedef void (APIENTRY * PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); |
typedef void (APIENTRY * PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); |
typedef void (APIENTRY * PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); |
typedef void (APIENTRY * PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); |
typedef void (APIENTRY * PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); |
typedef void (APIENTRY * PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); |
typedef void (APIENTRY * PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); |
#endif |
#ifndef GL_ATI_vertex_streams |
#define GL_ATI_vertex_streams 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); |
GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); |
GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); |
GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); |
GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); |
GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); |
GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); |
GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); |
GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); |
GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); |
GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); |
GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); |
GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); |
GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); |
GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); |
GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); |
GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); |
GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); |
GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); |
GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); |
GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); |
GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); |
GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); |
GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); |
GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); |
GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); |
GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); |
GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); |
GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); |
typedef void (APIENTRY * PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); |
typedef void (APIENTRY * PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); |
typedef void (APIENTRY * PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); |
typedef void (APIENTRY * PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); |
#endif |
#ifndef GL_ATI_element_array |
#define GL_ATI_element_array 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); |
GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); |
GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); |
typedef void (APIENTRY * PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); |
typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); |
#endif |
#ifndef GL_SUN_mesh_array |
#define GL_SUN_mesh_array 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); |
#endif |
#ifndef GL_SUN_slice_accum |
#define GL_SUN_slice_accum 1 |
#endif |
#ifndef GL_NV_multisample_filter_hint |
#define GL_NV_multisample_filter_hint 1 |
#endif |
#ifndef GL_NV_depth_clamp |
#define GL_NV_depth_clamp 1 |
#endif |
#ifndef GL_NV_occlusion_query |
#define GL_NV_occlusion_query 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); |
GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); |
GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); |
GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); |
GLAPI void APIENTRY glEndOcclusionQueryNV (void); |
GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); |
GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); |
typedef void (APIENTRY * PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); |
typedef GLboolean (APIENTRY * PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); |
typedef void (APIENTRY * PFNGLENDOCCLUSIONQUERYNVPROC) (void); |
typedef void (APIENTRY * PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); |
typedef void (APIENTRY * PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); |
#endif |
#ifndef GL_NV_point_sprite |
#define GL_NV_point_sprite 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); |
GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); |
typedef void (APIENTRY * PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); |
#endif |
#ifndef GL_NV_texture_shader3 |
#define GL_NV_texture_shader3 1 |
#endif |
#ifndef GL_NV_vertex_program1_1 |
#define GL_NV_vertex_program1_1 1 |
#endif |
#ifndef GL_EXT_shadow_funcs |
#define GL_EXT_shadow_funcs 1 |
#endif |
#ifndef GL_EXT_stencil_two_side |
#define GL_EXT_stencil_two_side 1 |
#ifdef GL_GLEXT_PROTOTYPES |
GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); |
#endif /* GL_GLEXT_PROTOTYPES */ |
typedef void (APIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); |
#endif |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/mglmesa.h |
---|
0,0 → 1,80 |
/**************************************************************************** |
* |
* Mesa bindings for SciTech MGL |
* |
* Copyright (C) 1996 SciTech Software. |
* All rights reserved. |
* |
* Filename: $Workfile: mglmesa.h $ |
* Version: $Revision: 1.1 $ |
* |
* Language: ANSI C |
* Environment: Any |
* |
* Description: Header file for the Mesa/OpenGL interface bindings for the |
* SciTech MGL graphics library. Uses the MGL internal |
* device context structures to get direct access to the |
* high performance MGL rasterization functions for maximum |
* performance. Utilizes the VESA VBE/AF Accelerator Functions |
* via the MGL's accelerated device driver functions, as well |
* as basic DirectDraw accelerated functions provided by the |
* MGL. |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* |
* $Date: 2003-02-28 11:41:56 $ $Author: pj $ |
* |
****************************************************************************/ |
#ifndef __MGLMESA_H |
#define __MGLMESA_H |
#include "mgraph.h" |
/*------------------------- Function Prototypes ---------------------------*/ |
#ifdef __cplusplus |
extern "C" { /* Use "C" linkage when in C++ mode */ |
#endif |
#ifndef __WINDOWS__ |
#define GLAPIENTRY |
#endif |
#ifdef __WINDOWS__ |
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version); |
#endif |
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual); |
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual); |
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC); |
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc); |
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc); |
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT); |
/* Palette manipulation support. The reason we provide palette manipulation |
* routines is so that when rendering in double buffered modes with a |
* software backbuffer, the palette for the backbuffer is kept consistent |
* with the hardware front buffer. |
*/ |
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue); |
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex); |
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT); |
#ifdef __cplusplus |
} /* End of "C" linkage for C++ */ |
#endif /* __cplusplus */ |
#endif /* __MGLMESA_H */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/gl_mangle.h |
---|
0,0 → 1,1056 |
#if 0 /* $Id: gl_mangle.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
# DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN KORN SHELL and save the output |
# This file is used to create GL function protypes and aliases for the function names |
files="gl.h glext.h" |
#get regeneration header - copy everything in this file above the "REGENERATE_TO_END" line |
awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 |
echo "\n" |
#get aliases |
grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq |
echo "\n#endif /* GL_MANGLE_H */" |
exit |
#endif /* REGENERATION */ |
/* |
* If you compile Mesa with USE_MGL_NAMESPACE defined then you can link |
* your application both with OpenGL and Mesa. The Mesa functions will |
* be redefined so they are prefixed with "mgl" instead of "gl". |
* Mgl contributed by Randy Frank (rfrank@rsinc.com) |
* Regneration code contributed by Ray Tice (rayt@ma.ultra.net) |
*/ |
#ifndef GL_MANGLE_H |
#define GL_MANGLE_H |
#ifndef MANGLE |
#define MANGLE(x) mgl##x |
#endif /*MANGLE*/ |
/* Internal symbols which may collide with other OpenGL implementations. */ |
#define __glCoreCreateContext __mglCoreCreateContext |
#define __glCoreNopDispatch __mglCoreNopDispatch |
/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ |
#define glAccum MANGLE(Accum) |
#define glActiveTexture MANGLE(ActiveTexture) |
#define glActiveTextureARB MANGLE(ActiveTextureARB) |
#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI) |
#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI) |
#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI) |
#define glAlphaFunc MANGLE(AlphaFunc) |
#define glApplyTextureEXT MANGLE(ApplyTextureEXT) |
#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV) |
#define glAreTexturesResident MANGLE(AreTexturesResident) |
#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT) |
#define glArrayElement MANGLE(ArrayElement) |
#define glArrayElementEXT MANGLE(ArrayElementEXT) |
#define glArrayObjectATI MANGLE(ArrayObjectATI) |
#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX) |
#define glBegin MANGLE(Begin) |
#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI) |
#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT) |
#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) |
#define glBindLightParameterEXT MANGLE(BindLightParameterEXT) |
#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) |
#define glBindParameterEXT MANGLE(BindParameterEXT) |
#define glBindProgramNV MANGLE(BindProgramNV) |
#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) |
#define glBindTexture MANGLE(BindTexture) |
#define glBindTextureEXT MANGLE(BindTextureEXT) |
#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) |
#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT) |
#define glBinormal3bEXT MANGLE(Binormal3bEXT) |
#define glBinormal3bvEXT MANGLE(Binormal3bvEXT) |
#define glBinormal3dEXT MANGLE(Binormal3dEXT) |
#define glBinormal3dvEXT MANGLE(Binormal3dvEXT) |
#define glBinormal3fEXT MANGLE(Binormal3fEXT) |
#define glBinormal3fvEXT MANGLE(Binormal3fvEXT) |
#define glBinormal3iEXT MANGLE(Binormal3iEXT) |
#define glBinormal3ivEXT MANGLE(Binormal3ivEXT) |
#define glBinormal3sEXT MANGLE(Binormal3sEXT) |
#define glBinormal3svEXT MANGLE(Binormal3svEXT) |
#define glBinormalPointerEXT MANGLE(BinormalPointerEXT) |
#define glBitmap MANGLE(Bitmap) |
#define glBlendColor MANGLE(BlendColor) |
#define glBlendColorEXT MANGLE(BlendColorEXT) |
#define glBlendEquation MANGLE(BlendEquation) |
#define glBlendEquationEXT MANGLE(BlendEquationEXT) |
#define glBlendFunc MANGLE(BlendFunc) |
#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) |
#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) |
#define glCallList MANGLE(CallList) |
#define glCallLists MANGLE(CallLists) |
#define glClear MANGLE(Clear) |
#define glClearAccum MANGLE(ClearAccum) |
#define glClearColor MANGLE(ClearColor) |
#define glClearDepth MANGLE(ClearDepth) |
#define glClearIndex MANGLE(ClearIndex) |
#define glClearStencil MANGLE(ClearStencil) |
#define glClientActiveTexture MANGLE(ClientActiveTexture) |
#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB) |
#define glClientActiveVertexStream MANGLE(ClientActiveVertexStream) |
#define glClipPlane MANGLE(ClipPlane) |
#define glColor3b MANGLE(Color3b) |
#define glColor3bv MANGLE(Color3bv) |
#define glColor3d MANGLE(Color3d) |
#define glColor3dv MANGLE(Color3dv) |
#define glColor3f MANGLE(Color3f) |
#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN) |
#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN) |
#define glColor3fv MANGLE(Color3fv) |
#define glColor3i MANGLE(Color3i) |
#define glColor3iv MANGLE(Color3iv) |
#define glColor3s MANGLE(Color3s) |
#define glColor3sv MANGLE(Color3sv) |
#define glColor3ub MANGLE(Color3ub) |
#define glColor3ubv MANGLE(Color3ubv) |
#define glColor3ui MANGLE(Color3ui) |
#define glColor3uiv MANGLE(Color3uiv) |
#define glColor3us MANGLE(Color3us) |
#define glColor3usv MANGLE(Color3usv) |
#define glColor4b MANGLE(Color4b) |
#define glColor4bv MANGLE(Color4bv) |
#define glColor4d MANGLE(Color4d) |
#define glColor4dv MANGLE(Color4dv) |
#define glColor4f MANGLE(Color4f) |
#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN) |
#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN) |
#define glColor4fv MANGLE(Color4fv) |
#define glColor4i MANGLE(Color4i) |
#define glColor4iv MANGLE(Color4iv) |
#define glColor4s MANGLE(Color4s) |
#define glColor4sv MANGLE(Color4sv) |
#define glColor4ub MANGLE(Color4ub) |
#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN) |
#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN) |
#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN) |
#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN) |
#define glColor4ubv MANGLE(Color4ubv) |
#define glColor4ui MANGLE(Color4ui) |
#define glColor4uiv MANGLE(Color4uiv) |
#define glColor4us MANGLE(Color4us) |
#define glColor4usv MANGLE(Color4usv) |
#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI) |
#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI) |
#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI) |
#define glColorMask MANGLE(ColorMask) |
#define glColorMaterial MANGLE(ColorMaterial) |
#define glColorPointer MANGLE(ColorPointer) |
#define glColorPointerEXT MANGLE(ColorPointerEXT) |
#define glColorPointerListIBM MANGLE(ColorPointerListIBM) |
#define glColorPointervINTEL MANGLE(ColorPointervINTEL) |
#define glColorSubTable MANGLE(ColorSubTable) |
#define glColorSubTableEXT MANGLE(ColorSubTableEXT) |
#define glColorTable MANGLE(ColorTable) |
#define glColorTableEXT MANGLE(ColorTableEXT) |
#define glColorTableParameterfv MANGLE(ColorTableParameterfv) |
#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI) |
#define glColorTableParameteriv MANGLE(ColorTableParameteriv) |
#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI) |
#define glColorTableSGI MANGLE(ColorTableSGI) |
#define glCombinerInputNV MANGLE(CombinerInputNV) |
#define glCombinerOutputNV MANGLE(CombinerOutputNV) |
#define glCombinerParameterfNV MANGLE(CombinerParameterfNV) |
#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV) |
#define glCombinerParameteriNV MANGLE(CombinerParameteriNV) |
#define glCombinerParameterivNV MANGLE(CombinerParameterivNV) |
#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) |
#define glCompressedTexImage1D MANGLE(CompressedTexImage1D) |
#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB) |
#define glCompressedTexImage2D MANGLE(CompressedTexImage2D) |
#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB) |
#define glCompressedTexImage3D MANGLE(CompressedTexImage3D) |
#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB) |
#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D) |
#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB) |
#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D) |
#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB) |
#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D) |
#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB) |
#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D) |
#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT) |
#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D) |
#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT) |
#define glConvolutionParameterf MANGLE(ConvolutionParameterf) |
#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT) |
#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv) |
#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT) |
#define glConvolutionParameteri MANGLE(ConvolutionParameteri) |
#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT) |
#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv) |
#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT) |
#define glCopyColorSubTable MANGLE(CopyColorSubTable) |
#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT) |
#define glCopyColorTable MANGLE(CopyColorTable) |
#define glCopyColorTableSGI MANGLE(CopyColorTableSGI) |
#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D) |
#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT) |
#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D) |
#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT) |
#define glCopyPixels MANGLE(CopyPixels) |
#define glCopyTexImage1D MANGLE(CopyTexImage1D) |
#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT) |
#define glCopyTexImage2D MANGLE(CopyTexImage2D) |
#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT) |
#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D) |
#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT) |
#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D) |
#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT) |
#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D) |
#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT) |
#define glCullFace MANGLE(CullFace) |
#define glCullParameterdvEXT MANGLE(CullParameterdvEXT) |
#define glCullParameterfvEXT MANGLE(CullParameterfvEXT) |
#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) |
#define glDeformSGIX MANGLE(DeformSGIX) |
#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) |
#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) |
#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX) |
#define glDeleteFencesNV MANGLE(DeleteFencesNV) |
#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI) |
#define glDeleteLists MANGLE(DeleteLists) |
#define glDeleteObjectBufferATI MANGLE(DeleteObjectBufferATI) |
#define glDeleteProgramsNV MANGLE(DeleteProgramsNV) |
#define glDeleteTextures MANGLE(DeleteTextures) |
#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) |
#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT) |
#define glDepthFunc MANGLE(DepthFunc) |
#define glDepthMask MANGLE(DepthMask) |
#define glDepthRange MANGLE(DepthRange) |
#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS) |
#define glDisable MANGLE(Disable) |
#define glDisableClientState MANGLE(DisableClientState) |
#define glDisableTraceMESA MANGLE(DisableTraceMESA) |
#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT) |
#define glDrawArrays MANGLE(DrawArrays) |
#define glDrawArraysEXT MANGLE(DrawArraysEXT) |
#define glDrawBuffer MANGLE(DrawBuffer) |
#define glDrawElements MANGLE(DrawElements) |
#define glDrawPixels MANGLE(DrawPixels) |
#define glDrawRangeElements MANGLE(DrawRangeElements) |
#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) |
#define glEdgeFlag MANGLE(EdgeFlag) |
#define glEdgeFlagPointer MANGLE(EdgeFlagPointer) |
#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) |
#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM) |
#define glEdgeFlagv MANGLE(EdgeFlagv) |
#define glEnable MANGLE(Enable) |
#define glEnableClientState MANGLE(EnableClientState) |
#define glEnableTraceMESA MANGLE(EnableTraceMESA) |
#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT) |
#define glEnd MANGLE(End) |
#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI) |
#define glEndList MANGLE(EndList) |
#define glEndTraceMESA MANGLE(EndTraceMESA) |
#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT) |
#define glEvalCoord1d MANGLE(EvalCoord1d) |
#define glEvalCoord1dv MANGLE(EvalCoord1dv) |
#define glEvalCoord1f MANGLE(EvalCoord1f) |
#define glEvalCoord1fv MANGLE(EvalCoord1fv) |
#define glEvalCoord2d MANGLE(EvalCoord2d) |
#define glEvalCoord2dv MANGLE(EvalCoord2dv) |
#define glEvalCoord2f MANGLE(EvalCoord2f) |
#define glEvalCoord2fv MANGLE(EvalCoord2fv) |
#define glEvalMapsNV MANGLE(EvalMapsNV) |
#define glEvalMesh1 MANGLE(EvalMesh1) |
#define glEvalMesh2 MANGLE(EvalMesh2) |
#define glEvalPoint1 MANGLE(EvalPoint1) |
#define glEvalPoint2 MANGLE(EvalPoint2) |
#define glExecuteProgramNV MANGLE(ExecuteProgramNV) |
#define glExtractComponentEXT MANGLE(ExtractComponentEXT) |
#define glFeedbackBuffer MANGLE(FeedbackBuffer) |
#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV) |
#define glFinish MANGLE(Finish) |
#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX) |
#define glFinishFenceNV MANGLE(FinishFenceNV) |
#define glFinishTextureSUNX MANGLE(FinishTextureSUNX) |
#define glFlush MANGLE(Flush) |
#define glFlushRasterSGIX MANGLE(FlushRasterSGIX) |
#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV) |
#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT) |
#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM) |
#define glFogCoorddEXT MANGLE(FogCoorddEXT) |
#define glFogCoorddvEXT MANGLE(FogCoorddvEXT) |
#define glFogCoordfEXT MANGLE(FogCoordfEXT) |
#define glFogCoordfvEXT MANGLE(FogCoordfvEXT) |
#define glFogFuncSGIS MANGLE(FogFuncSGIS) |
#define glFogf MANGLE(Fogf) |
#define glFogfv MANGLE(Fogfv) |
#define glFogi MANGLE(Fogi) |
#define glFogiv MANGLE(Fogiv) |
#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX) |
#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX) |
#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX) |
#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX) |
#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX) |
#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX) |
#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX) |
#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX) |
#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX) |
#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX) |
#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX) |
#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX) |
#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX) |
#define glFrameZoomSGIX MANGLE(FrameZoomSGIX) |
#define glFrontFace MANGLE(FrontFace) |
#define glFrustum MANGLE(Frustum) |
#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX) |
#define glGenFencesNV MANGLE(GenFencesNV) |
#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI) |
#define glGenLists MANGLE(GenLists) |
#define glGenProgramsNV MANGLE(GenProgramsNV) |
#define glGenSymbolsEXT MANGLE(GenSymbolsEXT) |
#define glGenTextures MANGLE(GenTextures) |
#define glGenTexturesEXT MANGLE(GenTexturesEXT) |
#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) |
#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI) |
#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI) |
#define glGetBooleanv MANGLE(GetBooleanv) |
#define glGetClipPlane MANGLE(GetClipPlane) |
#define glGetColorTable MANGLE(GetColorTable) |
#define glGetColorTableEXT MANGLE(GetColorTableEXT) |
#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv) |
#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT) |
#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI) |
#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv) |
#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT) |
#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI) |
#define glGetColorTableSGI MANGLE(GetColorTableSGI) |
#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV) |
#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV) |
#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV) |
#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV) |
#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV) |
#define glGetCompressedTexImage MANGLE(GetCompressedTexImage) |
#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB) |
#define glGetConvolutionFilter MANGLE(GetConvolutionFilter) |
#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT) |
#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv) |
#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT) |
#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) |
#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT) |
#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) |
#define glGetDoublev MANGLE(GetDoublev) |
#define glGetError MANGLE(GetError) |
#define glGetFenceivNV MANGLE(GetFenceivNV) |
#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) |
#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) |
#define glGetFloatv MANGLE(GetFloatv) |
#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) |
#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) |
#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX) |
#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX) |
#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX) |
#define glGetHistogram MANGLE(GetHistogram) |
#define glGetHistogramEXT MANGLE(GetHistogramEXT) |
#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv) |
#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT) |
#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv) |
#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT) |
#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP) |
#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP) |
#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX) |
#define glGetIntegerv MANGLE(GetIntegerv) |
#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT) |
#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT) |
#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT) |
#define glGetLightfv MANGLE(GetLightfv) |
#define glGetLightiv MANGLE(GetLightiv) |
#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX) |
#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX) |
#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT) |
#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT) |
#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT) |
#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV) |
#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV) |
#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV) |
#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV) |
#define glGetMapParameterivNV MANGLE(GetMapParameterivNV) |
#define glGetMapdv MANGLE(GetMapdv) |
#define glGetMapfv MANGLE(GetMapfv) |
#define glGetMapiv MANGLE(GetMapiv) |
#define glGetMaterialfv MANGLE(GetMaterialfv) |
#define glGetMaterialiv MANGLE(GetMaterialiv) |
#define glGetMinmax MANGLE(GetMinmax) |
#define glGetMinmaxEXT MANGLE(GetMinmaxEXT) |
#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv) |
#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT) |
#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv) |
#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT) |
#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) |
#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) |
#define glGetPixelMapfv MANGLE(GetPixelMapfv) |
#define glGetPixelMapuiv MANGLE(GetPixelMapuiv) |
#define glGetPixelMapusv MANGLE(GetPixelMapusv) |
#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS) |
#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS) |
#define glGetPointerv MANGLE(GetPointerv) |
#define glGetPointervEXT MANGLE(GetPointervEXT) |
#define glGetPolygonStipple MANGLE(GetPolygonStipple) |
#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) |
#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) |
#define glGetProgramStringNV MANGLE(GetProgramStringNV) |
#define glGetProgramivNV MANGLE(GetProgramivNV) |
#define glGetSeparableFilter MANGLE(GetSeparableFilter) |
#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) |
#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) |
#define glGetString MANGLE(GetString) |
#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) |
#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) |
#define glGetTexEnvfv MANGLE(GetTexEnvfv) |
#define glGetTexEnviv MANGLE(GetTexEnviv) |
#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS) |
#define glGetTexGendv MANGLE(GetTexGendv) |
#define glGetTexGenfv MANGLE(GetTexGenfv) |
#define glGetTexGeniv MANGLE(GetTexGeniv) |
#define glGetTexImage MANGLE(GetTexImage) |
#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv) |
#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv) |
#define glGetTexParameterfv MANGLE(GetTexParameterfv) |
#define glGetTexParameteriv MANGLE(GetTexParameteriv) |
#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV) |
#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI) |
#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI) |
#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT) |
#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT) |
#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT) |
#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT) |
#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) |
#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV) |
#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV) |
#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) |
#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN) |
#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN) |
#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN) |
#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN) |
#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN) |
#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN) |
#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN) |
#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN) |
#define glHint MANGLE(Hint) |
#define glHintPGI MANGLE(HintPGI) |
#define glHistogram MANGLE(Histogram) |
#define glHistogramEXT MANGLE(HistogramEXT) |
#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX) |
#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP) |
#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP) |
#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP) |
#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP) |
#define glIndexFuncEXT MANGLE(IndexFuncEXT) |
#define glIndexMask MANGLE(IndexMask) |
#define glIndexMaterialEXT MANGLE(IndexMaterialEXT) |
#define glIndexPointer MANGLE(IndexPointer) |
#define glIndexPointerEXT MANGLE(IndexPointerEXT) |
#define glIndexPointerListIBM MANGLE(IndexPointerListIBM) |
#define glIndexd MANGLE(Indexd) |
#define glIndexdv MANGLE(Indexdv) |
#define glIndexf MANGLE(Indexf) |
#define glIndexfv MANGLE(Indexfv) |
#define glIndexi MANGLE(Indexi) |
#define glIndexiv MANGLE(Indexiv) |
#define glIndexs MANGLE(Indexs) |
#define glIndexsv MANGLE(Indexsv) |
#define glIndexub MANGLE(Indexub) |
#define glIndexubv MANGLE(Indexubv) |
#define glInitNames MANGLE(InitNames) |
#define glInsertComponentEXT MANGLE(InsertComponentEXT) |
#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX) |
#define glInterleavedArrays MANGLE(InterleavedArrays) |
#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX) |
#define glIsEnabled MANGLE(IsEnabled) |
#define glIsFenceNV MANGLE(IsFenceNV) |
#define glIsList MANGLE(IsList) |
#define glIsObjectBufferATI MANGLE(IsObjectBufferATI) |
#define glIsProgramNV MANGLE(IsProgramNV) |
#define glIsTexture MANGLE(IsTexture) |
#define glIsTextureEXT MANGLE(IsTextureEXT) |
#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) |
#define glLightEnviSGIX MANGLE(LightEnviSGIX) |
#define glLightModelf MANGLE(LightModelf) |
#define glLightModelfv MANGLE(LightModelfv) |
#define glLightModeli MANGLE(LightModeli) |
#define glLightModeliv MANGLE(LightModeliv) |
#define glLightf MANGLE(Lightf) |
#define glLightfv MANGLE(Lightfv) |
#define glLighti MANGLE(Lighti) |
#define glLightiv MANGLE(Lightiv) |
#define glLineStipple MANGLE(LineStipple) |
#define glLineWidth MANGLE(LineWidth) |
#define glListBase MANGLE(ListBase) |
#define glListParameterfSGIX MANGLE(ListParameterfSGIX) |
#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX) |
#define glListParameteriSGIX MANGLE(ListParameteriSGIX) |
#define glListParameterivSGIX MANGLE(ListParameterivSGIX) |
#define glLoadIdentity MANGLE(LoadIdentity) |
#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX) |
#define glLoadMatrixd MANGLE(LoadMatrixd) |
#define glLoadMatrixf MANGLE(LoadMatrixf) |
#define glLoadName MANGLE(LoadName) |
#define glLoadProgramNV MANGLE(LoadProgramNV) |
#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd) |
#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB) |
#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf) |
#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB) |
#define glLockArraysEXT MANGLE(LockArraysEXT) |
#define glLogicOp MANGLE(LogicOp) |
#define glMap1d MANGLE(Map1d) |
#define glMap1f MANGLE(Map1f) |
#define glMap2d MANGLE(Map2d) |
#define glMap2f MANGLE(Map2f) |
#define glMapControlPointsNV MANGLE(MapControlPointsNV) |
#define glMapGrid1d MANGLE(MapGrid1d) |
#define glMapGrid1f MANGLE(MapGrid1f) |
#define glMapGrid2d MANGLE(MapGrid2d) |
#define glMapGrid2f MANGLE(MapGrid2f) |
#define glMapParameterfvNV MANGLE(MapParameterfvNV) |
#define glMapParameterivNV MANGLE(MapParameterivNV) |
#define glMaterialf MANGLE(Materialf) |
#define glMaterialfv MANGLE(Materialfv) |
#define glMateriali MANGLE(Materiali) |
#define glMaterialiv MANGLE(Materialiv) |
#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB) |
#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB) |
#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB) |
#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB) |
#define glMatrixMode MANGLE(MatrixMode) |
#define glMinmax MANGLE(Minmax) |
#define glMinmaxEXT MANGLE(MinmaxEXT) |
#define glMultMatrixd MANGLE(MultMatrixd) |
#define glMultMatrixf MANGLE(MultMatrixf) |
#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd) |
#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB) |
#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) |
#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB) |
#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) |
#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT) |
#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM) |
#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM) |
#define glMultiTexCoord1d MANGLE(MultiTexCoord1d) |
#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB) |
#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv) |
#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB) |
#define glMultiTexCoord1f MANGLE(MultiTexCoord1f) |
#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB) |
#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv) |
#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB) |
#define glMultiTexCoord1i MANGLE(MultiTexCoord1i) |
#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB) |
#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv) |
#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB) |
#define glMultiTexCoord1s MANGLE(MultiTexCoord1s) |
#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB) |
#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv) |
#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB) |
#define glMultiTexCoord2d MANGLE(MultiTexCoord2d) |
#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB) |
#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv) |
#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB) |
#define glMultiTexCoord2f MANGLE(MultiTexCoord2f) |
#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB) |
#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv) |
#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB) |
#define glMultiTexCoord2i MANGLE(MultiTexCoord2i) |
#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB) |
#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv) |
#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB) |
#define glMultiTexCoord2s MANGLE(MultiTexCoord2s) |
#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB) |
#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv) |
#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB) |
#define glMultiTexCoord3d MANGLE(MultiTexCoord3d) |
#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB) |
#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv) |
#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB) |
#define glMultiTexCoord3f MANGLE(MultiTexCoord3f) |
#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB) |
#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv) |
#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB) |
#define glMultiTexCoord3i MANGLE(MultiTexCoord3i) |
#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB) |
#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv) |
#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB) |
#define glMultiTexCoord3s MANGLE(MultiTexCoord3s) |
#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB) |
#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv) |
#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB) |
#define glMultiTexCoord4d MANGLE(MultiTexCoord4d) |
#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB) |
#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv) |
#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB) |
#define glMultiTexCoord4f MANGLE(MultiTexCoord4f) |
#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB) |
#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv) |
#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB) |
#define glMultiTexCoord4i MANGLE(MultiTexCoord4i) |
#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB) |
#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv) |
#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB) |
#define glMultiTexCoord4s MANGLE(MultiTexCoord4s) |
#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB) |
#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) |
#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) |
#define glNewList MANGLE(NewList) |
#define glNewObjectBufferATI MANGLE(NewObjectBufferATI) |
#define glNewTraceMESA MANGLE(NewTraceMESA) |
#define glNormal3b MANGLE(Normal3b) |
#define glNormal3bv MANGLE(Normal3bv) |
#define glNormal3d MANGLE(Normal3d) |
#define glNormal3dv MANGLE(Normal3dv) |
#define glNormal3f MANGLE(Normal3f) |
#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN) |
#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN) |
#define glNormal3fv MANGLE(Normal3fv) |
#define glNormal3i MANGLE(Normal3i) |
#define glNormal3iv MANGLE(Normal3iv) |
#define glNormal3s MANGLE(Normal3s) |
#define glNormal3sv MANGLE(Normal3sv) |
#define glNormalPointer MANGLE(NormalPointer) |
#define glNormalPointerEXT MANGLE(NormalPointerEXT) |
#define glNormalPointerListIBM MANGLE(NormalPointerListIBM) |
#define glNormalPointervINTEL MANGLE(NormalPointervINTEL) |
#define glNormalStream3b MANGLE(NormalStream3b) |
#define glNormalStream3bv MANGLE(NormalStream3bv) |
#define glNormalStream3d MANGLE(NormalStream3d) |
#define glNormalStream3dv MANGLE(NormalStream3dv) |
#define glNormalStream3f MANGLE(NormalStream3f) |
#define glNormalStream3fv MANGLE(NormalStream3fv) |
#define glNormalStream3i MANGLE(NormalStream3i) |
#define glNormalStream3iv MANGLE(NormalStream3iv) |
#define glNormalStream3s MANGLE(NormalStream3s) |
#define glNormalStream3sv MANGLE(NormalStream3sv) |
#define glOrtho MANGLE(Ortho) |
#define glPNTrianglesfATI MANGLE(PNTrianglesfATI) |
#define glPNTrianglesiATI MANGLE(PNTrianglesiATI) |
#define glPassTexCoordATI MANGLE(PassTexCoordATI) |
#define glPassThrough MANGLE(PassThrough) |
#define glPixelMapfv MANGLE(PixelMapfv) |
#define glPixelMapuiv MANGLE(PixelMapuiv) |
#define glPixelMapusv MANGLE(PixelMapusv) |
#define glPixelStoref MANGLE(PixelStoref) |
#define glPixelStorei MANGLE(PixelStorei) |
#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS) |
#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS) |
#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS) |
#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS) |
#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX) |
#define glPixelTransferf MANGLE(PixelTransferf) |
#define glPixelTransferi MANGLE(PixelTransferi) |
#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT) |
#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT) |
#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT) |
#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT) |
#define glPixelZoom MANGLE(PixelZoom) |
#define glPointParameterfARB MANGLE(PointParameterfARB) |
#define glPointParameterfEXT MANGLE(PointParameterfEXT) |
#define glPointParameterfSGIS MANGLE(PointParameterfSGIS) |
#define glPointParameterfvARB MANGLE(PointParameterfvARB) |
#define glPointParameterfvEXT MANGLE(PointParameterfvEXT) |
#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS) |
#define glPointSize MANGLE(PointSize) |
#define glPollAsyncSGIX MANGLE(PollAsyncSGIX) |
#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX) |
#define glPolygonMode MANGLE(PolygonMode) |
#define glPolygonOffset MANGLE(PolygonOffset) |
#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT) |
#define glPolygonStipple MANGLE(PolygonStipple) |
#define glPopAttrib MANGLE(PopAttrib) |
#define glPopClientAttrib MANGLE(PopClientAttrib) |
#define glPopMatrix MANGLE(PopMatrix) |
#define glPopName MANGLE(PopName) |
#define glPrioritizeTextures MANGLE(PrioritizeTextures) |
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) |
#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV) |
#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV) |
#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV) |
#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV) |
#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) |
#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) |
#define glPushAttrib MANGLE(PushAttrib) |
#define glPushClientAttrib MANGLE(PushClientAttrib) |
#define glPushMatrix MANGLE(PushMatrix) |
#define glPushName MANGLE(PushName) |
#define glRasterPos2d MANGLE(RasterPos2d) |
#define glRasterPos2dv MANGLE(RasterPos2dv) |
#define glRasterPos2f MANGLE(RasterPos2f) |
#define glRasterPos2fv MANGLE(RasterPos2fv) |
#define glRasterPos2i MANGLE(RasterPos2i) |
#define glRasterPos2iv MANGLE(RasterPos2iv) |
#define glRasterPos2s MANGLE(RasterPos2s) |
#define glRasterPos2sv MANGLE(RasterPos2sv) |
#define glRasterPos3d MANGLE(RasterPos3d) |
#define glRasterPos3dv MANGLE(RasterPos3dv) |
#define glRasterPos3f MANGLE(RasterPos3f) |
#define glRasterPos3fv MANGLE(RasterPos3fv) |
#define glRasterPos3i MANGLE(RasterPos3i) |
#define glRasterPos3iv MANGLE(RasterPos3iv) |
#define glRasterPos3s MANGLE(RasterPos3s) |
#define glRasterPos3sv MANGLE(RasterPos3sv) |
#define glRasterPos4d MANGLE(RasterPos4d) |
#define glRasterPos4dv MANGLE(RasterPos4dv) |
#define glRasterPos4f MANGLE(RasterPos4f) |
#define glRasterPos4fv MANGLE(RasterPos4fv) |
#define glRasterPos4i MANGLE(RasterPos4i) |
#define glRasterPos4iv MANGLE(RasterPos4iv) |
#define glRasterPos4s MANGLE(RasterPos4s) |
#define glRasterPos4sv MANGLE(RasterPos4sv) |
#define glReadBuffer MANGLE(ReadBuffer) |
#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) |
#define glReadPixels MANGLE(ReadPixels) |
#define glRectd MANGLE(Rectd) |
#define glRectdv MANGLE(Rectdv) |
#define glRectf MANGLE(Rectf) |
#define glRectfv MANGLE(Rectfv) |
#define glRecti MANGLE(Recti) |
#define glRectiv MANGLE(Rectiv) |
#define glRects MANGLE(Rects) |
#define glRectsv MANGLE(Rectsv) |
#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) |
#define glRenderMode MANGLE(RenderMode) |
#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN) |
#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN) |
#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN) |
#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN) |
#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN) |
#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN) |
#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN) |
#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN) |
#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN) |
#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN) |
#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN) |
#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN) |
#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) |
#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) |
#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) |
#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) |
#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN) |
#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN) |
#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN) |
#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN) |
#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN) |
#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN) |
#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN) |
#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV) |
#define glResetHistogram MANGLE(ResetHistogram) |
#define glResetHistogramEXT MANGLE(ResetHistogramEXT) |
#define glResetMinmax MANGLE(ResetMinmax) |
#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) |
#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) |
#define glRotated MANGLE(Rotated) |
#define glRotatef MANGLE(Rotatef) |
#define glSampleCoverage MANGLE(SampleCoverage) |
#define glSampleCoverageARB MANGLE(SampleCoverageARB) |
#define glSampleMapATI MANGLE(SampleMapATI) |
#define glSampleMaskEXT MANGLE(SampleMaskEXT) |
#define glSampleMaskSGIS MANGLE(SampleMaskSGIS) |
#define glSamplePass MANGLE(SamplePass) |
#define glSamplePatternEXT MANGLE(SamplePatternEXT) |
#define glSamplePatternSGIS MANGLE(SamplePatternSGIS) |
#define glScaled MANGLE(Scaled) |
#define glScalef MANGLE(Scalef) |
#define glScissor MANGLE(Scissor) |
#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) |
#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT) |
#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT) |
#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT) |
#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT) |
#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT) |
#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT) |
#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT) |
#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT) |
#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT) |
#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT) |
#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT) |
#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT) |
#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT) |
#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT) |
#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) |
#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) |
#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) |
#define glSelectBuffer MANGLE(SelectBuffer) |
#define glSeparableFilter2D MANGLE(SeparableFilter2D) |
#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT) |
#define glSetFenceNV MANGLE(SetFenceNV) |
#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI) |
#define glSetInvariantEXT MANGLE(SetInvariantEXT) |
#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) |
#define glShadeModel MANGLE(ShadeModel) |
#define glShaderOp1EXT MANGLE(ShaderOp1EXT) |
#define glShaderOp2EXT MANGLE(ShaderOp2EXT) |
#define glShaderOp3EXT MANGLE(ShaderOp3EXT) |
#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS) |
#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX) |
#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX) |
#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX) |
#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX) |
#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX) |
#define glStencilFunc MANGLE(StencilFunc) |
#define glStencilMask MANGLE(StencilMask) |
#define glStencilOp MANGLE(StencilOp) |
#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX) |
#define glSwizzleEXT MANGLE(SwizzleEXT) |
#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX) |
#define glTangent3bEXT MANGLE(Tangent3bEXT) |
#define glTangent3bvEXT MANGLE(Tangent3bvEXT) |
#define glTangent3dEXT MANGLE(Tangent3dEXT) |
#define glTangent3dvEXT MANGLE(Tangent3dvEXT) |
#define glTangent3fEXT MANGLE(Tangent3fEXT) |
#define glTangent3fvEXT MANGLE(Tangent3fvEXT) |
#define glTangent3iEXT MANGLE(Tangent3iEXT) |
#define glTangent3ivEXT MANGLE(Tangent3ivEXT) |
#define glTangent3sEXT MANGLE(Tangent3sEXT) |
#define glTangent3svEXT MANGLE(Tangent3svEXT) |
#define glTangentPointerEXT MANGLE(TangentPointerEXT) |
#define glTbufferMask3DFX MANGLE(TbufferMask3DFX) |
#define glTestFenceNV MANGLE(TestFenceNV) |
#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI) |
#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI) |
#define glTexCoord1d MANGLE(TexCoord1d) |
#define glTexCoord1dv MANGLE(TexCoord1dv) |
#define glTexCoord1f MANGLE(TexCoord1f) |
#define glTexCoord1fv MANGLE(TexCoord1fv) |
#define glTexCoord1i MANGLE(TexCoord1i) |
#define glTexCoord1iv MANGLE(TexCoord1iv) |
#define glTexCoord1s MANGLE(TexCoord1s) |
#define glTexCoord1sv MANGLE(TexCoord1sv) |
#define glTexCoord2d MANGLE(TexCoord2d) |
#define glTexCoord2dv MANGLE(TexCoord2dv) |
#define glTexCoord2f MANGLE(TexCoord2f) |
#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN) |
#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN) |
#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN) |
#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN) |
#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN) |
#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN) |
#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN) |
#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN) |
#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN) |
#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN) |
#define glTexCoord2fv MANGLE(TexCoord2fv) |
#define glTexCoord2i MANGLE(TexCoord2i) |
#define glTexCoord2iv MANGLE(TexCoord2iv) |
#define glTexCoord2s MANGLE(TexCoord2s) |
#define glTexCoord2sv MANGLE(TexCoord2sv) |
#define glTexCoord3d MANGLE(TexCoord3d) |
#define glTexCoord3dv MANGLE(TexCoord3dv) |
#define glTexCoord3f MANGLE(TexCoord3f) |
#define glTexCoord3fv MANGLE(TexCoord3fv) |
#define glTexCoord3i MANGLE(TexCoord3i) |
#define glTexCoord3iv MANGLE(TexCoord3iv) |
#define glTexCoord3s MANGLE(TexCoord3s) |
#define glTexCoord3sv MANGLE(TexCoord3sv) |
#define glTexCoord4d MANGLE(TexCoord4d) |
#define glTexCoord4dv MANGLE(TexCoord4dv) |
#define glTexCoord4f MANGLE(TexCoord4f) |
#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN) |
#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN) |
#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN) |
#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN) |
#define glTexCoord4fv MANGLE(TexCoord4fv) |
#define glTexCoord4i MANGLE(TexCoord4i) |
#define glTexCoord4iv MANGLE(TexCoord4iv) |
#define glTexCoord4s MANGLE(TexCoord4s) |
#define glTexCoord4sv MANGLE(TexCoord4sv) |
#define glTexCoordPointer MANGLE(TexCoordPointer) |
#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) |
#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) |
#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL) |
#define glTexEnvf MANGLE(TexEnvf) |
#define glTexEnvfv MANGLE(TexEnvfv) |
#define glTexEnvi MANGLE(TexEnvi) |
#define glTexEnviv MANGLE(TexEnviv) |
#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS) |
#define glTexGend MANGLE(TexGend) |
#define glTexGendv MANGLE(TexGendv) |
#define glTexGenf MANGLE(TexGenf) |
#define glTexGenfv MANGLE(TexGenfv) |
#define glTexGeni MANGLE(TexGeni) |
#define glTexGeniv MANGLE(TexGeniv) |
#define glTexImage1D MANGLE(TexImage1D) |
#define glTexImage2D MANGLE(TexImage2D) |
#define glTexImage3D MANGLE(TexImage3D) |
#define glTexImage3DEXT MANGLE(TexImage3DEXT) |
#define glTexImage4DSGIS MANGLE(TexImage4DSGIS) |
#define glTexParameterf MANGLE(TexParameterf) |
#define glTexParameterfv MANGLE(TexParameterfv) |
#define glTexParameteri MANGLE(TexParameteri) |
#define glTexParameteriv MANGLE(TexParameteriv) |
#define glTexSubImage1D MANGLE(TexSubImage1D) |
#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT) |
#define glTexSubImage2D MANGLE(TexSubImage2D) |
#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT) |
#define glTexSubImage3D MANGLE(TexSubImage3D) |
#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT) |
#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS) |
#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS) |
#define glTextureLightEXT MANGLE(TextureLightEXT) |
#define glTextureMaterialEXT MANGLE(TextureMaterialEXT) |
#define glTextureNormalEXT MANGLE(TextureNormalEXT) |
#define glTraceAssertAttribMESA MANGLE(TraceAssertAttribMESA) |
#define glTraceCommentMESA MANGLE(TraceCommentMESA) |
#define glTraceListMESA MANGLE(TraceListMESA) |
#define glTracePointerMESA MANGLE(TracePointerMESA) |
#define glTracePointerRangeMESA MANGLE(TracePointerRangeMESA) |
#define glTraceTextureMESA MANGLE(TraceTextureMESA) |
#define glTrackMatrixNV MANGLE(TrackMatrixNV) |
#define glTranslated MANGLE(Translated) |
#define glTranslatef MANGLE(Translatef) |
#define glUnlockArraysEXT MANGLE(UnlockArraysEXT) |
#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) |
#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) |
#define glVariantPointerEXT MANGLE(VariantPointerEXT) |
#define glVariantbvEXT MANGLE(VariantbvEXT) |
#define glVariantdvEXT MANGLE(VariantdvEXT) |
#define glVariantfvEXT MANGLE(VariantfvEXT) |
#define glVariantivEXT MANGLE(VariantivEXT) |
#define glVariantsvEXT MANGLE(VariantsvEXT) |
#define glVariantubvEXT MANGLE(VariantubvEXT) |
#define glVariantuivEXT MANGLE(VariantuivEXT) |
#define glVariantusvEXT MANGLE(VariantusvEXT) |
#define glVertex2d MANGLE(Vertex2d) |
#define glVertex2dv MANGLE(Vertex2dv) |
#define glVertex2f MANGLE(Vertex2f) |
#define glVertex2fv MANGLE(Vertex2fv) |
#define glVertex2i MANGLE(Vertex2i) |
#define glVertex2iv MANGLE(Vertex2iv) |
#define glVertex2s MANGLE(Vertex2s) |
#define glVertex2sv MANGLE(Vertex2sv) |
#define glVertex3d MANGLE(Vertex3d) |
#define glVertex3dv MANGLE(Vertex3dv) |
#define glVertex3f MANGLE(Vertex3f) |
#define glVertex3fv MANGLE(Vertex3fv) |
#define glVertex3i MANGLE(Vertex3i) |
#define glVertex3iv MANGLE(Vertex3iv) |
#define glVertex3s MANGLE(Vertex3s) |
#define glVertex3sv MANGLE(Vertex3sv) |
#define glVertex4d MANGLE(Vertex4d) |
#define glVertex4dv MANGLE(Vertex4dv) |
#define glVertex4f MANGLE(Vertex4f) |
#define glVertex4fv MANGLE(Vertex4fv) |
#define glVertex4i MANGLE(Vertex4i) |
#define glVertex4iv MANGLE(Vertex4iv) |
#define glVertex4s MANGLE(Vertex4s) |
#define glVertex4sv MANGLE(Vertex4sv) |
#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) |
#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) |
#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV) |
#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV) |
#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV) |
#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV) |
#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV) |
#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV) |
#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV) |
#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV) |
#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV) |
#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV) |
#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV) |
#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV) |
#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV) |
#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV) |
#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV) |
#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV) |
#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV) |
#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV) |
#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV) |
#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV) |
#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV) |
#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV) |
#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV) |
#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV) |
#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV) |
#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) |
#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV) |
#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV) |
#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV) |
#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV) |
#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV) |
#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV) |
#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV) |
#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV) |
#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV) |
#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV) |
#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV) |
#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV) |
#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV) |
#define glVertexBlendARB MANGLE(VertexBlendARB) |
#define glVertexBlendEnvf MANGLE(VertexBlendEnvf) |
#define glVertexBlendEnvi MANGLE(VertexBlendEnvi) |
#define glVertexPointer MANGLE(VertexPointer) |
#define glVertexPointerEXT MANGLE(VertexPointerEXT) |
#define glVertexPointerListIBM MANGLE(VertexPointerListIBM) |
#define glVertexPointervINTEL MANGLE(VertexPointervINTEL) |
#define glVertexStream1d MANGLE(VertexStream1d) |
#define glVertexStream1dv MANGLE(VertexStream1dv) |
#define glVertexStream1f MANGLE(VertexStream1f) |
#define glVertexStream1fv MANGLE(VertexStream1fv) |
#define glVertexStream1i MANGLE(VertexStream1i) |
#define glVertexStream1iv MANGLE(VertexStream1iv) |
#define glVertexStream1s MANGLE(VertexStream1s) |
#define glVertexStream1sv MANGLE(VertexStream1sv) |
#define glVertexStream2d MANGLE(VertexStream2d) |
#define glVertexStream2dv MANGLE(VertexStream2dv) |
#define glVertexStream2f MANGLE(VertexStream2f) |
#define glVertexStream2fv MANGLE(VertexStream2fv) |
#define glVertexStream2i MANGLE(VertexStream2i) |
#define glVertexStream2iv MANGLE(VertexStream2iv) |
#define glVertexStream2s MANGLE(VertexStream2s) |
#define glVertexStream2sv MANGLE(VertexStream2sv) |
#define glVertexStream3d MANGLE(VertexStream3d) |
#define glVertexStream3dv MANGLE(VertexStream3dv) |
#define glVertexStream3f MANGLE(VertexStream3f) |
#define glVertexStream3fv MANGLE(VertexStream3fv) |
#define glVertexStream3i MANGLE(VertexStream3i) |
#define glVertexStream3iv MANGLE(VertexStream3iv) |
#define glVertexStream3s MANGLE(VertexStream3s) |
#define glVertexStream3sv MANGLE(VertexStream3sv) |
#define glVertexStream4d MANGLE(VertexStream4d) |
#define glVertexStream4dv MANGLE(VertexStream4dv) |
#define glVertexStream4f MANGLE(VertexStream4f) |
#define glVertexStream4fv MANGLE(VertexStream4fv) |
#define glVertexStream4i MANGLE(VertexStream4i) |
#define glVertexStream4iv MANGLE(VertexStream4iv) |
#define glVertexStream4s MANGLE(VertexStream4s) |
#define glVertexStream4sv MANGLE(VertexStream4sv) |
#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT) |
#define glVertexWeightfEXT MANGLE(VertexWeightfEXT) |
#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT) |
#define glViewport MANGLE(Viewport) |
#define glWeightPointerARB MANGLE(WeightPointerARB) |
#define glWeightbvARB MANGLE(WeightbvARB) |
#define glWeightdvARB MANGLE(WeightdvARB) |
#define glWeightfvARB MANGLE(WeightfvARB) |
#define glWeightivARB MANGLE(WeightivARB) |
#define glWeightsvARB MANGLE(WeightsvARB) |
#define glWeightubvARB MANGLE(WeightubvARB) |
#define glWeightuivARB MANGLE(WeightuivARB) |
#define glWeightusvARB MANGLE(WeightusvARB) |
#define glWindowPos2dMESA MANGLE(WindowPos2dMESA) |
#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA) |
#define glWindowPos2fMESA MANGLE(WindowPos2fMESA) |
#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA) |
#define glWindowPos2iMESA MANGLE(WindowPos2iMESA) |
#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA) |
#define glWindowPos2sMESA MANGLE(WindowPos2sMESA) |
#define glWindowPos2svMESA MANGLE(WindowPos2svMESA) |
#define glWindowPos3dMESA MANGLE(WindowPos3dMESA) |
#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA) |
#define glWindowPos3fMESA MANGLE(WindowPos3fMESA) |
#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA) |
#define glWindowPos3iMESA MANGLE(WindowPos3iMESA) |
#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA) |
#define glWindowPos3sMESA MANGLE(WindowPos3sMESA) |
#define glWindowPos3svMESA MANGLE(WindowPos3svMESA) |
#define glWindowPos4dMESA MANGLE(WindowPos4dMESA) |
#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA) |
#define glWindowPos4fMESA MANGLE(WindowPos4fMESA) |
#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA) |
#define glWindowPos4iMESA MANGLE(WindowPos4iMESA) |
#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA) |
#define glWindowPos4sMESA MANGLE(WindowPos4sMESA) |
#define glWindowPos4svMESA MANGLE(WindowPos4svMESA) |
#define glWriteMaskEXT MANGLE(WriteMaskEXT) |
#endif /* GL_MANGLE_H */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/internal/glcore.h |
---|
0,0 → 1,431 |
/* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.7 2001/03/25 05:32:00 tsi Exp $ */ |
#ifndef __gl_core_h_ |
#define __gl_core_h_ |
/* |
** License Applicability. Except to the extent portions of this file are |
** made subject to an alternative license as permitted in the SGI Free |
** Software License B, Version 1.1 (the "License"), the contents of this |
** file are subject only to the provisions of the License. You may not use |
** this file except in compliance with the License. You may obtain a copy |
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
** |
** http://oss.sgi.com/projects/FreeB |
** |
** Note that, as provided in the License, the Software is distributed on an |
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
** |
** Original Code. The Original Code is: OpenGL Sample Implementation, |
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
** Copyright in any portions created by third parties is as indicated |
** elsewhere herein. All Rights Reserved. |
** |
** Additional Notice Provisions: The application programming interfaces |
** established by SGI in conjunction with the Original Code are The |
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released |
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version |
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X |
** Window System(R) (Version 1.3), released October 19, 1998. This software |
** was created using the OpenGL(R) version 1.2.1 Sample Implementation |
** published by SGI, but has not been independently verified as being |
** compliant with the OpenGL(R) version 1.2.1 Specification. |
** |
*/ |
#ifndef XFree86LOADER |
#include <sys/types.h> |
#endif |
#define GL_CORE_SGI 1 |
#define GL_CORE_MESA 2 |
typedef struct __GLcontextRec __GLcontext; |
typedef struct __GLinterfaceRec __GLinterface; |
/* |
** This file defines the interface between the GL core and the surrounding |
** "operating system" that supports it (currently the GLX or WGL extensions). |
** |
** Members (data and function pointers) are documented as imported or |
** exported according to how they are used by the core rendering functions. |
** Imported members are initialized by the "operating system" and used by |
** the core functions. Exported members are initialized by the core functions |
** and used by the "operating system". |
*/ |
/* |
** Mode and limit information for a context. This information is |
** kept around in the context so that values can be used during |
** command execution, and for returning information about the |
** context to the application. |
*/ |
typedef struct __GLcontextModesRec { |
GLboolean rgbMode; |
GLboolean colorIndexMode; |
GLboolean doubleBufferMode; |
GLboolean stereoMode; |
GLboolean haveAccumBuffer; |
GLboolean haveDepthBuffer; |
GLboolean haveStencilBuffer; |
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ |
GLuint redMask, greenMask, blueMask, alphaMask; |
GLint rgbBits; /* total bits for rgb */ |
GLint indexBits; /* total bits for colorindex */ |
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; |
GLint depthBits; |
GLint stencilBits; |
GLint numAuxBuffers; |
GLint level; |
GLint pixmapMode; |
} __GLcontextModes; |
/************************************************************************/ |
/* |
** Structure used for allocating and freeing drawable private memory. |
** (like software buffers, for example). |
** |
** The memory allocation routines are provided by the surrounding |
** "operating system" code, and they are to be used for allocating |
** software buffers and things which are associated with the drawable, |
** and used by any context which draws to that drawable. There are |
** separate memory allocation functions for drawables and contexts |
** since drawables and contexts can be created and destroyed independently |
** of one another, and the "operating system" may want to use separate |
** allocation arenas for each. |
** |
** The freePrivate function is filled in by the core routines when they |
** allocates software buffers, and stick them in "private". The freePrivate |
** function will destroy anything allocated to this drawable (to be called |
** when the drawable is destroyed). |
*/ |
typedef struct __GLdrawableRegionRec __GLdrawableRegion; |
typedef struct __GLdrawableBufferRec __GLdrawableBuffer; |
typedef struct __GLdrawablePrivateRec __GLdrawablePrivate; |
typedef struct __GLregionRectRec { |
/* lower left (inside the rectangle) */ |
GLint x0, y0; |
/* upper right (outside the rectangle) */ |
GLint x1, y1; |
} __GLregionRect; |
struct __GLdrawableRegionRec { |
GLint numRects; |
__GLregionRect *rects; |
__GLregionRect boundingRect; |
}; |
/************************************************************************/ |
/* masks for the buffers */ |
#define __GL_FRONT_BUFFER_MASK 0x00000001 |
#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001 |
#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002 |
#define __GL_BACK_BUFFER_MASK 0x00000004 |
#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004 |
#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008 |
#define __GL_ACCUM_BUFFER_MASK 0x00000010 |
#define __GL_DEPTH_BUFFER_MASK 0x00000020 |
#define __GL_STENCIL_BUFFER_MASK 0x00000040 |
#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i)) |
#define __GL_ALL_BUFFER_MASK 0xffffffff |
/* what Resize routines return if resize resorted to fallback case */ |
#define __GL_BUFFER_FALLBACK 0x10 |
typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf, |
__GLdrawablePrivate *glPriv, GLint bits); |
typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf, |
__GLdrawablePrivate *glPriv, GLint bits, |
__GLbufFallbackInitFn back); |
/* |
** A drawable buffer |
** |
** This data structure describes the context side of a drawable. |
** |
** According to the spec there could be multiple contexts bound to the same |
** drawable at the same time (from different threads). In order to avoid |
** multiple-access conflicts, locks are used to serialize access. When a |
** thread needs to access (read or write) a member of the drawable, it takes |
** a lock first. Some of the entries in the drawable are treated "mostly |
** constant", so we take the freedom of allowing access to them without |
** taking a lock (for optimization reasons). |
** |
** For more details regarding locking, see buffers.h in the GL core |
*/ |
struct __GLdrawableBufferRec { |
/* |
** Buffer dimensions |
*/ |
GLint width, height, depth; |
/* |
** Framebuffer base address |
*/ |
void *base; |
/* |
** Framebuffer size (in bytes) |
*/ |
GLuint size; |
/* |
** Size (in bytes) of each element in the framebuffer |
*/ |
GLuint elementSize; |
GLuint elementSizeLog2; |
/* |
** Element skip from one scanline to the next. |
** If the buffer is part of another buffer (for example, fullscreen |
** front buffer), outerWidth is the width of that buffer. |
*/ |
GLint outerWidth; |
/* |
** outerWidth * elementSize |
*/ |
GLint byteWidth; |
/* |
** Allocation/deallocation is done based on this handle. A handle |
** is conceptually different from the framebuffer 'base'. |
*/ |
void *handle; |
/* imported */ |
GLboolean (*resize)(__GLdrawableBuffer *buf, |
GLint x, GLint y, GLuint width, GLuint height, |
__GLdrawablePrivate *glPriv, GLuint bufferMask); |
void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); |
void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); |
void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, |
GLuint val, GLint x, GLint y, GLint w, GLint h); |
void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); |
/* exported */ |
void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); |
#ifdef __cplusplus |
void *privatePtr; |
#else |
void *private; |
#endif |
/* private */ |
void *other; /* implementation private data */ |
__GLbufMainInitFn mainInit; |
__GLbufFallbackInitFn fallbackInit; |
}; |
/* |
** The context side of the drawable private |
*/ |
struct __GLdrawablePrivateRec { |
/* |
** Drawable Modes |
*/ |
__GLcontextModes *modes; |
/* |
** Drawable size |
*/ |
GLuint width, height; |
/* |
** Origin in screen coordinates of the drawable |
*/ |
GLint xOrigin, yOrigin; |
#ifdef __GL_ALIGNED_BUFFERS |
/* |
** Drawable offset from screen origin |
*/ |
GLint xOffset, yOffset; |
/* |
** Alignment restriction |
*/ |
GLint xAlignment, yAlignment; |
#endif |
/* |
** Should we invert the y axis? |
*/ |
GLint yInverted; |
/* |
** Mask specifying which buffers are renderable by the hw |
*/ |
GLuint accelBufferMask; |
/* |
** the buffers themselves |
*/ |
__GLdrawableBuffer frontBuffer; |
__GLdrawableBuffer backBuffer; |
__GLdrawableBuffer accumBuffer; |
__GLdrawableBuffer depthBuffer; |
__GLdrawableBuffer stencilBuffer; |
#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) |
__GLdrawableBuffer *auxBuffer; |
#endif |
__GLdrawableRegion ownershipRegion; |
/* |
** Lock for the drawable private structure |
*/ |
void *lock; |
#ifdef DEBUG |
/* lock debugging info */ |
int lockRefCount; |
int lockLine[10]; |
char *lockFile[10]; |
#endif |
/* imported */ |
void *(*malloc)(size_t size); |
void *(*calloc)(size_t numElem, size_t elemSize); |
void *(*realloc)(void *oldAddr, size_t newSize); |
void (*free)(void *addr); |
GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv, |
GLint x, GLint y, GLsizei width, GLsizei height); |
void (*setClipRect)(__GLdrawablePrivate *glPriv, |
GLint x, GLint y, GLsizei width, GLsizei height); |
void (*updateClipRegion)(__GLdrawablePrivate *glPriv); |
GLboolean (*resize)(__GLdrawablePrivate *glPriv); |
void (*getDrawableSize)(__GLdrawablePrivate *glPriv, |
GLint *x, GLint *y, GLuint *width, GLuint *height); |
void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); |
void (*unlockDP)(__GLdrawablePrivate *glPriv); |
/* exported */ |
#if 0 /* disable, just like in __GLimportsRec */ |
void *wsPriv; /* pointer to the window system DrawablePrivate */ |
#endif |
#ifdef __cplusplus |
void *privatePtr; |
#else |
void *private; |
#endif |
void (*freePrivate)(__GLdrawablePrivate *); |
/* client data */ |
void *other; |
}; |
/* |
** Macros to lock/unlock the drawable private |
*/ |
#if defined(DEBUG) |
#define __GL_LOCK_DP(glPriv,gc) \ |
(*(glPriv)->lockDP)(glPriv,gc); \ |
(glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \ |
(glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \ |
(glPriv)->lockRefCount++ |
#define __GL_UNLOCK_DP(glPriv) \ |
(glPriv)->lockRefCount--; \ |
(glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \ |
(glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \ |
(*(glPriv)->unlockDP)(glPriv) |
#else /* DEBUG */ |
#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc) |
#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv) |
#endif /* DEBUG */ |
/* |
** Procedures which are imported by the GL from the surrounding |
** "operating system". Math functions are not considered part of the |
** "operating system". |
*/ |
typedef struct __GLimportsRec { |
/* Memory management */ |
void * (*malloc)(__GLcontext *gc, size_t size); |
void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); |
void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); |
void (*free)(__GLcontext *gc, void *addr); |
/* Error handling */ |
void (*warning)(__GLcontext *gc, char *fmt); |
void (*fatal)(__GLcontext *gc, char *fmt); |
/* other system calls */ |
char *(CAPI *getenv)(__GLcontext *gc, const char *var); |
int (CAPI *atoi)(__GLcontext *gc, const char *str); |
int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); |
void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); |
int (CAPI *fclose)(__GLcontext *gc, void *stream); |
int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); |
/* Drawing surface management */ |
__GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); |
#if 0 |
/* At some point, this field got removed from the XFree86 glcore.h file. |
* we're removing it here to prevent interop problems. (Brian) |
*/ |
/* Pointer to the window system context */ |
void *wscx; |
#endif |
/* Operating system dependent data goes here */ |
void *other; |
} __GLimports; |
/************************************************************************/ |
/* |
** Procedures which are exported by the GL to the surrounding "operating |
** system" so that it can manage multiple GL context's. |
*/ |
typedef struct __GLexportsRec { |
/* Context management (return GL_FALSE on failure) */ |
GLboolean (*destroyContext)(__GLcontext *gc); |
GLboolean (*loseCurrent)(__GLcontext *gc); |
GLboolean (*makeCurrent)(__GLcontext *gc); |
GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare); |
GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask); |
GLboolean (*forceCurrent)(__GLcontext *gc); |
/* Drawing surface notification callbacks */ |
GLboolean (*notifyResize)(__GLcontext *gc); |
void (*notifyDestroy)(__GLcontext *gc); |
void (*notifySwapBuffers)(__GLcontext *gc); |
/* Dispatch table override control for external agents like libGLS */ |
struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc); |
void (*beginDispatchOverride)(__GLcontext *gc); |
void (*endDispatchOverride)(__GLcontext *gc); |
} __GLexports; |
/************************************************************************/ |
/* |
** This must be the first member of a __GLcontext structure. This is the |
** only part of a context that is exposed to the outside world; everything |
** else is opaque. |
*/ |
struct __GLinterfaceRec { |
__GLimports imports; |
__GLexports exports; |
}; |
extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *); |
extern void __glCoreNopDispatch(void); |
#endif /* __gl_core_h_ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/amesa.h |
---|
0,0 → 1,67 |
/* $Id: amesa.h,v 1.1 2003-02-28 11:41:55 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* |
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* Allegro (DJGPP) driver by Bernhard Tschirren (bernie-t@geocities.com) */ |
#ifndef AMESA_H |
#define AMESA_H |
#define AMESA_MAJOR_VERSION 3 |
#define AMESA_MINOR_VERSION 3 |
typedef struct amesa_visual *AMesaVisual; |
typedef struct amesa_buffer *AMesaBuffer; |
typedef struct amesa_context *AMesaContext; |
extern AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth, |
GLint depthSize, |
GLint stencilSize, |
GLint accumSize); |
extern void AMesaDestroyVisual(AMesaVisual visual); |
extern AMesaBuffer AMesaCreateBuffer(AMesaVisual visual, |
GLint width, GLint height); |
extern void AMesaDestroyBuffer(AMesaBuffer buffer); |
extern AMesaContext AMesaCreateContext(AMesaVisual visual, |
AMesaContext sharelist); |
extern void AMesaDestroyContext(AMesaContext context); |
extern GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer); |
extern void AMesaSwapBuffers(AMesaBuffer buffer); |
#endif /* AMESA_H */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/glu.h |
---|
0,0 → 1,335 |
/* |
** License Applicability. Except to the extent portions of this file are |
** made subject to an alternative license as permitted in the SGI Free |
** Software License B, Version 1.1 (the "License"), the contents of this |
** file are subject only to the provisions of the License. You may not use |
** this file except in compliance with the License. You may obtain a copy |
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 |
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: |
** |
** http://oss.sgi.com/projects/FreeB |
** |
** Note that, as provided in the License, the Software is distributed on an |
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS |
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND |
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A |
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
** |
** Original Code. The Original Code is: OpenGL Sample Implementation, |
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, |
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. |
** Copyright in any portions created by third parties is as indicated |
** elsewhere herein. All Rights Reserved. |
** |
** Additional Notice Provisions: This software was created using the |
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has |
** not been independently verified as being compliant with the OpenGL(R) |
** version 1.2.1 Specification. |
*/ |
#ifndef __glu_h__ |
#define __glu_h__ |
#if defined(USE_MGL_NAMESPACE) |
#include "glu_mangle.h" |
#endif |
#include <GL/gl.h> |
#ifndef GLAPIENTRY |
#define GLAPIENTRY |
#endif |
#ifndef GLAPI |
#define GLAPI |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
/*************************************************************/ |
/* Extensions */ |
#define GLU_EXT_object_space_tess 1 |
#define GLU_EXT_nurbs_tessellator 1 |
/* Boolean */ |
#define GLU_FALSE 0 |
#define GLU_TRUE 1 |
/* Version */ |
#define GLU_VERSION_1_1 1 |
#define GLU_VERSION_1_2 1 |
#define GLU_VERSION_1_3 1 |
/* StringName */ |
#define GLU_VERSION 100800 |
#define GLU_EXTENSIONS 100801 |
/* ErrorCode */ |
#define GLU_INVALID_ENUM 100900 |
#define GLU_INVALID_VALUE 100901 |
#define GLU_OUT_OF_MEMORY 100902 |
#define GLU_INVALID_OPERATION 100904 |
/* NurbsDisplay */ |
/* GLU_FILL */ |
#define GLU_OUTLINE_POLYGON 100240 |
#define GLU_OUTLINE_PATCH 100241 |
/* NurbsCallback */ |
#define GLU_NURBS_ERROR 100103 |
#define GLU_ERROR 100103 |
#define GLU_NURBS_BEGIN 100164 |
#define GLU_NURBS_BEGIN_EXT 100164 |
#define GLU_NURBS_VERTEX 100165 |
#define GLU_NURBS_VERTEX_EXT 100165 |
#define GLU_NURBS_NORMAL 100166 |
#define GLU_NURBS_NORMAL_EXT 100166 |
#define GLU_NURBS_COLOR 100167 |
#define GLU_NURBS_COLOR_EXT 100167 |
#define GLU_NURBS_TEXTURE_COORD 100168 |
#define GLU_NURBS_TEX_COORD_EXT 100168 |
#define GLU_NURBS_END 100169 |
#define GLU_NURBS_END_EXT 100169 |
#define GLU_NURBS_BEGIN_DATA 100170 |
#define GLU_NURBS_BEGIN_DATA_EXT 100170 |
#define GLU_NURBS_VERTEX_DATA 100171 |
#define GLU_NURBS_VERTEX_DATA_EXT 100171 |
#define GLU_NURBS_NORMAL_DATA 100172 |
#define GLU_NURBS_NORMAL_DATA_EXT 100172 |
#define GLU_NURBS_COLOR_DATA 100173 |
#define GLU_NURBS_COLOR_DATA_EXT 100173 |
#define GLU_NURBS_TEXTURE_COORD_DATA 100174 |
#define GLU_NURBS_TEX_COORD_DATA_EXT 100174 |
#define GLU_NURBS_END_DATA 100175 |
#define GLU_NURBS_END_DATA_EXT 100175 |
/* NurbsError */ |
#define GLU_NURBS_ERROR1 100251 |
#define GLU_NURBS_ERROR2 100252 |
#define GLU_NURBS_ERROR3 100253 |
#define GLU_NURBS_ERROR4 100254 |
#define GLU_NURBS_ERROR5 100255 |
#define GLU_NURBS_ERROR6 100256 |
#define GLU_NURBS_ERROR7 100257 |
#define GLU_NURBS_ERROR8 100258 |
#define GLU_NURBS_ERROR9 100259 |
#define GLU_NURBS_ERROR10 100260 |
#define GLU_NURBS_ERROR11 100261 |
#define GLU_NURBS_ERROR12 100262 |
#define GLU_NURBS_ERROR13 100263 |
#define GLU_NURBS_ERROR14 100264 |
#define GLU_NURBS_ERROR15 100265 |
#define GLU_NURBS_ERROR16 100266 |
#define GLU_NURBS_ERROR17 100267 |
#define GLU_NURBS_ERROR18 100268 |
#define GLU_NURBS_ERROR19 100269 |
#define GLU_NURBS_ERROR20 100270 |
#define GLU_NURBS_ERROR21 100271 |
#define GLU_NURBS_ERROR22 100272 |
#define GLU_NURBS_ERROR23 100273 |
#define GLU_NURBS_ERROR24 100274 |
#define GLU_NURBS_ERROR25 100275 |
#define GLU_NURBS_ERROR26 100276 |
#define GLU_NURBS_ERROR27 100277 |
#define GLU_NURBS_ERROR28 100278 |
#define GLU_NURBS_ERROR29 100279 |
#define GLU_NURBS_ERROR30 100280 |
#define GLU_NURBS_ERROR31 100281 |
#define GLU_NURBS_ERROR32 100282 |
#define GLU_NURBS_ERROR33 100283 |
#define GLU_NURBS_ERROR34 100284 |
#define GLU_NURBS_ERROR35 100285 |
#define GLU_NURBS_ERROR36 100286 |
#define GLU_NURBS_ERROR37 100287 |
/* NurbsProperty */ |
#define GLU_AUTO_LOAD_MATRIX 100200 |
#define GLU_CULLING 100201 |
#define GLU_SAMPLING_TOLERANCE 100203 |
#define GLU_DISPLAY_MODE 100204 |
#define GLU_PARAMETRIC_TOLERANCE 100202 |
#define GLU_SAMPLING_METHOD 100205 |
#define GLU_U_STEP 100206 |
#define GLU_V_STEP 100207 |
#define GLU_NURBS_MODE 100160 |
#define GLU_NURBS_MODE_EXT 100160 |
#define GLU_NURBS_TESSELLATOR 100161 |
#define GLU_NURBS_TESSELLATOR_EXT 100161 |
#define GLU_NURBS_RENDERER 100162 |
#define GLU_NURBS_RENDERER_EXT 100162 |
/* NurbsSampling */ |
#define GLU_OBJECT_PARAMETRIC_ERROR 100208 |
#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208 |
#define GLU_OBJECT_PATH_LENGTH 100209 |
#define GLU_OBJECT_PATH_LENGTH_EXT 100209 |
#define GLU_PATH_LENGTH 100215 |
#define GLU_PARAMETRIC_ERROR 100216 |
#define GLU_DOMAIN_DISTANCE 100217 |
/* NurbsTrim */ |
#define GLU_MAP1_TRIM_2 100210 |
#define GLU_MAP1_TRIM_3 100211 |
/* QuadricDrawStyle */ |
#define GLU_POINT 100010 |
#define GLU_LINE 100011 |
#define GLU_FILL 100012 |
#define GLU_SILHOUETTE 100013 |
/* QuadricCallback */ |
/* GLU_ERROR */ |
/* QuadricNormal */ |
#define GLU_SMOOTH 100000 |
#define GLU_FLAT 100001 |
#define GLU_NONE 100002 |
/* QuadricOrientation */ |
#define GLU_OUTSIDE 100020 |
#define GLU_INSIDE 100021 |
/* TessCallback */ |
#define GLU_TESS_BEGIN 100100 |
#define GLU_BEGIN 100100 |
#define GLU_TESS_VERTEX 100101 |
#define GLU_VERTEX 100101 |
#define GLU_TESS_END 100102 |
#define GLU_END 100102 |
#define GLU_TESS_ERROR 100103 |
#define GLU_TESS_EDGE_FLAG 100104 |
#define GLU_EDGE_FLAG 100104 |
#define GLU_TESS_COMBINE 100105 |
#define GLU_TESS_BEGIN_DATA 100106 |
#define GLU_TESS_VERTEX_DATA 100107 |
#define GLU_TESS_END_DATA 100108 |
#define GLU_TESS_ERROR_DATA 100109 |
#define GLU_TESS_EDGE_FLAG_DATA 100110 |
#define GLU_TESS_COMBINE_DATA 100111 |
/* TessContour */ |
#define GLU_CW 100120 |
#define GLU_CCW 100121 |
#define GLU_INTERIOR 100122 |
#define GLU_EXTERIOR 100123 |
#define GLU_UNKNOWN 100124 |
/* TessProperty */ |
#define GLU_TESS_WINDING_RULE 100140 |
#define GLU_TESS_BOUNDARY_ONLY 100141 |
#define GLU_TESS_TOLERANCE 100142 |
/* TessError */ |
#define GLU_TESS_ERROR1 100151 |
#define GLU_TESS_ERROR2 100152 |
#define GLU_TESS_ERROR3 100153 |
#define GLU_TESS_ERROR4 100154 |
#define GLU_TESS_ERROR5 100155 |
#define GLU_TESS_ERROR6 100156 |
#define GLU_TESS_ERROR7 100157 |
#define GLU_TESS_ERROR8 100158 |
#define GLU_TESS_MISSING_BEGIN_POLYGON 100151 |
#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152 |
#define GLU_TESS_MISSING_END_POLYGON 100153 |
#define GLU_TESS_MISSING_END_CONTOUR 100154 |
#define GLU_TESS_COORD_TOO_LARGE 100155 |
#define GLU_TESS_NEED_COMBINE_CALLBACK 100156 |
/* TessWinding */ |
#define GLU_TESS_WINDING_ODD 100130 |
#define GLU_TESS_WINDING_NONZERO 100131 |
#define GLU_TESS_WINDING_POSITIVE 100132 |
#define GLU_TESS_WINDING_NEGATIVE 100133 |
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134 |
/*************************************************************/ |
#ifdef __cplusplus |
class GLUnurbs; |
class GLUquadric; |
class GLUtesselator; |
#else |
typedef struct GLUnurbs GLUnurbs; |
typedef struct GLUquadric GLUquadric; |
typedef struct GLUtesselator GLUtesselator; |
#endif |
typedef GLUnurbs GLUnurbsObj; |
typedef GLUquadric GLUquadricObj; |
typedef GLUtesselator GLUtesselatorObj; |
typedef GLUtesselator GLUtriangulatorObj; |
#define GLU_TESS_MAX_COORD 1.0e150 |
/* Internal convenience typedefs */ |
typedef void (GLAPIENTRY *_GLUfuncptr)(); |
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb); |
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb); |
GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb); |
GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); |
GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data); |
GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); |
GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); |
GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); |
GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); |
GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString); |
GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); |
GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb); |
GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad); |
GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); |
GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb); |
GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb); |
GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb); |
GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error); |
GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data); |
GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name); |
GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data); |
GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view); |
GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ); |
GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void); |
GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void); |
GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void); |
GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type); |
GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc); |
GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData); |
GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData); |
GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type); |
GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value); |
GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type); |
GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top); |
GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); |
GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); |
GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport); |
GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); |
GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type); |
GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc); |
GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw); |
GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal); |
GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation); |
GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture); |
GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut); |
GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks); |
GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); |
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); |
GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess); |
GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); |
GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); |
GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); |
GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); |
GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW); |
#ifdef __cplusplus |
} |
#endif |
#endif /* __glu_h__ */ |
/shark/tags/rel_0_4/ports/mesa/include/GL/osmesa.h |
---|
0,0 → 1,276 |
/* $Id: osmesa.h,v 1.1 2003-02-28 11:41:56 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* |
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included |
* in all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
*/ |
/* |
* Mesa Off-Screen rendering interface. |
* |
* This is an operating system and window system independent interface to |
* Mesa which allows one to render images into a client-supplied buffer in |
* main memory. Such images may manipulated or saved in whatever way the |
* client wants. |
* |
* These are the API functions: |
* OSMesaCreateContext - create a new Off-Screen Mesa rendering context |
* OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer |
* and make the specified context the current one. |
* OSMesaDestroyContext - destroy an OSMesaContext |
* OSMesaGetCurrentContext - return thread's current context ID |
* OSMesaPixelStore - controls how pixels are stored in image buffer |
* OSMesaGetIntegerv - return OSMesa state parameters |
* |
* |
* The limits on the width and height of an image buffer are MAX_WIDTH and |
* MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024. |
* You can increase them as needed but beware that many temporary arrays in |
* Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT. |
*/ |
#ifndef OSMESA_H |
#define OSMESA_H |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include <GL/gl.h> |
#define OSMESA_MAJOR_VERSION 4 |
#define OSMESA_MINOR_VERSION 1 |
#define OSMESA_PATCH_VERSION 0 |
/* |
* Values for the format parameter of OSMesaCreateContext() |
* New in version 2.0. |
*/ |
#define OSMESA_COLOR_INDEX GL_COLOR_INDEX |
#define OSMESA_RGBA GL_RGBA |
#define OSMESA_BGRA 0x1 |
#define OSMESA_ARGB 0x2 |
#define OSMESA_RGB GL_RGB |
#define OSMESA_BGR 0x4 |
#define OSMESA_RGB_565 0x5 |
/* |
* OSMesaPixelStore() parameters: |
* New in version 2.0. |
*/ |
#define OSMESA_ROW_LENGTH 0x10 |
#define OSMESA_Y_UP 0x11 |
/* |
* Accepted by OSMesaGetIntegerv: |
*/ |
#define OSMESA_WIDTH 0x20 |
#define OSMESA_HEIGHT 0x21 |
#define OSMESA_FORMAT 0x22 |
#define OSMESA_TYPE 0x23 |
#define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */ |
#define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */ |
typedef struct osmesa_context *OSMesaContext; |
#if defined(__BEOS__) || defined(__QUICKDRAW__) |
#pragma export on |
#endif |
/* |
* Create an Off-Screen Mesa rendering context. The only attribute needed is |
* an RGBA vs Color-Index mode flag. |
* |
* Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA, |
* OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR. |
* sharelist - specifies another OSMesaContext with which to share |
* display lists. NULL indicates no sharing. |
* Return: an OSMesaContext or 0 if error |
*/ |
GLAPI OSMesaContext GLAPIENTRY |
OSMesaCreateContext( GLenum format, OSMesaContext sharelist ); |
/* |
* Create an Off-Screen Mesa rendering context and specify desired |
* size of depth buffer, stencil buffer and accumulation buffer. |
* If you specify zero for depthBits, stencilBits, accumBits you |
* can save some memory. |
* |
* New in Mesa 3.5 |
*/ |
GLAPI OSMesaContext GLAPIENTRY |
OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, |
GLint accumBits, OSMesaContext sharelist); |
/* |
* Destroy an Off-Screen Mesa rendering context. |
* |
* Input: ctx - the context to destroy |
*/ |
GLAPI void GLAPIENTRY |
OSMesaDestroyContext( OSMesaContext ctx ); |
/* |
* Bind an OSMesaContext to an image buffer. The image buffer is just a |
* block of memory which the client provides. Its size must be at least |
* as large as width*height*sizeof(type). Its address should be a multiple |
* of 4 if using RGBA mode. |
* |
* Image data is stored in the order of glDrawPixels: row-major order |
* with the lower-left image pixel stored in the first array position |
* (ie. bottom-to-top). |
* |
* Since the only type initially supported is GL_UNSIGNED_BYTE, if the |
* context is in RGBA mode, each pixel will be stored as a 4-byte RGBA |
* value. If the context is in color indexed mode, each pixel will be |
* stored as a 1-byte value. |
* |
* If the context's viewport hasn't been initialized yet, it will now be |
* initialized to (0,0,width,height). |
* |
* Input: ctx - the rendering context |
* buffer - the image buffer memory |
* type - data type for pixel components, only GL_UNSIGNED_BYTE |
* supported now |
* width, height - size of image buffer in pixels, at least 1 |
* Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, |
* invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, |
* width>internal limit or height>internal limit. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, |
GLsizei width, GLsizei height ); |
/* |
* Return the current Off-Screen Mesa rendering context handle. |
*/ |
GLAPI OSMesaContext GLAPIENTRY |
OSMesaGetCurrentContext( void ); |
/* |
* Set pixel store/packing parameters for the current context. |
* This is similar to glPixelStore. |
* Input: pname - OSMESA_ROW_LENGTH |
* specify actual pixels per row in image buffer |
* 0 = same as image width (default) |
* OSMESA_Y_UP |
* zero = Y coordinates increase downward |
* non-zero = Y coordinates increase upward (default) |
* value - the value for the parameter pname |
* |
* New in version 2.0. |
*/ |
GLAPI void GLAPIENTRY |
OSMesaPixelStore( GLint pname, GLint value ); |
/* |
* Return an integer value like glGetIntegerv. |
* Input: pname - |
* OSMESA_WIDTH return current image width |
* OSMESA_HEIGHT return current image height |
* OSMESA_FORMAT return image format |
* OSMESA_TYPE return color component data type |
* OSMESA_ROW_LENGTH return row length in pixels |
* OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction |
* value - pointer to integer in which to return result. |
*/ |
GLAPI void GLAPIENTRY |
OSMesaGetIntegerv( GLint pname, GLint *value ); |
/* |
* Return the depth buffer associated with an OSMesa context. |
* Input: c - the OSMesa context |
* Output: width, height - size of buffer in pixels |
* bytesPerValue - bytes per depth value (2 or 4) |
* buffer - pointer to depth buffer values |
* Return: GL_TRUE or GL_FALSE to indicate success or failure. |
* |
* New in Mesa 2.4. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, |
GLint *bytesPerValue, void **buffer ); |
/* |
* Return the color buffer associated with an OSMesa context. |
* Input: c - the OSMesa context |
* Output: width, height - size of buffer in pixels |
* format - buffer format (OSMESA_FORMAT) |
* buffer - pointer to depth buffer values |
* Return: GL_TRUE or GL_FALSE to indicate success or failure. |
* |
* New in Mesa 3.3. |
*/ |
GLAPI GLboolean GLAPIENTRY |
OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height, |
GLint *format, void **buffer ); |
/* |
* Return pointer to the named function. |
* |
* New in Mesa 4.1 |
*/ |
GLAPI void * GLAPIENTRY |
OSMesaGetProcAddress( const char *funcName ); |
#if defined(__BEOS__) || defined(__QUICKDRAW__) |
#pragma export off |
#endif |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/uglglutshapes.h |
---|
0,0 → 1,45 |
/* uglglutshapes.h - Public header GLUT Shapes */ |
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ |
/* This program is freely distributable without licensing fees and is |
provided without guarantee or warrantee expressed or implied. This |
program is -not- in the public domain. */ |
#ifndef GLUTSHAPES_H |
#define GLUTSHAPES_H |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include <GL/gl.h> |
void glutWireSphere (GLdouble radius, GLint slices, GLint stacks); |
void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks); |
void glutWireCone (GLdouble base, GLdouble height, |
GLint slices, GLint stacks); |
void glutSolidCone (GLdouble base, GLdouble height, |
GLint slices, GLint stacks); |
void glutWireCube (GLdouble size); |
void glutSolidCube (GLdouble size); |
void glutWireTorus (GLdouble innerRadius, GLdouble outerRadius, |
GLint sides, GLint rings); |
void glutSolidTorus (GLdouble innerRadius, GLdouble outerRadius, |
GLint sides, GLint rings); |
void glutWireDodecahedron (void); |
void glutSolidDodecahedron (void); |
void glutWireOctahedron (void); |
void glutSolidOctahedron (void); |
void glutWireTetrahedron (void); |
void glutSolidTetrahedron (void); |
void glutWireIcosahedron (void); |
void glutSolidIcosahedron (void); |
void glutWireTeapot (GLdouble size); |
void glutSolidTeapot (GLdouble size); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GL/xmesa_xf86.h |
---|
0,0 → 1,188 |
/************************************************************************** |
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. |
All Rights Reserved. |
Permission is hereby granted, free of charge, to any person obtaining a |
copy of this software and associated documentation files (the |
"Software"), to deal in the Software without restriction, including |
without limitation the rights to use, copy, modify, merge, publish, |
distribute, sub license, and/or sell copies of the Software, and to |
permit persons to whom the Software is furnished to do so, subject to |
the following conditions: |
The above copyright notice and this permission notice (including the |
next paragraph) shall be included in all copies or substantial portions |
of the Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
**************************************************************************/ |
/* |
* Authors: |
* Kevin E. Martin <kevin@precisioninsight.com> |
* |
* $Header: /home/fabio/w/shark/sharkcvs/CVSROOT/shark/ports/mesa/include/GL/xmesa_xf86.h,v 1.1 2003-02-28 11:41:57 pj Exp $ |
*/ |
#ifndef _XMESA_XF86_H_ |
#define _XMESA_XF86_H_ |
#include "scrnintstr.h" |
#include "pixmapstr.h" |
typedef struct _XMesaImageRec XMesaImage; |
typedef ScreenRec XMesaDisplay; |
typedef PixmapPtr XMesaPixmap; |
typedef ColormapPtr XMesaColormap; |
typedef DrawablePtr XMesaDrawable; |
typedef WindowPtr XMesaWindow; |
typedef GCPtr XMesaGC; |
typedef VisualPtr XMesaVisualInfo; |
typedef DDXPointRec XMesaPoint; |
typedef xColorItem XMesaColor; |
#define XMesaSetGeneric(__d,__gc,__val,__mask) \ |
do { \ |
CARD32 __v[1]; \ |
(void) __d; \ |
__v[0] = __val; \ |
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \ |
} while (0) |
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \ |
do { \ |
ChangeGCVal __v[1]; \ |
(void) __d; \ |
__v[0].ptr = __pval; \ |
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \ |
} while (0) |
#define XMesaSetDashes(__d,__gc,__do,__dl,__n) \ |
do { \ |
(void) __d; \ |
SetDashes(__gc, __do, __n, (unsigned char *)__dl); \ |
} while (0) |
#define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \ |
do { \ |
CARD32 __v[4]; \ |
(void) __d; \ |
__v[0] = __lw; \ |
__v[1] = __ls; \ |
__v[2] = __cs; \ |
__v[3] = __js; \ |
dixChangeGC(NullClient, __gc, \ |
GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \ |
__v, NULL); \ |
} while (0) |
#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground) |
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground) |
#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask) |
#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction) |
#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle) |
#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile) |
#define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple) |
#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \ |
do { \ |
XMesaPoint __p[1]; \ |
(void) __d; \ |
__p[0].x = __x; \ |
__p[0].y = __y; \ |
ValidateGC(__b, __gc); \ |
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \ |
} while (0) |
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \ |
do { \ |
(void) __d; \ |
ValidateGC(__b, __gc); \ |
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \ |
} while (0) |
#define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \ |
do { \ |
XMesaPoint __p[2]; \ |
(void) __d; \ |
ValidateGC(__b, __gc); \ |
__p[0].x = __x0; \ |
__p[0].y = __y0; \ |
__p[1].x = __x1; \ |
__p[1].y = __y1; \ |
(*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \ |
} while (0) |
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \ |
do { \ |
xRectangle __r[1]; \ |
(void) __d; \ |
ValidateGC((DrawablePtr)__b, __gc); \ |
__r[0].x = __x; \ |
__r[0].y = __y; \ |
__r[0].width = __w; \ |
__r[0].height = __h; \ |
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \ |
} while (0) |
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \ |
do { \ |
/* Assumes: Images are always in ZPixmap format */ \ |
(void) __d; \ |
if (__sx || __sy) /* The non-trivial case */ \ |
XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \ |
ValidateGC(__b, __gc); \ |
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \ |
__x, __y, __w, __h, 0, ZPixmap, \ |
((XMesaImage *)(__i))->data); \ |
} while (0) |
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \ |
do { \ |
(void) __d; \ |
ValidateGC(__db, __gc); \ |
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \ |
__sx, __sy, __w, __h, __x, __y); \ |
} while (0) |
#define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \ |
do { \ |
(void) __d; \ |
ValidateGC(__b, __gc); \ |
(*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \ |
} while (0) |
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */ |
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \ |
(*__d->CreatePixmap)(__d, __w, __h, __depth) |
#define XMesaFreePixmap(__d,__b) \ |
(*__d->DestroyPixmap)(__b) |
#define XMesaFreeGC(__d,__gc) \ |
do { \ |
(void) __d; \ |
FreeScratchGC(__gc); \ |
} while (0) |
#define GET_COLORMAP_SIZE(__v) __v->visinfo->ColormapEntries |
#define GET_REDMASK(__v) __v->visinfo->redMask |
#define GET_GREENMASK(__v) __v->visinfo->greenMask |
#define GET_BLUEMASK(__v) __v->visinfo->blueMask |
#define GET_VISUAL_CLASS(__v) __v->visinfo->class |
#define GET_VISUAL_DEPTH(__v) __v->visinfo->nplanes |
#define GET_BLACK_PIXEL(__v) __v->display->blackPixel |
#define CHECK_BYTE_ORDER(__v) GL_TRUE |
#define CHECK_FOR_HPCR(__v) GL_FALSE |
#endif |
/shark/tags/rel_0_4/ports/mesa/include/GLView.h |
---|
0,0 → 1,196 |
/******************************************************************************* |
/ |
/ File: GLView.h |
/ |
/ Copyright 1993-98, Be Incorporated, All Rights Reserved. |
/ |
*******************************************************************************/ |
#ifndef BGLVIEW_H |
#define BGLVIEW_H |
// added by Brian Paul: |
#ifndef BGL_RGB |
#define BGL_RGB 0 |
#define BGL_INDEX 1 |
#define BGL_SINGLE 0 |
#define BGL_DOUBLE 2 |
#define BGL_DIRECT 0 |
#define BGL_INDIRECT 4 |
#define BGL_ACCUM 8 |
#define BGL_ALPHA 16 |
#define BGL_DEPTH 32 |
#define BGL_OVERLAY 64 |
#define BGL_UNDERLAY 128 |
#define BGL_STENCIL 512 |
#endif |
#include <GL/gl.h> |
#include <AppKit.h> |
#include <interface/Window.h> |
#include <interface/View.h> |
#include <interface/Bitmap.h> |
#include <game/WindowScreen.h> |
#include <game/DirectWindow.h> |
class BGLView : public BView { |
public: |
BGLView(BRect rect, char *name, |
ulong resizingMode, ulong mode, |
ulong options); |
virtual ~BGLView(); |
void LockGL(); |
void UnlockGL(); |
void SwapBuffers(); |
// Added for Mesa (can't be virtual!) |
void CopySubBufferMESA(GLint x, GLint y, GLuint width, GLuint height); |
BView * EmbeddedView(); |
status_t CopyPixelsOut(BPoint source, BBitmap *dest); |
status_t CopyPixelsIn(BBitmap *source, BPoint dest); |
virtual void ErrorCallback(unsigned long errorCode); // GLenum errorCode); |
virtual void Draw(BRect updateRect); |
virtual void AttachedToWindow(); |
virtual void AllAttached(); |
virtual void DetachedFromWindow(); |
virtual void AllDetached(); |
virtual void FrameResized(float width, float height); |
virtual status_t Perform(perform_code d, void *arg); |
/* The public methods below, for the moment, |
are just pass-throughs to BView */ |
virtual status_t Archive(BMessage *data, bool deep = true) const; |
virtual void MessageReceived(BMessage *msg); |
virtual void SetResizingMode(uint32 mode); |
virtual void Show(); |
virtual void Hide(); |
virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index, |
BMessage *specifier, int32 form, |
const char *property); |
virtual status_t GetSupportedSuites(BMessage *data); |
/* New public functions */ |
void DirectConnected( direct_buffer_info *info ); |
void EnableDirectMode( bool enabled ); |
private: |
virtual void _ReservedGLView1(); |
virtual void _ReservedGLView2(); |
virtual void _ReservedGLView3(); |
virtual void _ReservedGLView4(); |
virtual void _ReservedGLView5(); |
virtual void _ReservedGLView6(); |
virtual void _ReservedGLView7(); |
virtual void _ReservedGLView8(); |
BGLView(const BGLView &); |
BGLView &operator=(const BGLView &); |
void dither_front(); |
bool confirm_dither(); |
void draw(BRect r); |
void * m_gc; |
uint32 m_options; |
uint32 m_ditherCount; |
BLocker m_drawLock; |
BLocker m_displayLock; |
#if OLD_GLVIEW |
BView * m_embeddedFront; |
BView * m_embeddedBack; |
#else |
void * m_clip_info; |
void * _reserved1; |
#endif |
BBitmap * m_ditherMap; |
BRect m_bounds; |
int16 * m_errorBuffer[2]; |
uint64 _reserved[8]; |
/* Direct Window stuff */ |
private: |
void drawScanline( int x1, int x2, int y, void *data ); |
static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2); |
void lock_draw(); |
void unlock_draw(); |
bool validateView(); |
}; |
class BGLScreen : public BWindowScreen { |
public: |
BGLScreen(char *name, |
ulong screenMode, ulong options, |
status_t *error, bool debug=false); |
~BGLScreen(); |
void LockGL(); |
void UnlockGL(); |
void SwapBuffers(); |
virtual void ErrorCallback(GLenum errorCode); |
virtual void ScreenConnected(bool connected); |
virtual void FrameResized(float width, float height); |
virtual status_t Perform(perform_code d, void *arg); |
/* The public methods below, for the moment, |
are just pass-throughs to BWindowScreen */ |
virtual status_t Archive(BMessage *data, bool deep = true) const; |
virtual void MessageReceived(BMessage *msg); |
virtual void Show(); |
virtual void Hide(); |
virtual BHandler *ResolveSpecifier(BMessage *msg, |
int32 index, |
BMessage *specifier, |
int32 form, |
const char *property); |
virtual status_t GetSupportedSuites(BMessage *data); |
private: |
virtual void _ReservedGLScreen1(); |
virtual void _ReservedGLScreen2(); |
virtual void _ReservedGLScreen3(); |
virtual void _ReservedGLScreen4(); |
virtual void _ReservedGLScreen5(); |
virtual void _ReservedGLScreen6(); |
virtual void _ReservedGLScreen7(); |
virtual void _ReservedGLScreen8(); |
BGLScreen(const BGLScreen &); |
BGLScreen &operator=(const BGLScreen &); |
void * m_gc; |
long m_options; |
BLocker m_drawLock; |
int32 m_colorSpace; |
uint32 m_screen_mode; |
uint64 _reserved[7]; |
}; |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/makefile |
---|
0,0 → 1,21 |
# The Frame Buffer Device |
ifndef BASE |
BASE=../../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = glut |
OBJS_PATH = $(BASE)/drivers/mesa/src-glut.dos/ |
GLUT = bitmap.o color.o globals.o models.o teapot.o\ |
window.o callback.o init.o menu.o overlay.o state.o |
OBJS = $(GLUT) |
C_OPT += -I../../../drivers/linuxc24/include -I../include -I. -I.. |
include $(BASE)/config/lib.mk |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_hw.c |
---|
0,0 → 1,148 |
/* |
* PC/HW routine collection v1.2 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include <dpmi.h> |
#include <fcntl.h> |
#include <sys/stat.h> /* for mode definitions */ |
#include <stdio.h> |
#include <stdlib.h> |
#include <unistd.h> |
#include "pc_hw.h" |
/* |
* atexit |
*/ |
#define MAX_ATEXIT 32 |
static volatile int atexitcnt; |
static VFUNC atexittbl[MAX_ATEXIT]; |
static void __attribute__((destructor)) doexit (void) |
{ |
while (atexitcnt) atexittbl[--atexitcnt](); |
} |
int pc_clexit (VFUNC f) |
{ |
int i; |
for (i=0;i<atexitcnt;i++) { |
if (atexittbl[i]==f) { |
for (atexitcnt--;i<atexitcnt;i++) atexittbl[i] = atexittbl[i+1]; |
atexittbl[i] = 0; |
return 0; |
} |
} |
return -1; |
} |
int pc_atexit (VFUNC f) |
{ |
pc_clexit(f); |
if (atexitcnt<MAX_ATEXIT) { |
atexittbl[atexitcnt++] = f; |
return 0; |
} |
return -1; |
} |
/* |
* locked memory allocation |
*/ |
void *pc_malloc (size_t size) |
{ |
void *p = malloc(size); |
if (p) { |
if (_go32_dpmi_lock_data(p, size)) { |
free(p); |
return NULL; |
} |
} |
return p; |
} |
/* |
* standard redirection |
*/ |
static int h_out, h_outbak, h_err, h_errbak; |
int pc_open_stdout (void) |
{ |
if ((h_out=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) { |
if ((h_outbak=dup(1)) != -1) { |
fflush(stdout); |
if (dup2(h_out, 1) != -1) { |
return 0; |
} |
close(h_outbak); |
} |
close(h_out); |
} |
return (h_out = -1); |
} |
void pc_close_stdout (void) |
{ |
FILE *f; |
char *line = alloca(512); |
if (h_out >= 0) { |
dup2(h_outbak, 1); |
close(h_outbak); |
if ((f=fdopen(h_out, "r")) != NULL) { |
fseek(f, 0, SEEK_SET); |
while (fgets(line, 512, f)) { |
fputs(line, stdout); |
} |
fclose(f); |
} else { |
close(h_out); |
} |
} |
} |
int pc_open_stderr (void) |
{ |
if ((h_err=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) { |
if ((h_errbak=dup(2)) != -1) { |
fflush(stderr); |
if (dup2(h_err, 2) != -1) { |
return 0; |
} |
close(h_errbak); |
} |
close(h_err); |
} |
return (h_err = -1); |
} |
void pc_close_stderr (void) |
{ |
FILE *f; |
char *line = alloca(512); |
if (h_err >= 0) { |
dup2(h_errbak, 2); |
close(h_errbak); |
if ((f=fdopen(h_err, "r")) != NULL) { |
fseek(f, 0, SEEK_SET); |
while (fgets(line, 512, f)) { |
fputs(line, stderr); |
} |
fclose(f); |
} else { |
close(h_err); |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_timer.c |
---|
0,0 → 1,158 |
/* |
* PC/HW routine collection v1.0 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include <pc.h> |
#include "pc_hw.h" |
#define TIMER_IRQ 0 |
#define MAX_TIMERS 8 |
#define PIT_FREQ 0x1234DD |
#define unvolatile(__v, __t) __extension__ ({union { volatile __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;}) |
static int timer_installed; |
typedef struct { |
volatile unsigned int counter, clock_ticks, freq; |
volatile PFUNC func; |
volatile void *parm; |
} TIMER; |
TIMER timer_main, timer_func[MAX_TIMERS]; |
static int timer () |
{ |
int i; |
for (i=0;i<MAX_TIMERS;i++) { |
TIMER *t = &timer_func[i]; |
if (t->func) { |
t->clock_ticks += t->counter; |
if (t->clock_ticks>=timer_main.counter) { |
t->clock_ticks -= timer_main.counter; |
t->func(unvolatile(t->parm, void *)); |
} |
} |
} |
timer_main.clock_ticks += timer_main.counter; |
if (timer_main.clock_ticks>=0x10000) { |
timer_main.clock_ticks -= 0x10000; |
return 1; |
} else { |
outportb(0x20, 0x20); |
return 0; |
} |
} ENDOFUNC(timer) |
void pc_remove_timer (void) |
{ |
if (timer_installed) { |
timer_installed = FALSE; |
pc_clexit(pc_remove_timer); |
DISABLE(); |
outportb(0x43, 0x34); |
outportb(0x40, 0); |
outportb(0x40, 0); |
ENABLE(); |
pc_remove_irq(TIMER_IRQ); |
} |
} |
static int install_timer (void) |
{ |
if (timer_installed||pc_install_irq(TIMER_IRQ, timer)) { |
return -1; |
} else { |
LOCKDATA(timer_func); |
LOCKDATA(timer_main); |
LOCKFUNC(timer); |
timer_main.counter = 0x10000; |
DISABLE(); |
outportb(0x43, 0x34); |
outportb(0x40, 0); |
outportb(0x40, 0); |
timer_main.clock_ticks = 0; |
ENABLE(); |
pc_atexit(pc_remove_timer); |
timer_installed = TRUE; |
return 0; |
} |
} |
static TIMER *find_slot (PFUNC func) |
{ |
int i; |
for (i=0;i<MAX_TIMERS;i++) { |
if (timer_func[i].func==func) { |
return &timer_func[i]; |
} |
} |
for (i=0;i<MAX_TIMERS;i++) { |
if (!timer_func[i].func) { |
return &timer_func[i]; |
} |
} |
return NULL; |
} |
int pc_install_int (PFUNC func, void *parm, unsigned int freq) |
{ |
int i; |
TIMER *t; |
if (!timer_installed) { |
if (install_timer()) { |
return -1; |
} |
} |
if ((t=find_slot(func))!=NULL) { |
unsigned int new_counter = PIT_FREQ / freq; |
DISABLE(); |
t->func = func; |
t->parm = parm; |
t->freq = freq; |
t->clock_ticks = 0; |
if (new_counter < timer_main.counter) { |
for (i=0;i<MAX_TIMERS;i++) { |
if (timer_func[i].func) { |
timer_func[i].counter = new_counter * timer_func[i].freq / freq; |
} |
} |
outportb(0x43, 0x34); |
outportb(0x40, (unsigned char)new_counter); |
outportb(0x40, (unsigned char)(new_counter>>8)); |
timer_main.clock_ticks = 0; |
timer_main.counter = new_counter; |
timer_main.freq = freq; |
} else { |
t->counter = PIT_FREQ * freq / (timer_main.freq * timer_main.freq); |
} |
ENABLE(); |
return 0; |
} |
return -1; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_hw.h |
---|
0,0 → 1,225 |
/* |
* PC/HW routine collection v1.2 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#ifndef PC_HW_H_included |
#define PC_HW_H_included |
//#include <dpmi.h> //SHARK |
#include <stdlib.h> |
/* |
* misc C definitions |
*/ |
#define FALSE 0 |
#define TRUE !FALSE |
#define MIN(x,y) (((x) < (y)) ? (x) : (y)) |
#define MAX(x,y) (((x) > (y)) ? (x) : (y)) |
#define MID(x,y,z) MAX((x), MIN((y), (z))) |
typedef void (*VFUNC) (void); |
typedef void (*PFUNC) (void *); |
typedef void (*MFUNC) (int x, int y, int b); |
/* |
* atexit |
*/ |
int pc_atexit (VFUNC f); |
int pc_clexit (VFUNC f); |
/* |
* locked memory |
*/ |
#define ENDOFUNC(x) static void x##_end() { } |
#define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x) |
#define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x)) |
void *pc_malloc (size_t size); |
/* |
* IRQ |
*/ |
#define ENABLE() __asm __volatile ("sti") |
#define DISABLE() __asm __volatile ("cli") |
extern int pc_install_irq (int i, int (*handler) ()); |
extern int pc_remove_irq (int i); |
/* |
* keyboard |
*/ |
#define KB_SHIFT_FLAG 0x0001 |
#define KB_CTRL_FLAG 0x0002 |
#define KB_ALT_FLAG 0x0004 |
#define KB_LWIN_FLAG 0x0008 |
#define KB_RWIN_FLAG 0x0010 |
#define KB_MENU_FLAG 0x0020 |
#define KB_SCROLOCK_FLAG 0x0100 |
#define KB_NUMLOCK_FLAG 0x0200 |
#define KB_CAPSLOCK_FLAG 0x0400 |
#define KB_INALTSEQ_FLAG 0x0800 |
#define KB_ACCENT1_FLAG 0x1000 |
#define KB_ACCENT2_FLAG 0x2000 |
#define KB_ACCENT3_FLAG 0x4000 |
#define KB_ACCENT4_FLAG 0x8000 |
#define KEY_A 1 |
#define KEY_B 2 |
#define KEY_C 3 |
#define KEY_D 4 |
#define KEY_E 5 |
#define KEY_F 6 |
#define KEY_G 7 |
#define KEY_H 8 |
#define KEY_I 9 |
#define KEY_J 10 |
#define KEY_K 11 |
#define KEY_L 12 |
#define KEY_M 13 |
#define KEY_N 14 |
#define KEY_O 15 |
#define KEY_P 16 |
#define KEY_Q 17 |
#define KEY_R 18 |
#define KEY_S 19 |
#define KEY_T 20 |
#define KEY_U 21 |
#define KEY_V 22 |
#define KEY_W 23 |
#define KEY_X 24 |
#define KEY_Y 25 |
#define KEY_Z 26 |
#define KEY_0 27 |
#define KEY_1 28 |
#define KEY_2 29 |
#define KEY_3 30 |
#define KEY_4 31 |
#define KEY_5 32 |
#define KEY_6 33 |
#define KEY_7 34 |
#define KEY_8 35 |
#define KEY_9 36 |
#define KEY_0_PAD 37 |
#define KEY_1_PAD 38 |
#define KEY_2_PAD 39 |
#define KEY_3_PAD 40 |
#define KEY_4_PAD 41 |
#define KEY_5_PAD 42 |
#define KEY_6_PAD 43 |
#define KEY_7_PAD 44 |
#define KEY_8_PAD 45 |
#define KEY_9_PAD 46 |
#define KEY_F1 47 |
#define KEY_F2 48 |
#define KEY_F3 49 |
#define KEY_F4 50 |
#define KEY_F5 51 |
#define KEY_F6 52 |
#define KEY_F7 53 |
#define KEY_F8 54 |
#define KEY_F9 55 |
#define KEY_F10 56 |
#define KEY_F11 57 |
#define KEY_F12 58 |
#define KEY_ESC 59 |
#define KEY_TILDE 60 |
#define KEY_MINUS 61 |
#define KEY_EQUALS 62 |
#define KEY_BACKSPACE 63 |
#define KEY_TAB 64 |
#define KEY_OPENBRACE 65 |
#define KEY_CLOSEBRACE 66 |
#define KEY_ENTER 67 |
#define KEY_COLON 68 |
#define KEY_QUOTE 69 |
#define KEY_BACKSLASH 70 |
#define KEY_BACKSLASH2 71 |
#define KEY_COMMA 72 |
#define KEY_STOP 73 |
#define KEY_SLASH 74 |
#define KEY_SPACE 75 |
#define KEY_INSERT 76 |
#define KEY_DEL 77 |
#define KEY_HOME 78 |
#define KEY_END 79 |
#define KEY_PGUP 80 |
#define KEY_PGDN 81 |
#define KEY_LEFT 82 |
#define KEY_RIGHT 83 |
#define KEY_UP 84 |
#define KEY_DOWN 85 |
#define KEY_SLASH_PAD 86 |
#define KEY_ASTERISK 87 |
#define KEY_MINUS_PAD 88 |
#define KEY_PLUS_PAD 89 |
#define KEY_DEL_PAD 90 |
#define KEY_ENTER_PAD 91 |
#define KEY_PRTSCR 92 |
#define KEY_PAUSE 93 |
#define KEY_ABNT_C1 94 |
#define KEY_YEN 95 |
#define KEY_KANA 96 |
#define KEY_CONVERT 97 |
#define KEY_NOCONVERT 98 |
#define KEY_AT 99 |
#define KEY_CIRCUMFLEX 100 |
#define KEY_COLON2 101 |
#define KEY_KANJI 102 |
#define KEY_MODIFIERS 103 |
#define KEY_LSHIFT 103 |
#define KEY_RSHIFT 104 |
#define KEY_LCONTROL 105 |
#define KEY_RCONTROL 106 |
#define KEY_ALT 107 |
#define KEY_ALTGR 108 |
#define KEY_LWIN 109 |
#define KEY_RWIN 110 |
#define KEY_MENU 111 |
#define KEY_SCRLOCK 112 |
#define KEY_NUMLOCK 113 |
#define KEY_CAPSLOCK 114 |
#define KEY_MAX 115 |
int pc_install_keyb (void); |
void pc_remove_keyb (void); |
int pc_keypressed (void); |
int pc_readkey (void); |
int pc_keydown (int code); |
/* |
* timer |
*/ |
int pc_install_int (PFUNC func, void *parm, unsigned int freq); |
void pc_remove_timer (void); |
/* |
* mouse |
*/ |
int pc_install_mouse (void); |
void pc_remove_mouse (void); |
MFUNC pc_install_mouse_handler (MFUNC handler); |
void pc_mouse_area (int x1, int y1, int x2, int y2); |
void pc_mouse_speed (int xspeed, int yspeed); |
int pc_query_mouse (int *x, int *y); |
void pc_show_mouse (void); |
void pc_scare_mouse (void); |
void pc_unscare_mouse (void); |
/* |
* standard redirection |
*/ |
int pc_open_stdout (void); |
int pc_open_stderr (void); |
void pc_close_stdout (void); |
void pc_close_stderr (void); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_mouse.c |
---|
0,0 → 1,258 |
/* |
* PC/HW routine collection v1.2 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include <dpmi.h> |
#include "pc_hw.h" |
#define MOUSE_STACK_SIZE 16384 |
#define CLEAR_MICKEYS() \ |
do { \ |
__asm __volatile ("movw $0xb, %%ax; int $0x33":::"%eax", "%ecx", "%edx"); \ |
ox = oy = 0; \ |
} while (0) |
extern void mouse_wrapper (void); |
extern void mouse_wrapper_end (void); |
static MFUNC mouse_func; |
static void *mouse_stack; |
static long mouse_callback; |
static __dpmi_regs mouse_regs; |
static volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b; |
static int minx = 0; |
static int maxx = 319; |
static int miny = 0; |
static int maxy = 199; |
static int sx = 2; |
static int sy = 2; |
static int emulat3 = FALSE; |
static int ox, oy; |
static void mouse (__dpmi_regs *r) |
{ |
int nx = (signed short)r->x.si / sx; |
int ny = (signed short)r->x.di / sy; |
int dx = nx - ox; |
int dy = ny - oy; |
ox = nx; |
oy = ny; |
pc_mouse_b = r->x.bx; |
pc_mouse_x = MID(minx, pc_mouse_x + dx, maxx); |
pc_mouse_y = MID(miny, pc_mouse_y + dy, maxy); |
if (emulat3) { |
if ((pc_mouse_b&3)==3) { |
pc_mouse_b = 4; |
} |
} |
if (mouse_func) { |
mouse_func(pc_mouse_x, pc_mouse_y, pc_mouse_b); |
} |
} ENDOFUNC(mouse) |
void pc_remove_mouse (void) |
{ |
if (mouse_callback) { |
pc_clexit(pc_remove_mouse); |
__asm("\n\ |
movl %%edx, %%ecx \n\ |
shrl $16, %%ecx \n\ |
movw $0x0304, %%ax \n\ |
int $0x31 \n\ |
movw $0x000c, %%ax \n\ |
xorl %%ecx, %%ecx \n\ |
int $0x33 \n\ |
"::"d"(mouse_callback):"%eax", "%ecx"); |
mouse_callback = 0; |
free((void *)((unsigned long)mouse_stack-MOUSE_STACK_SIZE)); |
} |
} |
int pc_install_mouse (void) |
{ |
int buttons; |
/* fail if already call-backed */ |
if (mouse_callback) { |
return 0; |
} |
/* reset mouse and get status */ |
__asm("\n\ |
xorl %%eax, %%eax \n\ |
int $0x33 \n\ |
andl %%ebx, %%eax \n\ |
movl %%eax, %0 \n\ |
":"=g" (buttons)::"%eax", "%ebx"); |
if (!buttons) { |
return 0; |
} |
/* lock wrapper */ |
LOCKDATA(mouse_func); |
LOCKDATA(mouse_stack); |
LOCKDATA(mouse_callback); |
LOCKDATA(mouse_regs); |
LOCKDATA(pc_mouse_x); |
LOCKDATA(pc_mouse_y); |
LOCKDATA(pc_mouse_b); |
LOCKDATA(minx); |
LOCKDATA(maxx); |
LOCKDATA(miny); |
LOCKDATA(maxy); |
LOCKDATA(sx); |
LOCKDATA(sy); |
LOCKDATA(emulat3); |
LOCKDATA(ox); |
LOCKDATA(oy); |
LOCKFUNC(mouse); |
LOCKFUNC(mouse_wrapper); |
/* grab a locked stack */ |
if ((mouse_stack=pc_malloc(MOUSE_STACK_SIZE))==NULL) { |
return 0; |
} |
/* try to hook a call-back */ |
__asm("\n\ |
pushl %%ds \n\ |
pushl %%es \n\ |
movw $0x0303, %%ax \n\ |
pushl %%ds \n\ |
pushl %%cs \n\ |
popl %%ds \n\ |
popl %%es \n\ |
int $0x31 \n\ |
popl %%es \n\ |
popl %%ds \n\ |
jc 0f \n\ |
shll $16, %%ecx \n\ |
movw %%dx, %%cx \n\ |
movl %%ecx, %0 \n\ |
0: \n\ |
":"=g"(mouse_callback) |
:"S" (mouse_wrapper), "D"(&mouse_regs) |
:"%eax", "%ecx", "%edx"); |
if (!mouse_callback) { |
free(mouse_stack); |
return 0; |
} |
/* adjust stack */ |
mouse_stack = (void *)((unsigned long)mouse_stack + MOUSE_STACK_SIZE); |
/* install the handler */ |
mouse_regs.x.ax = 0x000c; |
mouse_regs.x.cx = 0x007f; |
mouse_regs.x.dx = mouse_callback&0xffff; |
mouse_regs.x.es = mouse_callback>>16; |
__dpmi_int(0x33, &mouse_regs); |
CLEAR_MICKEYS(); |
emulat3 = buttons<3; |
pc_atexit(pc_remove_mouse); |
return buttons; |
} |
MFUNC pc_install_mouse_handler (MFUNC handler) |
{ |
MFUNC old; |
if (!mouse_callback && !pc_install_mouse()) { |
return NULL; |
} |
old = mouse_func; |
mouse_func = handler; |
return old; |
} |
void pc_mouse_area (int x1, int y1, int x2, int y2) |
{ |
minx = x1; |
maxx = x2; |
miny = y1; |
maxy = y2; |
} |
void pc_mouse_speed (int xspeed, int yspeed) |
{ |
DISABLE(); |
sx = MAX(1, xspeed); |
sy = MAX(1, yspeed); |
ENABLE(); |
} |
int pc_query_mouse (int *x, int *y) |
{ |
*x = pc_mouse_x; |
*y = pc_mouse_y; |
return pc_mouse_b; |
} |
void pc_show_mouse (void) |
{ |
/* not implemented */ |
} |
void pc_scare_mouse (void) |
{ |
/* not implemented */ |
} |
void pc_unscare_mouse (void) |
{ |
/* not implemented */ |
} |
__asm("\n\ |
.text \n\ |
.balign 4 \n\ |
.global _mouse_wrapper \n\ |
_mouse_wrapper: \n\ |
cld \n\ |
lodsl \n\ |
movl %eax, %es:42(%edi) \n\ |
addw $4, %es:46(%edi) \n\ |
pushl %es \n\ |
movl %ss, %ebx \n\ |
movl %esp, %esi \n\ |
movl %cs:___djgpp_ds_alias, %ss \n\ |
movl %cs:_mouse_stack, %esp \n\ |
pushl %ss \n\ |
pushl %ss \n\ |
popl %es \n\ |
popl %ds \n\ |
movl ___djgpp_dos_sel, %fs \n\ |
pushl %fs \n\ |
popl %gs \n\ |
pushl %edi \n\ |
call _mouse \n\ |
popl %edi \n\ |
movl %ebx, %ss \n\ |
movl %esi, %esp \n\ |
popl %es \n\ |
iret \n\ |
.balign 4 \n\ |
.global _mouse_wrapper_end \n\ |
_mouse_wrapper_end:"); |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_keyb.c |
---|
0,0 → 1,541 |
/* |
* PC/HW routine collection v1.1 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include <pc.h> |
#include <sys/exceptn.h> |
#include <sys/farptr.h> |
#include "pc_hw.h" |
#define KEYB_IRQ 1 |
#define KEY_BUFFER_SIZE 64 |
#define KB_MODIFIERS (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG | KB_LWIN_FLAG | KB_RWIN_FLAG | KB_MENU_FLAG) |
#define KB_LED_FLAGS (KB_SCROLOCK_FLAG | KB_NUMLOCK_FLAG | KB_CAPSLOCK_FLAG) |
static int keyboard_installed; |
static volatile struct { |
volatile int start, end; |
volatile int key[KEY_BUFFER_SIZE]; |
} key_buffer; |
static volatile int key_enhanced, key_pause_loop, key_shifts; |
static int leds_ok = TRUE; |
static int in_a_terrupt = FALSE; |
static volatile char pc_key[KEY_MAX]; |
/* convert Allegro format scancodes into key_shifts flag bits */ |
static unsigned short modifier_table[KEY_MAX - KEY_MODIFIERS] = |
{ |
KB_SHIFT_FLAG, KB_SHIFT_FLAG, KB_CTRL_FLAG, |
KB_CTRL_FLAG, KB_ALT_FLAG, KB_ALT_FLAG, |
KB_LWIN_FLAG, KB_RWIN_FLAG, KB_MENU_FLAG, |
KB_SCROLOCK_FLAG, KB_NUMLOCK_FLAG, KB_CAPSLOCK_FLAG |
}; |
/* lookup table for converting hardware scancodes into Allegro format */ |
static unsigned char hw_to_mycode[128] = |
{ |
/* 0x00 */ 0, KEY_ESC, KEY_1, KEY_2, |
/* 0x04 */ KEY_3, KEY_4, KEY_5, KEY_6, |
/* 0x08 */ KEY_7, KEY_8, KEY_9, KEY_0, |
/* 0x0C */ KEY_MINUS, KEY_EQUALS, KEY_BACKSPACE, KEY_TAB, |
/* 0x10 */ KEY_Q, KEY_W, KEY_E, KEY_R, |
/* 0x14 */ KEY_T, KEY_Y, KEY_U, KEY_I, |
/* 0x18 */ KEY_O, KEY_P, KEY_OPENBRACE, KEY_CLOSEBRACE, |
/* 0x1C */ KEY_ENTER, KEY_LCONTROL, KEY_A, KEY_S, |
/* 0x20 */ KEY_D, KEY_F, KEY_G, KEY_H, |
/* 0x24 */ KEY_J, KEY_K, KEY_L, KEY_COLON, |
/* 0x28 */ KEY_QUOTE, KEY_TILDE, KEY_LSHIFT, KEY_BACKSLASH, |
/* 0x2C */ KEY_Z, KEY_X, KEY_C, KEY_V, |
/* 0x30 */ KEY_B, KEY_N, KEY_M, KEY_COMMA, |
/* 0x34 */ KEY_STOP, KEY_SLASH, KEY_RSHIFT, KEY_ASTERISK, |
/* 0x38 */ KEY_ALT, KEY_SPACE, KEY_CAPSLOCK, KEY_F1, |
/* 0x3C */ KEY_F2, KEY_F3, KEY_F4, KEY_F5, |
/* 0x40 */ KEY_F6, KEY_F7, KEY_F8, KEY_F9, |
/* 0x44 */ KEY_F10, KEY_NUMLOCK, KEY_SCRLOCK, KEY_7_PAD, |
/* 0x48 */ KEY_8_PAD, KEY_9_PAD, KEY_MINUS_PAD, KEY_4_PAD, |
/* 0x4C */ KEY_5_PAD, KEY_6_PAD, KEY_PLUS_PAD, KEY_1_PAD, |
/* 0x50 */ KEY_2_PAD, KEY_3_PAD, KEY_0_PAD, KEY_DEL_PAD, |
/* 0x54 */ KEY_PRTSCR, 0, KEY_BACKSLASH2, KEY_F11, |
/* 0x58 */ KEY_F12, 0, 0, KEY_LWIN, |
/* 0x5C */ KEY_RWIN, KEY_MENU, 0, 0, |
/* 0x60 */ 0, 0, 0, 0, |
/* 0x64 */ 0, 0, 0, 0, |
/* 0x68 */ 0, 0, 0, 0, |
/* 0x6C */ 0, 0, 0, 0, |
/* 0x70 */ KEY_KANA, 0, 0, KEY_ABNT_C1, |
/* 0x74 */ 0, 0, 0, 0, |
/* 0x78 */ 0, KEY_CONVERT, 0, KEY_NOCONVERT, |
/* 0x7C */ 0, KEY_YEN, 0, 0 |
}; |
/* lookup table for converting extended hardware codes into Allegro format */ |
static unsigned char hw_to_mycode_ex[128] = |
{ |
/* 0x00 */ 0, KEY_ESC, KEY_1, KEY_2, |
/* 0x04 */ KEY_3, KEY_4, KEY_5, KEY_6, |
/* 0x08 */ KEY_7, KEY_8, KEY_9, KEY_0, |
/* 0x0C */ KEY_MINUS, KEY_EQUALS, KEY_BACKSPACE, KEY_TAB, |
/* 0x10 */ KEY_CIRCUMFLEX, KEY_AT, KEY_COLON2, KEY_R, |
/* 0x14 */ KEY_KANJI, KEY_Y, KEY_U, KEY_I, |
/* 0x18 */ KEY_O, KEY_P, KEY_OPENBRACE, KEY_CLOSEBRACE, |
/* 0x1C */ KEY_ENTER_PAD, KEY_RCONTROL, KEY_A, KEY_S, |
/* 0x20 */ KEY_D, KEY_F, KEY_G, KEY_H, |
/* 0x24 */ KEY_J, KEY_K, KEY_L, KEY_COLON, |
/* 0x28 */ KEY_QUOTE, KEY_TILDE, 0, KEY_BACKSLASH, |
/* 0x2C */ KEY_Z, KEY_X, KEY_C, KEY_V, |
/* 0x30 */ KEY_B, KEY_N, KEY_M, KEY_COMMA, |
/* 0x34 */ KEY_STOP, KEY_SLASH_PAD, 0, KEY_PRTSCR, |
/* 0x38 */ KEY_ALTGR, KEY_SPACE, KEY_CAPSLOCK, KEY_F1, |
/* 0x3C */ KEY_F2, KEY_F3, KEY_F4, KEY_F5, |
/* 0x40 */ KEY_F6, KEY_F7, KEY_F8, KEY_F9, |
/* 0x44 */ KEY_F10, KEY_NUMLOCK, KEY_PAUSE, KEY_HOME, |
/* 0x48 */ KEY_UP, KEY_PGUP, KEY_MINUS_PAD, KEY_LEFT, |
/* 0x4C */ KEY_5_PAD, KEY_RIGHT, KEY_PLUS_PAD, KEY_END, |
/* 0x50 */ KEY_DOWN, KEY_PGDN, KEY_INSERT, KEY_DEL, |
/* 0x54 */ KEY_PRTSCR, 0, KEY_BACKSLASH2, KEY_F11, |
/* 0x58 */ KEY_F12, 0, 0, KEY_LWIN, |
/* 0x5C */ KEY_RWIN, KEY_MENU, 0, 0, |
/* 0x60 */ 0, 0, 0, 0, |
/* 0x64 */ 0, 0, 0, 0, |
/* 0x68 */ 0, 0, 0, 0, |
/* 0x6C */ 0, 0, 0, 0, |
/* 0x70 */ 0, 0, 0, 0, |
/* 0x74 */ 0, 0, 0, 0, |
/* 0x78 */ 0, 0, 0, 0, |
/* 0x7C */ 0, 0, 0, 0 |
}; |
/* default mapping table for the US keyboard layout */ |
static unsigned short standard_key_ascii_table[KEY_MAX] = |
{ |
/* start */ 0, |
/* alphabet */ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
/* numbers */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* misc chars */ 27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ', |
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* numpad */ '/', '*', '-', '+', '.', 13, |
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
}; |
/* capslock mapping table for the US keyboard layout */ |
static unsigned short standard_key_capslock_table[KEY_MAX] = |
{ |
/* start */ 0, |
/* alphabet */ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
/* numbers */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* misc chars */ 27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ', |
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* numpad */ '/', '*', '-', '+', '.', 13, |
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
}; |
/* shifted mapping table for the US keyboard layout */ |
static unsigned short standard_key_shift_table[KEY_MAX] = |
{ |
/* start */ 0, |
/* alphabet */ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
/* numbers */ ')', '!', '@', '#', '$', '%', '^', '&', '*', '(', |
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* misc chars */ 27, '~', '_', '+', 8, 9, '{', '}', 13, ':', '"', '|', '|', '<', '>', '?', ' ', |
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* numpad */ '/', '*', '-', '+', '.', 13, |
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
}; |
/* ctrl+key mapping table for the US keyboard layout */ |
static unsigned short standard_key_control_table[KEY_MAX] = |
{ |
/* start */ 0, |
/* alphabet */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
/* numbers */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* misc chars */ 27, 2, 2, 2, 127, 127, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 2, |
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
/* numpad */ 2, 2, 2, 2, 2, 10, |
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
}; |
/* convert numeric pad scancodes into arrow codes */ |
static unsigned char numlock_table[10] = |
{ |
KEY_INSERT, KEY_END, KEY_DOWN, KEY_PGDN, KEY_LEFT, |
KEY_5_PAD, KEY_RIGHT, KEY_HOME, KEY_UP, KEY_PGUP |
}; |
/* kb_wait_for_write_ready: |
* Wait for the keyboard controller to set the ready-for-write bit. |
*/ |
static __inline int kb_wait_for_write_ready (void) |
{ |
int timeout = 4096; |
while ((timeout>0) && (inportb(0x64)&2)) timeout--; |
return (timeout>0); |
} |
/* kb_wait_for_read_ready: |
* Wait for the keyboard controller to set the ready-for-read bit. |
*/ |
static __inline int kb_wait_for_read_ready (void) |
{ |
int timeout = 16384; |
while ((timeout>0) && (!(inportb(0x64)&1))) timeout--; |
return (timeout>0); |
} |
/* kb_send_data: |
* Sends a byte to the keyboard controller. Returns 1 if all OK. |
*/ |
static __inline int kb_send_data (unsigned char data) |
{ |
int resends = 4; |
int timeout, temp; |
do { |
if (!kb_wait_for_write_ready()) |
return 0; |
outportb(0x60, data); |
timeout = 4096; |
while (--timeout>0) { |
if (!kb_wait_for_read_ready()) |
return 0; |
temp = inportb(0x60); |
if (temp == 0xFA) |
return 1; |
if (temp == 0xFE) |
break; |
} |
} while ((resends-- > 0) && (timeout > 0)); |
return 0; |
} |
static void update_leds (int leds) |
{ |
if (leds_ok) { |
if (!in_a_terrupt) |
DISABLE(); |
if (!kb_send_data(0xED)) { |
kb_send_data(0xF4); |
leds_ok = FALSE; |
} else if (!kb_send_data((leds>>8)&7)) { |
kb_send_data(0xF4); |
leds_ok = FALSE; |
} |
if (!in_a_terrupt) |
ENABLE(); |
} |
} ENDOFUNC(update_leds) |
static void inject_key (int scancode) |
{ |
unsigned short *table; |
if ((scancode >= KEY_0_PAD) && (scancode <= KEY_9_PAD)) { |
if (((key_shifts & KB_NUMLOCK_FLAG) != 0) == ((key_shifts & KB_SHIFT_FLAG) != 0)) { |
scancode = numlock_table[scancode - KEY_0_PAD]; |
} |
table = standard_key_ascii_table; |
} else if (key_shifts & KB_CTRL_FLAG) { |
table = standard_key_control_table; |
} else if (key_shifts & KB_SHIFT_FLAG) { |
if (key_shifts & KB_CAPSLOCK_FLAG) { |
if (standard_key_ascii_table[scancode]==standard_key_capslock_table[scancode]) { |
table = standard_key_shift_table; |
} else { |
table = standard_key_ascii_table; |
} |
} else { |
table = standard_key_shift_table; |
} |
} else if (key_shifts & KB_CAPSLOCK_FLAG) { |
table = standard_key_capslock_table; |
} else { |
table = standard_key_ascii_table; |
} |
key_buffer.key[key_buffer.end++] = (scancode<<16)|table[scancode]; |
if (key_buffer.end>=KEY_BUFFER_SIZE) |
key_buffer.end = 0; |
if (key_buffer.end==key_buffer.start) { |
key_buffer.start++; |
if (key_buffer.start>=KEY_BUFFER_SIZE) |
key_buffer.start = 0; |
} |
} ENDOFUNC(inject_key) |
static void handle_code (int scancode, int keycode) |
{ |
in_a_terrupt++; |
if (keycode==0) { /* pause */ |
inject_key(scancode); |
pc_key[KEY_PAUSE] ^= TRUE; |
} else if (scancode) { |
int flag; |
if (scancode>=KEY_MODIFIERS) { |
flag = modifier_table[scancode - KEY_MODIFIERS]; |
} else { |
flag = 0; |
} |
if ((char)keycode<0) { /* release */ |
pc_key[scancode] = FALSE; |
if (flag&KB_MODIFIERS) { |
key_shifts &= ~flag; |
} |
} else { /* keypress */ |
pc_key[scancode] = TRUE; |
if (flag&KB_MODIFIERS) { |
key_shifts |= flag; |
} |
if (flag&KB_LED_FLAGS) { |
key_shifts ^= flag; |
update_leds(key_shifts); |
} |
if (scancode<KEY_MODIFIERS) { |
inject_key(scancode); |
} |
} |
} |
in_a_terrupt--; |
} ENDOFUNC(handle_code) |
static __inline void satisfy (void) |
{ |
__asm("\n\ |
inb $0x61, %%al \n\ |
movb %%al, %%ah \n\ |
orb $0x80, %%al \n\ |
outb %%al, $0x61 \n\ |
xchgb %%al, %%ah \n\ |
outb %%al, $0x61 \n\ |
movb $0x20, %%al \n\ |
outb %%al, $0x20 \n\ |
":::"%eax"); |
} |
static int keyboard () |
{ |
unsigned char temp, scancode; |
temp = inportb(0x60); |
if (temp<=0xe1) { |
if (key_pause_loop) { |
if (!--key_pause_loop) handle_code(KEY_PAUSE, 0); |
} else |
switch (temp) { |
case 0xe0: |
key_enhanced = TRUE; |
break; |
case 0xe1: |
key_pause_loop = 5; |
break; |
default: |
if (key_enhanced) { |
key_enhanced = FALSE; |
scancode = hw_to_mycode_ex[temp&0x7f]; |
} else { |
scancode = hw_to_mycode[temp&0x7f]; |
} |
handle_code(scancode, temp); |
} |
} |
if (((temp==0x4F)||(temp==0x53))&&(key_shifts&KB_CTRL_FLAG)&&(key_shifts&KB_ALT_FLAG)) { |
/* Hack alert: |
only SIGINT (but not Ctrl-Break) |
calls the destructors and will safely clean up |
*/ |
__asm("\n\ |
movb $0x79, %%al \n\ |
call ___djgpp_hw_exception \n\ |
":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); |
} |
satisfy(); |
return 0; |
} ENDOFUNC(keyboard) |
int pc_keypressed (void) |
{ |
return (key_buffer.start!=key_buffer.end); |
} |
int pc_readkey (void) |
{ |
if (keyboard_installed) { |
int key; |
do { |
} while (key_buffer.start==key_buffer.end); |
DISABLE(); |
key = key_buffer.key[key_buffer.start++]; |
if (key_buffer.start>=KEY_BUFFER_SIZE) |
key_buffer.start = 0; |
ENABLE(); |
return key; |
} else { |
return 0; |
} |
} |
int pc_keydown (int code) |
{ |
return pc_key[code]; |
} |
void pc_remove_keyb (void) |
{ |
if (keyboard_installed) { |
int s1, s2, s3; |
keyboard_installed = FALSE; |
pc_clexit(pc_remove_keyb); |
DISABLE(); |
_farsetsel(__djgpp_dos_sel); |
_farnspokew(0x41c, _farnspeekw(0x41a)); |
s1 = _farnspeekb(0x417) & 0x80; |
s2 = _farnspeekb(0x418) & 0xFC; |
s3 = _farnspeekb(0x496) & 0xF3; |
if (pc_key[KEY_RSHIFT]) { s1 |= 1; } |
if (pc_key[KEY_LSHIFT]) { s1 |= 2; } |
if (pc_key[KEY_LCONTROL]) { s2 |= 1; s1 |= 4; } |
if (pc_key[KEY_ALT]) { s1 |= 8; s2 |= 2; } |
if (pc_key[KEY_RCONTROL]) { s1 |= 4; s3 |= 4; } |
if (pc_key[KEY_ALTGR]) { s1 |= 8; s3 |= 8; } |
if (key_shifts&KB_SCROLOCK_FLAG) s1 |= 16; |
if (key_shifts&KB_NUMLOCK_FLAG) s1 |= 32; |
if (key_shifts&KB_CAPSLOCK_FLAG) s1 |= 64; |
_farnspokeb(0x417, s1); |
_farnspokeb(0x418, s2); |
_farnspokeb(0x496, s3); |
update_leds(key_shifts); |
ENABLE(); |
pc_remove_irq(KEYB_IRQ); |
} |
} |
int pc_install_keyb (void) |
{ |
if (keyboard_installed||pc_install_irq(KEYB_IRQ, keyboard)) { |
return -1; |
} else { |
int s1, s2, s3; |
LOCKDATA(key_buffer); |
LOCKDATA(key_enhanced); |
LOCKDATA(key_pause_loop); |
LOCKDATA(key_shifts); |
LOCKDATA(leds_ok); |
LOCKDATA(in_a_terrupt); |
LOCKDATA(pc_key); |
LOCKDATA(modifier_table); |
LOCKDATA(hw_to_mycode); |
LOCKDATA(hw_to_mycode_ex); |
LOCKDATA(standard_key_ascii_table); |
LOCKDATA(standard_key_capslock_table); |
LOCKDATA(standard_key_shift_table); |
LOCKDATA(standard_key_control_table); |
LOCKDATA(numlock_table); |
LOCKFUNC(update_leds); |
LOCKFUNC(inject_key); |
LOCKFUNC(handle_code); |
LOCKFUNC(keyboard); |
DISABLE(); |
_farsetsel(__djgpp_dos_sel); |
_farnspokew(0x41c, _farnspeekw(0x41a)); |
key_shifts = 0; |
s1 = _farnspeekb(0x417); |
s2 = _farnspeekb(0x418); |
s3 = _farnspeekb(0x496); |
if (s1&1) { key_shifts |= KB_SHIFT_FLAG; pc_key[KEY_RSHIFT] = TRUE; } |
if (s1&2) { key_shifts |= KB_SHIFT_FLAG; pc_key[KEY_LSHIFT] = TRUE; } |
if (s2&1) { key_shifts |= KB_CTRL_FLAG; pc_key[KEY_LCONTROL] = TRUE; } |
if (s2&2) { key_shifts |= KB_ALT_FLAG; pc_key[KEY_ALT] = TRUE; } |
if (s3&4) { key_shifts |= KB_CTRL_FLAG; pc_key[KEY_RCONTROL] = TRUE; } |
if (s3&8) { key_shifts |= KB_ALT_FLAG; pc_key[KEY_ALTGR] = TRUE; } |
if (s1&16) key_shifts |= KB_SCROLOCK_FLAG; |
if (s1&32) key_shifts |= KB_NUMLOCK_FLAG; |
if (s1&64) key_shifts |= KB_CAPSLOCK_FLAG; |
update_leds(key_shifts); |
key_enhanced = key_pause_loop = 0; |
key_buffer.start = key_buffer.end = 0; |
ENABLE(); |
pc_atexit(pc_remove_keyb); |
keyboard_installed = TRUE; |
return 0; |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/pc_hw/pc_irq.S |
---|
0,0 → 1,180 |
/* |
* PC/HW routine collection v1.0 for DOS/DJGPP |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
.file "pc_irq.S" |
.text |
#define IRQ_STACK_SIZE 16384 |
#define IRQ_WRAPPER_LEN (__irq_wrapper_1-__irq_wrapper_0) |
#define IRQ_OLD (__irq_old_0-__irq_wrapper_0) |
#define IRQ_HOOK (__irq_hook_0-__irq_wrapper_0) |
#define IRQ_STACK (__irq_stack_0-__irq_wrapper_0) |
.balign 4 |
common: |
movw $0x0400, %ax |
int $0x31 |
movl %ss:8(%ebp), %ebx |
cmpl $15, %ebx |
jbe 0f |
fail: |
orl $-1, %eax |
popl %edi |
popl %ebx |
leave |
ret |
0: |
movl %ebx, %edi |
imull $IRQ_WRAPPER_LEN, %edi |
addl $__irq_wrapper_0, %edi |
cmpb $7, %bl |
jbe 1f |
movb %dl, %dh |
subb $8, %dh |
1: |
addb %dh, %bl |
ret |
.balign 4 |
.global _pc_install_irq |
_pc_install_irq: |
pushl %ebp |
movl %esp, %ebp |
pushl %ebx |
pushl %edi |
call common |
cmpl $0, IRQ_HOOK(%edi) |
jne fail |
pushl $IRQ_WRAPPER_LEN |
pushl %edi |
call __go32_dpmi_lock_code |
addl $8, %esp |
testl %eax, %eax |
jnz fail |
pushl $IRQ_STACK_SIZE |
call _pc_malloc |
popl %edx |
testl %eax, %eax |
jz fail |
addl %edx, %eax |
movl %eax, IRQ_STACK(%edi) |
movl %ss:12(%ebp), %eax |
movl %eax, IRQ_HOOK(%edi) |
movw $0x0204, %ax |
int $0x31 |
movl %edx, IRQ_OLD(%edi) |
movw %cx, IRQ_OLD+4(%edi) |
movw $0x0205, %ax |
movl %edi, %edx |
movl %cs, %ecx |
int $0x31 |
done: |
xorl %eax, %eax |
popl %edi |
popl %ebx |
leave |
ret |
.balign 4 |
.global _pc_remove_irq |
_pc_remove_irq: |
pushl %ebp |
movl %esp, %ebp |
pushl %ebx |
pushl %edi |
call common |
cmpl $0, IRQ_HOOK(%edi) |
je fail |
movl $0, IRQ_HOOK(%edi) |
movw $0x0205, %ax |
movl IRQ_OLD(%edi), %edx |
movl IRQ_OLD+4(%edi), %ecx |
int $0x31 |
movl IRQ_STACK(%edi), %eax |
subl $IRQ_STACK_SIZE, %eax |
pushl %eax |
call _free |
popl %eax |
jmp done |
#define WRAPPER(x) ; \ |
.balign 4 ; \ |
__irq_wrapper_##x: ; \ |
pushal ; \ |
pushl %ds ; \ |
pushl %es ; \ |
pushl %fs ; \ |
pushl %gs ; \ |
movl %ss, %ebx ; \ |
movl %esp, %esi ; \ |
movl %cs:___djgpp_ds_alias, %ss ; \ |
movl %cs:__irq_stack_##x, %esp ; \ |
pushl %ss ; \ |
pushl %ss ; \ |
popl %es ; \ |
popl %ds ; \ |
movl ___djgpp_dos_sel, %fs ; \ |
pushl %fs ; \ |
popl %gs ; \ |
call *__irq_hook_##x ; \ |
movl %ebx, %ss ; \ |
movl %esi, %esp ; \ |
testl %eax, %eax ; \ |
popl %gs ; \ |
popl %fs ; \ |
popl %es ; \ |
popl %ds ; \ |
popal ; \ |
jz __irq_ignore_##x ; \ |
__irq_bypass_##x: ; \ |
ljmp *%cs:__irq_old_##x ; \ |
__irq_ignore_##x: ; \ |
iret ; \ |
.balign 4 ; \ |
__irq_old_##x: ; \ |
.long 0, 0 ; \ |
__irq_hook_##x: ; \ |
.long 0 ; \ |
__irq_stack_##x: ; \ |
.long 0 |
WRAPPER(0); |
WRAPPER(1); |
WRAPPER(2); |
WRAPPER(3); |
WRAPPER(4); |
WRAPPER(5); |
WRAPPER(6); |
WRAPPER(7); |
WRAPPER(8); |
WRAPPER(9); |
WRAPPER(10); |
WRAPPER(11); |
WRAPPER(12); |
WRAPPER(13); |
WRAPPER(14); |
WRAPPER(15); |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/color.c |
---|
0,0 → 1,46 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue) |
{ |
} |
GLfloat APIENTRY glutGetColor (int ndx, int component) |
{ |
return 0.0; |
} |
void APIENTRY glutCopyColormap (int win) |
{ |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/state.c |
---|
0,0 → 1,70 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
#include "internal.h" |
#define FREQUENCY 100 |
static int timer_installed=0; //SHARK |
static volatile int ticks; |
static void ticks_timer (void *p) |
{ |
(void)p; |
ticks++; |
} ENDOFUNC(ticks_timer) |
int APIENTRY glutGet (GLenum type) |
{ |
/* switch (type) { //SHARK |
case GLUT_WINDOW_RGBA: |
return 1; |
case GLUT_ELAPSED_TIME: |
if (!timer_installed) { |
timer_installed = !timer_installed; |
LOCKDATA(ticks); |
LOCKFUNC(ticks_timer); |
pc_install_int(ticks_timer, NULL, FREQUENCY); |
} |
return ticks*1000/FREQUENCY; |
default: |
return 0; |
}*/ |
} |
int APIENTRY glutDeviceGet (GLenum type) |
{ |
return 0; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/overlay.c |
---|
0,0 → 1,60 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
void APIENTRY glutEstablishOverlay (void) |
{ |
} |
void APIENTRY glutRemoveOverlay (void) |
{ |
} |
void APIENTRY glutUseLayer (GLenum layer) |
{ |
} |
void APIENTRY glutPostOverlayRedisplay (void) |
{ |
} |
void APIENTRY glutShowOverlay (void) |
{ |
} |
void APIENTRY glutHideOverlay (void) |
{ |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/internal.h |
---|
0,0 → 1,78 |
/* |
* Mesa 3-D graphics library |
* Version: 4.0 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#ifndef INTERNAL_H_included |
#define INTERNAL_H_included |
#include "GL/glut.h" |
#include "pc_hw/pc_hw.h" |
#define MAX_WINDOWS 4 |
#define DEFAULT_WIDTH 640 |
#define DEFAULT_HEIGHT 480 |
#define DEFAULT_BPP 16 |
#define DEPTH_SIZE 16 |
#define STENCIL_SIZE 8 |
#define ACCUM_SIZE 16 |
extern GLenum g_display_mode; |
extern GLuint g_width; |
extern GLuint g_height; |
extern GLint g_mouse; |
extern GLboolean g_redisplay; |
extern GLint g_xpos; |
extern GLint g_ypos; |
extern void (GLUTCALLBACK *display_func) (void); |
extern void (GLUTCALLBACK *reshape_func) (int width, int height); |
extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y); |
extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y); |
extern void (GLUTCALLBACK *motion_func) (int x, int y); |
extern void (GLUTCALLBACK *passive_motion_func) (int x, int y); |
extern void (GLUTCALLBACK *entry_func) (int state); |
extern void (GLUTCALLBACK *visibility_func) (int state); |
extern void (GLUTCALLBACK *idle_func) (void); |
extern void (GLUTCALLBACK *menu_state_func) (int state); |
extern void (GLUTCALLBACK *special_func) (int key, int x, int y); |
extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z); |
extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z); |
extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state); |
extern void (GLUTCALLBACK *button_box_func) (int button, int state); |
extern void (GLUTCALLBACK *dials_func) (int dial, int value); |
extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y); |
extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y); |
extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y); |
extern void (GLUTCALLBACK *overlay_display_func) (void); |
extern void (GLUTCALLBACK *window_status_func) (int state); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/models.c |
---|
0,0 → 1,598 |
/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ |
/** |
(c) Copyright 1993, Silicon Graphics, Inc. |
ALL RIGHTS RESERVED |
Permission to use, copy, modify, and distribute this software |
for any purpose and without fee is hereby granted, provided |
that the above copyright notice appear in all copies and that |
both the copyright notice and this permission notice appear in |
supporting documentation, and that the name of Silicon |
Graphics, Inc. not be used in advertising or publicity |
pertaining to distribution of the software without specific, |
written prior permission. |
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU |
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR |
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF |
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO |
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE |
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR |
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, |
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, |
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR |
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY |
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR |
PERFORMANCE OF THIS SOFTWARE. |
US Government Users Restricted Rights |
Use, duplication, or disclosure by the Government is subject to |
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph |
(c)(1)(ii) of the Rights in Technical Data and Computer |
Software clause at DFARS 252.227-7013 and/or in similar or |
successor clauses in the FAR or the DOD or NASA FAR |
Supplement. Unpublished-- rights reserved under the copyright |
laws of the United States. Contractor/manufacturer is Silicon |
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA |
94039-7311. |
OpenGL(TM) is a trademark of Silicon Graphics, Inc. |
*/ |
#include <math.h> |
#include <GL/gl.h> |
#include <GL/glu.h> |
#include "GL/glut.h" |
/* Some <math.h> files do not define M_PI... */ |
#ifndef M_PI |
#define M_PI 3.14159265358979323846 |
#endif |
static GLUquadricObj *quadObj; |
#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); } |
static void |
initQuadObj(void) |
{ |
quadObj = gluNewQuadric(); |
/* if (!quadObj) |
__glutFatalError("out of memory."); */ |
} |
/* CENTRY */ |
void APIENTRY |
glutWireSphere(GLdouble radius, GLint slices, GLint stacks) |
{ |
QUAD_OBJ_INIT(); |
gluQuadricDrawStyle(quadObj, GLU_LINE); |
gluQuadricNormals(quadObj, GLU_SMOOTH); |
/* If we ever changed/used the texture or orientation state |
of quadObj, we'd need to change it to the defaults here |
with gluQuadricTexture and/or gluQuadricOrientation. */ |
gluSphere(quadObj, radius, slices, stacks); |
} |
void APIENTRY |
glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) |
{ |
QUAD_OBJ_INIT(); |
gluQuadricDrawStyle(quadObj, GLU_FILL); |
gluQuadricNormals(quadObj, GLU_SMOOTH); |
/* If we ever changed/used the texture or orientation state |
of quadObj, we'd need to change it to the defaults here |
with gluQuadricTexture and/or gluQuadricOrientation. */ |
gluSphere(quadObj, radius, slices, stacks); |
} |
void APIENTRY |
glutWireCone(GLdouble base, GLdouble height, |
GLint slices, GLint stacks) |
{ |
QUAD_OBJ_INIT(); |
gluQuadricDrawStyle(quadObj, GLU_LINE); |
gluQuadricNormals(quadObj, GLU_SMOOTH); |
/* If we ever changed/used the texture or orientation state |
of quadObj, we'd need to change it to the defaults here |
with gluQuadricTexture and/or gluQuadricOrientation. */ |
gluCylinder(quadObj, base, 0.0, height, slices, stacks); |
} |
void APIENTRY |
glutSolidCone(GLdouble base, GLdouble height, |
GLint slices, GLint stacks) |
{ |
QUAD_OBJ_INIT(); |
gluQuadricDrawStyle(quadObj, GLU_FILL); |
gluQuadricNormals(quadObj, GLU_SMOOTH); |
/* If we ever changed/used the texture or orientation state |
of quadObj, we'd need to change it to the defaults here |
with gluQuadricTexture and/or gluQuadricOrientation. */ |
gluCylinder(quadObj, base, 0.0, height, slices, stacks); |
} |
/* ENDCENTRY */ |
static void |
drawBox(GLfloat size, GLenum type) |
{ |
static GLfloat n[6][3] = |
{ |
{-1.0, 0.0, 0.0}, |
{0.0, 1.0, 0.0}, |
{1.0, 0.0, 0.0}, |
{0.0, -1.0, 0.0}, |
{0.0, 0.0, 1.0}, |
{0.0, 0.0, -1.0} |
}; |
static GLint faces[6][4] = |
{ |
{0, 1, 2, 3}, |
{3, 2, 6, 7}, |
{7, 6, 5, 4}, |
{4, 5, 1, 0}, |
{5, 6, 2, 1}, |
{7, 4, 0, 3} |
}; |
GLfloat v[8][3]; |
GLint i; |
v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; |
v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; |
v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; |
v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; |
v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; |
v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; |
for (i = 5; i >= 0; i--) { |
glBegin(type); |
glNormal3fv(&n[i][0]); |
glVertex3fv(&v[faces[i][0]][0]); |
glVertex3fv(&v[faces[i][1]][0]); |
glVertex3fv(&v[faces[i][2]][0]); |
glVertex3fv(&v[faces[i][3]][0]); |
glEnd(); |
} |
} |
/* CENTRY */ |
void APIENTRY |
glutWireCube(GLdouble size) |
{ |
drawBox(size, GL_LINE_LOOP); |
} |
void APIENTRY |
glutSolidCube(GLdouble size) |
{ |
drawBox(size, GL_QUADS); |
} |
/* ENDCENTRY */ |
static void |
doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) |
{ |
int i, j; |
GLfloat theta, phi, theta1; |
GLfloat cosTheta, sinTheta; |
GLfloat cosTheta1, sinTheta1; |
GLfloat ringDelta, sideDelta; |
ringDelta = 2.0 * M_PI / rings; |
sideDelta = 2.0 * M_PI / nsides; |
theta = 0.0; |
cosTheta = 1.0; |
sinTheta = 0.0; |
for (i = rings - 1; i >= 0; i--) { |
theta1 = theta + ringDelta; |
cosTheta1 = cos(theta1); |
sinTheta1 = sin(theta1); |
glBegin(GL_QUAD_STRIP); |
phi = 0.0; |
for (j = nsides; j >= 0; j--) { |
GLfloat cosPhi, sinPhi, dist; |
phi += sideDelta; |
cosPhi = cos(phi); |
sinPhi = sin(phi); |
dist = R + r * cosPhi; |
glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); |
glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); |
glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); |
glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); |
} |
glEnd(); |
theta = theta1; |
cosTheta = cosTheta1; |
sinTheta = sinTheta1; |
} |
} |
/* CENTRY */ |
void APIENTRY |
glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, |
GLint nsides, GLint rings) |
{ |
glPushAttrib(GL_POLYGON_BIT); |
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); |
doughnut(innerRadius, outerRadius, nsides, rings); |
glPopAttrib(); |
} |
void APIENTRY |
glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, |
GLint nsides, GLint rings) |
{ |
doughnut(innerRadius, outerRadius, nsides, rings); |
} |
/* ENDCENTRY */ |
static GLfloat dodec[20][3]; |
static void |
initDodecahedron(void) |
{ |
GLfloat alpha, beta; |
alpha = sqrt(2.0 / (3.0 + sqrt(5.0))); |
beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) - |
2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0)))); |
/* *INDENT-OFF* */ |
dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; |
dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; |
dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; |
dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; |
dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; |
dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; |
dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; |
dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; |
dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; |
dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; |
dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; |
dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; |
dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; |
dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; |
dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; |
dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; |
dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; |
dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; |
dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; |
dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; |
/* *INDENT-ON* */ |
} |
#define DIFF3(_a,_b,_c) { \ |
(_c)[0] = (_a)[0] - (_b)[0]; \ |
(_c)[1] = (_a)[1] - (_b)[1]; \ |
(_c)[2] = (_a)[2] - (_b)[2]; \ |
} |
static void |
crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3]) |
{ |
GLfloat p[3]; /* in case prod == v1 or v2 */ |
p[0] = v1[1] * v2[2] - v2[1] * v1[2]; |
p[1] = v1[2] * v2[0] - v2[2] * v1[0]; |
p[2] = v1[0] * v2[1] - v2[0] * v1[1]; |
prod[0] = p[0]; |
prod[1] = p[1]; |
prod[2] = p[2]; |
} |
static void |
normalize(GLfloat v[3]) |
{ |
GLfloat d; |
d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |
if (d == 0.0) { |
// __glutWarning("normalize: zero length vector"); |
v[0] = d = 1.0; |
} |
d = 1 / d; |
v[0] *= d; |
v[1] *= d; |
v[2] *= d; |
} |
static void |
pentagon(int a, int b, int c, int d, int e, GLenum shadeType) |
{ |
GLfloat n0[3], d1[3], d2[3]; |
DIFF3(dodec[a], dodec[b], d1); |
DIFF3(dodec[b], dodec[c], d2); |
crossprod(d1, d2, n0); |
normalize(n0); |
glBegin(shadeType); |
glNormal3fv(n0); |
glVertex3fv(&dodec[a][0]); |
glVertex3fv(&dodec[b][0]); |
glVertex3fv(&dodec[c][0]); |
glVertex3fv(&dodec[d][0]); |
glVertex3fv(&dodec[e][0]); |
glEnd(); |
} |
static void |
dodecahedron(GLenum type) |
{ |
static int inited = 0; |
if (inited == 0) { |
inited = 1; |
initDodecahedron(); |
} |
pentagon(0, 1, 9, 16, 5, type); |
pentagon(1, 0, 3, 18, 7, type); |
pentagon(1, 7, 11, 10, 9, type); |
pentagon(11, 7, 18, 19, 6, type); |
pentagon(8, 17, 16, 9, 10, type); |
pentagon(2, 14, 15, 6, 19, type); |
pentagon(2, 13, 12, 4, 14, type); |
pentagon(2, 19, 18, 3, 13, type); |
pentagon(3, 0, 5, 12, 13, type); |
pentagon(6, 15, 8, 10, 11, type); |
pentagon(4, 17, 8, 15, 14, type); |
pentagon(4, 12, 5, 16, 17, type); |
} |
/* CENTRY */ |
void APIENTRY |
glutWireDodecahedron(void) |
{ |
dodecahedron(GL_LINE_LOOP); |
} |
void APIENTRY |
glutSolidDodecahedron(void) |
{ |
dodecahedron(GL_TRIANGLE_FAN); |
} |
/* ENDCENTRY */ |
static void |
recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3, |
GLenum shadeType) |
{ |
GLfloat q0[3], q1[3]; |
DIFF3(n1, n2, q0); |
DIFF3(n2, n3, q1); |
crossprod(q0, q1, q1); |
normalize(q1); |
glBegin(shadeType); |
glNormal3fv(q1); |
glVertex3fv(n1); |
glVertex3fv(n2); |
glVertex3fv(n3); |
glEnd(); |
} |
static void |
subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2, |
GLenum shadeType) |
{ |
int depth; |
GLfloat w0[3], w1[3], w2[3]; |
GLfloat l; |
int i, j, k, n; |
depth = 1; |
for (i = 0; i < depth; i++) { |
for (j = 0; i + j < depth; j++) { |
k = depth - i - j; |
for (n = 0; n < 3; n++) { |
w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; |
w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) |
/ depth; |
w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) |
/ depth; |
} |
l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); |
w0[0] /= l; |
w0[1] /= l; |
w0[2] /= l; |
l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); |
w1[0] /= l; |
w1[1] /= l; |
w1[2] /= l; |
l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); |
w2[0] /= l; |
w2[1] /= l; |
w2[2] /= l; |
recorditem(w1, w0, w2, shadeType); |
} |
} |
} |
static void |
drawtriangle(int i, GLfloat data[][3], int ndx[][3], |
GLenum shadeType) |
{ |
GLfloat *x0, *x1, *x2; |
x0 = data[ndx[i][0]]; |
x1 = data[ndx[i][1]]; |
x2 = data[ndx[i][2]]; |
subdivide(x0, x1, x2, shadeType); |
} |
/* octahedron data: The octahedron produced is centered at the |
origin and has radius 1.0 */ |
static GLfloat odata[6][3] = |
{ |
{1.0, 0.0, 0.0}, |
{-1.0, 0.0, 0.0}, |
{0.0, 1.0, 0.0}, |
{0.0, -1.0, 0.0}, |
{0.0, 0.0, 1.0}, |
{0.0, 0.0, -1.0} |
}; |
static int ondex[8][3] = |
{ |
{0, 4, 2}, |
{1, 2, 4}, |
{0, 3, 4}, |
{1, 4, 3}, |
{0, 2, 5}, |
{1, 5, 2}, |
{0, 5, 3}, |
{1, 3, 5} |
}; |
static void |
octahedron(GLenum shadeType) |
{ |
int i; |
for (i = 7; i >= 0; i--) { |
drawtriangle(i, odata, ondex, shadeType); |
} |
} |
/* CENTRY */ |
void APIENTRY |
glutWireOctahedron(void) |
{ |
octahedron(GL_LINE_LOOP); |
} |
void APIENTRY |
glutSolidOctahedron(void) |
{ |
octahedron(GL_TRIANGLES); |
} |
/* ENDCENTRY */ |
/* icosahedron data: These numbers are rigged to make an |
icosahedron of radius 1.0 */ |
#define X .525731112119133606 |
#define Z .850650808352039932 |
static GLfloat idata[12][3] = |
{ |
{-X, 0, Z}, |
{X, 0, Z}, |
{-X, 0, -Z}, |
{X, 0, -Z}, |
{0, Z, X}, |
{0, Z, -X}, |
{0, -Z, X}, |
{0, -Z, -X}, |
{Z, X, 0}, |
{-Z, X, 0}, |
{Z, -X, 0}, |
{-Z, -X, 0} |
}; |
static int index[20][3] = |
{ |
{0, 4, 1}, |
{0, 9, 4}, |
{9, 5, 4}, |
{4, 5, 8}, |
{4, 8, 1}, |
{8, 10, 1}, |
{8, 3, 10}, |
{5, 3, 8}, |
{5, 2, 3}, |
{2, 7, 3}, |
{7, 10, 3}, |
{7, 6, 10}, |
{7, 11, 6}, |
{11, 0, 6}, |
{0, 1, 6}, |
{6, 1, 10}, |
{9, 0, 11}, |
{9, 11, 2}, |
{9, 2, 5}, |
{7, 2, 11}, |
}; |
static void |
icosahedron(GLenum shadeType) |
{ |
int i; |
for (i = 19; i >= 0; i--) { |
drawtriangle(i, idata, index, shadeType); |
} |
} |
/* CENTRY */ |
void APIENTRY |
glutWireIcosahedron(void) |
{ |
icosahedron(GL_LINE_LOOP); |
} |
void APIENTRY |
glutSolidIcosahedron(void) |
{ |
icosahedron(GL_TRIANGLES); |
} |
/* ENDCENTRY */ |
/* tetrahedron data: */ |
#define T 1.73205080756887729 |
static GLfloat tdata[4][3] = |
{ |
{T, T, T}, |
{T, -T, -T}, |
{-T, T, -T}, |
{-T, -T, T} |
}; |
static int tndex[4][3] = |
{ |
{0, 1, 3}, |
{2, 1, 0}, |
{3, 2, 0}, |
{1, 2, 3} |
}; |
static void |
tetrahedron(GLenum shadeType) |
{ |
int i; |
for (i = 3; i >= 0; i--) |
drawtriangle(i, tdata, tndex, shadeType); |
} |
/* CENTRY */ |
void APIENTRY |
glutWireTetrahedron(void) |
{ |
tetrahedron(GL_LINE_LOOP); |
} |
void APIENTRY |
glutSolidTetrahedron(void) |
{ |
tetrahedron(GL_TRIANGLES); |
} |
/* ENDCENTRY */ |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/globals.c |
---|
0,0 → 1,61 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
#include "internal.h" |
GLenum g_display_mode = 0; |
GLuint g_width = DEFAULT_WIDTH; |
GLuint g_height = DEFAULT_HEIGHT; |
GLint g_mouse = GL_FALSE; |
GLboolean g_redisplay = GL_FALSE; |
GLint g_xpos = 0; |
GLint g_ypos = 0; |
void (GLUTCALLBACK *display_func) (void) = NULL; |
void (GLUTCALLBACK *reshape_func) (int width, int height) = NULL; |
void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = NULL; |
void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = NULL; |
void (GLUTCALLBACK *motion_func) (int x, int y) = NULL; |
void (GLUTCALLBACK *passive_motion_func) (int x, int y) = NULL; |
void (GLUTCALLBACK *entry_func) (int state) = NULL; |
void (GLUTCALLBACK *visibility_func) (int state) = NULL; |
void (GLUTCALLBACK *idle_func) (void) = NULL; |
void (GLUTCALLBACK *menu_state_func) (int state) = NULL; |
void (GLUTCALLBACK *special_func) (int key, int x, int y) = NULL; |
void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = NULL; |
void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = NULL; |
void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = NULL; |
void (GLUTCALLBACK *button_box_func) (int button, int state) = NULL; |
void (GLUTCALLBACK *dials_func) (int dial, int value) = NULL; |
void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = NULL; |
void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = NULL; |
void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = NULL; |
void (GLUTCALLBACK *overlay_display_func) (void) = NULL; |
void (GLUTCALLBACK *window_status_func) (int state) = NULL; |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/init.c |
---|
0,0 → 1,160 |
/* |
* Mesa 3-D graphics library |
* Version: 4.0 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
#include "internal.h" |
void APIENTRY glutInit (int *argcp, char **argv) |
{ |
glutGet(GLUT_ELAPSED_TIME); |
} |
void APIENTRY glutInitDisplayMode (unsigned int mode) |
{ |
g_display_mode = mode; |
pc_install_keyb(); |
g_mouse = pc_install_mouse(); |
} |
void APIENTRY glutInitWindowPosition (int x, int y) |
{ |
g_xpos = x; |
g_ypos = y; |
} |
void APIENTRY glutInitWindowSize (int width, int height) |
{ |
g_width = width; |
g_height = height; |
} |
void APIENTRY glutMainLoop (void) |
{ |
GLboolean idle; |
static int old_mouse_x = 0; |
static int old_mouse_y = 0; |
static int old_mouse_b = 0; |
glutPostRedisplay(); |
if (reshape_func) reshape_func(g_width, g_height); |
if (visibility_func) visibility_func(GLUT_VISIBLE); |
if (g_mouse) pc_show_mouse(); |
while (GL_TRUE) { |
idle = GL_TRUE; |
if (g_redisplay && display_func) { |
idle = GL_FALSE; |
g_redisplay = GL_FALSE; |
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_scare_mouse(); |
display_func(); |
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_unscare_mouse(); |
} |
if (pc_keypressed()) { |
int key; |
idle = GL_FALSE; |
key = pc_readkey(); |
switch (key>>16) { |
case KEY_F1: if (special_func) special_func(GLUT_KEY_F1, 0, 0); break; |
case KEY_F2: if (special_func) special_func(GLUT_KEY_F2, 0, 0); break; |
case KEY_F3: if (special_func) special_func(GLUT_KEY_F3, 0, 0); break; |
case KEY_F4: if (special_func) special_func(GLUT_KEY_F4, 0, 0); break; |
case KEY_F5: if (special_func) special_func(GLUT_KEY_F5, 0, 0); break; |
case KEY_F6: if (special_func) special_func(GLUT_KEY_F6, 0, 0); break; |
case KEY_F7: if (special_func) special_func(GLUT_KEY_F7, 0, 0); break; |
case KEY_F8: if (special_func) special_func(GLUT_KEY_F8, 0, 0); break; |
case KEY_F9: if (special_func) special_func(GLUT_KEY_F9, 0, 0); break; |
case KEY_F10: if (special_func) special_func(GLUT_KEY_F10, 0, 0); break; |
case KEY_F11: if (special_func) special_func(GLUT_KEY_F11, 0, 0); break; |
case KEY_F12: if (special_func) special_func(GLUT_KEY_F12, 0, 0); break; |
case KEY_LEFT: if (special_func) special_func(GLUT_KEY_LEFT, 0, 0); break; |
case KEY_UP: if (special_func) special_func(GLUT_KEY_UP, 0, 0); break; |
case KEY_RIGHT: if (special_func) special_func(GLUT_KEY_RIGHT, 0, 0); break; |
case KEY_DOWN: if (special_func) special_func(GLUT_KEY_DOWN, 0, 0); break; |
case KEY_PGUP: if (special_func) special_func(GLUT_KEY_PAGE_UP, 0, 0); break; |
case KEY_PGDN: if (special_func) special_func(GLUT_KEY_PAGE_DOWN, 0, 0); break; |
case KEY_HOME: if (special_func) special_func(GLUT_KEY_HOME, 0, 0); break; |
case KEY_END: if (special_func) special_func(GLUT_KEY_END, 0, 0); break; |
case KEY_INSERT: if (special_func) special_func(GLUT_KEY_INSERT, 0, 0); break; |
default: if (keyboard_func) keyboard_func(key & 0xFF, 0, 0); |
} |
} |
if (g_mouse) { |
int mouse_x; |
int mouse_y; |
int mouse_b; |
mouse_b = pc_query_mouse(&mouse_x, &mouse_y); |
if (motion_func && ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y))) { |
idle = GL_FALSE; |
old_mouse_x = mouse_x; |
old_mouse_y = mouse_y; |
motion_func(old_mouse_x, old_mouse_y); |
} |
if (mouse_func && (mouse_b != old_mouse_b)) { |
int new_mouse_b = mouse_b; |
if ((old_mouse_b & 1) && !(new_mouse_b & 1)) |
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, mouse_x, mouse_y); |
else if (!(old_mouse_b & 1) && (new_mouse_b & 1)) |
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |
if ((old_mouse_b & 2) && !(new_mouse_b & 2)) |
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, mouse_x, mouse_y); |
else if (!(old_mouse_b & 2) && (new_mouse_b & 2)) |
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |
if ((old_mouse_b & 4) && !(new_mouse_b & 4)) |
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, mouse_x, mouse_y); |
else if (!(old_mouse_b & 3) && (new_mouse_b & 4)) |
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, mouse_x, mouse_y); |
idle = GL_FALSE; |
old_mouse_b = new_mouse_b; |
} |
} |
if (idle && idle_func) |
idle_func(); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/menu.c |
---|
0,0 → 1,86 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int)) |
{ |
return 0; |
} |
void APIENTRY glutDestroyMenu (int menu) |
{ |
} |
int APIENTRY glutGetMenu (void) |
{ |
return 0; |
} |
void APIENTRY glutSetMenu (int menu) |
{ |
} |
void APIENTRY glutAddMenuEntry (const char *label, int value) |
{ |
} |
void APIENTRY glutAddSubMenu (const char *label, int submenu) |
{ |
} |
void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value) |
{ |
} |
void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu) |
{ |
} |
void APIENTRY glutRemoveMenuItem (int item) |
{ |
} |
void APIENTRY glutAttachMenu (int button) |
{ |
} |
void APIENTRY glutDetachMenu (int button) |
{ |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/window.c |
---|
0,0 → 1,260 |
/* |
* Mesa 3-D graphics library |
* Version: 4.1 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.2 for Mesa 4.1 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
#ifndef FX |
#include "GL/dmesa.h" |
#else |
#include "GL/fxmesa.h" |
#endif |
#include "internal.h" |
static int window; |
#ifndef FX |
static DMesaVisual visual = NULL; |
static DMesaContext context = NULL; |
static DMesaBuffer buffer[MAX_WINDOWS]; |
#else |
static void *visual = NULL; |
static fxMesaContext context = NULL; |
static int fx_attrib[32]; |
#endif |
static void clean (void) |
{ |
int i; |
for (i=0; i<MAX_WINDOWS; i++) { |
glutDestroyWindow(i+1); |
} |
#ifndef FX |
if (context) DMesaDestroyContext(context); |
if (visual) DMesaDestroyVisual(visual); |
#else |
if (context) fxMesaDestroyContext(context); |
#endif |
pc_close_stdout(); |
pc_close_stderr(); |
} |
int APIENTRY glutCreateWindow (const char *title) |
{ |
int i; |
if (!visual) { |
int screen_w = DEFAULT_WIDTH; |
int screen_h = DEFAULT_HEIGHT; |
if ((g_width<=640) && (g_height<=480)) { |
screen_w = 640; |
screen_h = 480; |
} else if ((g_width<=800) && (g_height<=600)) { |
screen_w = 800; |
screen_h = 600; |
} else if ((g_width<=1024) && (g_height<=768)) { |
screen_w = 1024; |
screen_h = 768; |
} |
#ifndef FX |
if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP, |
g_display_mode & GLUT_DOUBLE, |
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0, |
g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0, |
g_display_mode & GLUT_ACCUM ?ACCUM_SIZE :0))==NULL) { |
return 0; |
} |
if ((context=DMesaCreateContext(visual, NULL))==NULL) { |
DMesaDestroyVisual(visual); |
return 0; |
} |
#else |
i = 0; |
if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER; |
if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; } |
if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; } |
if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; } |
fx_attrib[i] = FXMESA_NONE; |
if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) { |
return 0; |
} |
visual = context; |
#endif |
pc_open_stdout(); |
pc_open_stderr(); |
pc_atexit(clean); |
} |
#ifndef FX |
for (i=0; i<MAX_WINDOWS; i++) { |
if (!buffer[i]) { |
DMesaBuffer b; |
if ((b=DMesaCreateBuffer(visual, g_xpos, g_ypos, g_width, g_height))==NULL) { |
return 0; |
} |
if (!DMesaMakeCurrent(context, b)) { |
DMesaDestroyBuffer(b); |
return 0; |
} |
if (g_mouse) { |
pc_mouse_area(g_xpos, g_ypos, g_xpos + g_width - 1, g_ypos + g_height - 1); |
} |
buffer[window = i] = b; |
return i+1; |
} |
} |
return 0; |
#else |
fxMesaMakeCurrent(context); |
return 1; |
#endif |
} |
int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height) |
{ |
return GL_FALSE; |
} |
void APIENTRY glutDestroyWindow (int win) |
{ |
#ifndef FX |
if (buffer[win-1]) { |
DMesaDestroyBuffer(buffer[win-1]); |
buffer[win-1] = NULL; |
} |
#endif |
} |
void APIENTRY glutPostRedisplay (void) |
{ |
g_redisplay = GL_TRUE; |
} |
void APIENTRY glutSwapBuffers (void) |
{ |
if (g_mouse) pc_scare_mouse(); |
#ifndef FX |
DMesaSwapBuffers(buffer[window]); |
#else |
fxMesaSwapBuffers(); |
#endif |
if (g_mouse) pc_unscare_mouse(); |
} |
int APIENTRY glutGetWindow (void) |
{ |
return window + 1; |
} |
void APIENTRY glutSetWindow (int win) |
{ |
window = win - 1; |
} |
void APIENTRY glutSetWindowTitle (const char *title) |
{ |
} |
void APIENTRY glutSetIconTitle (const char *title) |
{ |
} |
void APIENTRY glutPositionWindow (int x, int y) |
{ |
#ifndef FX |
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) { |
g_xpos = x; |
g_ypos = y; |
} |
#endif |
} |
void APIENTRY glutReshapeWindow (int width, int height) |
{ |
#ifndef FX |
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) { |
g_width = width; |
g_height = height; |
if (reshape_func) { |
reshape_func(width, height); |
} else { |
glViewport(0, 0, width, height); |
} |
} |
#endif |
} |
void APIENTRY glutPopWindow (void) |
{ |
} |
void APIENTRY glutPushWindow (void) |
{ |
} |
void APIENTRY glutIconifyWindow (void) |
{ |
} |
void APIENTRY glutShowWindow (void) |
{ |
} |
void APIENTRY glutHideWindow (void) |
{ |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/teapot.c |
---|
0,0 → 1,212 |
/* Copyright (c) Mark J. Kilgard, 1994. */ |
/** |
(c) Copyright 1993, Silicon Graphics, Inc. |
ALL RIGHTS RESERVED |
Permission to use, copy, modify, and distribute this software |
for any purpose and without fee is hereby granted, provided |
that the above copyright notice appear in all copies and that |
both the copyright notice and this permission notice appear in |
supporting documentation, and that the name of Silicon |
Graphics, Inc. not be used in advertising or publicity |
pertaining to distribution of the software without specific, |
written prior permission. |
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU |
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR |
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF |
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO |
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE |
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR |
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, |
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, |
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR |
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY |
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR |
PERFORMANCE OF THIS SOFTWARE. |
US Government Users Restricted Rights |
Use, duplication, or disclosure by the Government is subject to |
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph |
(c)(1)(ii) of the Rights in Technical Data and Computer |
Software clause at DFARS 252.227-7013 and/or in similar or |
successor clauses in the FAR or the DOD or NASA FAR |
Supplement. Unpublished-- rights reserved under the copyright |
laws of the United States. Contractor/manufacturer is Silicon |
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA |
94039-7311. |
OpenGL(TM) is a trademark of Silicon Graphics, Inc. |
*/ |
#include <GL/gl.h> |
#include <GL/glu.h> |
#include "GL/glut.h" |
/* Rim, body, lid, and bottom data must be reflected in x and |
y; handle and spout data across the y axis only. */ |
static int patchdata[][16] = |
{ |
/* rim */ |
{102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, |
12, 13, 14, 15}, |
/* body */ |
{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, |
24, 25, 26, 27}, |
{24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, |
37, 38, 39, 40}, |
/* lid */ |
{96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, |
101, 0, 1, 2, 3,}, |
{0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, |
113, 114, 115, 116, 117}, |
/* bottom */ |
{118, 118, 118, 118, 124, 122, 119, 121, 123, 126, |
125, 120, 40, 39, 38, 37}, |
/* handle */ |
{41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
53, 54, 55, 56}, |
{53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
28, 65, 66, 67}, |
/* spout */ |
{68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
80, 81, 82, 83}, |
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
92, 93, 94, 95} |
}; |
/* *INDENT-OFF* */ |
static float cpdata[][3] = |
{ |
{0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, |
-0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, |
{0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, |
0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, |
2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, |
2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, |
{1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, |
1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, |
{0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, |
0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, |
0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, |
{1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, |
{1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, |
-1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, |
-0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, |
2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, |
2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, |
2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, |
{-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, |
-0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, |
1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, |
-0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, |
1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, |
0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, |
0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, |
{2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, |
-0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, |
2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, |
{3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, |
{3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, |
{2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, |
3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, |
3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, |
-0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, |
2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, |
2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, |
2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, |
{0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, |
-0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, |
0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, |
{0.84, -1.5, 0.075} |
}; |
static float tex[2][2][2] = |
{ |
{ {0, 0}, |
{1, 0}}, |
{ {0, 1}, |
{1, 1}} |
}; |
/* *INDENT-ON* */ |
static void |
teapot(GLint grid, GLdouble scale, GLenum type) |
{ |
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; |
long i, j, k, l; |
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); |
glEnable(GL_AUTO_NORMAL); |
glEnable(GL_NORMALIZE); |
glEnable(GL_MAP2_VERTEX_3); |
glEnable(GL_MAP2_TEXTURE_COORD_2); |
glPushMatrix(); |
glRotatef(270.0, 1.0, 0.0, 0.0); |
glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); |
glTranslatef(0.0, 0.0, -1.5); |
for (i = 0; i < 10; i++) { |
for (j = 0; j < 4; j++) { |
for (k = 0; k < 4; k++) { |
for (l = 0; l < 3; l++) { |
p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; |
q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; |
if (l == 1) |
q[j][k][l] *= -1.0; |
if (i < 6) { |
r[j][k][l] = |
cpdata[patchdata[i][j * 4 + (3 - k)]][l]; |
if (l == 0) |
r[j][k][l] *= -1.0; |
s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; |
if (l == 0) |
s[j][k][l] *= -1.0; |
if (l == 1) |
s[j][k][l] *= -1.0; |
} |
} |
} |
} |
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, |
&tex[0][0][0]); |
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |
&p[0][0][0]); |
glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); |
glEvalMesh2(type, 0, grid, 0, grid); |
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |
&q[0][0][0]); |
glEvalMesh2(type, 0, grid, 0, grid); |
if (i < 6) { |
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |
&r[0][0][0]); |
glEvalMesh2(type, 0, grid, 0, grid); |
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, |
&s[0][0][0]); |
glEvalMesh2(type, 0, grid, 0, grid); |
} |
} |
glPopMatrix(); |
glPopAttrib(); |
} |
/* CENTRY */ |
void APIENTRY |
glutSolidTeapot(GLdouble scale) |
{ |
teapot(7, scale, GL_FILL); |
} |
void APIENTRY |
glutWireTeapot(GLdouble scale) |
{ |
teapot(10, scale, GL_LINE); |
} |
/* ENDCENTRY */ |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/bitmap.c |
---|
0,0 → 1,56 |
/* Copyright (c) Mark J. Kilgard, 1994. */ |
/* This program is freely distributable without licensing fees |
and is provided without guarantee or warrantee expressed or |
implied. This program is -not- in the public domain. */ |
#include "glutbitmap.h" |
void APIENTRY |
glutBitmapCharacter(GLUTbitmapFont font, int c) |
{ |
const BitmapCharRec *ch; |
BitmapFontPtr fontinfo; |
GLint swapbytes, lsbfirst, rowlength; |
GLint skiprows, skippixels, alignment; |
#if defined(_WIN32) |
fontinfo = (BitmapFontPtr) __glutFont(font); |
#else |
fontinfo = (BitmapFontPtr) font; |
#endif |
if (c < fontinfo->first || |
c >= fontinfo->first + fontinfo->num_chars) |
return; |
ch = fontinfo->ch[c - fontinfo->first]; |
if (ch) { |
/* Save current modes. */ |
glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); |
glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); |
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); |
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); |
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); |
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); |
/* Little endian machines (DEC Alpha for example) could |
benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE |
instead of GL_FALSE, but this would require changing the |
generated bitmaps too. */ |
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); |
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); |
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); |
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, |
ch->advance, 0, ch->bitmap); |
/* Restore saved modes. */ |
glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); |
glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); |
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); |
glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); |
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); |
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/callback.c |
---|
0,0 → 1,152 |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-1998 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* DOS/DJGPP glut driver v1.0 for Mesa 4.0 |
* |
* Copyright (C) 2002 - Borca Daniel |
* Email : dborca@yahoo.com |
* Web : http://www.geocities.com/dborca |
*/ |
#include "GL/glut.h" |
#include "internal.h" |
void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void)) |
{ |
display_func = func; |
} |
void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height)) |
{ |
reshape_func = func; |
} |
void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y)) |
{ |
keyboard_func = func; |
} |
void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) |
{ |
mouse_func = func; |
} |
void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |
{ |
motion_func = func; |
} |
void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |
{ |
passive_motion_func = func; |
} |
void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state)) |
{ |
entry_func = func; |
} |
void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state)) |
{ |
visibility_func = func; |
} |
void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void)) |
{ |
idle_func = func; |
} |
void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value) |
{ |
} |
void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state)) |
{ |
menu_state_func = func; |
} |
void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y)) |
{ |
special_func = func; |
} |
void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) |
{ |
} |
void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) |
{ |
} |
void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state)) |
{ |
} |
void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state)) |
{ |
} |
void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value)) |
{ |
} |
void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) |
{ |
} |
void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) |
{ |
} |
void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y)) |
{ |
} |
void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void)) |
{ |
} |
void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state)) |
{ |
} |
/shark/tags/rel_0_4/ports/mesa/src-glut.dos/glutbitmap.h |
---|
0,0 → 1,32 |
#ifndef __glutbitmap_h__ |
#define __glutbitmap_h__ |
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */ |
/* This program is freely distributable without licensing fees |
and is provided without guarantee or warrantee expressed or |
implied. This program is -not- in the public domain. */ |
#define GLUT_NO_LIB_PRAGMA /* Avoid auto library linking when building |
the GLUT library itself. */ |
#include <GL/glut.h> |
typedef struct { |
const GLsizei width; |
const GLsizei height; |
const GLfloat xorig; |
const GLfloat yorig; |
const GLfloat advance; |
const GLubyte *bitmap; |
} BitmapCharRec, *BitmapCharPtr; |
typedef struct { |
const char *name; |
const int num_chars; |
const int first; |
const BitmapCharRec * const *ch; |
} BitmapFontRec, *BitmapFontPtr; |
typedef void *GLUTbitmapFont; |
#endif /* __glutbitmap_h__ */ |
/shark/tags/rel_0_4/ports/mesa/src-glu/makefile |
---|
0,0 → 1,21 |
# The Frame Buffer Device |
ifndef BASE |
BASE=../../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = glu |
OBJS_PATH = $(BASE)/drivers/mesa/src-glu/ |
GLU = glu.o mipmap.o nurbs.o nurbsutl.o project.o tess.o\ |
nurbscrv.o nurbssrf.o polytest.o quadric.o tesselat.o |
OBJS = $(GLU) |
C_OPT += -I../../../drivers/linuxc24/include -I../include -I. -I.. |
include $(BASE)/config/lib.mk |
/shark/tags/rel_0_4/ports/mesa/src-glu/nurbs.h |
---|
0,0 → 1,253 |
/* $Id: nurbs.h,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) |
* See README2 for more info. |
*/ |
#ifndef NURBS_H |
#define NURBS_H |
#define EPSILON 1e-06 /* epsilon for double precision compares */ |
typedef enum |
{ |
GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM, |
GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE |
} |
GLU_nurbs_enum; |
typedef enum |
{ |
GLU_TRIM_NURBS, GLU_TRIM_PWL |
} |
GLU_trim_enum; |
typedef struct |
{ |
GLint sknot_count; |
GLfloat *sknot; |
GLint tknot_count; |
GLfloat *tknot; |
GLint s_stride; |
GLint t_stride; |
GLfloat *ctrlarray; |
GLint sorder; |
GLint torder; |
GLint dim; |
GLenum type; |
} |
surface_attribs; |
typedef struct |
{ |
surface_attribs geom; |
surface_attribs color; |
surface_attribs texture; |
surface_attribs normal; |
} |
nurbs_surface; |
typedef struct |
{ |
GLint knot_count; |
GLfloat *knot; |
GLint stride; |
GLfloat *ctrlarray; |
GLint order; |
GLint dim; |
GLenum type; |
} |
curve_attribs; |
typedef struct |
{ |
GLint pt_count; |
GLfloat *ctrlarray; |
GLint stride; |
GLint dim; |
GLenum type; |
} |
pwl_curve_attribs; |
typedef struct |
{ |
curve_attribs geom; |
curve_attribs color; |
curve_attribs texture; |
curve_attribs normal; |
} |
nurbs_curve; |
typedef struct trim_list_str |
{ |
GLU_trim_enum trim_type; |
union |
{ |
pwl_curve_attribs pwl_curve; |
curve_attribs nurbs_curve; |
} |
curve; |
struct trim_list_str *next; |
} |
trim_list; |
typedef struct seg_trim_str |
{ |
GLfloat *points; |
GLint pt_cnt, seg_array_len; |
struct seg_trim_str *next; |
} |
trim_segments; |
typedef struct nurbs_trim_str |
{ |
trim_list *trim_loop; |
trim_segments *segments; |
struct nurbs_trim_str *next; |
} |
nurbs_trim; |
typedef struct |
{ |
GLfloat model[16], proj[16], viewport[4]; |
} |
culling_and_sampling_str; |
struct GLUnurbs |
{ |
GLboolean culling; |
GLenum error; |
void (GLCALLBACK * error_callback) (GLenum err); |
GLenum display_mode; |
GLU_nurbs_enum nurbs_type; |
GLboolean auto_load_matrix; |
culling_and_sampling_str sampling_matrices; |
GLenum sampling_method; |
GLfloat sampling_tolerance; |
GLfloat parametric_tolerance; |
GLint u_step, v_step; |
nurbs_surface surface; |
nurbs_curve curve; |
nurbs_trim *trim; |
}; |
typedef struct |
{ |
GLfloat *knot; |
GLint nknots; |
GLfloat *unified_knot; |
GLint unified_nknots; |
GLint order; |
GLint t_min, t_max; |
GLint delta_nknots; |
GLboolean open_at_begin, open_at_end; |
GLfloat *new_knot; |
GLfloat *alpha; |
} |
knot_str_type; |
typedef struct |
{ |
GLfloat *geom_ctrl; |
GLint geom_s_stride, geom_t_stride; |
GLfloat **geom_offsets; |
GLint geom_s_pt_cnt, geom_t_pt_cnt; |
GLfloat *color_ctrl; |
GLint color_s_stride, color_t_stride; |
GLfloat **color_offsets; |
GLint color_s_pt_cnt, color_t_pt_cnt; |
GLfloat *normal_ctrl; |
GLint normal_s_stride, normal_t_stride; |
GLfloat **normal_offsets; |
GLint normal_s_pt_cnt, normal_t_pt_cnt; |
GLfloat *texture_ctrl; |
GLint texture_s_stride, texture_t_stride; |
GLfloat **texture_offsets; |
GLint texture_s_pt_cnt, texture_t_pt_cnt; |
GLint s_bezier_cnt, t_bezier_cnt; |
} |
new_ctrl_type; |
extern void call_user_error(GLUnurbsObj * nobj, GLenum error); |
extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order); |
extern GLenum explode_knot(knot_str_type * the_knot); |
extern GLenum calc_alphas(knot_str_type * the_knot); |
extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, |
knot_str_type * the_knot, GLint dim, |
GLfloat ** new_ctrl, GLint * ncontrol); |
extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl, |
GLint n_ctrl, GLint order, GLint dim, |
GLint ** factors); |
extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
int **sfactors, GLint ** tfactors); |
extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
int **sfactors, GLint ** tfactors); |
extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj, |
new_ctrl_type * new_ctrl, |
int **sfactors, GLint ** tfactors); |
extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl, |
GLint n_ctrl, GLint stride, GLint dim); |
extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl, |
GLint s_n_ctrl, GLint t_n_ctrl, |
GLint s_stride, GLint t_stride, |
GLint dim); |
extern void do_nurbs_curve(GLUnurbsObj * nobj); |
extern void do_nurbs_surface(GLUnurbsObj * nobj); |
extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
GLint * sfactors, GLint * tfactors); |
extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src, |
GLfloat maximal_min_knot, |
GLfloat minimal_max_knot); |
extern GLenum select_knot_working_range(GLUnurbsObj * nobj, |
knot_str_type * geom_knot, |
knot_str_type * color_knot, |
knot_str_type * normal_knot, |
knot_str_type * texture_knot); |
extern void free_unified_knots(knot_str_type * geom_knot, |
knot_str_type * color_knot, |
knot_str_type * normal_knot, |
knot_str_type * texture_knot); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glu/tess.c |
---|
0,0 → 1,328 |
/* $Id: tess.c,v 1.1 2003-02-28 11:42:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file is part of the polygon tesselation code contributed by |
* Bogdan Sikorski |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdlib.h> |
#include "tess.h" |
#endif |
/* |
* This is ugly, but seems the easiest way to do things to make the |
* code work under YellowBox for Windows |
*/ |
#if defined(OPENSTEP) && defined(CALLBACK) |
#undef CALLBACK |
#define CALLBACK |
#endif |
static void delete_contours(GLUtriangulatorObj *); |
#ifdef __CYGWIN32__ |
#define _CALLBACK |
#else |
#define _CALLBACK GLCALLBACK |
#endif |
static void |
init_callbacks(tess_callbacks * callbacks) |
{ |
callbacks->begin = (void (_CALLBACK *) (GLenum)) 0; |
callbacks->edgeFlag = (void (_CALLBACK *) (GLboolean)) 0; |
callbacks->vertex = (void (_CALLBACK *) (void *)) 0; |
callbacks->end = (void (_CALLBACK *) (void)) 0; |
callbacks->error = (void (_CALLBACK *) (GLenum)) 0; |
} |
void |
tess_call_user_error(GLUtriangulatorObj * tobj, GLenum gluerr) |
{ |
if (tobj->error == GLU_NO_ERROR) |
tobj->error = gluerr; |
if (tobj->callbacks.error != NULL) |
(tobj->callbacks.error) (gluerr); |
} |
GLUtriangulatorObj *GLAPIENTRY |
gluNewTess(void) |
{ |
GLUtriangulatorObj *tobj; |
if ((tobj = (GLUtriangulatorObj *) |
malloc(sizeof(struct GLUtesselator))) == NULL) |
return NULL; |
tobj->contours = tobj->last_contour = NULL; |
init_callbacks(&tobj->callbacks); |
tobj->error = GLU_NO_ERROR; |
tobj->current_polygon = NULL; |
tobj->contour_cnt = 0; |
return tobj; |
} |
void GLAPIENTRY |
gluTessCallback(GLUtriangulatorObj * tobj, GLenum which, |
void (GLCALLBACK * fn) ()) |
{ |
switch (which) { |
case GLU_BEGIN: |
tobj->callbacks.begin = (void (_CALLBACK *) (GLenum)) fn; |
break; |
case GLU_EDGE_FLAG: |
tobj->callbacks.edgeFlag = (void (_CALLBACK *) (GLboolean)) fn; |
break; |
case GLU_VERTEX: |
tobj->callbacks.vertex = (void (_CALLBACK *) (void *)) fn; |
break; |
case GLU_END: |
tobj->callbacks.end = (void (_CALLBACK *) (void)) fn; |
break; |
case GLU_ERROR: |
tobj->callbacks.error = (void (_CALLBACK *) (GLenum)) fn; |
break; |
default: |
tobj->error = GLU_INVALID_ENUM; |
break; |
} |
} |
void GLAPIENTRY |
gluDeleteTess(GLUtriangulatorObj * tobj) |
{ |
if (tobj->error == GLU_NO_ERROR && tobj->contour_cnt) |
/* was gluEndPolygon called? */ |
tess_call_user_error(tobj, GLU_TESS_ERROR1); |
/* delete all internal structures */ |
delete_contours(tobj); |
free(tobj); |
} |
void GLAPIENTRY |
gluBeginPolygon(GLUtriangulatorObj * tobj) |
{ |
/* |
if(tobj->error!=GLU_NO_ERROR) |
return; |
*/ |
tobj->error = GLU_NO_ERROR; |
if (tobj->current_polygon != NULL) { |
/* gluEndPolygon was not called */ |
tess_call_user_error(tobj, GLU_TESS_ERROR1); |
/* delete all internal structures */ |
delete_contours(tobj); |
} |
else { |
if ((tobj->current_polygon = |
(tess_polygon *) malloc(sizeof(tess_polygon))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return; |
} |
tobj->current_polygon->vertex_cnt = 0; |
tobj->current_polygon->vertices = |
tobj->current_polygon->last_vertex = NULL; |
} |
} |
void GLAPIENTRY |
gluEndPolygon(GLUtriangulatorObj * tobj) |
{ |
/*tess_contour *contour_ptr; */ |
/* there was an error */ |
if (tobj->error != GLU_NO_ERROR) |
goto end; |
/* check if gluBeginPolygon was called */ |
if (tobj->current_polygon == NULL) { |
tess_call_user_error(tobj, GLU_TESS_ERROR2); |
return; |
} |
tess_test_polygon(tobj); |
/* there was an error */ |
if (tobj->error != GLU_NO_ERROR) |
goto end; |
/* any real contours? */ |
if (tobj->contour_cnt == 0) { |
/* delete all internal structures */ |
delete_contours(tobj); |
return; |
} |
tess_find_contour_hierarchies(tobj); |
/* there was an error */ |
if (tobj->error != GLU_NO_ERROR) |
goto end; |
tess_handle_holes(tobj); |
/* there was an error */ |
if (tobj->error != GLU_NO_ERROR) |
goto end; |
/* if no callbacks, nothing to do */ |
if (tobj->callbacks.begin != NULL && tobj->callbacks.vertex != NULL && |
tobj->callbacks.end != NULL) { |
if (tobj->callbacks.edgeFlag == NULL) |
tess_tesselate(tobj); |
else |
tess_tesselate_with_edge_flag(tobj); |
} |
end: |
/* delete all internal structures */ |
delete_contours(tobj); |
} |
void GLAPIENTRY |
gluNextContour(GLUtriangulatorObj * tobj, GLenum type) |
{ |
if (tobj->error != GLU_NO_ERROR) |
return; |
if (tobj->current_polygon == NULL) { |
tess_call_user_error(tobj, GLU_TESS_ERROR2); |
return; |
} |
/* first contour? */ |
if (tobj->current_polygon->vertex_cnt) |
tess_test_polygon(tobj); |
} |
void GLAPIENTRY |
gluTessVertex(GLUtriangulatorObj * tobj, GLdouble v[3], void *data) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_vertex *last_vertex_ptr; |
if (tobj->error != GLU_NO_ERROR) |
return; |
if (polygon == NULL) { |
tess_call_user_error(tobj, GLU_TESS_ERROR2); |
return; |
} |
last_vertex_ptr = polygon->last_vertex; |
if (last_vertex_ptr == NULL) { |
if ((last_vertex_ptr = (tess_vertex *) |
malloc(sizeof(tess_vertex))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return; |
} |
polygon->vertices = last_vertex_ptr; |
polygon->last_vertex = last_vertex_ptr; |
last_vertex_ptr->data = data; |
last_vertex_ptr->location[0] = v[0]; |
last_vertex_ptr->location[1] = v[1]; |
last_vertex_ptr->location[2] = v[2]; |
last_vertex_ptr->next = NULL; |
last_vertex_ptr->previous = NULL; |
++(polygon->vertex_cnt); |
} |
else { |
tess_vertex *vertex_ptr; |
/* same point twice? */ |
if (fabs(last_vertex_ptr->location[0] - v[0]) < EPSILON && |
fabs(last_vertex_ptr->location[1] - v[1]) < EPSILON && |
fabs(last_vertex_ptr->location[2] - v[2]) < EPSILON) { |
tess_call_user_error(tobj, GLU_TESS_ERROR6); |
return; |
} |
if ((vertex_ptr = (tess_vertex *) |
malloc(sizeof(tess_vertex))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return; |
} |
vertex_ptr->data = data; |
vertex_ptr->location[0] = v[0]; |
vertex_ptr->location[1] = v[1]; |
vertex_ptr->location[2] = v[2]; |
vertex_ptr->next = NULL; |
vertex_ptr->previous = last_vertex_ptr; |
++(polygon->vertex_cnt); |
last_vertex_ptr->next = vertex_ptr; |
polygon->last_vertex = vertex_ptr; |
} |
} |
static void |
delete_contours(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_contour *contour, *contour_tmp; |
tess_vertex *vertex, *vertex_tmp; |
/* remove current_polygon list - if exists due to detected error */ |
if (polygon != NULL) { |
if (polygon->vertices) { |
for (vertex = polygon->vertices; vertex != polygon->last_vertex;) { |
vertex_tmp = vertex->next; |
free(vertex); |
vertex = vertex_tmp; |
} |
free(vertex); |
} |
free(polygon); |
tobj->current_polygon = NULL; |
} |
/* remove all contour data */ |
for (contour = tobj->contours; contour != NULL;) { |
for (vertex = contour->vertices; vertex != contour->last_vertex;) { |
vertex_tmp = vertex->next; |
free(vertex); |
vertex = vertex_tmp; |
} |
free(vertex); |
contour_tmp = contour->next; |
free(contour); |
contour = contour_tmp; |
} |
tobj->contours = tobj->last_contour = NULL; |
tobj->contour_cnt = 0; |
} |
void GLAPIENTRY |
gluTessNormal(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ) |
{ |
/* dummy function */ |
(void) tess; |
(void) valueX; |
(void) valueY; |
(void) valueZ; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/nurbsutl.c |
---|
0,0 → 1,1310 |
/* $Id: nurbsutl.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) |
* See README2 for more info. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdlib.h> |
#include "gluP.h" |
#include "nurbs.h" |
#endif |
GLenum test_knot(GLint nknots, GLfloat * knot, GLint order) |
{ |
GLsizei i; |
GLint knot_mult; |
GLfloat tmp_knot; |
tmp_knot = knot[0]; |
knot_mult = 1; |
for (i = 1; i < nknots; i++) { |
if (knot[i] < tmp_knot) |
return GLU_NURBS_ERROR4; |
if (fabs(tmp_knot - knot[i]) > EPSILON) { |
if (knot_mult > order) |
return GLU_NURBS_ERROR5; |
knot_mult = 1; |
tmp_knot = knot[i]; |
} |
else |
++knot_mult; |
} |
return GLU_NO_ERROR; |
} |
static int |
/* qsort function */ |
#if defined(WIN32) && !defined(OPENSTEP) |
__cdecl |
#endif |
knot_sort(const void *a, const void *b) |
{ |
GLfloat x, y; |
x = *((GLfloat *) a); |
y = *((GLfloat *) b); |
if (fabs(x - y) < EPSILON) |
return 0; |
if (x > y) |
return 1; |
return -1; |
} |
/* insert into dest knot all values within the valid range from src knot */ |
/* that do not appear in dest */ |
void |
collect_unified_knot(knot_str_type * dest, knot_str_type * src, |
GLfloat maximal_min_knot, GLfloat minimal_max_knot) |
{ |
GLfloat *src_knot, *dest_knot; |
GLint src_t_min, src_t_max, dest_t_min, dest_t_max; |
GLint src_nknots, dest_nknots; |
GLint i, j, k, new_cnt; |
GLboolean not_found_flag; |
src_knot = src->unified_knot; |
dest_knot = dest->unified_knot; |
src_t_min = src->t_min; |
src_t_max = src->t_max; |
dest_t_min = dest->t_min; |
dest_t_max = dest->t_max; |
src_nknots = src->unified_nknots; |
dest_nknots = dest->unified_nknots; |
k = new_cnt = dest_nknots; |
for (i = src_t_min; i <= src_t_max; i++) |
if (src_knot[i] - maximal_min_knot > -EPSILON && |
src_knot[i] - minimal_max_knot < EPSILON) { |
not_found_flag = GL_TRUE; |
for (j = dest_t_min; j <= dest_t_max; j++) |
if (fabs(dest_knot[j] - src_knot[i]) < EPSILON) { |
not_found_flag = GL_FALSE; |
break; |
} |
if (not_found_flag) { |
/* knot from src is not in dest - add this knot to dest */ |
dest_knot[k++] = src_knot[i]; |
++new_cnt; |
++(dest->t_max); /* the valid range widens */ |
++(dest->delta_nknots); /* increment the extra knot value counter */ |
} |
} |
dest->unified_nknots = new_cnt; |
qsort((void *) dest_knot, (size_t) new_cnt, (size_t) sizeof(GLfloat), |
&knot_sort); |
} |
/* basing on the new common knot range for all attributes set */ |
/* t_min and t_max values for each knot - they will be used later on */ |
/* by explode_knot() and calc_new_ctrl_pts */ |
static void |
set_new_t_min_t_max(knot_str_type * geom_knot, knot_str_type * color_knot, |
knot_str_type * normal_knot, knot_str_type * texture_knot, |
GLfloat maximal_min_knot, GLfloat minimal_max_knot) |
{ |
GLuint t_min = 0, t_max = 0, cnt = 0; |
if (minimal_max_knot - maximal_min_knot < EPSILON) { |
/* knot common range empty */ |
geom_knot->t_min = geom_knot->t_max = 0; |
color_knot->t_min = color_knot->t_max = 0; |
normal_knot->t_min = normal_knot->t_max = 0; |
texture_knot->t_min = texture_knot->t_max = 0; |
} |
else { |
if (geom_knot->unified_knot != NULL) { |
cnt = geom_knot->unified_nknots; |
for (t_min = 0; t_min < cnt; t_min++) |
if (fabs((geom_knot->unified_knot)[t_min] - maximal_min_knot) < |
EPSILON) break; |
for (t_max = cnt - 1; t_max; t_max--) |
if (fabs((geom_knot->unified_knot)[t_max] - minimal_max_knot) < |
EPSILON) break; |
} |
else if (geom_knot->nknots) { |
cnt = geom_knot->nknots; |
for (t_min = 0; t_min < cnt; t_min++) |
if (fabs((geom_knot->knot)[t_min] - maximal_min_knot) < EPSILON) |
break; |
for (t_max = cnt - 1; t_max; t_max--) |
if (fabs((geom_knot->knot)[t_max] - minimal_max_knot) < EPSILON) |
break; |
} |
geom_knot->t_min = t_min; |
geom_knot->t_max = t_max; |
if (color_knot->unified_knot != NULL) { |
cnt = color_knot->unified_nknots; |
for (t_min = 0; t_min < cnt; t_min++) |
if (fabs((color_knot->unified_knot)[t_min] - maximal_min_knot) < |
EPSILON) break; |
for (t_max = cnt - 1; t_max; t_max--) |
if (fabs((color_knot->unified_knot)[t_max] - minimal_max_knot) < |
EPSILON) break; |
color_knot->t_min = t_min; |
color_knot->t_max = t_max; |
} |
if (normal_knot->unified_knot != NULL) { |
cnt = normal_knot->unified_nknots; |
for (t_min = 0; t_min < cnt; t_min++) |
if (fabs((normal_knot->unified_knot)[t_min] - maximal_min_knot) < |
EPSILON) break; |
for (t_max = cnt - 1; t_max; t_max--) |
if (fabs((normal_knot->unified_knot)[t_max] - minimal_max_knot) < |
EPSILON) break; |
normal_knot->t_min = t_min; |
normal_knot->t_max = t_max; |
} |
if (texture_knot->unified_knot != NULL) { |
cnt = texture_knot->unified_nknots; |
for (t_min = 0; t_min < cnt; t_min++) |
if (fabs((texture_knot->unified_knot)[t_min] - maximal_min_knot) |
< EPSILON) |
break; |
for (t_max = cnt - 1; t_max; t_max--) |
if (fabs((texture_knot->unified_knot)[t_max] - minimal_max_knot) |
< EPSILON) |
break; |
texture_knot->t_min = t_min; |
texture_knot->t_max = t_max; |
} |
} |
} |
/* modify all knot valid ranges in such a way that all have the same */ |
/* range, common to all knots */ |
/* do this by knot insertion */ |
GLenum |
select_knot_working_range(GLUnurbsObj * nobj, knot_str_type * geom_knot, |
knot_str_type * color_knot, |
knot_str_type * normal_knot, |
knot_str_type * texture_knot) |
{ |
GLint max_nknots; |
GLfloat maximal_min_knot, minimal_max_knot; |
GLint i; |
/* find the maximum modified knot length */ |
max_nknots = geom_knot->nknots; |
if (color_knot->unified_knot) |
max_nknots += color_knot->nknots; |
if (normal_knot->unified_knot) |
max_nknots += normal_knot->nknots; |
if (texture_knot->unified_knot) |
max_nknots += texture_knot->nknots; |
maximal_min_knot = (geom_knot->knot)[geom_knot->t_min]; |
minimal_max_knot = (geom_knot->knot)[geom_knot->t_max]; |
/* any attirb data ? */ |
if (max_nknots != geom_knot->nknots) { |
/* allocate space for the unified knots */ |
if ((geom_knot->unified_knot = |
(GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
/* copy the original knot to the unified one */ |
geom_knot->unified_nknots = geom_knot->nknots; |
for (i = 0; i < geom_knot->nknots; i++) |
(geom_knot->unified_knot)[i] = (geom_knot->knot)[i]; |
if (color_knot->unified_knot) { |
if ((color_knot->knot)[color_knot->t_min] - maximal_min_knot > |
EPSILON) |
maximal_min_knot = (color_knot->knot)[color_knot->t_min]; |
if (minimal_max_knot - (color_knot->knot)[color_knot->t_max] > |
EPSILON) |
minimal_max_knot = (color_knot->knot)[color_knot->t_max]; |
if ((color_knot->unified_knot = |
(GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { |
free(geom_knot->unified_knot); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
/* copy the original knot to the unified one */ |
color_knot->unified_nknots = color_knot->nknots; |
for (i = 0; i < color_knot->nknots; i++) |
(color_knot->unified_knot)[i] = (color_knot->knot)[i]; |
} |
if (normal_knot->unified_knot) { |
if ((normal_knot->knot)[normal_knot->t_min] - maximal_min_knot > |
EPSILON) |
maximal_min_knot = (normal_knot->knot)[normal_knot->t_min]; |
if (minimal_max_knot - (normal_knot->knot)[normal_knot->t_max] > |
EPSILON) |
minimal_max_knot = (normal_knot->knot)[normal_knot->t_max]; |
if ((normal_knot->unified_knot = |
(GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { |
free(geom_knot->unified_knot); |
free(color_knot->unified_knot); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
/* copy the original knot to the unified one */ |
normal_knot->unified_nknots = normal_knot->nknots; |
for (i = 0; i < normal_knot->nknots; i++) |
(normal_knot->unified_knot)[i] = (normal_knot->knot)[i]; |
} |
if (texture_knot->unified_knot) { |
if ((texture_knot->knot)[texture_knot->t_min] - maximal_min_knot > |
EPSILON) |
maximal_min_knot = (texture_knot->knot)[texture_knot->t_min]; |
if (minimal_max_knot - (texture_knot->knot)[texture_knot->t_max] > |
EPSILON) |
minimal_max_knot = (texture_knot->knot)[texture_knot->t_max]; |
if ((texture_knot->unified_knot = |
(GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) { |
free(geom_knot->unified_knot); |
free(color_knot->unified_knot); |
free(normal_knot->unified_knot); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
/* copy the original knot to the unified one */ |
texture_knot->unified_nknots = texture_knot->nknots; |
for (i = 0; i < texture_knot->nknots; i++) |
(texture_knot->unified_knot)[i] = (texture_knot->knot)[i]; |
} |
/* work on the geometry knot with all additional knot values */ |
/* appearing in attirbutive knots */ |
if (minimal_max_knot - maximal_min_knot < EPSILON) { |
/* empty working range */ |
geom_knot->unified_nknots = 0; |
color_knot->unified_nknots = 0; |
normal_knot->unified_nknots = 0; |
texture_knot->unified_nknots = 0; |
} |
else { |
if (color_knot->unified_knot) |
collect_unified_knot(geom_knot, color_knot, maximal_min_knot, |
minimal_max_knot); |
if (normal_knot->unified_knot) |
collect_unified_knot(geom_knot, normal_knot, maximal_min_knot, |
minimal_max_knot); |
if (texture_knot->unified_knot) |
collect_unified_knot(geom_knot, texture_knot, maximal_min_knot, |
minimal_max_knot); |
/* since we have now built the "unified" geometry knot */ |
/* add same knot values to all attributive knots */ |
if (color_knot->unified_knot) |
collect_unified_knot(color_knot, geom_knot, maximal_min_knot, |
minimal_max_knot); |
if (normal_knot->unified_knot) |
collect_unified_knot(normal_knot, geom_knot, maximal_min_knot, |
minimal_max_knot); |
if (texture_knot->unified_knot) |
collect_unified_knot(texture_knot, geom_knot, maximal_min_knot, |
minimal_max_knot); |
} |
} |
set_new_t_min_t_max(geom_knot, color_knot, normal_knot, texture_knot, |
maximal_min_knot, minimal_max_knot); |
return GLU_NO_ERROR; |
} |
void |
free_unified_knots(knot_str_type * geom_knot, knot_str_type * color_knot, |
knot_str_type * normal_knot, knot_str_type * texture_knot) |
{ |
if (geom_knot->unified_knot) |
free(geom_knot->unified_knot); |
if (color_knot->unified_knot) |
free(color_knot->unified_knot); |
if (normal_knot->unified_knot) |
free(normal_knot->unified_knot); |
if (texture_knot->unified_knot) |
free(texture_knot->unified_knot); |
} |
GLenum explode_knot(knot_str_type * the_knot) |
{ |
GLfloat *knot, *new_knot; |
GLint nknots, n_new_knots = 0; |
GLint t_min, t_max; |
GLint ord; |
GLsizei i, j, k; |
GLfloat tmp_float; |
if (the_knot->unified_knot) { |
knot = the_knot->unified_knot; |
nknots = the_knot->unified_nknots; |
} |
else { |
knot = the_knot->knot; |
nknots = the_knot->nknots; |
} |
ord = the_knot->order; |
t_min = the_knot->t_min; |
t_max = the_knot->t_max; |
for (i = t_min; i <= t_max;) { |
tmp_float = knot[i]; |
for (j = 0; j < ord && (i + j) <= t_max; j++) |
if (fabs(tmp_float - knot[i + j]) > EPSILON) |
break; |
n_new_knots += ord - j; |
i += j; |
} |
/* alloc space for new_knot */ |
if ( |
(new_knot = |
(GLfloat *) malloc(sizeof(GLfloat) * (nknots + n_new_knots + 1))) == NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
/* fill in new knot */ |
for (j = 0; j < t_min; j++) |
new_knot[j] = knot[j]; |
for (i = j; i <= t_max; i++) { |
tmp_float = knot[i]; |
for (k = 0; k < ord; k++) { |
new_knot[j++] = knot[i]; |
if (tmp_float == knot[i + 1]) |
i++; |
} |
} |
for (i = t_max + 1; i < (int) nknots; i++) |
new_knot[j++] = knot[i]; |
/* fill in the knot structure */ |
the_knot->new_knot = new_knot; |
the_knot->delta_nknots += n_new_knots; |
the_knot->t_max += n_new_knots; |
return GLU_NO_ERROR; |
} |
GLenum calc_alphas(knot_str_type * the_knot) |
{ |
GLfloat tmp_float; |
int i, j, k, m, n; |
int order; |
GLfloat *alpha, *alpha_new, *tmp_alpha; |
GLfloat denom; |
GLfloat *knot, *new_knot; |
knot = the_knot->knot; |
order = the_knot->order; |
new_knot = the_knot->new_knot; |
n = the_knot->nknots - the_knot->order; |
m = n + the_knot->delta_nknots; |
if ((alpha = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
if ((alpha_new = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) { |
free(alpha); |
return GLU_OUT_OF_MEMORY; |
} |
for (j = 0; j < m; j++) { |
for (i = 0; i < n; i++) { |
if ((knot[i] <= new_knot[j]) && (new_knot[j] < knot[i + 1])) |
tmp_float = 1.0; |
else |
tmp_float = 0.0; |
alpha[i + j * n] = tmp_float; |
} |
} |
for (k = 1; k < order; k++) { |
for (j = 0; j < m; j++) |
for (i = 0; i < n; i++) { |
denom = knot[i + k] - knot[i]; |
if (fabs(denom) < EPSILON) |
tmp_float = 0.0; |
else |
tmp_float = (new_knot[j + k] - knot[i]) / denom * |
alpha[i + j * n]; |
denom = knot[i + k + 1] - knot[i + 1]; |
if (fabs(denom) > EPSILON) |
tmp_float += (knot[i + k + 1] - new_knot[j + k]) / denom * |
alpha[(i + 1) + j * n]; |
alpha_new[i + j * n] = tmp_float; |
} |
tmp_alpha = alpha_new; |
alpha_new = alpha; |
alpha = tmp_alpha; |
} |
the_knot->alpha = alpha; |
free(alpha_new); |
return GLU_NO_ERROR; |
} |
GLenum |
calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, knot_str_type * the_knot, |
GLint dim, GLfloat ** new_ctrl, GLint * ncontrol) |
{ |
GLsizei i, j, k, l, m, n; |
GLsizei index1, index2; |
GLfloat *alpha; |
GLfloat *new_knot; |
new_knot = the_knot->new_knot; |
n = the_knot->nknots - the_knot->order; |
alpha = the_knot->alpha; |
m = the_knot->t_max + 1 - the_knot->t_min - the_knot->order; |
k = the_knot->t_min; |
/* allocate space for new control points */ |
if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * dim * m)) == NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
for (j = 0; j < m; j++) { |
for (l = 0; l < dim; l++) |
(*new_ctrl)[j * dim + l] = 0.0; |
for (i = 0; i < n; i++) { |
index1 = i + (j + k) * n; |
index2 = i * stride; |
for (l = 0; l < dim; l++) |
(*new_ctrl)[j * dim + l] += alpha[index1] * ctrl[index2 + l]; |
} |
} |
*ncontrol = (GLint) m; |
return GLU_NO_ERROR; |
} |
static GLint |
calc_factor(GLfloat * pts, GLint order, GLint indx, GLint stride, |
GLfloat tolerance, GLint dim) |
{ |
GLdouble model[16], proj[16]; |
GLint viewport[4]; |
GLdouble x, y, z, w, winx1, winy1, winz, winx2, winy2; |
GLint i; |
GLdouble len, dx, dy; |
glGetDoublev(GL_MODELVIEW_MATRIX, model); |
glGetDoublev(GL_PROJECTION_MATRIX, proj); |
glGetIntegerv(GL_VIEWPORT, viewport); |
if (dim == 4) { |
w = (GLdouble) pts[indx + 3]; |
x = (GLdouble) pts[indx] / w; |
y = (GLdouble) pts[indx + 1] / w; |
z = (GLdouble) pts[indx + 2] / w; |
gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz); |
len = 0.0; |
for (i = 1; i < order; i++) { |
w = (GLdouble) pts[indx + i * stride + 3]; |
x = (GLdouble) pts[indx + i * stride] / w; |
y = (GLdouble) pts[indx + i * stride + 1] / w; |
z = (GLdouble) pts[indx + i * stride + 2] / w; |
if (gluProject |
(x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) { |
dx = winx2 - winx1; |
dy = winy2 - winy1; |
len += sqrt(dx * dx + dy * dy); |
} |
winx1 = winx2; |
winy1 = winy2; |
} |
} |
else { |
x = (GLdouble) pts[indx]; |
y = (GLdouble) pts[indx + 1]; |
if (dim == 2) |
z = 0.0; |
else |
z = (GLdouble) pts[indx + 2]; |
gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz); |
len = 0.0; |
for (i = 1; i < order; i++) { |
x = (GLdouble) pts[indx + i * stride]; |
y = (GLdouble) pts[indx + i * stride + 1]; |
if (dim == 2) |
z = 0.0; |
else |
z = (GLdouble) pts[indx + i * stride + 2]; |
if (gluProject |
(x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) { |
dx = winx2 - winx1; |
dy = winy2 - winy1; |
len += sqrt(dx * dx + dy * dy); |
} |
winx1 = winx2; |
winy1 = winy2; |
} |
} |
len /= tolerance; |
return ((GLint) len + 1); |
} |
/* we can't use the Mesa evaluators - no way to get the point coords */ |
/* so we use our own Bezier point calculus routines */ |
/* because I'm lazy, I reuse the ones from eval.c */ |
static void |
bezier_curve(GLfloat * cp, GLfloat * out, GLfloat t, |
GLuint dim, GLuint order, GLint offset) |
{ |
GLfloat s, powert; |
GLuint i, k, bincoeff; |
if (order >= 2) { |
bincoeff = order - 1; |
s = 1.0 - t; |
for (k = 0; k < dim; k++) |
out[k] = s * cp[k] + bincoeff * t * cp[offset + k]; |
for (i = 2, cp += 2 * offset, powert = t * t; i < order; |
i++, powert *= t, cp += offset) { |
bincoeff *= order - i; |
bincoeff /= i; |
for (k = 0; k < dim; k++) |
out[k] = s * out[k] + bincoeff * powert * cp[k]; |
} |
} |
else { /* order=1 -> constant curve */ |
for (k = 0; k < dim; k++) |
out[k] = cp[k]; |
} |
} |
static GLint |
calc_parametric_factor(GLfloat * pts, GLint order, GLint indx, GLint stride, |
GLfloat tolerance, GLint dim) |
{ |
GLdouble model[16], proj[16]; |
GLint viewport[4]; |
GLdouble x, y, z, w, x1, y1, z1, x2, y2, z2, x3, y3, z3; |
GLint i; |
GLint P; |
GLfloat bez_pt[4]; |
GLdouble len = 0.0, tmp, z_med; |
P = 2 * (order + 2); |
glGetDoublev(GL_MODELVIEW_MATRIX, model); |
glGetDoublev(GL_PROJECTION_MATRIX, proj); |
glGetIntegerv(GL_VIEWPORT, viewport); |
z_med = (viewport[2] + viewport[3]) * 0.5; |
switch (dim) { |
case 4: |
for (i = 1; i < P; i++) { |
bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 4, |
order, stride); |
w = (GLdouble) bez_pt[3]; |
x = (GLdouble) bez_pt[0] / w; |
y = (GLdouble) bez_pt[1] / w; |
z = (GLdouble) bez_pt[2] / w; |
gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); |
z3 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 4, |
order, stride); |
w = (GLdouble) bez_pt[3]; |
x = (GLdouble) bez_pt[0] / w; |
y = (GLdouble) bez_pt[1] / w; |
z = (GLdouble) bez_pt[2] / w; |
gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); |
z1 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 4, |
order, stride); |
w = (GLdouble) bez_pt[3]; |
x = (GLdouble) bez_pt[0] / w; |
y = (GLdouble) bez_pt[1] / w; |
z = (GLdouble) bez_pt[2] / w; |
gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); |
z2 *= z_med; |
/* calc distance between point (x3,y3,z3) and line segment */ |
/* <x1,y1,z1><x2,y2,z2> */ |
x = x2 - x1; |
y = y2 - y1; |
z = z2 - z1; |
tmp = sqrt(x * x + y * y + z * z); |
x /= tmp; |
y /= tmp; |
z /= tmp; |
tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; |
x = x1 + x * tmp - x3; |
y = y1 + y * tmp - y3; |
z = z1 + z * tmp - z3; |
tmp = sqrt(x * x + y * y + z * z); |
if (tmp > len) |
len = tmp; |
} |
break; |
case 3: |
for (i = 1; i < P; i++) { |
bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 3, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = (GLdouble) bez_pt[2]; |
gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); |
z3 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 3, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = (GLdouble) bez_pt[2]; |
gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); |
z1 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 3, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = (GLdouble) bez_pt[2]; |
gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); |
z2 *= z_med; |
/* calc distance between point (x3,y3,z3) and line segment */ |
/* <x1,y1,z1><x2,y2,z2> */ |
x = x2 - x1; |
y = y2 - y1; |
z = z2 - z1; |
tmp = sqrt(x * x + y * y + z * z); |
x /= tmp; |
y /= tmp; |
z /= tmp; |
tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; |
x = x1 + x * tmp - x3; |
y = y1 + y * tmp - y3; |
z = z1 + z * tmp - z3; |
tmp = sqrt(x * x + y * y + z * z); |
if (tmp > len) |
len = tmp; |
} |
break; |
case 2: |
for (i = 1; i < P; i++) { |
bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 2, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = 0.0; |
gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3); |
z3 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 2, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = 0.0; |
gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1); |
z1 *= z_med; |
bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 2, |
order, stride); |
x = (GLdouble) bez_pt[0]; |
y = (GLdouble) bez_pt[1]; |
z = 0.0; |
gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2); |
z2 *= z_med; |
/* calc distance between point (x3,y3,z3) and line segment */ |
/* <x1,y1,z1><x2,y2,z2> */ |
x = x2 - x1; |
y = y2 - y1; |
z = z2 - z1; |
tmp = sqrt(x * x + y * y + z * z); |
x /= tmp; |
y /= tmp; |
z /= tmp; |
tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z; |
x = x1 + x * tmp - x3; |
y = y1 + y * tmp - y3; |
z = z1 + z * tmp - z3; |
tmp = sqrt(x * x + y * y + z * z); |
if (tmp > len) |
len = tmp; |
} |
break; |
} |
if (len < tolerance) |
return (order); |
else |
return (GLint) (sqrt(len / tolerance) * (order + 2) + 1); |
} |
static GLenum |
calc_sampling_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim, |
GLint uorder, GLint vorder, GLint ** ufactors, |
GLint ** vfactors) |
{ |
GLfloat *ctrl; |
GLint tmp_factor1, tmp_factor2; |
GLint ufactor_cnt, vfactor_cnt; |
GLint offset1, offset2, offset3; |
GLint i, j; |
ufactor_cnt = new_ctrl->s_bezier_cnt; |
vfactor_cnt = new_ctrl->t_bezier_cnt; |
if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3)) |
== NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3)) |
== NULL) { |
free(*ufactors); |
return GLU_OUT_OF_MEMORY; |
} |
ctrl = new_ctrl->geom_ctrl; |
offset1 = new_ctrl->geom_t_stride * vorder; |
offset2 = new_ctrl->geom_s_stride * uorder; |
for (j = 0; j < vfactor_cnt; j++) { |
*(*vfactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, vorder, |
j * offset1, dim, |
tolerance, dim); |
/* loop ufactor_cnt-1 times */ |
for (i = 1; i < ufactor_cnt; i++) { |
tmp_factor2 = calc_factor(ctrl, vorder, |
j * offset1 + i * offset2, dim, tolerance, |
dim); |
if (tmp_factor2 > tmp_factor1) |
tmp_factor1 = tmp_factor2; |
} |
/* last time for the opposite edge */ |
*(*vfactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, vorder, |
j * offset1 + |
i * offset2 - |
new_ctrl-> |
geom_s_stride, dim, |
tolerance, dim); |
if (tmp_factor2 > tmp_factor1) |
*(*vfactors + j * 3) = tmp_factor2; |
else |
*(*vfactors + j * 3) = tmp_factor1; |
} |
offset3 = new_ctrl->geom_s_stride; |
offset2 = new_ctrl->geom_s_stride * uorder; |
for (j = 0; j < ufactor_cnt; j++) { |
*(*ufactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, uorder, |
j * offset2, |
offset3, tolerance, |
dim); |
/* loop vfactor_cnt-1 times */ |
for (i = 1; i < vfactor_cnt; i++) { |
tmp_factor2 = calc_factor(ctrl, uorder, |
j * offset2 + i * offset1, offset3, |
tolerance, dim); |
if (tmp_factor2 > tmp_factor1) |
tmp_factor1 = tmp_factor2; |
} |
/* last time for the opposite edge */ |
*(*ufactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, uorder, |
j * offset2 + |
i * offset1 - |
new_ctrl-> |
geom_t_stride, |
offset3, tolerance, |
dim); |
if (tmp_factor2 > tmp_factor1) |
*(*ufactors + j * 3) = tmp_factor2; |
else |
*(*ufactors + j * 3) = tmp_factor1; |
} |
return GL_NO_ERROR; |
} |
static GLenum |
calc_sampling_param_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim, |
GLint uorder, GLint vorder, GLint ** ufactors, |
GLint ** vfactors) |
{ |
GLfloat *ctrl; |
GLint tmp_factor1, tmp_factor2; |
GLint ufactor_cnt, vfactor_cnt; |
GLint offset1, offset2, offset3; |
GLint i, j; |
ufactor_cnt = new_ctrl->s_bezier_cnt; |
vfactor_cnt = new_ctrl->t_bezier_cnt; |
if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3)) |
== NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3)) |
== NULL) { |
free(*ufactors); |
return GLU_OUT_OF_MEMORY; |
} |
ctrl = new_ctrl->geom_ctrl; |
offset1 = new_ctrl->geom_t_stride * vorder; |
offset2 = new_ctrl->geom_s_stride * uorder; |
for (j = 0; j < vfactor_cnt; j++) { |
*(*vfactors + j * 3 + 1) = tmp_factor1 = |
calc_parametric_factor(ctrl, vorder, j * offset1, dim, tolerance, |
dim); |
/* loop ufactor_cnt-1 times */ |
for (i = 1; i < ufactor_cnt; i++) { |
tmp_factor2 = calc_parametric_factor(ctrl, vorder, |
j * offset1 + i * offset2, dim, |
tolerance, dim); |
if (tmp_factor2 > tmp_factor1) |
tmp_factor1 = tmp_factor2; |
} |
/* last time for the opposite edge */ |
*(*vfactors + j * 3 + 2) = tmp_factor2 = |
calc_parametric_factor(ctrl, vorder, |
j * offset1 + i * offset2 - |
new_ctrl->geom_s_stride, dim, tolerance, dim); |
if (tmp_factor2 > tmp_factor1) |
*(*vfactors + j * 3) = tmp_factor2; |
else |
*(*vfactors + j * 3) = tmp_factor1; |
} |
offset3 = new_ctrl->geom_s_stride; |
offset2 = new_ctrl->geom_s_stride * uorder; |
for (j = 0; j < ufactor_cnt; j++) { |
*(*ufactors + j * 3 + 1) = tmp_factor1 = |
calc_parametric_factor(ctrl, uorder, j * offset2, offset3, tolerance, |
dim); |
/* loop vfactor_cnt-1 times */ |
for (i = 1; i < vfactor_cnt; i++) { |
tmp_factor2 = calc_parametric_factor(ctrl, uorder, |
j * offset2 + i * offset1, |
offset3, tolerance, dim); |
if (tmp_factor2 > tmp_factor1) |
tmp_factor1 = tmp_factor2; |
} |
/* last time for the opposite edge */ |
*(*ufactors + j * 3 + 2) = tmp_factor2 = |
calc_parametric_factor(ctrl, uorder, |
j * offset2 + i * offset1 - |
new_ctrl->geom_t_stride, offset3, tolerance, |
dim); |
if (tmp_factor2 > tmp_factor1) |
*(*ufactors + j * 3) = tmp_factor2; |
else |
*(*ufactors + j * 3) = tmp_factor1; |
} |
return GL_NO_ERROR; |
} |
static GLenum |
calc_sampling_2D(GLfloat * ctrl, GLint cnt, GLint order, |
GLfloat tolerance, GLint dim, GLint ** factors) |
{ |
GLint factor_cnt; |
GLint tmp_factor; |
GLint offset; |
GLint i; |
factor_cnt = cnt / order; |
if ((*factors = (GLint *) malloc(sizeof(GLint) * factor_cnt)) == NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
offset = order * dim; |
for (i = 0; i < factor_cnt; i++) { |
tmp_factor = calc_factor(ctrl, order, i * offset, dim, tolerance, dim); |
if (tmp_factor == 0) |
(*factors)[i] = 1; |
else |
(*factors)[i] = tmp_factor; |
} |
return GL_NO_ERROR; |
} |
static void |
set_sampling_and_culling(GLUnurbsObj * nobj) |
{ |
if (nobj->auto_load_matrix == GL_FALSE) { |
GLint i; |
GLfloat m[4]; |
glPushAttrib((GLbitfield) (GL_VIEWPORT_BIT | GL_TRANSFORM_BIT)); |
for (i = 0; i < 4; i++) |
m[i] = nobj->sampling_matrices.viewport[i]; |
glViewport(m[0], m[1], m[2], m[3]); |
glMatrixMode(GL_PROJECTION); |
glPushMatrix(); |
glLoadMatrixf(nobj->sampling_matrices.proj); |
glMatrixMode(GL_MODELVIEW); |
glPushMatrix(); |
glLoadMatrixf(nobj->sampling_matrices.model); |
} |
} |
static void |
revert_sampling_and_culling(GLUnurbsObj * nobj) |
{ |
if (nobj->auto_load_matrix == GL_FALSE) { |
glMatrixMode(GL_MODELVIEW); |
glPopMatrix(); |
glMatrixMode(GL_PROJECTION); |
glPopMatrix(); |
glPopAttrib(); |
} |
} |
GLenum |
glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
GLint ** sfactors, GLint ** tfactors) |
{ |
GLint dim; |
GLenum err; |
*sfactors = NULL; |
*tfactors = NULL; |
dim = nobj->surface.geom.dim; |
set_sampling_and_culling(nobj); |
if ((err = calc_sampling_3D(new_ctrl, nobj->sampling_tolerance, dim, |
nobj->surface.geom.sorder, |
nobj->surface.geom.torder, sfactors, |
tfactors)) == GLU_ERROR) { |
revert_sampling_and_culling(nobj); |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
revert_sampling_and_culling(nobj); |
return GLU_NO_ERROR; |
} |
GLenum |
glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
GLint ** sfactors, GLint ** tfactors) |
{ |
GLint s_cnt, t_cnt, i; |
GLint u_steps, v_steps; |
s_cnt = new_ctrl->s_bezier_cnt; |
t_cnt = new_ctrl->t_bezier_cnt; |
*sfactors = NULL; |
*tfactors = NULL; |
if ((*sfactors = (GLint *) malloc(sizeof(GLint) * s_cnt * 3)) |
== NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
if ((*tfactors = (GLint *) malloc(sizeof(GLint) * t_cnt * 3)) |
== NULL) { |
free(*sfactors); |
return GLU_OUT_OF_MEMORY; |
} |
u_steps = nobj->u_step; |
v_steps = nobj->v_step; |
for (i = 0; i < s_cnt; i++) { |
*(*sfactors + i * 3) = u_steps; |
*(*sfactors + i * 3 + 1) = u_steps; |
*(*sfactors + i * 3 + 2) = u_steps; |
} |
for (i = 0; i < t_cnt; i++) { |
*(*tfactors + i * 3) = v_steps; |
*(*tfactors + i * 3 + 1) = v_steps; |
*(*tfactors + i * 3 + 2) = v_steps; |
} |
return GLU_NO_ERROR; |
} |
GLenum |
glu_do_sampling_param_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl, |
GLint ** sfactors, GLint ** tfactors) |
{ |
GLint dim; |
GLenum err; |
*sfactors = NULL; |
*tfactors = NULL; |
dim = nobj->surface.geom.dim; |
set_sampling_and_culling(nobj); |
if ( |
(err = |
calc_sampling_param_3D(new_ctrl, nobj->parametric_tolerance, dim, |
nobj->surface.geom.sorder, |
nobj->surface.geom.torder, sfactors, |
tfactors)) == GLU_ERROR) { |
revert_sampling_and_culling(nobj); |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
revert_sampling_and_culling(nobj); |
return GLU_NO_ERROR; |
} |
static GLenum |
glu_do_sampling_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order, |
GLint dim, GLint ** factors) |
{ |
GLenum err; |
set_sampling_and_culling(nobj); |
err = calc_sampling_2D(ctrl, cnt, order, nobj->sampling_tolerance, dim, |
factors); |
revert_sampling_and_culling(nobj); |
return err; |
} |
static GLenum |
glu_do_sampling_u(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order, |
GLint dim, GLint ** factors) |
{ |
GLint i; |
GLint u_steps; |
cnt /= order; |
if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt)) |
== NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
u_steps = nobj->u_step; |
for (i = 0; i < cnt; i++) |
(*factors)[i] = u_steps; |
return GLU_NO_ERROR; |
} |
static GLenum |
glu_do_sampling_param_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, |
GLint order, GLint dim, GLint ** factors) |
{ |
GLint i; |
GLint u_steps; |
GLfloat tolerance; |
set_sampling_and_culling(nobj); |
tolerance = nobj->parametric_tolerance; |
cnt /= order; |
if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt)) |
== NULL) { |
revert_sampling_and_culling(nobj); |
return GLU_OUT_OF_MEMORY; |
} |
u_steps = nobj->u_step; |
for (i = 0; i < cnt; i++) { |
(*factors)[i] = calc_parametric_factor(ctrl, order, 0, |
dim, tolerance, dim); |
} |
revert_sampling_and_culling(nobj); |
return GLU_NO_ERROR; |
} |
GLenum |
glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, |
GLint order, GLint dim, GLint ** factors) |
{ |
GLenum err; |
*factors = NULL; |
switch (nobj->sampling_method) { |
case GLU_PATH_LENGTH: |
if ((err = glu_do_sampling_2D(nobj, ctrl, cnt, order, dim, factors)) != |
GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
break; |
case GLU_DOMAIN_DISTANCE: |
if ((err = glu_do_sampling_u(nobj, ctrl, cnt, order, dim, factors)) != |
GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
break; |
case GLU_PARAMETRIC_ERROR: |
if ( |
(err = |
glu_do_sampling_param_2D(nobj, ctrl, cnt, order, dim, |
factors)) != GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
break; |
default: |
abort(); |
} |
return GLU_NO_ERROR; |
} |
/* TODO - i don't like this culling - this one just tests if at least one */ |
/* ctrl point lies within the viewport . Also the point_in_viewport() */ |
/* should be included in the fnctions for efficiency reasons */ |
static GLboolean |
point_in_viewport(GLfloat * pt, GLint dim) |
{ |
GLdouble model[16], proj[16]; |
GLint viewport[4]; |
GLdouble x, y, z, w, winx, winy, winz; |
glGetDoublev(GL_MODELVIEW_MATRIX, model); |
glGetDoublev(GL_PROJECTION_MATRIX, proj); |
glGetIntegerv(GL_VIEWPORT, viewport); |
if (dim == 3) { |
x = (GLdouble) pt[0]; |
y = (GLdouble) pt[1]; |
z = (GLdouble) pt[2]; |
gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz); |
} |
else { |
w = (GLdouble) pt[3]; |
x = (GLdouble) pt[0] / w; |
y = (GLdouble) pt[1] / w; |
z = (GLdouble) pt[2] / w; |
gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz); |
} |
if ((GLint) winx >= viewport[0] && (GLint) winx < viewport[2] && |
(GLint) winy >= viewport[1] && (GLint) winy < viewport[3]) |
return GL_TRUE; |
return GL_FALSE; |
} |
GLboolean |
fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * pts, GLint s_cnt, |
GLint t_cnt, GLint s_stride, GLint t_stride, GLint dim) |
{ |
GLint i, j; |
if (nobj->culling == GL_FALSE) |
return GL_FALSE; |
set_sampling_and_culling(nobj); |
if (dim == 3) { |
for (i = 0; i < s_cnt; i++) |
for (j = 0; j < t_cnt; j++) |
if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) { |
revert_sampling_and_culling(nobj); |
return GL_FALSE; |
} |
} |
else { |
for (i = 0; i < s_cnt; i++) |
for (j = 0; j < t_cnt; j++) |
if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) { |
revert_sampling_and_culling(nobj); |
return GL_FALSE; |
} |
} |
revert_sampling_and_culling(nobj); |
return GL_TRUE; |
} |
/*GLboolean |
fine_culling_test_3D(GLUnurbsObj *nobj,GLfloat *pts,GLint s_cnt,GLint t_cnt, |
GLint s_stride,GLint t_stride, GLint dim) |
{ |
GLint visible_cnt; |
GLfloat feedback_buffer[5]; |
GLsizei buffer_size; |
GLint i,j; |
if(nobj->culling==GL_FALSE) |
return GL_FALSE; |
buffer_size=5; |
set_sampling_and_culling(nobj); |
glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer); |
glRenderMode(GL_FEEDBACK); |
if(dim==3) |
{ |
for(i=0;i<s_cnt;i++) |
{ |
glBegin(GL_LINE_LOOP); |
for(j=0;j<t_cnt;j++) |
glVertex3fv(pts+i*s_stride+j*t_stride); |
glEnd(); |
} |
for(j=0;j<t_cnt;j++) |
{ |
glBegin(GL_LINE_LOOP); |
for(i=0;i<s_cnt;i++) |
glVertex3fv(pts+i*s_stride+j*t_stride); |
glEnd(); |
} |
} |
else |
{ |
for(i=0;i<s_cnt;i++) |
{ |
glBegin(GL_LINE_LOOP); |
for(j=0;j<t_cnt;j++) |
glVertex4fv(pts+i*s_stride+j*t_stride); |
glEnd(); |
} |
for(j=0;j<t_cnt;j++) |
{ |
glBegin(GL_LINE_LOOP); |
for(i=0;i<s_cnt;i++) |
glVertex4fv(pts+i*s_stride+j*t_stride); |
glEnd(); |
} |
} |
visible_cnt=glRenderMode(GL_RENDER); |
revert_sampling_and_culling(nobj); |
return (GLboolean)(visible_cnt==0); |
}*/ |
GLboolean |
fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * pts, GLint cnt, |
GLint stride, GLint dim) |
{ |
GLint i; |
if (nobj->culling == GL_FALSE) |
return GL_FALSE; |
set_sampling_and_culling(nobj); |
if (dim == 3) { |
for (i = 0; i < cnt; i++) |
if (point_in_viewport(pts + i * stride, dim)) { |
revert_sampling_and_culling(nobj); |
return GL_FALSE; |
} |
} |
else { |
for (i = 0; i < cnt; i++) |
if (point_in_viewport(pts + i * stride, dim)) { |
revert_sampling_and_culling(nobj); |
return GL_FALSE; |
} |
} |
revert_sampling_and_culling(nobj); |
return GL_TRUE; |
} |
/*GLboolean |
fine_culling_test_2D(GLUnurbsObj *nobj,GLfloat *pts,GLint cnt, |
GLint stride, GLint dim) |
{ |
GLint visible_cnt; |
GLfloat feedback_buffer[5]; |
GLsizei buffer_size; |
GLint i; |
if(nobj->culling==GL_FALSE) |
return GL_FALSE; |
buffer_size=5; |
set_sampling_and_culling(nobj); |
glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer); |
glRenderMode(GL_FEEDBACK); |
glBegin(GL_LINE_LOOP); |
if(dim==3) |
{ |
for(i=0;i<cnt;i++) |
glVertex3fv(pts+i*stride); |
} |
else |
{ |
for(i=0;i<cnt;i++) |
glVertex4fv(pts+i*stride); |
} |
glEnd(); |
visible_cnt=glRenderMode(GL_RENDER); |
revert_sampling_and_culling(nobj); |
return (GLboolean)(visible_cnt==0); |
}*/ |
/shark/tags/rel_0_4/ports/mesa/src-glu/polytest.c |
---|
0,0 → 1,938 |
/* $Id: polytest.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file is part of the polygon tesselation code contributed by |
* Bogdan Sikorski |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdlib.h> |
#include "gluP.h" |
#include "tess.h" |
#endif |
static GLenum store_polygon_as_contour(GLUtriangulatorObj *); |
static void free_current_polygon(tess_polygon *); |
static void prepare_projection_info(GLUtriangulatorObj *); |
static GLdouble twice_the_polygon_area(tess_vertex *, tess_vertex *); |
static GLenum verify_edge_vertex_intersections(GLUtriangulatorObj *); |
void tess_find_contour_hierarchies(GLUtriangulatorObj *); |
static GLenum test_for_overlapping_contours(GLUtriangulatorObj *); |
static GLenum contours_overlap(tess_contour *, tess_polygon *); |
static GLenum is_contour_contained_in(tess_contour *, tess_contour *); |
static void add_new_exterior(GLUtriangulatorObj *, tess_contour *); |
static void add_new_interior(GLUtriangulatorObj *, tess_contour *, |
tess_contour *); |
static void add_interior_with_hierarchy_check(GLUtriangulatorObj *, |
tess_contour *, tess_contour *); |
static void reverse_hierarchy_and_add_exterior(GLUtriangulatorObj *, |
tess_contour *, |
tess_contour *); |
static GLboolean point_in_polygon(tess_contour *, GLdouble, GLdouble); |
static void shift_interior_to_exterior(GLUtriangulatorObj *, tess_contour *); |
static void add_exterior_with_check(GLUtriangulatorObj *, tess_contour *, |
tess_contour *); |
static GLenum cut_out_hole(GLUtriangulatorObj *, tess_contour *, |
tess_contour *); |
static GLenum merge_hole_with_contour(GLUtriangulatorObj *, |
tess_contour *, tess_contour *, |
tess_vertex *, tess_vertex *); |
static GLenum |
find_normal(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_vertex *va, *vb, *vc; |
GLdouble A, B, C; |
GLdouble A0, A1, A2, B0, B1, B2; |
va = polygon->vertices; |
vb = va->next; |
A0 = vb->location[0] - va->location[0]; |
A1 = vb->location[1] - va->location[1]; |
A2 = vb->location[2] - va->location[2]; |
for (vc = vb->next; vc != va; vc = vc->next) { |
B0 = vc->location[0] - va->location[0]; |
B1 = vc->location[1] - va->location[1]; |
B2 = vc->location[2] - va->location[2]; |
A = A1 * B2 - A2 * B1; |
B = A2 * B0 - A0 * B2; |
C = A0 * B1 - A1 * B0; |
if (fabs(A) > EPSILON || fabs(B) > EPSILON || fabs(C) > EPSILON) { |
polygon->A = A; |
polygon->B = B; |
polygon->C = C; |
polygon->D = |
-A * va->location[0] - B * va->location[1] - C * va->location[2]; |
return GLU_NO_ERROR; |
} |
} |
tess_call_user_error(tobj, GLU_TESS_ERROR7); |
return GLU_ERROR; |
} |
void |
tess_test_polygon(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
/* any vertices defined? */ |
if (polygon->vertex_cnt < 3) { |
free_current_polygon(polygon); |
return; |
} |
/* wrap pointers */ |
polygon->last_vertex->next = polygon->vertices; |
polygon->vertices->previous = polygon->last_vertex; |
/* determine the normal */ |
if (find_normal(tobj) == GLU_ERROR) |
return; |
/* compare the normals of previously defined contours and this one */ |
/* first contour define ? */ |
if (tobj->contours == NULL) { |
tobj->A = polygon->A; |
tobj->B = polygon->B; |
tobj->C = polygon->C; |
tobj->D = polygon->D; |
/* determine the best projection to use */ |
if (fabs(polygon->A) > fabs(polygon->B)) |
if (fabs(polygon->A) > fabs(polygon->C)) |
tobj->projection = OYZ; |
else |
tobj->projection = OXY; |
else if (fabs(polygon->B) > fabs(polygon->C)) |
tobj->projection = OXZ; |
else |
tobj->projection = OXY; |
} |
else { |
GLdouble a[3], b[3]; |
tess_vertex *vertex = polygon->vertices; |
a[0] = tobj->A; |
a[1] = tobj->B; |
a[2] = tobj->C; |
b[0] = polygon->A; |
b[1] = polygon->B; |
b[2] = polygon->C; |
/* compare the normals */ |
if (fabs(a[1] * b[2] - a[2] * b[1]) > EPSILON || |
fabs(a[2] * b[0] - a[0] * b[2]) > EPSILON || |
fabs(a[0] * b[1] - a[1] * b[0]) > EPSILON) { |
/* not coplanar */ |
tess_call_user_error(tobj, GLU_TESS_ERROR9); |
return; |
} |
/* the normals are parallel - test for plane equation */ |
if (fabs(a[0] * vertex->location[0] + a[1] * vertex->location[1] + |
a[2] * vertex->location[2] + tobj->D) > EPSILON) { |
/* not the same plane */ |
tess_call_user_error(tobj, GLU_TESS_ERROR9); |
return; |
} |
} |
prepare_projection_info(tobj); |
if (verify_edge_vertex_intersections(tobj) == GLU_ERROR) |
return; |
if (test_for_overlapping_contours(tobj) == GLU_ERROR) |
return; |
if (store_polygon_as_contour(tobj) == GLU_ERROR) |
return; |
} |
static GLenum |
test_for_overlapping_contours(GLUtriangulatorObj * tobj) |
{ |
tess_contour *contour; |
tess_polygon *polygon; |
polygon = tobj->current_polygon; |
for (contour = tobj->contours; contour != NULL; contour = contour->next) |
if (contours_overlap(contour, polygon) != GLU_NO_ERROR) { |
tess_call_user_error(tobj, GLU_TESS_ERROR5); |
return GLU_ERROR; |
} |
return GLU_NO_ERROR; |
} |
static GLenum |
store_polygon_as_contour(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_contour *contour = tobj->contours; |
/* the first contour defined */ |
if (contour == NULL) { |
if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
free_current_polygon(polygon); |
return GLU_ERROR; |
} |
tobj->contours = tobj->last_contour = contour; |
contour->next = contour->previous = NULL; |
} |
else { |
if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
free_current_polygon(polygon); |
return GLU_ERROR; |
} |
contour->previous = tobj->last_contour; |
tobj->last_contour->next = contour; |
tobj->last_contour = contour; |
contour->next = NULL; |
} |
/* mark all vertices in new contour as not special */ |
/* and all are boundary edges */ |
{ |
tess_vertex *vertex; |
GLuint vertex_cnt, i; |
for (vertex = polygon->vertices, i = 0, vertex_cnt = |
polygon->vertex_cnt; i < vertex_cnt; vertex = vertex->next, i++) { |
vertex->shadow_vertex = NULL; |
vertex->edge_flag = GL_TRUE; |
} |
} |
contour->vertex_cnt = polygon->vertex_cnt; |
contour->area = polygon->area; |
contour->orientation = polygon->orientation; |
contour->type = GLU_UNKNOWN; |
contour->vertices = polygon->vertices; |
contour->last_vertex = polygon->last_vertex; |
polygon->vertices = polygon->last_vertex = NULL; |
polygon->vertex_cnt = 0; |
++(tobj->contour_cnt); |
return GLU_NO_ERROR; |
} |
static void |
free_current_polygon(tess_polygon * polygon) |
{ |
tess_vertex *vertex, *vertex_tmp; |
GLuint i; |
/* free current_polygon structures */ |
for (vertex = polygon->vertices, i = 0; i < polygon->vertex_cnt; i++) { |
vertex_tmp = vertex->next; |
free(vertex); |
vertex = vertex_tmp; |
} |
polygon->vertices = polygon->last_vertex = NULL; |
polygon->vertex_cnt = 0; |
} |
static void |
prepare_projection_info(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_vertex *vertex, *last_vertex_ptr; |
GLdouble area; |
last_vertex_ptr = polygon->last_vertex; |
switch (tobj->projection) { |
case OXY: |
for (vertex = polygon->vertices; vertex != last_vertex_ptr; |
vertex = vertex->next) { |
vertex->x = vertex->location[0]; |
vertex->y = vertex->location[1]; |
} |
last_vertex_ptr->x = last_vertex_ptr->location[0]; |
last_vertex_ptr->y = last_vertex_ptr->location[1]; |
break; |
case OXZ: |
for (vertex = polygon->vertices; vertex != last_vertex_ptr; |
vertex = vertex->next) { |
vertex->x = vertex->location[0]; |
vertex->y = vertex->location[2]; |
} |
last_vertex_ptr->x = last_vertex_ptr->location[0]; |
last_vertex_ptr->y = last_vertex_ptr->location[2]; |
break; |
case OYZ: |
for (vertex = polygon->vertices; vertex != last_vertex_ptr; |
vertex = vertex->next) { |
vertex->x = vertex->location[1]; |
vertex->y = vertex->location[2]; |
} |
last_vertex_ptr->x = last_vertex_ptr->location[1]; |
last_vertex_ptr->y = last_vertex_ptr->location[2]; |
break; |
} |
area = twice_the_polygon_area(polygon->vertices, polygon->last_vertex); |
if (area >= 0.0) { |
polygon->orientation = GLU_CCW; |
polygon->area = area; |
} |
else { |
polygon->orientation = GLU_CW; |
polygon->area = -area; |
} |
} |
static GLdouble |
twice_the_polygon_area(tess_vertex * vertex, tess_vertex * last_vertex) |
{ |
tess_vertex *next; |
GLdouble area, x, y; |
area = 0.0; |
x = vertex->x; |
y = vertex->y; |
vertex = vertex->next; |
for (; vertex != last_vertex; vertex = vertex->next) { |
next = vertex->next; |
area += |
(vertex->x - x) * (next->y - y) - (vertex->y - y) * (next->x - x); |
} |
return area; |
} |
/* test if edges ab and cd intersect */ |
/* if not return GLU_NO_ERROR, else if cross return GLU_TESS_ERROR8, */ |
/* else if adjacent return GLU_TESS_ERROR4 */ |
static GLenum |
edge_edge_intersect(tess_vertex * a, |
tess_vertex * b, tess_vertex * c, tess_vertex * d) |
{ |
GLdouble denom, r, s; |
GLdouble xba, ydc, yba, xdc, yac, xac; |
xba = b->x - a->x; |
yba = b->y - a->y; |
xdc = d->x - c->x; |
ydc = d->y - c->y; |
xac = a->x - c->x; |
yac = a->y - c->y; |
denom = xba * ydc - yba * xdc; |
r = yac * xdc - xac * ydc; |
/* parallel? */ |
if (fabs(denom) < EPSILON) { |
if (fabs(r) < EPSILON) { |
/* colinear */ |
if (fabs(xba) < EPSILON) { |
/* compare the Y coordinate */ |
if (yba > 0.0) { |
if ( |
(fabs(a->y - c->y) < EPSILON |
&& fabs(c->y - b->y) < EPSILON) |
|| (fabs(a->y - d->y) < EPSILON |
&& fabs(d->y - b->y) < |
EPSILON)) return GLU_TESS_ERROR4; |
} |
else { |
if ( |
(fabs(b->y - c->y) < EPSILON |
&& fabs(c->y - a->y) < EPSILON) |
|| (fabs(b->y - d->y) < EPSILON |
&& fabs(d->y - a->y) < |
EPSILON)) return GLU_TESS_ERROR4; |
} |
} |
else { |
/* compare the X coordinate */ |
if (xba > 0.0) { |
if ( |
(fabs(a->x - c->x) < EPSILON |
&& fabs(c->x - b->x) < EPSILON) |
|| (fabs(a->x - d->x) < EPSILON |
&& fabs(d->x - b->x) < |
EPSILON)) return GLU_TESS_ERROR4; |
} |
else { |
if ( |
(fabs(b->x - c->x) < EPSILON |
&& fabs(c->x - a->x) < EPSILON) |
|| (fabs(b->x - d->x) < EPSILON |
&& fabs(d->x - a->x) < |
EPSILON)) return GLU_TESS_ERROR4; |
} |
} |
} |
return GLU_NO_ERROR; |
} |
r /= denom; |
s = (yac * xba - xac * yba) / denom; |
/* test if one vertex lies on other edge */ |
if (((fabs(r) < EPSILON || (r < 1.0 + EPSILON && r > 1.0 - EPSILON)) && |
s > -EPSILON && s < 1.0 + EPSILON) || |
((fabs(s) < EPSILON || (s < 1.0 + EPSILON && s > 1.0 - EPSILON)) && |
r > -EPSILON && r < 1.0 + EPSILON)) { |
return GLU_TESS_ERROR4; |
} |
/* test for crossing */ |
if (r > -EPSILON && r < 1.0 + EPSILON && s > -EPSILON && s < 1.0 + EPSILON) { |
return GLU_TESS_ERROR8; |
} |
return GLU_NO_ERROR; |
} |
static GLenum |
verify_edge_vertex_intersections(GLUtriangulatorObj * tobj) |
{ |
tess_polygon *polygon = tobj->current_polygon; |
tess_vertex *vertex1, *last_vertex, *vertex2; |
GLenum test; |
last_vertex = polygon->last_vertex; |
vertex1 = last_vertex; |
for (vertex2 = vertex1->next->next; |
vertex2->next != last_vertex; vertex2 = vertex2->next) { |
test = edge_edge_intersect(vertex1, vertex1->next, vertex2, |
vertex2->next); |
if (test != GLU_NO_ERROR) { |
tess_call_user_error(tobj, test); |
return GLU_ERROR; |
} |
} |
for (vertex1 = polygon->vertices; |
vertex1->next->next != last_vertex; vertex1 = vertex1->next) { |
for (vertex2 = vertex1->next->next; |
vertex2 != last_vertex; vertex2 = vertex2->next) { |
test = edge_edge_intersect(vertex1, vertex1->next, vertex2, |
vertex2->next); |
if (test != GLU_NO_ERROR) { |
tess_call_user_error(tobj, test); |
return GLU_ERROR; |
} |
} |
} |
return GLU_NO_ERROR; |
} |
static int |
#ifdef WIN32 |
__cdecl |
#endif |
area_compare(const void *a, const void *b) |
{ |
GLdouble area1, area2; |
area1 = (*((tess_contour **) a))->area; |
area2 = (*((tess_contour **) b))->area; |
if (area1 < area2) |
return 1; |
if (area1 > area2) |
return -1; |
return 0; |
} |
void |
tess_find_contour_hierarchies(GLUtriangulatorObj * tobj) |
{ |
tess_contour **contours; /* dinamic array of pointers */ |
tess_contour *tmp_contour_ptr = tobj->contours; |
GLuint cnt, i; |
GLenum result; |
GLboolean hierarchy_changed; |
/* any contours? */ |
if (tobj->contour_cnt < 2) { |
tobj->contours->type = GLU_EXTERIOR; |
return; |
} |
if ((contours = (tess_contour **) |
malloc(sizeof(tess_contour *) * (tobj->contour_cnt))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return; |
} |
for (tmp_contour_ptr = tobj->contours, cnt = 0; |
tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) |
contours[cnt++] = tmp_contour_ptr; |
/* now sort the contours in decreasing area size order */ |
qsort((void *) contours, (size_t) cnt, (size_t) sizeof(tess_contour *), |
area_compare); |
/* we leave just the first contour - remove others from list */ |
tobj->contours = contours[0]; |
tobj->contours->next = tobj->contours->previous = NULL; |
tobj->last_contour = tobj->contours; |
tobj->contour_cnt = 1; |
/* first contour is the one with greatest area */ |
/* must be EXTERIOR */ |
tobj->contours->type = GLU_EXTERIOR; |
tmp_contour_ptr = tobj->contours; |
/* now we play! */ |
for (i = 1; i < cnt; i++) { |
hierarchy_changed = GL_FALSE; |
for (tmp_contour_ptr = tobj->contours; |
tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) { |
if (tmp_contour_ptr->type == GLU_EXTERIOR) { |
/* check if contour completely contained in EXTERIOR */ |
result = is_contour_contained_in(tmp_contour_ptr, contours[i]); |
switch (result) { |
case GLU_INTERIOR: |
/* now we have to check if contour is inside interiors */ |
/* or not */ |
/* any interiors? */ |
if (tmp_contour_ptr->next != NULL && |
tmp_contour_ptr->next->type == GLU_INTERIOR) { |
/* for all interior, check if inside any of them */ |
/* if not inside any of interiors, its another */ |
/* interior */ |
/* or it may contain some interiors, then change */ |
/* the contained interiors to exterior ones */ |
add_interior_with_hierarchy_check(tobj, |
tmp_contour_ptr, |
contours[i]); |
} |
else { |
/* not in interior, add as new interior contour */ |
add_new_interior(tobj, tmp_contour_ptr, contours[i]); |
} |
hierarchy_changed = GL_TRUE; |
break; |
case GLU_EXTERIOR: |
/* ooops, the marked as EXTERIOR (contours[i]) is */ |
/* actually an interior of tmp_contour_ptr */ |
/* reverse the local hierarchy */ |
reverse_hierarchy_and_add_exterior(tobj, tmp_contour_ptr, |
contours[i]); |
hierarchy_changed = GL_TRUE; |
break; |
case GLU_NO_ERROR: |
break; |
default: |
abort(); |
} |
} |
if (hierarchy_changed) |
break; /* break from for loop */ |
} |
if (hierarchy_changed == GL_FALSE) { |
/* disjoint with all contours, add to contour list */ |
add_new_exterior(tobj, contours[i]); |
} |
} |
free(contours); |
} |
/* returns GLU_INTERIOR if inner is completey enclosed within outer */ |
/* returns GLU_EXTERIOR if outer is completely enclosed within inner */ |
/* returns GLU_NO_ERROR if contours are disjoint */ |
static GLenum |
is_contour_contained_in(tess_contour * outer, tess_contour * inner) |
{ |
GLenum relation_flag; |
/* set relation_flag to relation of containment of first inner vertex */ |
/* regarding outer contour */ |
if (point_in_polygon(outer, inner->vertices->x, inner->vertices->y)) |
relation_flag = GLU_INTERIOR; |
else |
relation_flag = GLU_EXTERIOR; |
if (relation_flag == GLU_INTERIOR) |
return GLU_INTERIOR; |
if (point_in_polygon(inner, outer->vertices->x, outer->vertices->y)) |
return GLU_EXTERIOR; |
return GLU_NO_ERROR; |
} |
static GLboolean |
point_in_polygon(tess_contour * contour, GLdouble x, GLdouble y) |
{ |
tess_vertex *v1, *v2; |
GLuint i, vertex_cnt; |
GLdouble xp1, yp1, xp2, yp2; |
GLboolean tst; |
tst = GL_FALSE; |
v1 = contour->vertices; |
v2 = contour->vertices->previous; |
for (i = 0, vertex_cnt = contour->vertex_cnt; i < vertex_cnt; i++) { |
xp1 = v1->x; |
yp1 = v1->y; |
xp2 = v2->x; |
yp2 = v2->y; |
if ((((yp1 <= y) && (y < yp2)) || ((yp2 <= y) && (y < yp1))) && |
(x < (xp2 - xp1) * (y - yp1) / (yp2 - yp1) + xp1)) |
tst = (tst == GL_FALSE ? GL_TRUE : GL_FALSE); |
v2 = v1; |
v1 = v1->next; |
} |
return tst; |
} |
static GLenum |
contours_overlap(tess_contour * contour, tess_polygon * polygon) |
{ |
tess_vertex *vertex1, *vertex2; |
GLuint vertex1_cnt, vertex2_cnt, i, j; |
GLenum test; |
vertex1 = contour->vertices; |
vertex2 = polygon->vertices; |
vertex1_cnt = contour->vertex_cnt; |
vertex2_cnt = polygon->vertex_cnt; |
for (i = 0; i < vertex1_cnt; vertex1 = vertex1->next, i++) { |
for (j = 0; j < vertex2_cnt; vertex2 = vertex2->next, j++) |
if ((test = edge_edge_intersect(vertex1, vertex1->next, vertex2, |
vertex2->next)) != GLU_NO_ERROR) |
return test; |
} |
return GLU_NO_ERROR; |
} |
static void |
add_new_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
contour->type = GLU_EXTERIOR; |
contour->next = NULL; |
contour->previous = tobj->last_contour; |
tobj->last_contour->next = contour; |
tobj->last_contour = contour; |
} |
static void |
add_new_interior(GLUtriangulatorObj * tobj, |
tess_contour * outer, tess_contour * contour) |
{ |
contour->type = GLU_INTERIOR; |
contour->next = outer->next; |
contour->previous = outer; |
if (outer->next != NULL) |
outer->next->previous = contour; |
outer->next = contour; |
if (tobj->last_contour == outer) |
tobj->last_contour = contour; |
} |
static void |
add_interior_with_hierarchy_check(GLUtriangulatorObj * tobj, |
tess_contour * outer, |
tess_contour * contour) |
{ |
tess_contour *ptr; |
/* for all interiors of outer check if they are interior of contour */ |
/* if so, change that interior to exterior and move it of of the */ |
/* interior sequence */ |
if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { |
GLenum test; |
for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; |
ptr = ptr->next) { |
test = is_contour_contained_in(ptr, contour); |
switch (test) { |
case GLU_INTERIOR: |
/* contour is contained in one of the interiors */ |
/* check if possibly contained in other exteriors */ |
/* move ptr to first EXTERIOR */ |
for (; ptr != NULL && ptr->type == GLU_INTERIOR; ptr = ptr->next); |
if (ptr == NULL) |
/* another exterior */ |
add_new_exterior(tobj, contour); |
else |
add_exterior_with_check(tobj, ptr, contour); |
return; |
case GLU_EXTERIOR: |
/* one of the interiors is contained in the contour */ |
/* change it to EXTERIOR, and shift it away from the */ |
/* interior sequence */ |
shift_interior_to_exterior(tobj, ptr); |
break; |
case GLU_NO_ERROR: |
/* disjoint */ |
break; |
default: |
abort(); |
} |
} |
} |
/* add contour to the interior sequence */ |
add_new_interior(tobj, outer, contour); |
} |
static void |
reverse_hierarchy_and_add_exterior(GLUtriangulatorObj * tobj, |
tess_contour * outer, |
tess_contour * contour) |
{ |
tess_contour *ptr; |
/* reverse INTERIORS to EXTERIORS */ |
/* any INTERIORS? */ |
if (outer->next != NULL && outer->next->type == GLU_INTERIOR) |
for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR; |
ptr = ptr->next) ptr->type = GLU_EXTERIOR; |
/* the outer now becomes inner */ |
outer->type = GLU_INTERIOR; |
/* contour is the EXTERIOR */ |
contour->next = outer; |
if (tobj->contours == outer) { |
/* first contour beeing reversed */ |
contour->previous = NULL; |
tobj->contours = contour; |
} |
else { |
outer->previous->next = contour; |
contour->previous = outer->previous; |
} |
outer->previous = contour; |
} |
static void |
shift_interior_to_exterior(GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
contour->previous->next = contour->next; |
if (contour->next != NULL) |
contour->next->previous = contour->previous; |
else |
tobj->last_contour = contour->previous; |
} |
static void |
add_exterior_with_check(GLUtriangulatorObj * tobj, |
tess_contour * outer, tess_contour * contour) |
{ |
GLenum test; |
/* this contour might be interior to further exteriors - check */ |
/* if not, just add as a new exterior */ |
for (; outer != NULL && outer->type == GLU_EXTERIOR; outer = outer->next) { |
test = is_contour_contained_in(outer, contour); |
switch (test) { |
case GLU_INTERIOR: |
/* now we have to check if contour is inside interiors */ |
/* or not */ |
/* any interiors? */ |
if (outer->next != NULL && outer->next->type == GLU_INTERIOR) { |
/* for all interior, check if inside any of them */ |
/* if not inside any of interiors, its another */ |
/* interior */ |
/* or it may contain some interiors, then change */ |
/* the contained interiors to exterior ones */ |
add_interior_with_hierarchy_check(tobj, outer, contour); |
} |
else { |
/* not in interior, add as new interior contour */ |
add_new_interior(tobj, outer, contour); |
} |
return; |
case GLU_NO_ERROR: |
/* disjoint */ |
break; |
default: |
abort(); |
} |
} |
/* add contour to the exterior sequence */ |
add_new_exterior(tobj, contour); |
} |
void |
tess_handle_holes(GLUtriangulatorObj * tobj) |
{ |
tess_contour *contour, *hole; |
GLenum exterior_orientation; |
/* verify hole orientation */ |
for (contour = tobj->contours; contour != NULL;) { |
exterior_orientation = contour->orientation; |
for (contour = contour->next; |
contour != NULL && contour->type == GLU_INTERIOR; |
contour = contour->next) { |
if (contour->orientation == exterior_orientation) { |
tess_call_user_error(tobj, GLU_TESS_ERROR5); |
return; |
} |
} |
} |
/* now cut-out holes */ |
for (contour = tobj->contours; contour != NULL;) { |
hole = contour->next; |
while (hole != NULL && hole->type == GLU_INTERIOR) { |
if (cut_out_hole(tobj, contour, hole) == GLU_ERROR) |
return; |
hole = contour->next; |
} |
contour = contour->next; |
} |
} |
static GLenum |
cut_out_hole(GLUtriangulatorObj * tobj, |
tess_contour * contour, tess_contour * hole) |
{ |
tess_contour *tmp_hole; |
tess_vertex *v1, *v2, *tmp_vertex; |
GLuint vertex1_cnt, vertex2_cnt, tmp_vertex_cnt; |
GLuint i, j, k; |
GLenum test = 0; |
/* find an edge connecting contour and hole not intersecting any other */ |
/* edge belonging to either the contour or any of the other holes */ |
for (v1 = contour->vertices, vertex1_cnt = contour->vertex_cnt, i = 0; |
i < vertex1_cnt; i++, v1 = v1->next) { |
for (v2 = hole->vertices, vertex2_cnt = hole->vertex_cnt, j = 0; |
j < vertex2_cnt; j++, v2 = v2->next) { |
/* does edge (v1,v2) intersect any edge of contour */ |
for (tmp_vertex = contour->vertices, tmp_vertex_cnt = |
contour->vertex_cnt, k = 0; k < tmp_vertex_cnt; |
tmp_vertex = tmp_vertex->next, k++) { |
/* skip edge tests for edges directly connected */ |
if (v1 == tmp_vertex || v1 == tmp_vertex->next) |
continue; |
test = edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); |
if (test != GLU_NO_ERROR) |
break; |
} |
if (test == GLU_NO_ERROR) { |
/* does edge (v1,v2) intersect any edge of hole */ |
for (tmp_vertex = hole->vertices, |
tmp_vertex_cnt = hole->vertex_cnt, k = 0; |
k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { |
/* skip edge tests for edges directly connected */ |
if (v2 == tmp_vertex || v2 == tmp_vertex->next) |
continue; |
test = |
edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next); |
if (test != GLU_NO_ERROR) |
break; |
} |
if (test == GLU_NO_ERROR) { |
/* does edge (v1,v2) intersect any other hole? */ |
for (tmp_hole = hole->next; |
tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; |
tmp_hole = tmp_hole->next) { |
/* does edge (v1,v2) intersect any edge of hole */ |
for (tmp_vertex = tmp_hole->vertices, |
tmp_vertex_cnt = tmp_hole->vertex_cnt, k = 0; |
k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) { |
test = edge_edge_intersect(v1, v2, tmp_vertex, |
tmp_vertex->next); |
if (test != GLU_NO_ERROR) |
break; |
} |
if (test != GLU_NO_ERROR) |
break; |
} |
} |
} |
if (test == GLU_NO_ERROR) { |
/* edge (v1,v2) is good for eliminating the hole */ |
if (merge_hole_with_contour(tobj, contour, hole, v1, v2) |
== GLU_NO_ERROR) |
return GLU_NO_ERROR; |
else |
return GLU_ERROR; |
} |
} |
} |
/* other holes are blocking all possible connections of hole */ |
/* with contour, we shift this hole as the last hole and retry */ |
for (tmp_hole = hole; |
tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR; |
tmp_hole = tmp_hole->next); |
contour->next = hole->next; |
hole->next->previous = contour; |
if (tmp_hole == NULL) { |
/* last EXTERIOR contour, shift hole as last contour */ |
hole->next = NULL; |
hole->previous = tobj->last_contour; |
tobj->last_contour->next = hole; |
tobj->last_contour = hole; |
} |
else { |
tmp_hole->previous->next = hole; |
hole->previous = tmp_hole->previous; |
tmp_hole->previous = hole; |
hole->next = tmp_hole; |
} |
hole = contour->next; |
/* try once again - recurse */ |
return cut_out_hole(tobj, contour, hole); |
} |
static GLenum |
merge_hole_with_contour(GLUtriangulatorObj * tobj, |
tess_contour * contour, |
tess_contour * hole, |
tess_vertex * v1, tess_vertex * v2) |
{ |
tess_vertex *v1_new, *v2_new; |
/* make copies of v1 and v2, place them respectively after their originals */ |
if ((v1_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
if ((v2_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) { |
tess_call_user_error(tobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
v1_new->edge_flag = GL_TRUE; |
v1_new->data = v1->data; |
v1_new->location[0] = v1->location[0]; |
v1_new->location[1] = v1->location[1]; |
v1_new->location[2] = v1->location[2]; |
v1_new->x = v1->x; |
v1_new->y = v1->y; |
v1_new->shadow_vertex = v1; |
v1->shadow_vertex = v1_new; |
v1_new->next = v1->next; |
v1_new->previous = v1; |
v1->next->previous = v1_new; |
v1->next = v1_new; |
v2_new->edge_flag = GL_TRUE; |
v2_new->data = v2->data; |
v2_new->location[0] = v2->location[0]; |
v2_new->location[1] = v2->location[1]; |
v2_new->location[2] = v2->location[2]; |
v2_new->x = v2->x; |
v2_new->y = v2->y; |
v2_new->shadow_vertex = v2; |
v2->shadow_vertex = v2_new; |
v2_new->next = v2->next; |
v2_new->previous = v2; |
v2->next->previous = v2_new; |
v2->next = v2_new; |
/* link together the two lists */ |
v1->next = v2_new; |
v2_new->previous = v1; |
v2->next = v1_new; |
v1_new->previous = v2; |
/* update the vertex count of the contour */ |
contour->vertex_cnt += hole->vertex_cnt + 2; |
/* remove the INTERIOR contour */ |
contour->next = hole->next; |
if (hole->next != NULL) |
hole->next->previous = contour; |
free(hole); |
/* update tobj structure */ |
--(tobj->contour_cnt); |
if (contour->last_vertex == v1) |
contour->last_vertex = v1_new; |
/* mark two vertices with edge_flag */ |
v2->edge_flag = GL_FALSE; |
v1->edge_flag = GL_FALSE; |
return GLU_NO_ERROR; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/mipmap.c |
---|
0,0 → 1,825 |
/* $Id: mipmap.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.4 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <assert.h> |
#include <math.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include "gluP.h" |
#endif |
/* |
* Compute ceiling of integer quotient of A divided by B: |
*/ |
#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) |
#ifdef EPSILON |
#undef EPSILON |
#endif |
#define EPSILON 0.001 |
/* To work around optimizer bug in MSVC4.1 */ |
#if defined(__WIN32__) && !defined(OPENSTEP) |
void |
dummy(GLuint j, GLuint k) |
{ |
} |
#else |
#define dummy(J, K) |
#endif |
GLint GLAPIENTRY |
gluScaleImage(GLenum format, |
GLsizei widthin, GLsizei heightin, |
GLenum typein, const void *datain, |
GLsizei widthout, GLsizei heightout, |
GLenum typeout, void *dataout) |
{ |
GLint components, i, j, k; |
GLfloat *tempin, *tempout; |
GLfloat sx, sy; |
GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; |
GLint packrowlength, packalignment, packskiprows, packskippixels; |
GLint sizein, sizeout; |
GLint rowstride, rowlen; |
/* Determine number of components per pixel */ |
switch (format) { |
case GL_COLOR_INDEX: |
case GL_STENCIL_INDEX: |
case GL_DEPTH_COMPONENT: |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_LUMINANCE: |
components = 1; |
break; |
case GL_LUMINANCE_ALPHA: |
components = 2; |
break; |
case GL_RGB: |
case GL_BGR: |
components = 3; |
break; |
case GL_RGBA: |
case GL_BGRA: |
#ifdef GL_EXT_abgr |
case GL_ABGR_EXT: |
#endif |
components = 4; |
break; |
default: |
return GLU_INVALID_ENUM; |
} |
/* Determine bytes per input datum */ |
switch (typein) { |
case GL_UNSIGNED_BYTE: |
sizein = sizeof(GLubyte); |
break; |
case GL_BYTE: |
sizein = sizeof(GLbyte); |
break; |
case GL_UNSIGNED_SHORT: |
sizein = sizeof(GLushort); |
break; |
case GL_SHORT: |
sizein = sizeof(GLshort); |
break; |
case GL_UNSIGNED_INT: |
sizein = sizeof(GLuint); |
break; |
case GL_INT: |
sizein = sizeof(GLint); |
break; |
case GL_FLOAT: |
sizein = sizeof(GLfloat); |
break; |
case GL_BITMAP: |
/* not implemented yet */ |
default: |
return GL_INVALID_ENUM; |
} |
/* Determine bytes per output datum */ |
switch (typeout) { |
case GL_UNSIGNED_BYTE: |
sizeout = sizeof(GLubyte); |
break; |
case GL_BYTE: |
sizeout = sizeof(GLbyte); |
break; |
case GL_UNSIGNED_SHORT: |
sizeout = sizeof(GLushort); |
break; |
case GL_SHORT: |
sizeout = sizeof(GLshort); |
break; |
case GL_UNSIGNED_INT: |
sizeout = sizeof(GLuint); |
break; |
case GL_INT: |
sizeout = sizeof(GLint); |
break; |
case GL_FLOAT: |
sizeout = sizeof(GLfloat); |
break; |
case GL_BITMAP: |
/* not implemented yet */ |
default: |
return GL_INVALID_ENUM; |
} |
/* Get glPixelStore state */ |
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength); |
glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment); |
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows); |
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels); |
glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength); |
glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment); |
glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows); |
glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels); |
/* Allocate storage for intermediate images */ |
tempin = (GLfloat *) malloc(widthin * heightin |
* components * sizeof(GLfloat)); |
if (!tempin) { |
return GLU_OUT_OF_MEMORY; |
} |
tempout = (GLfloat *) malloc(widthout * heightout |
* components * sizeof(GLfloat)); |
if (!tempout) { |
free(tempin); |
return GLU_OUT_OF_MEMORY; |
} |
/* |
* Unpack the pixel data and convert to floating point |
*/ |
if (unpackrowlength > 0) { |
rowlen = unpackrowlength; |
} |
else { |
rowlen = widthin; |
} |
if (sizein >= unpackalignment) { |
rowstride = components * rowlen; |
} |
else { |
rowstride = unpackalignment / sizein |
* CEILING(components * rowlen * sizein, unpackalignment); |
} |
switch (typein) { |
case GL_UNSIGNED_BYTE: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLubyte *ubptr = (GLubyte *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * ubptr++; |
} |
} |
break; |
case GL_BYTE: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLbyte *bptr = (GLbyte *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * bptr++; |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLushort *usptr = (GLushort *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * usptr++; |
} |
} |
break; |
case GL_SHORT: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLshort *sptr = (GLshort *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * sptr++; |
} |
} |
break; |
case GL_UNSIGNED_INT: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLuint *uiptr = (GLuint *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * uiptr++; |
} |
} |
break; |
case GL_INT: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLint *iptr = (GLint *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = (GLfloat) * iptr++; |
} |
} |
break; |
case GL_FLOAT: |
k = 0; |
for (i = 0; i < heightin; i++) { |
GLfloat *fptr = (GLfloat *) datain |
+ i * rowstride |
+ unpackskiprows * rowstride + unpackskippixels * components; |
for (j = 0; j < widthin * components; j++) { |
dummy(j, k); |
tempin[k++] = *fptr++; |
} |
} |
break; |
default: |
return GLU_INVALID_ENUM; |
} |
/* |
* Scale the image! |
*/ |
if (widthout > 1) |
sx = (GLfloat) (widthin - 1) / (GLfloat) (widthout - 1); |
else |
sx = (GLfloat) (widthin - 1); |
if (heightout > 1) |
sy = (GLfloat) (heightin - 1) / (GLfloat) (heightout - 1); |
else |
sy = (GLfloat) (heightin - 1); |
/*#define POINT_SAMPLE*/ |
#ifdef POINT_SAMPLE |
for (i = 0; i < heightout; i++) { |
GLint ii = i * sy; |
for (j = 0; j < widthout; j++) { |
GLint jj = j * sx; |
GLfloat *src = tempin + (ii * widthin + jj) * components; |
GLfloat *dst = tempout + (i * widthout + j) * components; |
for (k = 0; k < components; k++) { |
*dst++ = *src++; |
} |
} |
} |
#else |
if (sx < 1.0 && sy < 1.0) { |
/* magnify both width and height: use weighted sample of 4 pixels */ |
GLint i0, i1, j0, j1; |
GLfloat alpha, beta; |
GLfloat *src00, *src01, *src10, *src11; |
GLfloat s1, s2; |
GLfloat *dst; |
for (i = 0; i < heightout; i++) { |
i0 = i * sy; |
i1 = i0 + 1; |
if (i1 >= heightin) |
i1 = heightin - 1; |
/* i1 = (i+1) * sy - EPSILON;*/ |
alpha = i * sy - i0; |
for (j = 0; j < widthout; j++) { |
j0 = j * sx; |
j1 = j0 + 1; |
if (j1 >= widthin) |
j1 = widthin - 1; |
/* j1 = (j+1) * sx - EPSILON; */ |
beta = j * sx - j0; |
/* compute weighted average of pixels in rect (i0,j0)-(i1,j1) */ |
src00 = tempin + (i0 * widthin + j0) * components; |
src01 = tempin + (i0 * widthin + j1) * components; |
src10 = tempin + (i1 * widthin + j0) * components; |
src11 = tempin + (i1 * widthin + j1) * components; |
dst = tempout + (i * widthout + j) * components; |
for (k = 0; k < components; k++) { |
s1 = *src00++ * (1.0 - beta) + *src01++ * beta; |
s2 = *src10++ * (1.0 - beta) + *src11++ * beta; |
*dst++ = s1 * (1.0 - alpha) + s2 * alpha; |
} |
} |
} |
} |
else { |
/* shrink width and/or height: use an unweighted box filter */ |
GLint i0, i1; |
GLint j0, j1; |
GLint ii, jj; |
GLfloat sum, *dst; |
for (i = 0; i < heightout; i++) { |
i0 = i * sy; |
i1 = i0 + 1; |
if (i1 >= heightin) |
i1 = heightin - 1; |
/* i1 = (i+1) * sy - EPSILON; */ |
for (j = 0; j < widthout; j++) { |
j0 = j * sx; |
j1 = j0 + 1; |
if (j1 >= widthin) |
j1 = widthin - 1; |
/* j1 = (j+1) * sx - EPSILON; */ |
dst = tempout + (i * widthout + j) * components; |
/* compute average of pixels in the rectangle (i0,j0)-(i1,j1) */ |
for (k = 0; k < components; k++) { |
sum = 0.0; |
for (ii = i0; ii <= i1; ii++) { |
for (jj = j0; jj <= j1; jj++) { |
sum += *(tempin + (ii * widthin + jj) * components + k); |
} |
} |
sum /= (j1 - j0 + 1) * (i1 - i0 + 1); |
*dst++ = sum; |
} |
} |
} |
} |
#endif |
/* |
* Return output image |
*/ |
if (packrowlength > 0) { |
rowlen = packrowlength; |
} |
else { |
rowlen = widthout; |
} |
if (sizeout >= packalignment) { |
rowstride = components * rowlen; |
} |
else { |
rowstride = packalignment / sizeout |
* CEILING(components * rowlen * sizeout, packalignment); |
} |
switch (typeout) { |
case GL_UNSIGNED_BYTE: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLubyte *ubptr = (GLubyte *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*ubptr++ = (GLubyte) tempout[k++]; |
} |
} |
break; |
case GL_BYTE: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLbyte *bptr = (GLbyte *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*bptr++ = (GLbyte) tempout[k++]; |
} |
} |
break; |
case GL_UNSIGNED_SHORT: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLushort *usptr = (GLushort *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*usptr++ = (GLushort) tempout[k++]; |
} |
} |
break; |
case GL_SHORT: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLshort *sptr = (GLshort *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*sptr++ = (GLshort) tempout[k++]; |
} |
} |
break; |
case GL_UNSIGNED_INT: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLuint *uiptr = (GLuint *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*uiptr++ = (GLuint) tempout[k++]; |
} |
} |
break; |
case GL_INT: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLint *iptr = (GLint *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*iptr++ = (GLint) tempout[k++]; |
} |
} |
break; |
case GL_FLOAT: |
k = 0; |
for (i = 0; i < heightout; i++) { |
GLfloat *fptr = (GLfloat *) dataout |
+ i * rowstride |
+ packskiprows * rowstride + packskippixels * components; |
for (j = 0; j < widthout * components; j++) { |
dummy(j, k + i); |
*fptr++ = tempout[k++]; |
} |
} |
break; |
default: |
return GLU_INVALID_ENUM; |
} |
/* free temporary image storage */ |
free(tempin); |
free(tempout); |
return 0; |
} |
/* |
* Return the largest k such that 2^k <= n. |
*/ |
static GLint |
ilog2(GLint n) |
{ |
GLint k; |
if (n <= 0) |
return 0; |
for (k = 0; n >>= 1; k++); |
return k; |
} |
/* |
* Find the value nearest to n which is also a power of two. |
*/ |
static GLint |
round2(GLint n) |
{ |
GLint m; |
for (m = 1; m < n; m *= 2); |
/* m>=n */ |
if (m - n <= n - m / 2) { |
return m; |
} |
else { |
return m / 2; |
} |
} |
/* |
* Given an pixel format and datatype, return the number of bytes to |
* store one pixel. |
*/ |
static GLint |
bytes_per_pixel(GLenum format, GLenum type) |
{ |
GLint n, m; |
switch (format) { |
case GL_COLOR_INDEX: |
case GL_STENCIL_INDEX: |
case GL_DEPTH_COMPONENT: |
case GL_RED: |
case GL_GREEN: |
case GL_BLUE: |
case GL_ALPHA: |
case GL_LUMINANCE: |
n = 1; |
break; |
case GL_LUMINANCE_ALPHA: |
n = 2; |
break; |
case GL_RGB: |
case GL_BGR: |
n = 3; |
break; |
case GL_RGBA: |
case GL_BGRA: |
#ifdef GL_EXT_abgr |
case GL_ABGR_EXT: |
#endif |
n = 4; |
break; |
default: |
n = 0; |
} |
switch (type) { |
case GL_UNSIGNED_BYTE: |
m = sizeof(GLubyte); |
break; |
case GL_BYTE: |
m = sizeof(GLbyte); |
break; |
case GL_BITMAP: |
m = 1; |
break; |
case GL_UNSIGNED_SHORT: |
m = sizeof(GLushort); |
break; |
case GL_SHORT: |
m = sizeof(GLshort); |
break; |
case GL_UNSIGNED_INT: |
m = sizeof(GLuint); |
break; |
case GL_INT: |
m = sizeof(GLint); |
break; |
case GL_FLOAT: |
m = sizeof(GLfloat); |
break; |
default: |
m = 0; |
} |
return n * m; |
} |
/* |
* WARNING: This function isn't finished and has never been tested!!!! |
*/ |
GLint GLAPIENTRY |
gluBuild1DMipmaps(GLenum target, GLint components, |
GLsizei width, GLenum format, GLenum type, const void *data) |
{ |
GLubyte *texture; |
GLint levels, max_levels; |
GLint new_width, max_width; |
GLint i, j, k, l; |
if (width < 1) |
return GLU_INVALID_VALUE; |
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_width); |
max_levels = ilog2(max_width) + 1; |
/* Compute how many mipmap images to make */ |
levels = ilog2(width) + 1; |
if (levels > max_levels) { |
levels = max_levels; |
} |
new_width = 1 << (levels - 1); |
texture = (GLubyte *) malloc(new_width * components); |
if (!texture) { |
return GLU_OUT_OF_MEMORY; |
} |
if (width != new_width) { |
/* initial rescaling */ |
switch (type) { |
case GL_UNSIGNED_BYTE: |
{ |
GLubyte *ub_data = (GLubyte *) data; |
for (i = 0; i < new_width; i++) { |
j = i * width / new_width; |
for (k = 0; k < components; k++) { |
texture[i * components + k] = ub_data[j * components + k]; |
} |
} |
} |
break; |
default: |
/* Not implemented */ |
return GLU_ERROR; |
} |
} |
/* generate and load mipmap images */ |
for (l = 0; l < levels; l++) { |
glTexImage1D(GL_TEXTURE_1D, l, components, new_width, 0, |
format, GL_UNSIGNED_BYTE, texture); |
/* Scale image down to 1/2 size */ |
new_width = new_width / 2; |
for (i = 0; i < new_width; i++) { |
for (k = 0; k < components; k++) { |
GLint sample1, sample2; |
sample1 = (GLint) texture[i * 2 * components + k]; |
sample2 = (GLint) texture[(i * 2 + 1) * components + k]; |
texture[i * components + k] = (GLubyte) ((sample1 + sample2) / 2); |
} |
} |
} |
free(texture); |
return 0; |
} |
GLint GLAPIENTRY |
gluBuild2DMipmaps(GLenum target, GLint components, |
GLsizei width, GLsizei height, GLenum format, |
GLenum type, const void *data) |
{ |
GLint w, h, maxsize; |
void *image, *newimage; |
GLint neww, newh, level, bpp; |
int error; |
GLboolean done; |
GLint retval = 0; |
GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels; |
GLint packrowlength, packalignment, packskiprows, packskippixels; |
if (width < 1 || height < 1) |
return GLU_INVALID_VALUE; |
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize); |
w = round2(width); |
if (w > maxsize) { |
w = maxsize; |
} |
h = round2(height); |
if (h > maxsize) { |
h = maxsize; |
} |
bpp = bytes_per_pixel(format, type); |
if (bpp == 0) { |
/* probably a bad format or type enum */ |
return GLU_INVALID_ENUM; |
} |
/* Get current glPixelStore values */ |
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength); |
glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment); |
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows); |
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels); |
glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength); |
glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment); |
glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows); |
glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels); |
/* set pixel packing */ |
glPixelStorei(GL_PACK_ROW_LENGTH, 0); |
glPixelStorei(GL_PACK_ALIGNMENT, 1); |
glPixelStorei(GL_PACK_SKIP_ROWS, 0); |
glPixelStorei(GL_PACK_SKIP_PIXELS, 0); |
done = GL_FALSE; |
if (w != width || h != height) { |
/* must rescale image to get "top" mipmap texture image */ |
image = malloc((w + 4) * h * bpp); |
if (!image) { |
return GLU_OUT_OF_MEMORY; |
} |
error = gluScaleImage(format, width, height, type, data, |
w, h, type, image); |
if (error) { |
retval = error; |
done = GL_TRUE; |
} |
} |
else { |
image = (void *) data; |
} |
level = 0; |
while (!done) { |
if (image != data) { |
/* set pixel unpacking */ |
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); |
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); |
} |
glTexImage2D(target, level, components, w, h, 0, format, type, image); |
if (w == 1 && h == 1) |
break; |
neww = (w < 2) ? 1 : w / 2; |
newh = (h < 2) ? 1 : h / 2; |
newimage = malloc((neww + 4) * newh * bpp); |
if (!newimage) { |
return GLU_OUT_OF_MEMORY; |
} |
error = gluScaleImage(format, w, h, type, image, |
neww, newh, type, newimage); |
if (error) { |
retval = error; |
done = GL_TRUE; |
} |
if (image != data) { |
free(image); |
} |
image = newimage; |
w = neww; |
h = newh; |
level++; |
} |
if (image != data) { |
free(image); |
} |
/* Restore original glPixelStore state */ |
glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackrowlength); |
glPixelStorei(GL_UNPACK_ALIGNMENT, unpackalignment); |
glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackskiprows); |
glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackskippixels); |
glPixelStorei(GL_PACK_ROW_LENGTH, packrowlength); |
glPixelStorei(GL_PACK_ALIGNMENT, packalignment); |
glPixelStorei(GL_PACK_SKIP_ROWS, packskiprows); |
glPixelStorei(GL_PACK_SKIP_PIXELS, packskippixels); |
return retval; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/tess.h |
---|
0,0 → 1,108 |
/* $Id: tess.h,v 1.1 2003-02-28 11:42:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file is part of the polygon tesselation code contributed by |
* Bogdan Sikorski |
*/ |
#ifndef TESS_H |
#define TESS_H |
#include "gluP.h" |
#define EPSILON 1e-06 /* epsilon for double precision compares */ |
typedef enum |
{ |
OXY, |
OYZ, |
OXZ |
} |
projection_type; |
typedef struct callbacks_str |
{ |
void (GLCALLBACK * begin) (GLenum mode); |
void (GLCALLBACK * edgeFlag) (GLboolean flag); |
void (GLCALLBACK * vertex) (GLvoid * v); |
void (GLCALLBACK * end) (void); |
void (GLCALLBACK * error) (GLenum err); |
} |
tess_callbacks; |
typedef struct vertex_str |
{ |
void *data; |
GLdouble location[3]; |
GLdouble x, y; |
GLboolean edge_flag; |
struct vertex_str *shadow_vertex; |
struct vertex_str *next, *previous; |
} |
tess_vertex; |
typedef struct contour_str |
{ |
GLenum type; |
GLuint vertex_cnt; |
GLdouble area; |
GLenum orientation; |
struct vertex_str *vertices, *last_vertex; |
struct contour_str *next, *previous; |
} |
tess_contour; |
typedef struct polygon_str |
{ |
GLuint vertex_cnt; |
GLdouble A, B, C, D; |
GLdouble area; |
GLenum orientation; |
struct vertex_str *vertices, *last_vertex; |
} |
tess_polygon; |
struct GLUtesselator |
{ |
tess_contour *contours, *last_contour; |
GLuint contour_cnt; |
tess_callbacks callbacks; |
tess_polygon *current_polygon; |
GLenum error; |
GLdouble A, B, C, D; |
projection_type projection; |
}; |
extern void tess_call_user_error(GLUtriangulatorObj *, GLenum); |
extern void tess_test_polygon(GLUtriangulatorObj *); |
extern void tess_find_contour_hierarchies(GLUtriangulatorObj *); |
extern void tess_handle_holes(GLUtriangulatorObj *); |
extern void tess_tesselate(GLUtriangulatorObj *); |
extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *); |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glu/nurbscrv.c |
---|
0,0 → 1,445 |
/* $Id: nurbscrv.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) |
* See README2 for more info. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdlib.h> |
#include "gluP.h" |
#include "nurbs.h" |
#endif |
static int |
get_curve_dim(GLenum type) |
{ |
switch (type) { |
case GL_MAP1_VERTEX_3: |
return 3; |
case GL_MAP1_VERTEX_4: |
return 4; |
case GL_MAP1_INDEX: |
return 1; |
case GL_MAP1_COLOR_4: |
return 4; |
case GL_MAP1_NORMAL: |
return 3; |
case GL_MAP1_TEXTURE_COORD_1: |
return 1; |
case GL_MAP1_TEXTURE_COORD_2: |
return 2; |
case GL_MAP1_TEXTURE_COORD_3: |
return 3; |
case GL_MAP1_TEXTURE_COORD_4: |
return 4; |
default: |
abort(); /* TODO: is this OK? */ |
} |
return 0; /*never get here */ |
} |
static GLenum |
test_nurbs_curve(GLUnurbsObj * nobj, curve_attribs * attribs) |
{ |
GLenum err; |
GLint tmp_int; |
if (attribs->order < 0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return GLU_ERROR; |
} |
glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int); |
if (attribs->order > tmp_int || attribs->order < 2) { |
call_user_error(nobj, GLU_NURBS_ERROR1); |
return GLU_ERROR; |
} |
if (attribs->knot_count < attribs->order + 2) { |
call_user_error(nobj, GLU_NURBS_ERROR2); |
return GLU_ERROR; |
} |
if (attribs->stride < 0) { |
call_user_error(nobj, GLU_NURBS_ERROR34); |
return GLU_ERROR; |
} |
if (attribs->knot == NULL || attribs->ctrlarray == NULL) { |
call_user_error(nobj, GLU_NURBS_ERROR36); |
return GLU_ERROR; |
} |
if ((err = test_knot(attribs->knot_count, attribs->knot, attribs->order)) |
!= GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
return GLU_NO_ERROR; |
} |
static GLenum |
test_nurbs_curves(GLUnurbsObj * nobj) |
{ |
/* test the geometric data */ |
if (test_nurbs_curve(nobj, &(nobj->curve.geom)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* now test the attributive data */ |
/* color */ |
if (nobj->curve.color.type != GLU_INVALID_ENUM) |
if (test_nurbs_curve(nobj, &(nobj->curve.color)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* normal */ |
if (nobj->curve.normal.type != GLU_INVALID_ENUM) |
if (test_nurbs_curve(nobj, &(nobj->curve.normal)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* texture */ |
if (nobj->curve.texture.type != GLU_INVALID_ENUM) |
if (test_nurbs_curve(nobj, &(nobj->curve.texture)) != GLU_NO_ERROR) |
return GLU_ERROR; |
return GLU_NO_ERROR; |
} |
/* prepare the knot information structures */ |
static GLenum |
fill_knot_structures(GLUnurbsObj * nobj, knot_str_type * geom_knot, |
knot_str_type * color_knot, knot_str_type * normal_knot, |
knot_str_type * texture_knot) |
{ |
GLint order; |
GLfloat *knot; |
GLint nknots; |
GLint t_min, t_max; |
geom_knot->unified_knot = NULL; |
knot = geom_knot->knot = nobj->curve.geom.knot; |
nknots = geom_knot->nknots = nobj->curve.geom.knot_count; |
order = geom_knot->order = nobj->curve.geom.order; |
geom_knot->delta_nknots = 0; |
t_min = geom_knot->t_min = order - 1; |
t_max = geom_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
geom_knot->open_at_begin = GL_TRUE; |
} |
else |
geom_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
geom_knot->open_at_end = GL_TRUE; |
} |
else |
geom_knot->open_at_end = GL_FALSE; |
if (nobj->curve.color.type != GLU_INVALID_ENUM) { |
color_knot->unified_knot = (GLfloat *) 1; |
knot = color_knot->knot = nobj->curve.color.knot; |
nknots = color_knot->nknots = nobj->curve.color.knot_count; |
order = color_knot->order = nobj->curve.color.order; |
color_knot->delta_nknots = 0; |
t_min = color_knot->t_min = order - 1; |
t_max = color_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
color_knot->open_at_begin = GL_TRUE; |
} |
else |
color_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
color_knot->open_at_end = GL_TRUE; |
} |
else |
color_knot->open_at_end = GL_FALSE; |
} |
else |
color_knot->unified_knot = NULL; |
if (nobj->curve.normal.type != GLU_INVALID_ENUM) { |
normal_knot->unified_knot = (GLfloat *) 1; |
knot = normal_knot->knot = nobj->curve.normal.knot; |
nknots = normal_knot->nknots = nobj->curve.normal.knot_count; |
order = normal_knot->order = nobj->curve.normal.order; |
normal_knot->delta_nknots = 0; |
t_min = normal_knot->t_min = order - 1; |
t_max = normal_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
normal_knot->open_at_begin = GL_TRUE; |
} |
else |
normal_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
normal_knot->open_at_end = GL_TRUE; |
} |
else |
normal_knot->open_at_end = GL_FALSE; |
} |
else |
normal_knot->unified_knot = NULL; |
if (nobj->curve.texture.type != GLU_INVALID_ENUM) { |
texture_knot->unified_knot = (GLfloat *) 1; |
knot = texture_knot->knot = nobj->curve.texture.knot; |
nknots = texture_knot->nknots = nobj->curve.texture.knot_count; |
order = texture_knot->order = nobj->curve.texture.order; |
texture_knot->delta_nknots = 0; |
t_min = texture_knot->t_min = order - 1; |
t_max = texture_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
texture_knot->open_at_begin = GL_TRUE; |
} |
else |
texture_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
texture_knot->open_at_end = GL_TRUE; |
} |
else |
texture_knot->open_at_end = GL_FALSE; |
} |
else |
texture_knot->unified_knot = NULL; |
return GLU_NO_ERROR; |
} |
/* covert the NURBS curve into a series of adjacent Bezier curves */ |
static GLenum |
convert_curve(knot_str_type * the_knot, curve_attribs * attrib, |
GLfloat ** new_ctrl, GLint * ncontrol) |
{ |
GLenum err; |
if ((err = explode_knot(the_knot)) != GLU_NO_ERROR) { |
if (the_knot->unified_knot) { |
free(the_knot->unified_knot); |
the_knot->unified_knot = NULL; |
} |
return err; |
} |
if (the_knot->unified_knot) { |
free(the_knot->unified_knot); |
the_knot->unified_knot = NULL; |
} |
if ((err = calc_alphas(the_knot)) != GLU_NO_ERROR) { |
free(the_knot->new_knot); |
return err; |
} |
free(the_knot->new_knot); |
if ((err = calc_new_ctrl_pts(attrib->ctrlarray, attrib->stride, the_knot, |
attrib->dim, new_ctrl, ncontrol)) |
!= GLU_NO_ERROR) { |
free(the_knot->alpha); |
return err; |
} |
free(the_knot->alpha); |
return GLU_NO_ERROR; |
} |
/* covert curves - geometry and possible attribute ones into equivalent */ |
/* sequence of adjacent Bezier curves */ |
static GLenum |
convert_curves(GLUnurbsObj * nobj, GLfloat ** new_geom_ctrl, |
GLint * ncontrol, GLfloat ** new_color_ctrl, |
GLfloat ** new_normal_ctrl, GLfloat ** new_texture_ctrl) |
{ |
knot_str_type geom_knot, color_knot, normal_knot, texture_knot; |
GLint junk; |
GLenum err; |
*new_color_ctrl = *new_normal_ctrl = *new_texture_ctrl = NULL; |
if (fill_knot_structures(nobj, &geom_knot, &color_knot, &normal_knot, |
&texture_knot) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* unify knots - all knots should have the same number of working */ |
/* ranges */ |
if ( |
(err = |
select_knot_working_range(nobj, &geom_knot, &color_knot, &normal_knot, |
&texture_knot)) != GLU_NO_ERROR) { |
return err; |
} |
/* convert the geometry curve */ |
nobj->curve.geom.dim = get_curve_dim(nobj->curve.geom.type); |
if ((err = convert_curve(&geom_knot, &(nobj->curve.geom), new_geom_ctrl, |
ncontrol)) != GLU_NO_ERROR) { |
free_unified_knots(&geom_knot, &color_knot, &normal_knot, |
&texture_knot); |
call_user_error(nobj, err); |
return err; |
} |
/* if additional attributive curves are given convert them as well */ |
if (color_knot.unified_knot) { |
nobj->curve.color.dim = get_curve_dim(nobj->curve.color.type); |
if ((err = convert_curve(&color_knot, &(nobj->curve.color), |
new_color_ctrl, &junk)) != GLU_NO_ERROR) { |
free_unified_knots(&geom_knot, &color_knot, &normal_knot, |
&texture_knot); |
free(*new_geom_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
if (normal_knot.unified_knot) { |
nobj->curve.normal.dim = get_curve_dim(nobj->curve.normal.type); |
if ((err = convert_curve(&normal_knot, &(nobj->curve.normal), |
new_normal_ctrl, &junk)) != GLU_NO_ERROR) { |
free_unified_knots(&geom_knot, &color_knot, &normal_knot, |
&texture_knot); |
free(*new_geom_ctrl); |
if (*new_color_ctrl) |
free(*new_color_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
if (texture_knot.unified_knot) { |
nobj->curve.texture.dim = get_curve_dim(nobj->curve.texture.type); |
if ((err = convert_curve(&texture_knot, &(nobj->curve.texture), |
new_texture_ctrl, &junk)) != GLU_NO_ERROR) { |
free_unified_knots(&geom_knot, &color_knot, &normal_knot, |
&texture_knot); |
free(*new_geom_ctrl); |
if (*new_color_ctrl) |
free(*new_color_ctrl); |
if (*new_normal_ctrl) |
free(*new_normal_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
return GLU_NO_ERROR; |
} |
/* main NURBS curve procedure */ |
void |
do_nurbs_curve(GLUnurbsObj * nobj) |
{ |
GLint geom_order, color_order = 0, normal_order = 0, texture_order = 0; |
GLenum geom_type; |
GLint n_ctrl; |
GLfloat *new_geom_ctrl, *new_color_ctrl, *new_normal_ctrl, |
*new_texture_ctrl; |
GLfloat *geom_ctrl = 0, *color_ctrl = 0, *normal_ctrl = 0, *texture_ctrl = 0; |
GLint *factors; |
GLint i, j; |
GLint geom_dim, color_dim = 0, normal_dim = 0, texture_dim = 0; |
/* test the user supplied data */ |
if (test_nurbs_curves(nobj) != GLU_NO_ERROR) |
return; |
if (convert_curves(nobj, &new_geom_ctrl, &n_ctrl, &new_color_ctrl, |
&new_normal_ctrl, &new_texture_ctrl) != GLU_NO_ERROR) |
return; |
geom_order = nobj->curve.geom.order; |
geom_type = nobj->curve.geom.type; |
geom_dim = nobj->curve.geom.dim; |
if (glu_do_sampling_crv(nobj, new_geom_ctrl, n_ctrl, geom_order, geom_dim, |
&factors) != GLU_NO_ERROR) { |
free(new_geom_ctrl); |
if (new_color_ctrl) |
free(new_color_ctrl); |
if (new_normal_ctrl) |
free(new_normal_ctrl); |
if (new_texture_ctrl) |
free(new_texture_ctrl); |
return; |
} |
glEnable(geom_type); |
if (new_color_ctrl) { |
glEnable(nobj->curve.color.type); |
color_dim = nobj->curve.color.dim; |
color_ctrl = new_color_ctrl; |
color_order = nobj->curve.color.order; |
} |
if (new_normal_ctrl) { |
glEnable(nobj->curve.normal.type); |
normal_dim = nobj->curve.normal.dim; |
normal_ctrl = new_normal_ctrl; |
normal_order = nobj->curve.normal.order; |
} |
if (new_texture_ctrl) { |
glEnable(nobj->curve.texture.type); |
texture_dim = nobj->curve.texture.dim; |
texture_ctrl = new_texture_ctrl; |
texture_order = nobj->curve.texture.order; |
} |
for (i = 0, j = 0, geom_ctrl = new_geom_ctrl; |
i < n_ctrl; i += geom_order, j++, geom_ctrl += geom_order * geom_dim) { |
if (fine_culling_test_2D |
(nobj, geom_ctrl, geom_order, geom_dim, geom_dim)) { |
color_ctrl += color_order * color_dim; |
normal_ctrl += normal_order * normal_dim; |
texture_ctrl += texture_order * texture_dim; |
continue; |
} |
glMap1f(geom_type, 0.0, 1.0, geom_dim, geom_order, geom_ctrl); |
if (new_color_ctrl) { |
glMap1f(nobj->curve.color.type, 0.0, 1.0, color_dim, |
color_order, color_ctrl); |
color_ctrl += color_order * color_dim; |
} |
if (new_normal_ctrl) { |
glMap1f(nobj->curve.normal.type, 0.0, 1.0, normal_dim, |
normal_order, normal_ctrl); |
normal_ctrl += normal_order * normal_dim; |
} |
if (new_texture_ctrl) { |
glMap1f(nobj->curve.texture.type, 0.0, 1.0, texture_dim, |
texture_order, texture_ctrl); |
texture_ctrl += texture_order * texture_dim; |
} |
glMapGrid1f(factors[j], 0.0, 1.0); |
glEvalMesh1(GL_LINE, 0, factors[j]); |
} |
free(new_geom_ctrl); |
free(factors); |
if (new_color_ctrl) |
free(new_color_ctrl); |
if (new_normal_ctrl) |
free(new_normal_ctrl); |
if (new_texture_ctrl) |
free(new_texture_ctrl); |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/nurbssrf.c |
---|
0,0 → 1,1318 |
/* $Id: nurbssrf.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) |
* See README2 for more info. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdlib.h> |
#include <string.h> |
#include "gluP.h" |
#include "nurbs.h" |
#endif |
static int |
get_surface_dim(GLenum type) |
{ |
switch (type) { |
case GL_MAP2_VERTEX_3: |
return 3; |
case GL_MAP2_VERTEX_4: |
return 4; |
case GL_MAP2_INDEX: |
return 1; |
case GL_MAP2_COLOR_4: |
return 4; |
case GL_MAP2_NORMAL: |
return 3; |
case GL_MAP2_TEXTURE_COORD_1: |
return 1; |
case GL_MAP2_TEXTURE_COORD_2: |
return 2; |
case GL_MAP2_TEXTURE_COORD_3: |
return 3; |
case GL_MAP2_TEXTURE_COORD_4: |
return 4; |
default: |
abort(); /* TODO: is this OK? */ |
} |
return 0; /*never get here */ |
} |
static GLenum |
test_nurbs_surface(GLUnurbsObj * nobj, surface_attribs * attrib) |
{ |
GLenum err; |
GLint tmp_int; |
if (attrib->sorder < 0 || attrib->torder < 0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return GLU_ERROR; |
} |
glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int); |
if (attrib->sorder > tmp_int || attrib->sorder < 2) { |
call_user_error(nobj, GLU_NURBS_ERROR1); |
return GLU_ERROR; |
} |
if (attrib->torder > tmp_int || attrib->torder < 2) { |
call_user_error(nobj, GLU_NURBS_ERROR1); |
return GLU_ERROR; |
} |
if (attrib->sknot_count < attrib->sorder + 2) { |
call_user_error(nobj, GLU_NURBS_ERROR2); |
return GLU_ERROR; |
} |
if (attrib->tknot_count < attrib->torder + 2) { |
call_user_error(nobj, GLU_NURBS_ERROR2); |
return GLU_ERROR; |
} |
if (attrib->s_stride < 0 || attrib->t_stride < 0) { |
call_user_error(nobj, GLU_NURBS_ERROR34); |
return GLU_ERROR; |
} |
if (attrib->sknot == NULL || attrib->tknot == NULL |
|| attrib->ctrlarray == NULL) { |
call_user_error(nobj, GLU_NURBS_ERROR36); |
return GLU_ERROR; |
} |
if ((err = test_knot(attrib->tknot_count, attrib->tknot, attrib->torder)) |
!= GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
if ((err = test_knot(attrib->sknot_count, attrib->sknot, attrib->sorder)) |
!= GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return GLU_ERROR; |
} |
return GLU_NO_ERROR; |
} |
static GLenum |
test_nurbs_surfaces(GLUnurbsObj * nobj) |
{ |
/* test the geometric data */ |
if (test_nurbs_surface(nobj, &(nobj->surface.geom)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* now test the attributive data */ |
/* color */ |
if (nobj->surface.color.type != GLU_INVALID_ENUM) |
if (test_nurbs_surface(nobj, &(nobj->surface.color)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* normal */ |
if (nobj->surface.normal.type != GLU_INVALID_ENUM) |
if (test_nurbs_surface(nobj, &(nobj->surface.normal)) != GLU_NO_ERROR) |
return GLU_ERROR; |
/* texture */ |
if (nobj->surface.texture.type != GLU_INVALID_ENUM) |
if (test_nurbs_surface(nobj, &(nobj->surface.texture)) != GLU_NO_ERROR) |
return GLU_ERROR; |
return GLU_NO_ERROR; |
} |
static GLenum |
convert_surf(knot_str_type * s_knot, knot_str_type * t_knot, |
surface_attribs * attrib, GLfloat ** new_ctrl, |
GLint * s_n_ctrl, GLint * t_n_ctrl) |
{ |
GLfloat **tmp_ctrl; |
GLfloat *ctrl_offset; |
GLint tmp_n_control; |
GLint i, j, t_cnt, s_cnt; |
GLint tmp_stride; |
GLint dim; |
GLenum err; |
/* valid range is empty? */ |
if ((s_knot->unified_knot != NULL && s_knot->unified_nknots == 0) || |
(t_knot->unified_knot != NULL && t_knot->unified_nknots == 0)) { |
if (s_knot->unified_knot) { |
free(s_knot->unified_knot); |
s_knot->unified_knot = NULL; |
} |
if (t_knot->unified_knot) { |
free(t_knot->unified_knot); |
t_knot->unified_knot = NULL; |
} |
*s_n_ctrl = 0; |
*t_n_ctrl = 0; |
return GLU_NO_ERROR; |
} |
t_cnt = attrib->tknot_count - attrib->torder; |
s_cnt = attrib->sknot_count - attrib->sorder; |
if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * t_cnt)) == NULL) |
return GLU_OUT_OF_MEMORY; |
if ((err = explode_knot(s_knot)) != GLU_NO_ERROR) { |
free(tmp_ctrl); |
if (s_knot->unified_knot) { |
free(s_knot->unified_knot); |
s_knot->unified_knot = NULL; |
} |
return err; |
} |
if (s_knot->unified_knot) { |
free(s_knot->unified_knot); |
s_knot->unified_knot = NULL; |
} |
if ((err = calc_alphas(s_knot)) != GLU_NO_ERROR) { |
free(tmp_ctrl); |
free(s_knot->new_knot); |
return err; |
} |
free(s_knot->new_knot); |
ctrl_offset = attrib->ctrlarray; |
dim = attrib->dim; |
for (i = 0; i < t_cnt; i++) { |
if ((err = calc_new_ctrl_pts(ctrl_offset, attrib->s_stride, s_knot, |
dim, &(tmp_ctrl[i]), |
&tmp_n_control)) != GLU_NO_ERROR) { |
for (--i; i <= 0; i--) |
free(tmp_ctrl[i]); |
free(tmp_ctrl); |
free(s_knot->alpha); |
return err; |
} |
ctrl_offset += attrib->t_stride; |
} |
free(s_knot->alpha); |
tmp_stride = dim * tmp_n_control; |
if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * t_cnt)) |
== NULL) { |
for (i = 0; i < t_cnt; i++) |
free(tmp_ctrl[i]); |
free(tmp_ctrl); |
return GLU_OUT_OF_MEMORY; |
} |
for (i = 0; i < tmp_n_control; i++) |
for (j = 0; j < t_cnt; j++) |
MEMCPY(*new_ctrl + j * dim + i * dim * t_cnt, tmp_ctrl[j] + dim * i, |
sizeof(GLfloat) * dim); |
for (i = 0; i < t_cnt; i++) |
free(tmp_ctrl[i]); |
free(tmp_ctrl); |
*s_n_ctrl = tmp_n_control; |
if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * (*s_n_ctrl))) == |
NULL) { |
return GLU_OUT_OF_MEMORY; |
} |
if ((err = explode_knot(t_knot)) != GLU_NO_ERROR) { |
free(tmp_ctrl); |
if (t_knot->unified_knot) { |
free(t_knot->unified_knot); |
t_knot->unified_knot = NULL; |
} |
return err; |
} |
if (t_knot->unified_knot) { |
free(t_knot->unified_knot); |
t_knot->unified_knot = NULL; |
} |
if ((err = calc_alphas(t_knot)) != GLU_NO_ERROR) { |
free(tmp_ctrl); |
free(t_knot->new_knot); |
return err; |
} |
free(t_knot->new_knot); |
ctrl_offset = *new_ctrl; |
for (i = 0; i < (*s_n_ctrl); i++) { |
if ((err = calc_new_ctrl_pts(ctrl_offset, dim, t_knot, |
dim, &(tmp_ctrl[i]), |
&tmp_n_control)) != GLU_NO_ERROR) { |
for (--i; i <= 0; i--) |
free(tmp_ctrl[i]); |
free(tmp_ctrl); |
free(t_knot->alpha); |
return err; |
} |
ctrl_offset += dim * t_cnt; |
} |
free(t_knot->alpha); |
free(*new_ctrl); |
tmp_stride = dim * tmp_n_control; |
if ( |
(*new_ctrl = |
(GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * (*s_n_ctrl))) == |
NULL) { |
for (i = 0; i < (*s_n_ctrl); i++) |
free(tmp_ctrl[i]); |
free(tmp_ctrl); |
return GLU_OUT_OF_MEMORY; |
} |
for (i = 0; i < (*s_n_ctrl); i++) { |
MEMCPY(*new_ctrl + i * tmp_stride, tmp_ctrl[i], |
sizeof(GLfloat) * tmp_stride); |
free(tmp_ctrl[i]); |
} |
free(tmp_ctrl); |
*t_n_ctrl = tmp_n_control; |
return GLU_NO_ERROR; |
} |
/* prepare the knot information structures */ |
static GLenum |
fill_knot_structures(GLUnurbsObj * nobj, |
knot_str_type * geom_s_knot, knot_str_type * geom_t_knot, |
knot_str_type * color_s_knot, |
knot_str_type * color_t_knot, |
knot_str_type * normal_s_knot, |
knot_str_type * normal_t_knot, |
knot_str_type * texture_s_knot, |
knot_str_type * texture_t_knot) |
{ |
GLint order; |
GLfloat *knot; |
GLint nknots; |
GLint t_min, t_max; |
geom_s_knot->unified_knot = NULL; |
knot = geom_s_knot->knot = nobj->surface.geom.sknot; |
nknots = geom_s_knot->nknots = nobj->surface.geom.sknot_count; |
order = geom_s_knot->order = nobj->surface.geom.sorder; |
geom_s_knot->delta_nknots = 0; |
t_min = geom_s_knot->t_min = order - 1; |
t_max = geom_s_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
geom_s_knot->open_at_begin = GL_TRUE; |
} |
else |
geom_s_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
geom_s_knot->open_at_end = GL_TRUE; |
} |
else |
geom_s_knot->open_at_end = GL_FALSE; |
geom_t_knot->unified_knot = NULL; |
knot = geom_t_knot->knot = nobj->surface.geom.tknot; |
nknots = geom_t_knot->nknots = nobj->surface.geom.tknot_count; |
order = geom_t_knot->order = nobj->surface.geom.torder; |
geom_t_knot->delta_nknots = 0; |
t_min = geom_t_knot->t_min = order - 1; |
t_max = geom_t_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
geom_t_knot->open_at_begin = GL_TRUE; |
} |
else |
geom_t_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
geom_t_knot->open_at_end = GL_TRUE; |
} |
else |
geom_t_knot->open_at_end = GL_FALSE; |
if (nobj->surface.color.type != GLU_INVALID_ENUM) { |
color_s_knot->unified_knot = (GLfloat *) 1; |
knot = color_s_knot->knot = nobj->surface.color.sknot; |
nknots = color_s_knot->nknots = nobj->surface.color.sknot_count; |
order = color_s_knot->order = nobj->surface.color.sorder; |
color_s_knot->delta_nknots = 0; |
t_min = color_s_knot->t_min = order - 1; |
t_max = color_s_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
color_s_knot->open_at_begin = GL_TRUE; |
} |
else |
color_s_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
color_s_knot->open_at_end = GL_TRUE; |
} |
else |
color_s_knot->open_at_end = GL_FALSE; |
color_t_knot->unified_knot = (GLfloat *) 1; |
knot = color_t_knot->knot = nobj->surface.color.tknot; |
nknots = color_t_knot->nknots = nobj->surface.color.tknot_count; |
order = color_t_knot->order = nobj->surface.color.torder; |
color_t_knot->delta_nknots = 0; |
t_min = color_t_knot->t_min = order - 1; |
t_max = color_t_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
color_t_knot->open_at_begin = GL_TRUE; |
} |
else |
color_t_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
color_t_knot->open_at_end = GL_TRUE; |
} |
else |
color_t_knot->open_at_end = GL_FALSE; |
} |
else { |
color_s_knot->unified_knot = NULL; |
color_t_knot->unified_knot = NULL; |
} |
if (nobj->surface.normal.type != GLU_INVALID_ENUM) { |
normal_s_knot->unified_knot = (GLfloat *) 1; |
knot = normal_s_knot->knot = nobj->surface.normal.sknot; |
nknots = normal_s_knot->nknots = nobj->surface.normal.sknot_count; |
order = normal_s_knot->order = nobj->surface.normal.sorder; |
normal_s_knot->delta_nknots = 0; |
t_min = normal_s_knot->t_min = order - 1; |
t_max = normal_s_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
normal_s_knot->open_at_begin = GL_TRUE; |
} |
else |
normal_s_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
normal_s_knot->open_at_end = GL_TRUE; |
} |
else |
normal_s_knot->open_at_end = GL_FALSE; |
normal_t_knot->unified_knot = (GLfloat *) 1; |
knot = normal_t_knot->knot = nobj->surface.normal.tknot; |
nknots = normal_t_knot->nknots = nobj->surface.normal.tknot_count; |
order = normal_t_knot->order = nobj->surface.normal.torder; |
normal_t_knot->delta_nknots = 0; |
t_min = normal_t_knot->t_min = order - 1; |
t_max = normal_t_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
normal_t_knot->open_at_begin = GL_TRUE; |
} |
else |
normal_t_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
normal_t_knot->open_at_end = GL_TRUE; |
} |
else |
normal_t_knot->open_at_end = GL_FALSE; |
} |
else { |
normal_s_knot->unified_knot = NULL; |
normal_t_knot->unified_knot = NULL; |
} |
if (nobj->surface.texture.type != GLU_INVALID_ENUM) { |
texture_s_knot->unified_knot = (GLfloat *) 1; |
knot = texture_s_knot->knot = nobj->surface.texture.sknot; |
nknots = texture_s_knot->nknots = nobj->surface.texture.sknot_count; |
order = texture_s_knot->order = nobj->surface.texture.sorder; |
texture_s_knot->delta_nknots = 0; |
t_min = texture_s_knot->t_min = order - 1; |
t_max = texture_s_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
texture_s_knot->open_at_begin = GL_TRUE; |
} |
else |
texture_s_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
texture_s_knot->open_at_end = GL_TRUE; |
} |
else |
texture_s_knot->open_at_end = GL_FALSE; |
texture_t_knot->unified_knot = (GLfloat *) 1; |
knot = texture_t_knot->knot = nobj->surface.texture.tknot; |
nknots = texture_t_knot->nknots = nobj->surface.texture.tknot_count; |
order = texture_t_knot->order = nobj->surface.texture.torder; |
texture_t_knot->delta_nknots = 0; |
t_min = texture_t_knot->t_min = order - 1; |
t_max = texture_t_knot->t_max = nknots - order; |
if (fabs(knot[t_min] - knot[t_max]) < EPSILON) { |
call_user_error(nobj, GLU_NURBS_ERROR3); |
return GLU_ERROR; |
} |
if (fabs(knot[0] - knot[t_min]) < EPSILON) { |
/* knot open at beggining */ |
texture_t_knot->open_at_begin = GL_TRUE; |
} |
else |
texture_t_knot->open_at_begin = GL_FALSE; |
if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) { |
/* knot open at end */ |
texture_t_knot->open_at_end = GL_TRUE; |
} |
else |
texture_t_knot->open_at_end = GL_FALSE; |
} |
else { |
texture_s_knot->unified_knot = NULL; |
texture_t_knot->unified_knot = NULL; |
} |
return GLU_NO_ERROR; |
} |
static void |
free_new_ctrl(new_ctrl_type * p) |
{ |
if (p->geom_ctrl) |
free(p->geom_ctrl); |
if (p->geom_offsets) |
free(p->geom_offsets); |
if (p->color_ctrl) { |
free(p->color_ctrl); |
if (p->color_offsets) |
free(p->color_offsets); |
} |
if (p->normal_ctrl) { |
free(p->normal_ctrl); |
if (p->normal_offsets) |
free(p->normal_offsets); |
} |
if (p->texture_ctrl) { |
free(p->texture_ctrl); |
if (p->texture_offsets) |
free(p->texture_offsets); |
} |
} |
/* convert surfaces - geometry and possible attribute ones into equivalent */ |
/* sequence of adjacent Bezier patches */ |
static GLenum |
convert_surfs(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl) |
{ |
knot_str_type geom_s_knot, color_s_knot, normal_s_knot, texture_s_knot; |
knot_str_type geom_t_knot, color_t_knot, normal_t_knot, texture_t_knot; |
GLenum err; |
if ((err = fill_knot_structures(nobj, &geom_s_knot, &geom_t_knot, |
&color_s_knot, &color_t_knot, |
&normal_s_knot, &normal_t_knot, |
&texture_s_knot, |
&texture_t_knot)) != GLU_NO_ERROR) { |
return err; |
} |
/* unify knots - all knots should have the same working range */ |
if ((err = select_knot_working_range(nobj, &geom_s_knot, &color_s_knot, |
&normal_s_knot, |
&texture_s_knot)) != GLU_NO_ERROR) { |
call_user_error(nobj, err); |
return err; |
} |
if ((err = select_knot_working_range(nobj, &geom_t_knot, &color_t_knot, |
&normal_t_knot, |
&texture_t_knot)) != GLU_NO_ERROR) { |
free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot, |
&texture_s_knot); |
call_user_error(nobj, err); |
return err; |
} |
/* convert the geometry surface */ |
nobj->surface.geom.dim = get_surface_dim(nobj->surface.geom.type); |
if ((err = convert_surf(&geom_s_knot, &geom_t_knot, &(nobj->surface.geom), |
&(new_ctrl->geom_ctrl), &(new_ctrl->geom_s_pt_cnt), |
&(new_ctrl->geom_t_pt_cnt))) != GLU_NO_ERROR) { |
free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot, |
&texture_s_knot); |
free_unified_knots(&geom_t_knot, &color_t_knot, &normal_t_knot, |
&texture_t_knot); |
call_user_error(nobj, err); |
return err; |
} |
/* if additional attributive surfaces are given convert them as well */ |
if (color_s_knot.unified_knot) { |
nobj->surface.color.dim = get_surface_dim(nobj->surface.color.type); |
if ( |
(err = |
convert_surf(&color_s_knot, &color_t_knot, &(nobj->surface.color), |
&(new_ctrl->color_ctrl), &(new_ctrl->color_s_pt_cnt), |
&(new_ctrl->color_t_pt_cnt))) != GLU_NO_ERROR) { |
free_unified_knots(&color_s_knot, &color_s_knot, &normal_s_knot, |
&texture_s_knot); |
free_unified_knots(&color_t_knot, &color_t_knot, &normal_t_knot, |
&texture_t_knot); |
free_new_ctrl(new_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
if (normal_s_knot.unified_knot) { |
nobj->surface.normal.dim = get_surface_dim(nobj->surface.normal.type); |
if ((err = convert_surf(&normal_s_knot, &normal_t_knot, |
&(nobj->surface.normal), |
&(new_ctrl->normal_ctrl), |
&(new_ctrl->normal_s_pt_cnt), |
&(new_ctrl->normal_t_pt_cnt))) != |
GLU_NO_ERROR) { |
free_unified_knots(&normal_s_knot, &normal_s_knot, &normal_s_knot, |
&texture_s_knot); |
free_unified_knots(&normal_t_knot, &normal_t_knot, &normal_t_knot, |
&texture_t_knot); |
free_new_ctrl(new_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
if (texture_s_knot.unified_knot) { |
nobj->surface.texture.dim = get_surface_dim(nobj->surface.texture.type); |
if ((err = convert_surf(&texture_s_knot, &texture_t_knot, |
&(nobj->surface.texture), |
&(new_ctrl->texture_ctrl), |
&(new_ctrl->texture_s_pt_cnt), |
&(new_ctrl->texture_t_pt_cnt))) != |
GLU_NO_ERROR) { |
free_unified_knots(&texture_s_knot, &texture_s_knot, &texture_s_knot, |
&texture_s_knot); |
free_unified_knots(&texture_t_knot, &texture_t_knot, &texture_t_knot, |
&texture_t_knot); |
free_new_ctrl(new_ctrl); |
call_user_error(nobj, err); |
return err; |
} |
} |
return GLU_NO_ERROR; |
} |
/* tesselate the "boundary" Bezier edge strips */ |
static void |
tesselate_strip_t_line(GLint top_start, GLint top_end, GLint top_z, |
GLint bottom_start, GLint bottom_end, GLint bottom_z, |
GLint bottom_domain) |
{ |
GLint top_cnt, bottom_cnt, tri_cnt, k; |
GLint direction; |
top_cnt = top_end - top_start; |
direction = (top_cnt >= 0 ? 1 : -1); |
bottom_cnt = bottom_end - bottom_start; |
glBegin(GL_LINES); |
while (top_cnt) { |
if (bottom_cnt) |
tri_cnt = top_cnt / bottom_cnt; |
else |
tri_cnt = abs(top_cnt); |
for (k = 0; k <= tri_cnt; k++, top_start += direction) { |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
glEvalPoint2(top_z, top_start); |
} |
if (bottom_cnt) { |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
bottom_start += direction; |
top_start -= direction; |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
glEvalPoint2(top_z, top_start); |
} |
top_cnt -= direction * tri_cnt; |
bottom_cnt -= direction; |
} |
glEnd(); |
} |
static void |
tesselate_strip_t_fill(GLint top_start, GLint top_end, GLint top_z, |
GLint bottom_start, GLint bottom_end, GLint bottom_z, |
GLint bottom_domain) |
{ |
GLint top_cnt, bottom_cnt, tri_cnt, k; |
GLint direction; |
top_cnt = top_end - top_start; |
direction = (top_cnt >= 0 ? 1 : -1); |
bottom_cnt = bottom_end - bottom_start; |
while (top_cnt) { |
if (bottom_cnt) |
tri_cnt = top_cnt / bottom_cnt; |
else |
tri_cnt = abs(top_cnt); |
glBegin(GL_TRIANGLE_FAN); |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
for (k = 0; k <= tri_cnt; k++, top_start += direction) |
glEvalPoint2(top_z, top_start); |
if (bottom_cnt) { |
bottom_start += direction; |
top_start -= direction; |
glEvalCoord2f((GLfloat) bottom_z / bottom_domain, |
(GLfloat) bottom_start / bottom_domain); |
} |
glEnd(); |
top_cnt -= direction * tri_cnt; |
bottom_cnt -= direction; |
} |
} |
static void |
tesselate_strip_t(GLenum display_mode, GLint top_start, GLint top_end, |
GLint top_z, GLint bottom_start, GLint bottom_end, |
GLint bottom_z, GLint bottom_domain) |
{ |
if (display_mode == GL_FILL) |
tesselate_strip_t_fill(top_start, top_end, top_z, bottom_start, |
bottom_end, bottom_z, bottom_domain); |
else |
tesselate_strip_t_line(top_start, top_end, top_z, bottom_start, |
bottom_end, bottom_z, bottom_domain); |
} |
static void |
tesselate_strip_s_fill(GLint top_start, GLint top_end, GLint top_z, |
GLint bottom_start, GLint bottom_end, GLint bottom_z, |
GLfloat bottom_domain) |
{ |
GLint top_cnt, bottom_cnt, tri_cnt, k; |
GLint direction; |
top_cnt = top_end - top_start; |
direction = (top_cnt >= 0 ? 1 : -1); |
bottom_cnt = bottom_end - bottom_start; |
while (top_cnt) { |
if (bottom_cnt) |
tri_cnt = top_cnt / bottom_cnt; |
else |
tri_cnt = abs(top_cnt); |
glBegin(GL_TRIANGLE_FAN); |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
for (k = 0; k <= tri_cnt; k++, top_start += direction) |
glEvalPoint2(top_start, top_z); |
if (bottom_cnt) { |
bottom_start += direction; |
top_start -= direction; |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
} |
glEnd(); |
top_cnt -= direction * tri_cnt; |
bottom_cnt -= direction; |
} |
} |
static void |
tesselate_strip_s_line(GLint top_start, GLint top_end, GLint top_z, |
GLint bottom_start, GLint bottom_end, GLint bottom_z, |
GLfloat bottom_domain) |
{ |
GLint top_cnt, bottom_cnt, tri_cnt, k; |
GLint direction; |
top_cnt = top_end - top_start; |
direction = (top_cnt >= 0 ? 1 : -1); |
bottom_cnt = bottom_end - bottom_start; |
glBegin(GL_LINES); |
while (top_cnt) { |
if (bottom_cnt) |
tri_cnt = top_cnt / bottom_cnt; |
else |
tri_cnt = abs(top_cnt); |
for (k = 0; k <= tri_cnt; k++, top_start += direction) { |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
glEvalPoint2(top_start, top_z); |
} |
if (bottom_cnt) { |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
bottom_start += direction; |
top_start -= direction; |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
glEvalPoint2(top_start, top_z); |
glEvalCoord2f((GLfloat) bottom_start / bottom_domain, |
(GLfloat) bottom_z / bottom_domain); |
} |
top_cnt -= direction * tri_cnt; |
bottom_cnt -= direction; |
} |
glEnd(); |
} |
static void |
tesselate_strip_s(GLenum display_mode, GLint top_start, GLint top_end, |
GLint top_z, GLint bottom_start, GLint bottom_end, |
GLint bottom_z, GLfloat bottom_domain) |
{ |
if (display_mode == GL_FILL) |
tesselate_strip_s_fill(top_start, top_end, top_z, bottom_start, |
bottom_end, bottom_z, bottom_domain); |
else |
tesselate_strip_s_line(top_start, top_end, top_z, bottom_start, |
bottom_end, bottom_z, bottom_domain); |
} |
static void |
tesselate_bottom_left_corner(GLenum display_mode, GLfloat s_1, GLfloat t_1) |
{ |
if (display_mode == GL_FILL) { |
glBegin(GL_TRIANGLE_FAN); |
glEvalPoint2(1, 1); |
glEvalCoord2f(s_1, 0.0); |
glEvalCoord2f(0.0, 0.0); |
glEvalCoord2f(0.0, t_1); |
} |
else { |
glBegin(GL_LINES); |
glEvalCoord2f(0.0, 0.0); |
glEvalCoord2f(0.0, t_1); |
glEvalCoord2f(0.0, 0.0); |
glEvalPoint2(1, 1); |
glEvalCoord2f(0.0, 0.0); |
glEvalCoord2f(s_1, 0.0); |
} |
glEnd(); |
} |
static void |
tesselate_bottom_right_corner(GLenum display_mode, GLint v_top, |
GLint v_bottom, GLfloat s_1, GLfloat t_1) |
{ |
if (display_mode == GL_FILL) { |
glBegin(GL_TRIANGLE_FAN); |
glEvalPoint2(1, v_top); |
glEvalCoord2f(0.0, v_bottom * t_1); |
glEvalCoord2f(0.0, (v_bottom + 1) * t_1); |
glEvalCoord2f(s_1, (v_bottom + 1) * t_1); |
} |
else { |
glBegin(GL_LINES); |
glEvalCoord2f(0.0, (v_bottom + 1) * t_1); |
glEvalPoint2(1, v_top); |
glEvalCoord2f(0.0, (v_bottom + 1) * t_1); |
glEvalCoord2f(0.0, v_bottom * t_1); |
glEvalCoord2f(0.0, (v_bottom + 1) * t_1); |
glEvalCoord2f(s_1, (v_bottom + 1) * t_1); |
} |
glEnd(); |
} |
static void |
tesselate_top_left_corner(GLenum display_mode, GLint u_right, GLint u_left, |
GLfloat s_1, GLfloat t_1) |
{ |
if (display_mode == GL_FILL) { |
glBegin(GL_TRIANGLE_FAN); |
glEvalPoint2(u_right, 1); |
glEvalCoord2f((u_left + 1) * s_1, t_1); |
glEvalCoord2f((u_left + 1) * s_1, 0.0); |
glEvalCoord2f(u_left * s_1, 0.0); |
} |
else { |
glBegin(GL_LINES); |
glEvalCoord2f((u_left + 1) * s_1, 0.0); |
glEvalPoint2(u_right, 1); |
glEvalCoord2f((u_left + 1) * s_1, 0.0); |
glEvalCoord2f(u_left * s_1, 0.0); |
glEvalCoord2f((u_left + 1) * s_1, 0.0); |
glEvalCoord2f((u_left + 1) * s_1, t_1); |
} |
glEnd(); |
} |
static void |
tesselate_top_right_corner(GLenum display_mode, GLint u_left, GLint v_bottom, |
GLint u_right, GLint v_top, GLfloat s_1, |
GLfloat t_1) |
{ |
if (display_mode == GL_FILL) { |
glBegin(GL_TRIANGLE_FAN); |
glEvalPoint2(u_left, v_bottom); |
glEvalCoord2f((u_right - 1) * s_1, v_top * t_1); |
glEvalCoord2f(u_right * s_1, v_top * t_1); |
glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1); |
} |
else { |
glBegin(GL_LINES); |
glEvalCoord2f(u_right * s_1, v_top * t_1); |
glEvalPoint2(u_left, v_bottom); |
glEvalCoord2f(u_right * s_1, v_top * t_1); |
glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1); |
glEvalCoord2f(u_right * s_1, v_top * t_1); |
glEvalCoord2f((u_right - 1) * s_1, v_top * t_1); |
} |
glEnd(); |
} |
/* do mesh mapping of Bezier */ |
static void |
nurbs_map_bezier(GLenum display_mode, GLint * sfactors, GLint * tfactors, |
GLint s_bezier_cnt, GLint t_bezier_cnt, GLint s, GLint t) |
{ |
GLint top, bottom, right, left; |
if (s == 0) { |
top = *(tfactors + t * 3); |
bottom = *(tfactors + t * 3 + 1); |
} |
else if (s == s_bezier_cnt - 1) { |
top = *(tfactors + t * 3 + 2); |
bottom = *(tfactors + t * 3); |
} |
else { |
top = bottom = *(tfactors + t * 3); |
} |
if (t == 0) { |
left = *(sfactors + s * 3 + 1); |
right = *(sfactors + s * 3); |
} |
else if (t == t_bezier_cnt - 1) { |
left = *(sfactors + s * 3); |
right = *(sfactors + s * 3 + 2); |
} |
else { |
left = right = *(sfactors + s * 3); |
} |
if (top > bottom) { |
if (left < right) { |
glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 1, right, 1, top); |
tesselate_strip_s(display_mode, 1, right, 1, 1, left, 0, |
(GLfloat) left); |
tesselate_bottom_left_corner(display_mode, (GLfloat) (1.0 / left), |
(GLfloat) (1.0 / bottom)); |
/* tesselate_strip_t(display_mode,1,top,1,1,bottom,0,(GLfloat)bottom);*/ |
tesselate_strip_t(display_mode, top, 1, 1, bottom, 1, 0, |
(GLfloat) bottom); |
} |
else if (left == right) { |
glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 1, right, 0, top); |
/* tesselate_strip_t(display_mode,0,top,1,0,bottom,0,(GLfloat)bottom);*/ |
tesselate_strip_t(display_mode, top, 0, 1, bottom, 0, 0, |
(GLfloat) bottom); |
} |
else { |
glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 1, left, 0, top - 1); |
/* tesselate_strip_t(display_mode,0,top-1,1,0,bottom-1,0, |
(GLfloat)bottom);*/ |
tesselate_strip_t(display_mode, top - 1, 0, 1, bottom - 1, 0, 0, |
(GLfloat) bottom); |
tesselate_bottom_right_corner(display_mode, top - 1, bottom - 1, |
(GLfloat) (1.0 / right), |
(GLfloat) (1.0 / bottom)); |
/* tesselate_strip_s(display_mode,1,left,top-1,1,right,right, |
(GLfloat)right);*/ |
tesselate_strip_s(display_mode, left, 1, top - 1, right, 1, right, |
(GLfloat) right); |
} |
} |
else if (top == bottom) { |
if (left < right) { |
glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, right, 1, top); |
tesselate_strip_s(display_mode, 0, right, 1, 0, left, 0, |
(GLfloat) left); |
} |
else if (left == right) { |
glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, right, 0, top); |
} |
else { |
glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, left, 0, top - 1); |
/* tesselate_strip_s(display_mode,0,left,top-1,0,right,right, |
(GLfloat)right);*/ |
tesselate_strip_s(display_mode, left, 0, top - 1, right, 0, right, |
(GLfloat) right); |
} |
} |
else { |
if (left < right) { |
glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, right - 1, 1, bottom); |
tesselate_strip_s(display_mode, 0, right - 1, 1, 0, left - 1, 0, |
(GLfloat) left); |
tesselate_top_left_corner(display_mode, right - 1, left - 1, |
(GLfloat) (1.0 / left), |
(GLfloat) (1.0 / top)); |
tesselate_strip_t(display_mode, 1, bottom, right - 1, 1, top, top, |
(GLfloat) top); |
} |
else if (left == right) { |
glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, right - 1, 0, bottom); |
tesselate_strip_t(display_mode, 0, bottom, right - 1, 0, top, top, |
(GLfloat) top); |
} |
else { |
glMapGrid2f(left, 0.0, 1.0, bottom, 0.0, 1.0); |
glEvalMesh2(display_mode, 0, left - 1, 0, bottom - 1); |
tesselate_strip_t(display_mode, 0, bottom - 1, left - 1, 0, top - 1, |
top, (GLfloat) top); |
tesselate_top_right_corner(display_mode, left - 1, bottom - 1, right, |
top, (GLfloat) (1.0 / right), |
(GLfloat) (1.0 / top)); |
/* tesselate_strip_s(display_mode,0,left-1,bottom-1,0,right-1,right, |
(GLfloat)right);*/ |
tesselate_strip_s(display_mode, left - 1, 0, bottom - 1, right - 1, |
0, right, (GLfloat) right); |
} |
} |
} |
/* draw NURBS surface in OUTLINE POLYGON mode */ |
static void |
draw_polygon_mode(GLenum display_mode, GLUnurbsObj * nobj, |
new_ctrl_type * new_ctrl, GLint * sfactors, |
GLint * tfactors) |
{ |
GLsizei offset; |
GLint t_bezier_cnt, s_bezier_cnt; |
GLboolean do_color, do_normal, do_texture; |
GLint i, j; |
t_bezier_cnt = new_ctrl->t_bezier_cnt; |
s_bezier_cnt = new_ctrl->s_bezier_cnt; |
glEnable(nobj->surface.geom.type); |
if (new_ctrl->color_ctrl) { |
glEnable(nobj->surface.color.type); |
do_color = GL_TRUE; |
} |
else |
do_color = GL_FALSE; |
if (new_ctrl->normal_ctrl) { |
glEnable(nobj->surface.normal.type); |
do_normal = GL_TRUE; |
} |
else |
do_normal = GL_FALSE; |
if (new_ctrl->texture_ctrl) { |
glEnable(nobj->surface.texture.type); |
do_texture = GL_TRUE; |
} |
else |
do_texture = GL_FALSE; |
for (j = 0; j < s_bezier_cnt; j++) { |
for (i = 0; i < t_bezier_cnt; i++) { |
offset = j * t_bezier_cnt + i; |
if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset), |
nobj->surface.geom.sorder, |
nobj->surface.geom.torder, |
new_ctrl->geom_s_stride, |
new_ctrl->geom_t_stride, |
nobj->surface.geom.dim)) continue; |
glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride, |
nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride, |
nobj->surface.geom.torder, |
*(new_ctrl->geom_offsets + offset)); |
if (do_color) { |
glMap2f(nobj->surface.color.type, 0.0, 1.0, |
new_ctrl->color_s_stride, nobj->surface.color.sorder, |
0.0, 1.0, new_ctrl->color_t_stride, |
nobj->surface.color.torder, |
*(new_ctrl->color_offsets + offset)); |
} |
if (do_normal) { |
glMap2f(nobj->surface.normal.type, 0.0, 1.0, |
new_ctrl->normal_s_stride, nobj->surface.normal.sorder, |
0.0, 1.0, new_ctrl->normal_t_stride, |
nobj->surface.normal.torder, |
*(new_ctrl->normal_offsets + offset)); |
} |
if (do_texture) { |
glMap2f(nobj->surface.texture.type, 0.0, 1.0, |
new_ctrl->texture_s_stride, nobj->surface.texture.sorder, |
0.0, 1.0, new_ctrl->texture_t_stride, |
nobj->surface.texture.torder, |
*(new_ctrl->texture_offsets + offset)); |
} |
/* glMapGrid2f(sfactors[j*3+0],0.0,1.0,tfactors[i*3+0],0.0,1.0); |
glEvalMesh2(display_mode,0,sfactors[j*3+0],0,tfactors[i*3+0]);*/ |
nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt, |
t_bezier_cnt, j, i); |
} |
} |
} |
/* draw NURBS surface in OUTLINE POLYGON mode */ |
#if 0 |
static void |
draw_patch_mode(GLenum display_mode, GLUnurbsObj * nobj, |
new_ctrl_type * new_ctrl, GLint * sfactors, GLint * tfactors) |
{ |
GLsizei offset; |
GLint t_bezier_cnt, s_bezier_cnt; |
GLboolean do_color, do_normal, do_texture; |
GLint i, j; |
t_bezier_cnt = new_ctrl->t_bezier_cnt; |
s_bezier_cnt = new_ctrl->s_bezier_cnt; |
glEnable(nobj->surface.geom.type); |
if (new_ctrl->color_ctrl) { |
glEnable(nobj->surface.color.type); |
do_color = GL_TRUE; |
} |
else |
do_color = GL_FALSE; |
if (new_ctrl->normal_ctrl) { |
glEnable(nobj->surface.normal.type); |
do_normal = GL_TRUE; |
} |
else |
do_normal = GL_FALSE; |
if (new_ctrl->texture_ctrl) { |
glEnable(nobj->surface.texture.type); |
do_texture = GL_TRUE; |
} |
else |
do_texture = GL_FALSE; |
for (j = 0; j < s_bezier_cnt; j++) { |
for (i = 0; i < t_bezier_cnt; i++) { |
offset = j * t_bezier_cnt + i; |
if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset), |
nobj->surface.geom.sorder, |
nobj->surface.geom.torder, |
new_ctrl->geom_s_stride, |
new_ctrl->geom_t_stride, |
nobj->surface.geom.dim)) continue; |
glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride, |
nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride, |
nobj->surface.geom.torder, |
*(new_ctrl->geom_offsets + offset)); |
if (do_color) { |
glMap2f(nobj->surface.color.type, 0.0, 1.0, |
new_ctrl->color_s_stride, nobj->surface.color.sorder, |
0.0, 1.0, new_ctrl->color_t_stride, |
nobj->surface.color.torder, |
*(new_ctrl->color_offsets + offset)); |
} |
if (do_normal) { |
glMap2f(nobj->surface.normal.type, 0.0, 1.0, |
new_ctrl->normal_s_stride, nobj->surface.normal.sorder, |
0.0, 1.0, new_ctrl->normal_t_stride, |
nobj->surface.normal.torder, |
*(new_ctrl->normal_offsets + offset)); |
} |
if (do_texture) { |
glMap2f(nobj->surface.texture.type, 0.0, 1.0, |
new_ctrl->texture_s_stride, nobj->surface.texture.sorder, |
0.0, 1.0, new_ctrl->texture_t_stride, |
nobj->surface.texture.torder, |
*(new_ctrl->texture_offsets + offset)); |
} |
nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt, |
t_bezier_cnt, i, j); |
/* glMapGrid2f(sfactors[j],0.0,1.0,tfactors[i],0.0,1.0); |
glEvalMesh2(display_mode,0,sfactors[j],0,tfactors[i]);*/ |
} |
} |
} |
#endif |
static void |
init_new_ctrl(new_ctrl_type * p) |
{ |
p->geom_ctrl = p->color_ctrl = p->normal_ctrl = p->texture_ctrl = NULL; |
p->geom_offsets = p->color_offsets = p->normal_offsets = |
p->texture_offsets = NULL; |
p->s_bezier_cnt = p->t_bezier_cnt = 0; |
} |
static GLenum |
augment_new_ctrl(GLUnurbsObj * nobj, new_ctrl_type * p) |
{ |
GLsizei offset_size; |
GLint i, j; |
p->s_bezier_cnt = (p->geom_s_pt_cnt) / (nobj->surface.geom.sorder); |
p->t_bezier_cnt = (p->geom_t_pt_cnt) / (nobj->surface.geom.torder); |
offset_size = (p->s_bezier_cnt) * (p->t_bezier_cnt); |
p->geom_t_stride = nobj->surface.geom.dim; |
p->geom_s_stride = (p->geom_t_pt_cnt) * (nobj->surface.geom.dim); |
p->color_t_stride = nobj->surface.color.dim; |
p->color_s_stride = (p->color_t_pt_cnt) * (nobj->surface.color.dim); |
p->normal_t_stride = nobj->surface.normal.dim; |
p->normal_s_stride = (p->normal_t_pt_cnt) * (nobj->surface.normal.dim); |
p->texture_t_stride = nobj->surface.texture.dim; |
p->texture_s_stride = (p->texture_t_pt_cnt) * (nobj->surface.texture.dim); |
if ( |
(p->geom_offsets = |
(GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
if (p->color_ctrl) |
if ( |
(p->color_offsets = |
(GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { |
free_new_ctrl(p); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
if (p->normal_ctrl) |
if ( |
(p->normal_offsets = |
(GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { |
free_new_ctrl(p); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
if (p->texture_ctrl) |
if ( |
(p->texture_offsets = |
(GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) { |
free_new_ctrl(p); |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return GLU_ERROR; |
} |
for (i = 0; i < p->s_bezier_cnt; i++) |
for (j = 0; j < p->t_bezier_cnt; j++) |
*(p->geom_offsets + i * (p->t_bezier_cnt) + j) = |
p->geom_ctrl + i * (nobj->surface.geom.sorder) * |
(nobj->surface.geom.dim) * (p->geom_t_pt_cnt) + |
j * (nobj->surface.geom.dim) * (nobj->surface.geom.torder); |
if (p->color_ctrl) |
for (i = 0; i < p->s_bezier_cnt; i++) |
for (j = 0; j < p->t_bezier_cnt; j++) |
*(p->color_offsets + i * (p->t_bezier_cnt) + j) = |
p->color_ctrl + i * (nobj->surface.color.sorder) * |
(nobj->surface.color.dim) * (p->color_t_pt_cnt) + |
j * (nobj->surface.color.dim) * (nobj->surface.color.torder); |
if (p->normal_ctrl) |
for (i = 0; i < p->s_bezier_cnt; i++) |
for (j = 0; j < p->t_bezier_cnt; j++) |
*(p->normal_offsets + i * (p->t_bezier_cnt) + j) = |
p->normal_ctrl + i * (nobj->surface.normal.sorder) * |
(nobj->surface.normal.dim) * (p->normal_t_pt_cnt) + |
j * (nobj->surface.normal.dim) * (nobj->surface.normal.torder); |
if (p->texture_ctrl) |
for (i = 0; i < p->s_bezier_cnt; i++) |
for (j = 0; j < p->t_bezier_cnt; j++) |
*(p->texture_offsets + i * (p->t_bezier_cnt) + j) = |
p->texture_ctrl + i * (nobj->surface.texture.sorder) * |
(nobj->surface.texture.dim) * (p->texture_t_pt_cnt) + |
j * (nobj->surface.texture.dim) * |
(nobj->surface.texture.torder); |
return GLU_NO_ERROR; |
} |
/* main NURBS surface procedure */ |
void |
do_nurbs_surface(GLUnurbsObj * nobj) |
{ |
GLint *sfactors, *tfactors; |
new_ctrl_type new_ctrl; |
/* test user supplied data */ |
if (test_nurbs_surfaces(nobj) != GLU_NO_ERROR) |
return; |
init_new_ctrl(&new_ctrl); |
if (convert_surfs(nobj, &new_ctrl) != GLU_NO_ERROR) |
return; |
if (augment_new_ctrl(nobj, &new_ctrl) != GLU_NO_ERROR) |
return; |
switch (nobj->sampling_method) { |
case GLU_PATH_LENGTH: |
if (glu_do_sampling_3D(nobj, &new_ctrl, &sfactors, &tfactors) != |
GLU_NO_ERROR) { |
free_new_ctrl(&new_ctrl); |
return; |
} |
break; |
case GLU_DOMAIN_DISTANCE: |
if (glu_do_sampling_uv(nobj, &new_ctrl, &sfactors, &tfactors) != |
GLU_NO_ERROR) { |
free_new_ctrl(&new_ctrl); |
return; |
} |
break; |
case GLU_PARAMETRIC_ERROR: |
if (glu_do_sampling_param_3D(nobj, &new_ctrl, &sfactors, &tfactors) != |
GLU_NO_ERROR) { |
free_new_ctrl(&new_ctrl); |
return; |
} |
break; |
default: |
abort(); |
} |
glFrontFace(GL_CW); |
switch (nobj->display_mode) { |
case GLU_FILL: |
/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/ |
draw_polygon_mode(GL_FILL, nobj, &new_ctrl, sfactors, tfactors); |
break; |
case GLU_OUTLINE_POLYGON: |
/* TODO - missing trimming handeling */ |
/* just for now - no OUTLINE_PATCH mode |
draw_patch_mode(GL_LINE,nobj,&new_ctrl,sfactors,tfactors); |
break; */ |
case GLU_OUTLINE_PATCH: |
/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/ |
draw_polygon_mode(GL_LINE, nobj, &new_ctrl, sfactors, tfactors); |
break; |
default: |
abort(); /* TODO: is this OK? */ |
} |
free(sfactors); |
free(tfactors); |
free_new_ctrl(&new_ctrl); |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/tesselat.c |
---|
0,0 → 1,407 |
/* $Id: tesselat.c,v 1.1 2003-02-28 11:42:08 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file is part of the polygon tesselation code contributed by |
* Bogdan Sikorski |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <stdlib.h> |
#include <math.h> |
#include "tess.h" |
#endif |
static GLboolean edge_flag; |
static void emit_triangle(GLUtriangulatorObj *, tess_vertex *, |
tess_vertex *, tess_vertex *); |
static void emit_triangle_with_edge_flag(GLUtriangulatorObj *, |
tess_vertex *, GLboolean, |
tess_vertex *, GLboolean, |
tess_vertex *, GLboolean); |
static GLdouble |
twice_the_triangle_area(tess_vertex * va, tess_vertex * vb, tess_vertex * vc) |
{ |
return (vb->x - va->x) * (vc->y - va->y) - (vb->y - va->y) * (vc->x - |
va->x); |
} |
static GLboolean |
left(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) |
{ |
if (A * x + B * y + C > -EPSILON) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
static GLboolean |
right(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y) |
{ |
if (A * x + B * y + C < EPSILON) |
return GL_TRUE; |
else |
return GL_FALSE; |
} |
static GLint |
convex_ccw(tess_vertex * va, |
tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) |
{ |
GLdouble d; |
d = twice_the_triangle_area(va, vb, vc); |
if (d > EPSILON) { |
return 1; |
} |
else if (d < -EPSILON) { |
return 0; |
} |
else { |
return -1; |
} |
} |
static GLint |
convex_cw(tess_vertex * va, |
tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj) |
{ |
GLdouble d; |
d = twice_the_triangle_area(va, vb, vc); |
if (d < -EPSILON) { |
return 1; |
} |
else if (d > EPSILON) { |
return 0; |
} |
else { |
return -1; |
} |
} |
static GLboolean |
diagonal_ccw(tess_vertex * va, |
tess_vertex * vb, |
GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
tess_vertex *vc = va->next, *vertex, *shadow_vertex; |
struct |
{ |
GLdouble A, B, C; |
} |
ac, cb, ba; |
GLdouble x, y; |
GLint res = convex_ccw(va, vc, vb, tobj); |
if (res == 0) |
return GL_FALSE; |
if (res == -1) |
return GL_TRUE; |
ba.A = vb->y - va->y; |
ba.B = va->x - vb->x; |
ba.C = -ba.A * va->x - ba.B * va->y; |
ac.A = va->y - vc->y; |
ac.B = vc->x - va->x; |
ac.C = -ac.A * vc->x - ac.B * vc->y; |
cb.A = vc->y - vb->y; |
cb.B = vb->x - vc->x; |
cb.C = -cb.A * vb->x - cb.B * vb->y; |
for (vertex = vb->next; vertex != va; vertex = vertex->next) { |
shadow_vertex = vertex->shadow_vertex; |
if (shadow_vertex != NULL && |
(shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) |
continue; |
x = vertex->x; |
y = vertex->y; |
if (left(ba.A, ba.B, ba.C, x, y) && |
left(ac.A, ac.B, ac.C, x, y) && left(cb.A, cb.B, cb.C, x, y)) |
return GL_FALSE; |
} |
return GL_TRUE; |
} |
static GLboolean |
diagonal_cw(tess_vertex * va, |
tess_vertex * vb, |
GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
tess_vertex *vc = va->next, *vertex, *shadow_vertex; |
struct |
{ |
GLdouble A, B, C; |
} |
ac, cb, ba; |
GLdouble x, y; |
GLint res = convex_cw(va, vc, vb, tobj); |
if (res == 0) |
return GL_FALSE; |
if (res == -1) |
return GL_TRUE; |
ba.A = vb->y - va->y; |
ba.B = va->x - vb->x; |
ba.C = -ba.A * va->x - ba.B * va->y; |
ac.A = va->y - vc->y; |
ac.B = vc->x - va->x; |
ac.C = -ac.A * vc->x - ac.B * vc->y; |
cb.A = vc->y - vb->y; |
cb.B = vb->x - vc->x; |
cb.C = -cb.A * vb->x - cb.B * vb->y; |
for (vertex = vb->next; vertex != va; vertex = vertex->next) { |
shadow_vertex = vertex->shadow_vertex; |
if (shadow_vertex != NULL && |
(shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc)) |
continue; |
x = vertex->x; |
y = vertex->y; |
if (right(ba.A, ba.B, ba.C, x, y) && |
right(ac.A, ac.B, ac.C, x, y) && right(cb.A, cb.B, cb.C, x, y)) |
return GL_FALSE; |
} |
return GL_TRUE; |
} |
static void |
clip_ear(GLUtriangulatorObj * tobj, tess_vertex * v, tess_contour * contour) |
{ |
emit_triangle(tobj, v->previous, v, v->next); |
/* the first in the list */ |
if (contour->vertices == v) { |
contour->vertices = v->next; |
contour->last_vertex->next = v->next; |
v->next->previous = contour->last_vertex; |
} |
else |
/* the last ? */ |
if (contour->last_vertex == v) { |
contour->vertices->previous = v->previous; |
v->previous->next = v->next; |
contour->last_vertex = v->previous; |
} |
else { |
v->next->previous = v->previous; |
v->previous->next = v->next; |
} |
free(v); |
--(contour->vertex_cnt); |
} |
static void |
clip_ear_with_edge_flag(GLUtriangulatorObj * tobj, |
tess_vertex * v, tess_contour * contour) |
{ |
emit_triangle_with_edge_flag(tobj, v->previous, v->previous->edge_flag, |
v, v->edge_flag, v->next, GL_FALSE); |
v->previous->edge_flag = GL_FALSE; |
/* the first in the list */ |
if (contour->vertices == v) { |
contour->vertices = v->next; |
contour->last_vertex->next = v->next; |
v->next->previous = contour->last_vertex; |
} |
else |
/* the last ? */ |
if (contour->last_vertex == v) { |
contour->vertices->previous = v->previous; |
v->previous->next = v->next; |
contour->last_vertex = v->previous; |
} |
else { |
v->next->previous = v->previous; |
v->previous->next = v->next; |
} |
free(v); |
--(contour->vertex_cnt); |
} |
static void |
triangulate_ccw(GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
tess_vertex *vertex; |
GLuint vertex_cnt = contour->vertex_cnt; |
while (vertex_cnt > 3) { |
vertex = contour->vertices; |
while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == |
GL_FALSE && tobj->error == GLU_NO_ERROR) |
vertex = vertex->next; |
if (tobj->error != GLU_NO_ERROR) |
return; |
clip_ear(tobj, vertex->next, contour); |
--vertex_cnt; |
} |
} |
static void |
triangulate_cw(GLUtriangulatorObj * tobj, tess_contour * contour) |
{ |
tess_vertex *vertex; |
GLuint vertex_cnt = contour->vertex_cnt; |
while (vertex_cnt > 3) { |
vertex = contour->vertices; |
while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == |
GL_FALSE && tobj->error == GLU_NO_ERROR) |
vertex = vertex->next; |
if (tobj->error != GLU_NO_ERROR) |
return; |
clip_ear(tobj, vertex->next, contour); |
--vertex_cnt; |
} |
} |
static void |
triangulate_ccw_with_edge_flag(GLUtriangulatorObj * tobj, |
tess_contour * contour) |
{ |
tess_vertex *vertex; |
GLuint vertex_cnt = contour->vertex_cnt; |
while (vertex_cnt > 3) { |
vertex = contour->vertices; |
while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) == |
GL_FALSE && tobj->error == GLU_NO_ERROR) |
vertex = vertex->next; |
if (tobj->error != GLU_NO_ERROR) |
return; |
clip_ear_with_edge_flag(tobj, vertex->next, contour); |
--vertex_cnt; |
} |
} |
static void |
triangulate_cw_with_edge_flag(GLUtriangulatorObj * tobj, |
tess_contour * contour) |
{ |
tess_vertex *vertex; |
GLuint vertex_cnt = contour->vertex_cnt; |
while (vertex_cnt > 3) { |
vertex = contour->vertices; |
while (diagonal_cw(vertex, vertex->next->next, tobj, contour) == |
GL_FALSE && tobj->error == GLU_NO_ERROR) |
vertex = vertex->next; |
if (tobj->error != GLU_NO_ERROR) |
return; |
clip_ear_with_edge_flag(tobj, vertex->next, contour); |
--vertex_cnt; |
} |
} |
void |
tess_tesselate(GLUtriangulatorObj * tobj) |
{ |
tess_contour *contour; |
for (contour = tobj->contours; contour != NULL; contour = contour->next) { |
if (contour->orientation == GLU_CCW) { |
triangulate_ccw(tobj, contour); |
} |
else { |
triangulate_cw(tobj, contour); |
} |
if (tobj->error != GLU_NO_ERROR) |
return; |
/* emit the last triangle */ |
emit_triangle(tobj, contour->vertices, contour->vertices->next, |
contour->vertices->next->next); |
} |
} |
void |
tess_tesselate_with_edge_flag(GLUtriangulatorObj * tobj) |
{ |
tess_contour *contour; |
edge_flag = GL_TRUE; |
/* first callback with edgeFlag set to GL_TRUE */ |
(tobj->callbacks.edgeFlag) (GL_TRUE); |
for (contour = tobj->contours; contour != NULL; contour = contour->next) { |
if (contour->orientation == GLU_CCW) |
triangulate_ccw_with_edge_flag(tobj, contour); |
else |
triangulate_cw_with_edge_flag(tobj, contour); |
if (tobj->error != GLU_NO_ERROR) |
return; |
/* emit the last triangle */ |
emit_triangle_with_edge_flag(tobj, contour->vertices, |
contour->vertices->edge_flag, |
contour->vertices->next, |
contour->vertices->next->edge_flag, |
contour->vertices->next->next, |
contour->vertices->next->next->edge_flag); |
} |
} |
static void |
emit_triangle(GLUtriangulatorObj * tobj, |
tess_vertex * v1, tess_vertex * v2, tess_vertex * v3) |
{ |
(tobj->callbacks.begin) (GL_TRIANGLES); |
(tobj->callbacks.vertex) (v1->data); |
(tobj->callbacks.vertex) (v2->data); |
(tobj->callbacks.vertex) (v3->data); |
(tobj->callbacks.end) (); |
} |
static void |
emit_triangle_with_edge_flag(GLUtriangulatorObj * tobj, |
tess_vertex * v1, |
GLboolean edge_flag1, |
tess_vertex * v2, |
GLboolean edge_flag2, |
tess_vertex * v3, GLboolean edge_flag3) |
{ |
(tobj->callbacks.begin) (GL_TRIANGLES); |
if (edge_flag1 != edge_flag) { |
edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); |
(tobj->callbacks.edgeFlag) (edge_flag); |
} |
(tobj->callbacks.vertex) (v1->data); |
if (edge_flag2 != edge_flag) { |
edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); |
(tobj->callbacks.edgeFlag) (edge_flag); |
} |
(tobj->callbacks.vertex) (v2->data); |
if (edge_flag3 != edge_flag) { |
edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE); |
(tobj->callbacks.edgeFlag) (edge_flag); |
} |
(tobj->callbacks.vertex) (v3->data); |
(tobj->callbacks.end) (); |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/project.c |
---|
0,0 → 1,402 |
/* $Id: project.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <stdio.h> |
#include <string.h> |
#include <math.h> |
#include "gluP.h" |
#endif |
/* |
* This code was contributed by Marc Buffat (buffat@mecaflu.ec-lyon.fr). |
* Thanks Marc!!! |
*/ |
/* implementation de gluProject et gluUnproject */ |
/* M. Buffat 17/2/95 */ |
/* |
* Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in |
* Input: m - the 4x4 matrix |
* in - the 4x1 vector |
* Output: out - the resulting 4x1 vector. |
*/ |
static void |
transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]) |
{ |
#define M(row,col) m[col*4+row] |
out[0] = |
M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3]; |
out[1] = |
M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3]; |
out[2] = |
M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3]; |
out[3] = |
M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3]; |
#undef M |
} |
/* |
* Perform a 4x4 matrix multiplication (product = a x b). |
* Input: a, b - matrices to multiply |
* Output: product - product of a and b |
*/ |
static void |
matmul(GLdouble * product, const GLdouble * a, const GLdouble * b) |
{ |
/* This matmul was contributed by Thomas Malik */ |
GLdouble temp[16]; |
GLint i; |
#define A(row,col) a[(col<<2)+row] |
#define B(row,col) b[(col<<2)+row] |
#define T(row,col) temp[(col<<2)+row] |
/* i-te Zeile */ |
for (i = 0; i < 4; i++) { |
T(i, 0) = |
A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i, |
3) * |
B(3, 0); |
T(i, 1) = |
A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i, |
3) * |
B(3, 1); |
T(i, 2) = |
A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i, |
3) * |
B(3, 2); |
T(i, 3) = |
A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i, |
3) * |
B(3, 3); |
} |
#undef A |
#undef B |
#undef T |
MEMCPY(product, temp, 16 * sizeof(GLdouble)); |
} |
/* |
* Compute inverse of 4x4 transformation matrix. |
* Code contributed by Jacques Leroy jle@star.be |
* Return GL_TRUE for success, GL_FALSE for failure (singular matrix) |
*/ |
static GLboolean |
invert_matrix(const GLdouble * m, GLdouble * out) |
{ |
/* NB. OpenGL Matrices are COLUMN major. */ |
#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; } |
#define MAT(m,r,c) (m)[(c)*4+(r)] |
GLdouble wtmp[4][8]; |
GLdouble m0, m1, m2, m3, s; |
GLdouble *r0, *r1, *r2, *r3; |
r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; |
r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1), |
r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3), |
r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, |
r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1), |
r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3), |
r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, |
r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1), |
r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3), |
r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, |
r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1), |
r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3), |
r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; |
/* choose pivot - or die */ |
if (fabs(r3[0]) > fabs(r2[0])) |
SWAP_ROWS(r3, r2); |
if (fabs(r2[0]) > fabs(r1[0])) |
SWAP_ROWS(r2, r1); |
if (fabs(r1[0]) > fabs(r0[0])) |
SWAP_ROWS(r1, r0); |
if (0.0 == r0[0]) |
return GL_FALSE; |
/* eliminate first variable */ |
m1 = r1[0] / r0[0]; |
m2 = r2[0] / r0[0]; |
m3 = r3[0] / r0[0]; |
s = r0[1]; |
r1[1] -= m1 * s; |
r2[1] -= m2 * s; |
r3[1] -= m3 * s; |
s = r0[2]; |
r1[2] -= m1 * s; |
r2[2] -= m2 * s; |
r3[2] -= m3 * s; |
s = r0[3]; |
r1[3] -= m1 * s; |
r2[3] -= m2 * s; |
r3[3] -= m3 * s; |
s = r0[4]; |
if (s != 0.0) { |
r1[4] -= m1 * s; |
r2[4] -= m2 * s; |
r3[4] -= m3 * s; |
} |
s = r0[5]; |
if (s != 0.0) { |
r1[5] -= m1 * s; |
r2[5] -= m2 * s; |
r3[5] -= m3 * s; |
} |
s = r0[6]; |
if (s != 0.0) { |
r1[6] -= m1 * s; |
r2[6] -= m2 * s; |
r3[6] -= m3 * s; |
} |
s = r0[7]; |
if (s != 0.0) { |
r1[7] -= m1 * s; |
r2[7] -= m2 * s; |
r3[7] -= m3 * s; |
} |
/* choose pivot - or die */ |
if (fabs(r3[1]) > fabs(r2[1])) |
SWAP_ROWS(r3, r2); |
if (fabs(r2[1]) > fabs(r1[1])) |
SWAP_ROWS(r2, r1); |
if (0.0 == r1[1]) |
return GL_FALSE; |
/* eliminate second variable */ |
m2 = r2[1] / r1[1]; |
m3 = r3[1] / r1[1]; |
r2[2] -= m2 * r1[2]; |
r3[2] -= m3 * r1[2]; |
r2[3] -= m2 * r1[3]; |
r3[3] -= m3 * r1[3]; |
s = r1[4]; |
if (0.0 != s) { |
r2[4] -= m2 * s; |
r3[4] -= m3 * s; |
} |
s = r1[5]; |
if (0.0 != s) { |
r2[5] -= m2 * s; |
r3[5] -= m3 * s; |
} |
s = r1[6]; |
if (0.0 != s) { |
r2[6] -= m2 * s; |
r3[6] -= m3 * s; |
} |
s = r1[7]; |
if (0.0 != s) { |
r2[7] -= m2 * s; |
r3[7] -= m3 * s; |
} |
/* choose pivot - or die */ |
if (fabs(r3[2]) > fabs(r2[2])) |
SWAP_ROWS(r3, r2); |
if (0.0 == r2[2]) |
return GL_FALSE; |
/* eliminate third variable */ |
m3 = r3[2] / r2[2]; |
r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], |
r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; |
/* last check */ |
if (0.0 == r3[3]) |
return GL_FALSE; |
s = 1.0 / r3[3]; /* now back substitute row 3 */ |
r3[4] *= s; |
r3[5] *= s; |
r3[6] *= s; |
r3[7] *= s; |
m2 = r2[3]; /* now back substitute row 2 */ |
s = 1.0 / r2[2]; |
r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), |
r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); |
m1 = r1[3]; |
r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, |
r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; |
m0 = r0[3]; |
r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, |
r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; |
m1 = r1[2]; /* now back substitute row 1 */ |
s = 1.0 / r1[1]; |
r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), |
r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); |
m0 = r0[2]; |
r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, |
r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; |
m0 = r0[1]; /* now back substitute row 0 */ |
s = 1.0 / r0[0]; |
r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), |
r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); |
MAT(out, 0, 0) = r0[4]; |
MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6]; |
MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4]; |
MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6]; |
MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4]; |
MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6]; |
MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4]; |
MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6]; |
MAT(out, 3, 3) = r3[7]; |
return GL_TRUE; |
#undef MAT |
#undef SWAP_ROWS |
} |
/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */ |
GLint GLAPIENTRY |
gluProject(GLdouble objx, GLdouble objy, GLdouble objz, |
const GLdouble model[16], const GLdouble proj[16], |
const GLint viewport[4], |
GLdouble * winx, GLdouble * winy, GLdouble * winz) |
{ |
/* matrice de transformation */ |
GLdouble in[4], out[4]; |
/* initilise la matrice et le vecteur a transformer */ |
in[0] = objx; |
in[1] = objy; |
in[2] = objz; |
in[3] = 1.0; |
transform_point(out, model, in); |
transform_point(in, proj, out); |
/* d'ou le resultat normalise entre -1 et 1 */ |
if (in[3] == 0.0) |
return GL_FALSE; |
in[0] /= in[3]; |
in[1] /= in[3]; |
in[2] /= in[3]; |
/* en coordonnees ecran */ |
*winx = viewport[0] + (1 + in[0]) * viewport[2] / 2; |
*winy = viewport[1] + (1 + in[1]) * viewport[3] / 2; |
/* entre 0 et 1 suivant z */ |
*winz = (1 + in[2]) / 2; |
return GL_TRUE; |
} |
/* transformation du point ecran (winx,winy,winz) en point objet */ |
GLint GLAPIENTRY |
gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, |
const GLdouble model[16], const GLdouble proj[16], |
const GLint viewport[4], |
GLdouble * objx, GLdouble * objy, GLdouble * objz) |
{ |
/* matrice de transformation */ |
GLdouble m[16], A[16]; |
GLdouble in[4], out[4]; |
/* transformation coordonnees normalisees entre -1 et 1 */ |
in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; |
in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; |
in[2] = 2 * winz - 1.0; |
in[3] = 1.0; |
/* calcul transformation inverse */ |
matmul(A, proj, model); |
invert_matrix(A, m); |
/* d'ou les coordonnees objets */ |
transform_point(out, m, in); |
if (out[3] == 0.0) |
return GL_FALSE; |
*objx = out[0] / out[3]; |
*objy = out[1] / out[3]; |
*objz = out[2] / out[3]; |
return GL_TRUE; |
} |
/* |
* New in GLU 1.3 |
* This is like gluUnProject but also takes near and far DepthRange values. |
*/ |
#ifdef GLU_VERSION_1_3 |
GLint GLAPIENTRY |
gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw, |
const GLdouble modelMatrix[16], |
const GLdouble projMatrix[16], |
const GLint viewport[4], |
GLclampd nearZ, GLclampd farZ, |
GLdouble * objx, GLdouble * objy, GLdouble * objz, |
GLdouble * objw) |
{ |
/* matrice de transformation */ |
GLdouble m[16], A[16]; |
GLdouble in[4], out[4]; |
GLdouble z = nearZ + winz * (farZ - nearZ); |
/* transformation coordonnees normalisees entre -1 et 1 */ |
in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0; |
in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0; |
in[2] = 2.0 * z - 1.0; |
in[3] = clipw; |
/* calcul transformation inverse */ |
matmul(A, projMatrix, modelMatrix); |
invert_matrix(A, m); |
/* d'ou les coordonnees objets */ |
transform_point(out, m, in); |
if (out[3] == 0.0) |
return GL_FALSE; |
*objx = out[0] / out[3]; |
*objy = out[1] / out[3]; |
*objz = out[2] / out[3]; |
*objw = out[3]; |
return GL_TRUE; |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glu/glu.c |
---|
0,0 → 1,417 |
/* $Id: glu.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.5 |
* Copyright (C) 1995-2001 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <assert.h> |
#include <math.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "gluP.h" |
#endif |
/* |
* Miscellaneous utility functions |
*/ |
#ifndef M_PI |
#define M_PI 3.1415926536 |
#endif |
#define EPS 0.00001 |
#ifndef GLU_INCOMPATIBLE_GL_VERSION |
#define GLU_INCOMPATIBLE_GL_VERSION 100903 |
#endif |
void GLAPIENTRY |
gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, |
GLdouble centerx, GLdouble centery, GLdouble centerz, |
GLdouble upx, GLdouble upy, GLdouble upz) |
{ |
GLdouble m[16]; |
GLdouble x[3], y[3], z[3]; |
GLdouble mag; |
/* Make rotation matrix */ |
/* Z vector */ |
z[0] = eyex - centerx; |
z[1] = eyey - centery; |
z[2] = eyez - centerz; |
mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]); |
if (mag) { /* mpichler, 19950515 */ |
z[0] /= mag; |
z[1] /= mag; |
z[2] /= mag; |
} |
/* Y vector */ |
y[0] = upx; |
y[1] = upy; |
y[2] = upz; |
/* X vector = Y cross Z */ |
x[0] = y[1] * z[2] - y[2] * z[1]; |
x[1] = -y[0] * z[2] + y[2] * z[0]; |
x[2] = y[0] * z[1] - y[1] * z[0]; |
/* Recompute Y = Z cross X */ |
y[0] = z[1] * x[2] - z[2] * x[1]; |
y[1] = -z[0] * x[2] + z[2] * x[0]; |
y[2] = z[0] * x[1] - z[1] * x[0]; |
/* mpichler, 19950515 */ |
/* cross product gives area of parallelogram, which is < 1.0 for |
* non-perpendicular unit-length vectors; so normalize x, y here |
*/ |
mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); |
if (mag) { |
x[0] /= mag; |
x[1] /= mag; |
x[2] /= mag; |
} |
mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); |
if (mag) { |
y[0] /= mag; |
y[1] /= mag; |
y[2] /= mag; |
} |
#define M(row,col) m[col*4+row] |
M(0, 0) = x[0]; |
M(0, 1) = x[1]; |
M(0, 2) = x[2]; |
M(0, 3) = 0.0; |
M(1, 0) = y[0]; |
M(1, 1) = y[1]; |
M(1, 2) = y[2]; |
M(1, 3) = 0.0; |
M(2, 0) = z[0]; |
M(2, 1) = z[1]; |
M(2, 2) = z[2]; |
M(2, 3) = 0.0; |
M(3, 0) = 0.0; |
M(3, 1) = 0.0; |
M(3, 2) = 0.0; |
M(3, 3) = 1.0; |
#undef M |
glMultMatrixd(m); |
/* Translate Eye to Origin */ |
glTranslated(-eyex, -eyey, -eyez); |
} |
void GLAPIENTRY |
gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top) |
{ |
glOrtho(left, right, bottom, top, -1.0, 1.0); |
} |
static void |
frustum(GLdouble left, GLdouble right, |
GLdouble bottom, GLdouble top, |
GLdouble nearval, GLdouble farval) |
{ |
GLdouble x, y, a, b, c, d; |
GLdouble m[16]; |
x = (2.0 * nearval) / (right - left); |
y = (2.0 * nearval) / (top - bottom); |
a = (right + left) / (right - left); |
b = (top + bottom) / (top - bottom); |
c = -(farval + nearval) / ( farval - nearval); |
d = -(2.0 * farval * nearval) / (farval - nearval); |
#define M(row,col) m[col*4+row] |
M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; |
M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; |
M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; |
M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; |
#undef M |
glMultMatrixd(m); |
} |
void GLAPIENTRY |
gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) |
{ |
GLdouble xmin, xmax, ymin, ymax; |
ymax = zNear * tan(fovy * M_PI / 360.0); |
ymin = -ymax; |
xmin = ymin * aspect; |
xmax = ymax * aspect; |
/* don't call glFrustum() because of error semantics (covglu) */ |
frustum(xmin, xmax, ymin, ymax, zNear, zFar); |
} |
void GLAPIENTRY |
gluPickMatrix(GLdouble x, GLdouble y, |
GLdouble width, GLdouble height, GLint viewport[4]) |
{ |
GLfloat m[16]; |
GLfloat sx, sy; |
GLfloat tx, ty; |
sx = viewport[2] / width; |
sy = viewport[3] / height; |
tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width; |
ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height; |
#define M(row,col) m[col*4+row] |
M(0, 0) = sx; |
M(0, 1) = 0.0; |
M(0, 2) = 0.0; |
M(0, 3) = tx; |
M(1, 0) = 0.0; |
M(1, 1) = sy; |
M(1, 2) = 0.0; |
M(1, 3) = ty; |
M(2, 0) = 0.0; |
M(2, 1) = 0.0; |
M(2, 2) = 1.0; |
M(2, 3) = 0.0; |
M(3, 0) = 0.0; |
M(3, 1) = 0.0; |
M(3, 2) = 0.0; |
M(3, 3) = 1.0; |
#undef M |
glMultMatrixf(m); |
} |
const GLubyte *GLAPIENTRY |
gluErrorString(GLenum errorCode) |
{ |
static char *tess_error[] = { |
"missing gluBeginPolygon", |
"missing gluBeginContour", |
"missing gluEndPolygon", |
"missing gluEndContour", |
"misoriented or self-intersecting loops", |
"coincident vertices", |
"colinear vertices", |
"FIST recovery process fatal error" |
}; |
static char *nurbs_error[] = { |
"spline order un-supported", |
"too few knots", |
"valid knot range is empty", |
"decreasing knot sequence knot", |
"knot multiplicity greater than order of spline", |
"endcurve() must follow bgncurve()", |
"bgncurve() must precede endcurve()", |
"missing or extra geometric data", |
"can't draw pwlcurves", |
"missing bgncurve()", |
"missing bgnsurface()", |
"endtrim() must precede endsurface()", |
"bgnsurface() must precede endsurface()", |
"curve of improper type passed as trim curve", |
"bgnsurface() must precede bgntrim()", |
"endtrim() must follow bgntrim()", |
"bgntrim() must precede endtrim()", |
"invalid or missing trim curve", |
"bgntrim() must precede pwlcurve()", |
"pwlcurve referenced twice", |
"pwlcurve and nurbscurve mixed", |
"improper usage of trim data type", |
"nurbscurve referenced twice", |
"nurbscurve and pwlcurve mixed", |
"nurbssurface referenced twice", |
"invalid property", |
"endsurface() must follow bgnsurface()", |
"misoriented trim curves", |
"intersecting trim curves", |
"UNUSED", |
"unconnected trim curves", |
"unknown knot error", |
"negative vertex count encountered", |
"negative byte-stride encountered", |
"unknown type descriptor", |
"null control array or knot vector", |
"duplicate point on pwlcurve" |
}; |
/* GL Errors */ |
if (errorCode == GL_NO_ERROR) { |
return (GLubyte *) "no error"; |
} |
else if (errorCode == GL_INVALID_VALUE) { |
return (GLubyte *) "invalid value"; |
} |
else if (errorCode == GL_INVALID_ENUM) { |
return (GLubyte *) "invalid enum"; |
} |
else if (errorCode == GL_INVALID_OPERATION) { |
return (GLubyte *) "invalid operation"; |
} |
else if (errorCode == GL_STACK_OVERFLOW) { |
return (GLubyte *) "stack overflow"; |
} |
else if (errorCode == GL_STACK_UNDERFLOW) { |
return (GLubyte *) "stack underflow"; |
} |
else if (errorCode == GL_OUT_OF_MEMORY) { |
return (GLubyte *) "out of memory"; |
} |
/* GLU Errors */ |
else if (errorCode == GLU_NO_ERROR) { |
return (GLubyte *) "no error"; |
} |
else if (errorCode == GLU_INVALID_ENUM) { |
return (GLubyte *) "invalid enum"; |
} |
else if (errorCode == GLU_INVALID_VALUE) { |
return (GLubyte *) "invalid value"; |
} |
else if (errorCode == GLU_OUT_OF_MEMORY) { |
return (GLubyte *) "out of memory"; |
} |
else if (errorCode == GLU_INCOMPATIBLE_GL_VERSION) { |
return (GLubyte *) "incompatible GL version"; |
} |
else if (errorCode >= GLU_TESS_ERROR1 && errorCode <= GLU_TESS_ERROR8) { |
return (GLubyte *) tess_error[errorCode - GLU_TESS_ERROR1]; |
} |
else if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) { |
return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1]; |
} |
else { |
return NULL; |
} |
} |
/* |
* New in GLU 1.1 |
*/ |
const GLubyte *GLAPIENTRY |
gluGetString(GLenum name) |
{ |
static char *extensions = "GL_EXT_abgr"; |
static char *version = "1.1 Mesa 3.5"; |
switch (name) { |
case GLU_EXTENSIONS: |
return (GLubyte *) extensions; |
case GLU_VERSION: |
return (GLubyte *) version; |
default: |
return NULL; |
} |
} |
#if 0 /* gluGetProcAddressEXT not finalized yet! */ |
#ifdef __cplusplus |
/* for BeOS R4.5 */ |
void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...) |
#else |
void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) () |
#endif |
{ |
struct proc |
{ |
const char *name; |
void *address; |
}; |
static struct proc procTable[] = { |
{"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */ |
/* new 1.1 functions */ |
{"gluGetString", (void *) gluGetString}, |
/* new 1.2 functions */ |
{"gluTessBeginPolygon", (void *) gluTessBeginPolygon}, |
{"gluTessBeginContour", (void *) gluTessBeginContour}, |
{"gluTessEndContour", (void *) gluTessEndContour}, |
{"gluTessEndPolygon", (void *) gluTessEndPolygon}, |
{"gluGetTessProperty", (void *) gluGetTessProperty}, |
/* new 1.3 functions */ |
{NULL, NULL} |
}; |
GLuint i; |
for (i = 0; procTable[i].address; i++) { |
if (strcmp((const char *) procName, procTable[i].name) == 0) |
return (void (GLAPIENTRY *) ()) procTable[i].address; |
} |
return NULL; |
} |
#endif |
/* |
* New in GLU 1.3 |
*/ |
#ifdef GLU_VERSION_1_3 |
GLboolean GLAPIENTRY |
gluCheckExtension(const GLubyte *extName, const GLubyte * extString) |
{ |
assert(extName); |
assert(extString); |
{ |
const int len = strlen((const char *) extName); |
const char *start = (const char *) extString; |
/*while (1) { |
const char *c = strstr(start, (const char *) extName); |
if (!c) |
return GL_FALSE; |
if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0)) |
return GL_TRUE; |
start = c + len; |
}*/ return GL_TRUE; |
} |
} |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glu/quadric.c |
---|
0,0 → 1,820 |
/* $Id: quadric.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1999-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* TODO: |
* texture coordinate support |
* flip normals according to orientation |
* there's still some inside/outside orientation bugs in possibly all |
* but the sphere function |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <math.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include "gluP.h" |
#endif |
#ifndef M_PI |
# define M_PI (3.1415926) |
#endif |
/* |
* Convert degrees to radians: |
*/ |
#define DEG_TO_RAD(A) ((A)*(M_PI/180.0)) |
/* |
* Sin and Cos for degree angles: |
*/ |
#define SIND( A ) sin( (A)*(M_PI/180.0) ) |
#define COSD( A) cos( (A)*(M_PI/180.0) ) |
/* |
* Texture coordinates if texture flag is set |
*/ |
#define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y); |
struct GLUquadric |
{ |
GLenum DrawStyle; /* GLU_FILL, LINE, SILHOUETTE, or POINT */ |
GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */ |
GLboolean TextureFlag; /* Generate texture coords? */ |
GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */ |
void (GLCALLBACK * ErrorFunc) (GLenum err); /* Error handler callback function */ |
}; |
/* |
* Process a GLU error. |
*/ |
static void |
quadric_error(GLUquadricObj * qobj, GLenum error, const char *msg) |
{ |
/* Call the error call back function if any */ |
if (qobj->ErrorFunc) { |
(*qobj->ErrorFunc) (error); |
} |
/* Print a message to stdout if MESA_DEBUG variable is defined */ |
if (getenv("MESA_DEBUG")) { |
fprintf(stderr, "GLUError: %s: %s\n", (char *) gluErrorString(error), |
msg); |
} |
} |
GLUquadricObj *GLAPIENTRY |
gluNewQuadric(void) |
{ |
GLUquadricObj *q; |
q = (GLUquadricObj *) malloc(sizeof(struct GLUquadric)); |
if (q) { |
q->DrawStyle = GLU_FILL; |
q->Orientation = GLU_OUTSIDE; |
q->TextureFlag = GL_FALSE; |
q->Normals = GLU_SMOOTH; |
q->ErrorFunc = NULL; |
} |
return q; |
} |
void GLAPIENTRY |
gluDeleteQuadric(GLUquadricObj * state) |
{ |
if (state) { |
free((void *) state); |
} |
} |
/* |
* Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE, |
* or GLU_POINT. |
*/ |
void GLAPIENTRY |
gluQuadricDrawStyle(GLUquadricObj * quadObject, GLenum drawStyle) |
{ |
if (quadObject && (drawStyle == GLU_FILL || drawStyle == GLU_LINE |
|| drawStyle == GLU_SILHOUETTE |
|| drawStyle == GLU_POINT)) { |
quadObject->DrawStyle = drawStyle; |
} |
else { |
quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricDrawStyle"); |
} |
} |
/* |
* Set the orientation to GLU_INSIDE or GLU_OUTSIDE. |
*/ |
void GLAPIENTRY |
gluQuadricOrientation(GLUquadricObj * quadObject, GLenum orientation) |
{ |
if (quadObject |
&& (orientation == GLU_INSIDE || orientation == GLU_OUTSIDE)) { |
quadObject->Orientation = orientation; |
} |
else { |
quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricOrientation"); |
} |
} |
/* |
* Set the error handler callback function. |
*/ |
void GLAPIENTRY |
gluQuadricCallback(GLUquadricObj * qobj, |
GLenum which, void (GLCALLBACK * fn) ()) |
{ |
/* |
* UGH, this is a mess! I thought ANSI was a standard. |
*/ |
if (qobj && which == GLU_ERROR) { |
#ifdef __CYGWIN32__ |
qobj->ErrorFunc = (void (GLCALLBACKPCAST) (GLenum)) fn; |
#elif defined(OPENSTEP) |
qobj->ErrorFunc = (void (*)(GLenum)) fn; |
#elif defined(_WIN32) |
qobj->ErrorFunc = (void (GLCALLBACK *) (int)) fn; |
#elif defined(__STORM__) |
qobj->ErrorFunc = (void (GLCALLBACK *) (GLenum)) fn; |
#elif defined(__BEOS__) |
qobj->ErrorFunc = (void (*)(GLenum)) fn; |
#else |
qobj->ErrorFunc = (void (GLCALLBACK *) ()) fn; |
#endif |
} |
} |
void GLAPIENTRY |
gluQuadricNormals(GLUquadricObj * quadObject, GLenum normals) |
{ |
if (quadObject |
&& (normals == GLU_NONE || normals == GLU_FLAT |
|| normals == GLU_SMOOTH)) { |
quadObject->Normals = normals; |
} |
} |
void GLAPIENTRY |
gluQuadricTexture(GLUquadricObj * quadObject, GLboolean textureCoords) |
{ |
if (quadObject) { |
quadObject->TextureFlag = textureCoords; |
} |
} |
/* |
* Call glNormal3f after scaling normal to unit length. |
*/ |
static void |
normal3f(GLfloat x, GLfloat y, GLfloat z) |
{ |
GLdouble mag; |
mag = sqrt(x * x + y * y + z * z); |
if (mag > 0.00001F) { |
x /= mag; |
y /= mag; |
z /= mag; |
} |
glNormal3f(x, y, z); |
} |
void GLAPIENTRY |
gluCylinder(GLUquadricObj * qobj, |
GLdouble baseRadius, GLdouble topRadius, |
GLdouble height, GLint slices, GLint stacks) |
{ |
GLdouble da, r, dr, dz; |
GLfloat x, y, z, nz, nsign; |
GLint i, j; |
if (qobj->Orientation == GLU_INSIDE) { |
nsign = -1.0; |
} |
else { |
nsign = 1.0; |
} |
da = 2.0 * M_PI / slices; |
dr = (topRadius - baseRadius) / stacks; |
dz = height / stacks; |
nz = (baseRadius - topRadius) / height; /* Z component of normal vectors */ |
if (qobj->DrawStyle == GLU_POINT) { |
glBegin(GL_POINTS); |
for (i = 0; i < slices; i++) { |
x = cos(i * da); |
y = sin(i * da); |
normal3f(x * nsign, y * nsign, nz * nsign); |
z = 0.0; |
r = baseRadius; |
for (j = 0; j <= stacks; j++) { |
glVertex3f(x * r, y * r, z); |
z += dz; |
r += dr; |
} |
} |
glEnd(); |
} |
else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { |
/* Draw rings */ |
if (qobj->DrawStyle == GLU_LINE) { |
z = 0.0; |
r = baseRadius; |
for (j = 0; j <= stacks; j++) { |
glBegin(GL_LINE_LOOP); |
for (i = 0; i < slices; i++) { |
x = cos(i * da); |
y = sin(i * da); |
normal3f(x * nsign, y * nsign, nz * nsign); |
glVertex3f(x * r, y * r, z); |
} |
glEnd(); |
z += dz; |
r += dr; |
} |
} |
else { |
/* draw one ring at each end */ |
if (baseRadius != 0.0) { |
glBegin(GL_LINE_LOOP); |
for (i = 0; i < slices; i++) { |
x = cos(i * da); |
y = sin(i * da); |
normal3f(x * nsign, y * nsign, nz * nsign); |
glVertex3f(x * baseRadius, y * baseRadius, 0.0); |
} |
glEnd(); |
glBegin(GL_LINE_LOOP); |
for (i = 0; i < slices; i++) { |
x = cos(i * da); |
y = sin(i * da); |
normal3f(x * nsign, y * nsign, nz * nsign); |
glVertex3f(x * topRadius, y * topRadius, height); |
} |
glEnd(); |
} |
} |
/* draw length lines */ |
glBegin(GL_LINES); |
for (i = 0; i < slices; i++) { |
x = cos(i * da); |
y = sin(i * da); |
normal3f(x * nsign, y * nsign, nz * nsign); |
glVertex3f(x * baseRadius, y * baseRadius, 0.0); |
glVertex3f(x * topRadius, y * topRadius, height); |
} |
glEnd(); |
} |
else if (qobj->DrawStyle == GLU_FILL) { |
GLfloat ds = 1.0 / slices; |
GLfloat dt = 1.0 / stacks; |
GLfloat t = 0.0; |
z = 0.0; |
r = baseRadius; |
for (j = 0; j < stacks; j++) { |
GLfloat s = 0.0; |
glBegin(GL_QUAD_STRIP); |
for (i = 0; i <= slices; i++) { |
GLfloat x, y; |
if (i == slices) { |
x = sin(0.0); |
y = cos(0.0); |
} |
else { |
x = sin(i * da); |
y = cos(i * da); |
} |
if (nsign == 1.0) { |
normal3f(x * nsign, y * nsign, nz * nsign); |
TXTR_COORD(s, t); |
glVertex3f(x * r, y * r, z); |
normal3f(x * nsign, y * nsign, nz * nsign); |
TXTR_COORD(s, t + dt); |
glVertex3f(x * (r + dr), y * (r + dr), z + dz); |
} |
else { |
normal3f(x * nsign, y * nsign, nz * nsign); |
TXTR_COORD(s, t); |
glVertex3f(x * r, y * r, z); |
normal3f(x * nsign, y * nsign, nz * nsign); |
TXTR_COORD(s, t + dt); |
glVertex3f(x * (r + dr), y * (r + dr), z + dz); |
} |
s += ds; |
} /* for slices */ |
glEnd(); |
r += dr; |
t += dt; |
z += dz; |
} /* for stacks */ |
} |
} |
void GLAPIENTRY |
gluSphere(GLUquadricObj * qobj, GLdouble radius, GLint slices, GLint stacks) |
{ |
GLfloat rho, drho, theta, dtheta; |
GLfloat x, y, z; |
GLfloat s, t, ds, dt; |
GLint i, j, imin, imax; |
GLboolean normals; |
GLfloat nsign; |
if (qobj->Normals == GLU_NONE) { |
normals = GL_FALSE; |
} |
else { |
normals = GL_TRUE; |
} |
if (qobj->Orientation == GLU_INSIDE) { |
nsign = -1.0; |
} |
else { |
nsign = 1.0; |
} |
drho = M_PI / (GLfloat) stacks; |
dtheta = 2.0 * M_PI / (GLfloat) slices; |
/* texturing: s goes from 0.0/0.25/0.5/0.75/1.0 at +y/+x/-y/-x/+y axis */ |
/* t goes from -1.0/+1.0 at z = -radius/+radius (linear along longitudes) */ |
/* cannot use triangle fan on texturing (s coord. at top/bottom tip varies) */ |
if (qobj->DrawStyle == GLU_FILL) { |
if (!qobj->TextureFlag) { |
/* draw +Z end as a triangle fan */ |
glBegin(GL_TRIANGLE_FAN); |
glNormal3f(0.0, 0.0, 1.0); |
glVertex3f(0.0, 0.0, nsign * radius); |
for (j = 0; j <= slices; j++) { |
theta = (j == slices) ? 0.0 : j * dtheta; |
x = -sin(theta) * sin(drho); |
y = cos(theta) * sin(drho); |
z = nsign * cos(drho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
glVertex3f(x * radius, y * radius, z * radius); |
} |
glEnd(); |
} |
ds = 1.0 / slices; |
dt = 1.0 / stacks; |
t = 1.0; /* because loop now runs from 0 */ |
if (qobj->TextureFlag) { |
imin = 0; |
imax = stacks; |
} |
else { |
imin = 1; |
imax = stacks - 1; |
} |
/* draw intermediate stacks as quad strips */ |
for (i = imin; i < imax; i++) { |
rho = i * drho; |
glBegin(GL_QUAD_STRIP); |
s = 0.0; |
for (j = 0; j <= slices; j++) { |
theta = (j == slices) ? 0.0 : j * dtheta; |
x = -sin(theta) * sin(rho); |
y = cos(theta) * sin(rho); |
z = nsign * cos(rho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
TXTR_COORD(s, t); |
glVertex3f(x * radius, y * radius, z * radius); |
x = -sin(theta) * sin(rho + drho); |
y = cos(theta) * sin(rho + drho); |
z = nsign * cos(rho + drho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
TXTR_COORD(s, t - dt); |
s += ds; |
glVertex3f(x * radius, y * radius, z * radius); |
} |
glEnd(); |
t -= dt; |
} |
if (!qobj->TextureFlag) { |
/* draw -Z end as a triangle fan */ |
glBegin(GL_TRIANGLE_FAN); |
glNormal3f(0.0, 0.0, -1.0); |
glVertex3f(0.0, 0.0, -radius * nsign); |
rho = M_PI - drho; |
s = 1.0; |
t = dt; |
for (j = slices; j >= 0; j--) { |
theta = (j == slices) ? 0.0 : j * dtheta; |
x = -sin(theta) * sin(rho); |
y = cos(theta) * sin(rho); |
z = nsign * cos(rho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
s -= ds; |
glVertex3f(x * radius, y * radius, z * radius); |
} |
glEnd(); |
} |
} |
else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) { |
/* draw stack lines */ |
for (i = 1; i < stacks; i++) { /* stack line at i==stacks-1 was missing here */ |
rho = i * drho; |
glBegin(GL_LINE_LOOP); |
for (j = 0; j < slices; j++) { |
theta = j * dtheta; |
x = cos(theta) * sin(rho); |
y = sin(theta) * sin(rho); |
z = cos(rho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
glVertex3f(x * radius, y * radius, z * radius); |
} |
glEnd(); |
} |
/* draw slice lines */ |
for (j = 0; j < slices; j++) { |
theta = j * dtheta; |
glBegin(GL_LINE_STRIP); |
for (i = 0; i <= stacks; i++) { |
rho = i * drho; |
x = cos(theta) * sin(rho); |
y = sin(theta) * sin(rho); |
z = cos(rho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
glVertex3f(x * radius, y * radius, z * radius); |
} |
glEnd(); |
} |
} |
else if (qobj->DrawStyle == GLU_POINT) { |
/* top and bottom-most points */ |
glBegin(GL_POINTS); |
if (normals) |
glNormal3f(0.0, 0.0, nsign); |
glVertex3d(0.0, 0.0, radius); |
if (normals) |
glNormal3f(0.0, 0.0, -nsign); |
glVertex3d(0.0, 0.0, -radius); |
/* loop over stacks */ |
for (i = 1; i < stacks - 1; i++) { |
rho = i * drho; |
for (j = 0; j < slices; j++) { |
theta = j * dtheta; |
x = cos(theta) * sin(rho); |
y = sin(theta) * sin(rho); |
z = cos(rho); |
if (normals) |
glNormal3f(x * nsign, y * nsign, z * nsign); |
glVertex3f(x * radius, y * radius, z * radius); |
} |
} |
glEnd(); |
} |
} |
void GLAPIENTRY |
gluDisk(GLUquadricObj * qobj, |
GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops) |
{ |
GLfloat da, dr; |
#if 0 |
GLdouble a, da; |
GLfloat r, dr; |
GLfloat x, y; |
GLfloat r1, r2, dtc; |
GLint s, l; |
#endif |
/* Normal vectors */ |
if (qobj->Normals != GLU_NONE) { |
if (qobj->Orientation == GLU_OUTSIDE) { |
glNormal3f(0.0, 0.0, +1.0); |
} |
else { |
glNormal3f(0.0, 0.0, -1.0); |
} |
} |
da = 2.0 * M_PI / slices; |
dr = (outerRadius - innerRadius) / (GLfloat) loops; |
switch (qobj->DrawStyle) { |
case GLU_FILL: |
{ |
/* texture of a gluDisk is a cut out of the texture unit square |
* x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] |
* (linear mapping) |
*/ |
GLfloat dtc = 2.0f * outerRadius; |
GLfloat sa, ca; |
GLfloat r1 = innerRadius; |
GLint l; |
for (l = 0; l < loops; l++) { |
GLfloat r2 = r1 + dr; |
if (qobj->Orientation == GLU_OUTSIDE) { |
GLint s; |
glBegin(GL_QUAD_STRIP); |
for (s = 0; s <= slices; s++) { |
GLfloat a; |
if (s == slices) |
a = 0.0; |
else |
a = s * da; |
sa = sin(a); |
ca = cos(a); |
TXTR_COORD(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc); |
glVertex2f(r2 * sa, r2 * ca); |
TXTR_COORD(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc); |
glVertex2f(r1 * sa, r1 * ca); |
} |
glEnd(); |
} |
else { |
GLint s; |
glBegin(GL_QUAD_STRIP); |
for (s = slices; s >= 0; s--) { |
GLfloat a; |
if (s == slices) |
a = 0.0; |
else |
a = s * da; |
sa = sin(a); |
ca = cos(a); |
TXTR_COORD(0.5 - sa * r2 / dtc, 0.5 + ca * r2 / dtc); |
glVertex2f(r2 * sa, r2 * ca); |
TXTR_COORD(0.5 - sa * r1 / dtc, 0.5 + ca * r1 / dtc); |
glVertex2f(r1 * sa, r1 * ca); |
} |
glEnd(); |
} |
r1 = r2; |
} |
break; |
} |
case GLU_LINE: |
{ |
GLint l, s; |
/* draw loops */ |
for (l = 0; l <= loops; l++) { |
GLfloat r = innerRadius + l * dr; |
glBegin(GL_LINE_LOOP); |
for (s = 0; s < slices; s++) { |
GLfloat a = s * da; |
glVertex2f(r * sin(a), r * cos(a)); |
} |
glEnd(); |
} |
/* draw spokes */ |
for (s = 0; s < slices; s++) { |
GLfloat a = s * da; |
GLfloat x = sin(a); |
GLfloat y = cos(a); |
glBegin(GL_LINE_STRIP); |
for (l = 0; l <= loops; l++) { |
GLfloat r = innerRadius + l * dr; |
glVertex2f(r * x, r * y); |
} |
glEnd(); |
} |
break; |
} |
case GLU_POINT: |
{ |
GLint s; |
glBegin(GL_POINTS); |
for (s = 0; s < slices; s++) { |
GLfloat a = s * da; |
GLfloat x = sin(a); |
GLfloat y = cos(a); |
GLint l; |
for (l = 0; l <= loops; l++) { |
GLfloat r = innerRadius * l * dr; |
glVertex2f(r * x, r * y); |
} |
} |
glEnd(); |
break; |
} |
case GLU_SILHOUETTE: |
{ |
if (innerRadius != 0.0) { |
GLfloat a; |
glBegin(GL_LINE_LOOP); |
for (a = 0.0; a < 2.0 * M_PI; a += da) { |
GLfloat x = innerRadius * sin(a); |
GLfloat y = innerRadius * cos(a); |
glVertex2f(x, y); |
} |
glEnd(); |
} |
{ |
GLfloat a; |
glBegin(GL_LINE_LOOP); |
for (a = 0; a < 2.0 * M_PI; a += da) { |
GLfloat x = outerRadius * sin(a); |
GLfloat y = outerRadius * cos(a); |
glVertex2f(x, y); |
} |
glEnd(); |
} |
break; |
} |
default: |
abort(); |
} |
} |
void GLAPIENTRY |
gluPartialDisk(GLUquadricObj * qobj, GLdouble innerRadius, |
GLdouble outerRadius, GLint slices, GLint loops, |
GLdouble startAngle, GLdouble sweepAngle) |
{ |
if (qobj->Normals != GLU_NONE) { |
if (qobj->Orientation == GLU_OUTSIDE) { |
glNormal3f(0.0, 0.0, +1.0); |
} |
else { |
glNormal3f(0.0, 0.0, -1.0); |
} |
} |
if (qobj->DrawStyle == GLU_POINT) { |
GLint loop, slice; |
GLdouble radius, delta_radius; |
GLdouble angle, delta_angle; |
delta_radius = (outerRadius - innerRadius) / (loops - 1); |
delta_angle = DEG_TO_RAD((sweepAngle) / (slices - 1)); |
glBegin(GL_POINTS); |
radius = innerRadius; |
for (loop = 0; loop < loops; loop++) { |
angle = DEG_TO_RAD(startAngle); |
for (slice = 0; slice < slices; slice++) { |
glVertex2d(radius * sin(angle), radius * cos(angle)); |
angle += delta_angle; |
} |
radius += delta_radius; |
} |
glEnd(); |
} |
else if (qobj->DrawStyle == GLU_LINE) { |
GLint loop, slice; |
GLdouble radius, delta_radius; |
GLdouble angle, delta_angle; |
delta_radius = (outerRadius - innerRadius) / loops; |
delta_angle = DEG_TO_RAD(sweepAngle / slices); |
/* draw rings */ |
radius = innerRadius; |
for (loop = 0; loop < loops; loop++) { |
angle = DEG_TO_RAD(startAngle); |
glBegin(GL_LINE_STRIP); |
for (slice = 0; slice <= slices; slice++) { |
glVertex2d(radius * sin(angle), radius * cos(angle)); |
angle += delta_angle; |
} |
glEnd(); |
radius += delta_radius; |
} |
/* draw spokes */ |
angle = DEG_TO_RAD(startAngle); |
for (slice = 0; slice <= slices; slice++) { |
radius = innerRadius; |
glBegin(GL_LINE_STRIP); |
for (loop = 0; loop < loops; loop++) { |
glVertex2d(radius * sin(angle), radius * cos(angle)); |
radius += delta_radius; |
} |
glEnd(); |
angle += delta_angle; |
} |
} |
else if (qobj->DrawStyle == GLU_SILHOUETTE) { |
GLint slice; |
GLdouble angle, delta_angle; |
delta_angle = DEG_TO_RAD(sweepAngle / slices); |
/* draw outer ring */ |
glBegin(GL_LINE_STRIP); |
angle = DEG_TO_RAD(startAngle); |
for (slice = 0; slice <= slices; slice++) { |
glVertex2d(outerRadius * sin(angle), outerRadius * cos(angle)); |
angle += delta_angle; |
} |
glEnd(); |
/* draw inner ring */ |
if (innerRadius > 0.0) { |
glBegin(GL_LINE_STRIP); |
angle = DEG_TO_RAD(startAngle); |
for (slice = 0; slice < slices; slice++) { |
glVertex2d(innerRadius * sin(angle), innerRadius * cos(angle)); |
angle += delta_angle; |
} |
glEnd(); |
} |
/* draw spokes */ |
if (sweepAngle < 360.0) { |
GLdouble stopAngle = startAngle + sweepAngle; |
glBegin(GL_LINES); |
glVertex2d(innerRadius * SIND(startAngle), |
innerRadius * COSD(startAngle)); |
glVertex2d(outerRadius * SIND(startAngle), |
outerRadius * COSD(startAngle)); |
glVertex2d(innerRadius * SIND(stopAngle), |
innerRadius * COSD(stopAngle)); |
glVertex2d(outerRadius * SIND(stopAngle), |
outerRadius * COSD(stopAngle)); |
glEnd(); |
} |
} |
else if (qobj->DrawStyle == GLU_FILL) { |
GLint loop, slice; |
GLdouble radius, delta_radius; |
GLdouble angle, delta_angle; |
delta_radius = (outerRadius - innerRadius) / loops; |
delta_angle = DEG_TO_RAD(sweepAngle / slices); |
radius = innerRadius; |
for (loop = 0; loop < loops; loop++) { |
glBegin(GL_QUAD_STRIP); |
angle = DEG_TO_RAD(startAngle); |
for (slice = 0; slice <= slices; slice++) { |
if (qobj->Orientation == GLU_OUTSIDE) { |
glVertex2d((radius + delta_radius) * sin(angle), |
(radius + delta_radius) * cos(angle)); |
glVertex2d(radius * sin(angle), radius * cos(angle)); |
} |
else { |
glVertex2d(radius * sin(angle), radius * cos(angle)); |
glVertex2d((radius + delta_radius) * sin(angle), |
(radius + delta_radius) * cos(angle)); |
} |
angle += delta_angle; |
} |
glEnd(); |
radius += delta_radius; |
} |
} |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/nurbs.c |
---|
0,0 → 1,629 |
/* $Id: nurbs.c,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* NURBS implementation written by Bogdan Sikorski (bogdan@cira.it) |
* See README2 for more info. |
*/ |
#ifdef PC_HEADER |
#include "all.h" |
#else |
#include <stdio.h> |
#include <stdlib.h> |
#include "gluP.h" |
#include "nurbs.h" |
#endif |
void |
call_user_error(GLUnurbsObj * nobj, GLenum error) |
{ |
nobj->error = error; |
if (nobj->error_callback != NULL) { |
(*(nobj->error_callback)) (error); |
} |
else { |
printf("NURBS error %d %s\n", error, (char *) gluErrorString(error)); |
} |
} |
GLUnurbsObj *GLAPIENTRY |
gluNewNurbsRenderer(void) |
{ |
GLUnurbsObj *n; |
GLfloat tmp_viewport[4]; |
GLint i, j; |
n = (GLUnurbsObj *) malloc(sizeof(GLUnurbsObj)); |
if (n) { |
/* init */ |
n->culling = GL_FALSE; |
n->nurbs_type = GLU_NURBS_NONE; |
n->error = GLU_NO_ERROR; |
n->error_callback = NULL; |
n->auto_load_matrix = GL_TRUE; |
n->sampling_tolerance = 50.0; |
n->parametric_tolerance = 0.5; |
n->u_step = n->v_step = 100; |
n->sampling_method = GLU_PATH_LENGTH; |
n->display_mode = GLU_FILL; |
/* in case the user doesn't supply the sampling matrices */ |
/* set projection and modelview to identity */ |
for (i = 0; i < 4; i++) |
for (j = 0; j < 4; j++) |
if (i == j) { |
n->sampling_matrices.model[i * 4 + j] = 1.0; |
n->sampling_matrices.proj[i * 4 + j] = 1.0; |
} |
else { |
n->sampling_matrices.model[i * 4 + j] = 0.0; |
n->sampling_matrices.proj[i * 4 + j] = 0.0; |
} |
/* and set the viewport sampling matrix to current ciewport */ |
glGetFloatv(GL_VIEWPORT, tmp_viewport); |
for (i = 0; i < 4; i++) |
n->sampling_matrices.viewport[i] = tmp_viewport[i]; |
n->trim = NULL; |
} |
return n; |
} |
void GLAPIENTRY |
gluDeleteNurbsRenderer(GLUnurbsObj * nobj) |
{ |
if (nobj) { |
free(nobj); |
} |
} |
void GLAPIENTRY |
gluLoadSamplingMatrices(GLUnurbsObj * nobj, |
const GLfloat modelMatrix[16], |
const GLfloat projMatrix[16], const GLint viewport[4]) |
{ |
GLint i; |
for (i = 0; i < 16; i++) { |
nobj->sampling_matrices.model[i] = modelMatrix[i]; |
nobj->sampling_matrices.proj[i] = projMatrix[i]; |
} |
for (i = 0; i < 4; i++) |
nobj->sampling_matrices.viewport[i] = viewport[i]; |
} |
void GLAPIENTRY |
gluNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat value) |
{ |
GLenum val; |
switch (property) { |
case GLU_SAMPLING_TOLERANCE: |
if (value <= 0.0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return; |
} |
nobj->sampling_tolerance = value; |
break; |
case GLU_PARAMETRIC_TOLERANCE: |
if (value <= 0.0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return; |
} |
nobj->parametric_tolerance = value; |
break; |
case GLU_U_STEP: |
if (value <= 0.0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return; |
} |
nobj->u_step = (GLint) value; |
break; |
case GLU_V_STEP: |
if (value <= 0.0) { |
call_user_error(nobj, GLU_INVALID_VALUE); |
return; |
} |
nobj->v_step = (GLint) value; |
break; |
case GLU_SAMPLING_METHOD: |
val = (GLenum) value; |
if (val != GLU_PATH_LENGTH && val != GLU_PARAMETRIC_ERROR |
&& val != GLU_DOMAIN_DISTANCE) { |
call_user_error(nobj, GLU_INVALID_ENUM); |
return; |
} |
nobj->sampling_method = val; |
break; |
case GLU_DISPLAY_MODE: |
val = (GLenum) value; |
if (val != GLU_FILL && val != GLU_OUTLINE_POLYGON |
&& val != GLU_OUTLINE_PATCH) { |
call_user_error(nobj, GLU_INVALID_ENUM); |
return; |
} |
if (nobj->nurbs_type == GLU_NURBS_CURVE) { |
call_user_error(nobj, GLU_NURBS_ERROR26); |
return; |
} |
nobj->display_mode = val; |
if (val == GLU_OUTLINE_PATCH) |
fprintf(stderr, |
"NURBS, for the moment, can display only in POLYGON mode\n"); |
break; |
case GLU_CULLING: |
val = (GLenum) value; |
if (val != GL_TRUE && val != GL_FALSE) { |
call_user_error(nobj, GLU_INVALID_ENUM); |
return; |
} |
nobj->culling = (GLboolean) value; |
break; |
case GLU_AUTO_LOAD_MATRIX: |
val = (GLenum) value; |
if (val != GL_TRUE && val != GL_FALSE) { |
call_user_error(nobj, GLU_INVALID_ENUM); |
return; |
} |
nobj->auto_load_matrix = (GLboolean) value; |
break; |
default: |
call_user_error(nobj, GLU_NURBS_ERROR26); |
} |
} |
void GLAPIENTRY |
gluGetNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat * value) |
{ |
switch (property) { |
case GLU_SAMPLING_TOLERANCE: |
*value = nobj->sampling_tolerance; |
break; |
case GLU_DISPLAY_MODE: |
*value = (GLfloat) (GLint) nobj->display_mode; |
break; |
case GLU_CULLING: |
*value = nobj->culling ? 1.0 : 0.0; |
break; |
case GLU_AUTO_LOAD_MATRIX: |
*value = nobj->auto_load_matrix ? 1.0 : 0.0; |
break; |
default: |
call_user_error(nobj, GLU_INVALID_ENUM); |
} |
} |
void GLAPIENTRY |
gluBeginCurve(GLUnurbsObj * nobj) |
{ |
if (nobj->nurbs_type == GLU_NURBS_CURVE) { |
call_user_error(nobj, GLU_NURBS_ERROR6); |
return; |
} |
nobj->nurbs_type = GLU_NURBS_CURVE; |
nobj->curve.geom.type = GLU_INVALID_ENUM; |
nobj->curve.color.type = GLU_INVALID_ENUM; |
nobj->curve.texture.type = GLU_INVALID_ENUM; |
nobj->curve.normal.type = GLU_INVALID_ENUM; |
} |
void GLAPIENTRY |
gluEndCurve(GLUnurbsObj * nobj) |
{ |
if (nobj->nurbs_type == GLU_NURBS_NONE) { |
call_user_error(nobj, GLU_NURBS_ERROR7); |
return; |
} |
if (nobj->curve.geom.type == GLU_INVALID_ENUM) { |
call_user_error(nobj, GLU_NURBS_ERROR8); |
nobj->nurbs_type = GLU_NURBS_NONE; |
return; |
} |
glPushAttrib((GLbitfield) (GL_EVAL_BIT | GL_ENABLE_BIT)); |
glDisable(GL_MAP1_VERTEX_3); |
glDisable(GL_MAP1_VERTEX_4); |
glDisable(GL_MAP1_INDEX); |
glDisable(GL_MAP1_COLOR_4); |
glDisable(GL_MAP1_NORMAL); |
glDisable(GL_MAP1_TEXTURE_COORD_1); |
glDisable(GL_MAP1_TEXTURE_COORD_2); |
glDisable(GL_MAP1_TEXTURE_COORD_3); |
glDisable(GL_MAP1_TEXTURE_COORD_4); |
glDisable(GL_MAP2_VERTEX_3); |
glDisable(GL_MAP2_VERTEX_4); |
glDisable(GL_MAP2_INDEX); |
glDisable(GL_MAP2_COLOR_4); |
glDisable(GL_MAP2_NORMAL); |
glDisable(GL_MAP2_TEXTURE_COORD_1); |
glDisable(GL_MAP2_TEXTURE_COORD_2); |
glDisable(GL_MAP2_TEXTURE_COORD_3); |
glDisable(GL_MAP2_TEXTURE_COORD_4); |
do_nurbs_curve(nobj); |
glPopAttrib(); |
nobj->nurbs_type = GLU_NURBS_NONE; |
} |
void GLAPIENTRY |
gluNurbsCurve(GLUnurbsObj * nobj, GLint nknots, GLfloat * knot, |
GLint stride, GLfloat * ctlarray, GLint order, GLenum type) |
{ |
if (nobj->nurbs_type == GLU_NURBS_TRIM) { |
#if 0 |
/* TODO: NOT IMPLEMENTED YET */ |
nurbs_trim *ptr1; |
trim_list *ptr2; |
if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) { |
call_user_error(nobj, GLU_NURBS_ERROR14); |
return; |
} |
for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next); |
if (ptr1->trim_loop) { |
for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next); |
if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return; |
} |
ptr2 = ptr2->next; |
} |
else { |
if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return; |
} |
ptr1->trim_loop = ptr2; |
} |
ptr2->trim_type = GLU_TRIM_NURBS; |
ptr2->curve.nurbs_curve.knot_count = nknots; |
ptr2->curve.nurbs_curve.knot = knot; |
ptr2->curve.nurbs_curve.stride = stride; |
ptr2->curve.nurbs_curve.ctrlarray = ctlarray; |
ptr2->curve.nurbs_curve.order = order; |
ptr2->curve.nurbs_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3); |
ptr2->curve.nurbs_curve.type = type; |
ptr2->next = NULL; |
#endif |
} |
else { |
if (type == GLU_MAP1_TRIM_2 || type == GLU_MAP1_TRIM_3) { |
call_user_error(nobj, GLU_NURBS_ERROR22); |
return; |
} |
if (nobj->nurbs_type != GLU_NURBS_CURVE) { |
call_user_error(nobj, GLU_NURBS_ERROR10); |
return; |
} |
switch (type) { |
case GL_MAP1_VERTEX_3: |
case GL_MAP1_VERTEX_4: |
if (nobj->curve.geom.type != GLU_INVALID_ENUM) { |
call_user_error(nobj, GLU_NURBS_ERROR8); |
return; |
} |
nobj->curve.geom.type = type; |
nobj->curve.geom.knot_count = nknots; |
nobj->curve.geom.knot = knot; |
nobj->curve.geom.stride = stride; |
nobj->curve.geom.ctrlarray = ctlarray; |
nobj->curve.geom.order = order; |
break; |
case GL_MAP1_INDEX: |
case GL_MAP1_COLOR_4: |
nobj->curve.color.type = type; |
nobj->curve.color.knot_count = nknots; |
nobj->curve.color.knot = knot; |
nobj->curve.color.stride = stride; |
nobj->curve.color.ctrlarray = ctlarray; |
nobj->curve.color.order = order; |
break; |
case GL_MAP1_NORMAL: |
nobj->curve.normal.type = type; |
nobj->curve.normal.knot_count = nknots; |
nobj->curve.normal.knot = knot; |
nobj->curve.normal.stride = stride; |
nobj->curve.normal.ctrlarray = ctlarray; |
nobj->curve.normal.order = order; |
break; |
case GL_MAP1_TEXTURE_COORD_1: |
case GL_MAP1_TEXTURE_COORD_2: |
case GL_MAP1_TEXTURE_COORD_3: |
case GL_MAP1_TEXTURE_COORD_4: |
nobj->curve.texture.type = type; |
nobj->curve.texture.knot_count = nknots; |
nobj->curve.texture.knot = knot; |
nobj->curve.texture.stride = stride; |
nobj->curve.texture.ctrlarray = ctlarray; |
nobj->curve.texture.order = order; |
break; |
default: |
call_user_error(nobj, GLU_INVALID_ENUM); |
} |
} |
} |
void GLAPIENTRY |
gluBeginSurface(GLUnurbsObj * nobj) |
{ |
switch (nobj->nurbs_type) { |
case GLU_NURBS_NONE: |
nobj->nurbs_type = GLU_NURBS_SURFACE; |
nobj->surface.geom.type = GLU_INVALID_ENUM; |
nobj->surface.color.type = GLU_INVALID_ENUM; |
nobj->surface.texture.type = GLU_INVALID_ENUM; |
nobj->surface.normal.type = GLU_INVALID_ENUM; |
break; |
case GLU_NURBS_TRIM: |
call_user_error(nobj, GLU_NURBS_ERROR16); |
break; |
case GLU_NURBS_SURFACE: |
case GLU_NURBS_NO_TRIM: |
case GLU_NURBS_TRIM_DONE: |
call_user_error(nobj, GLU_NURBS_ERROR27); |
break; |
case GLU_NURBS_CURVE: |
call_user_error(nobj, GLU_NURBS_ERROR6); |
break; |
} |
} |
void GLAPIENTRY |
gluEndSurface(GLUnurbsObj * nobj) |
{ |
switch (nobj->nurbs_type) { |
case GLU_NURBS_NONE: |
call_user_error(nobj, GLU_NURBS_ERROR13); |
break; |
case GLU_NURBS_TRIM: |
call_user_error(nobj, GLU_NURBS_ERROR12); |
break; |
case GLU_NURBS_TRIM_DONE: |
/* if(nobj->trim->trim_loop==NULL) |
{ |
call_user_error(nobj,GLU_NURBS_ERROR18); |
return; |
}*/ |
/* no break - fallthrough */ |
case GLU_NURBS_NO_TRIM: |
glPushAttrib((GLbitfield) |
(GL_EVAL_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT)); |
glDisable(GL_MAP2_VERTEX_3); |
glDisable(GL_MAP2_VERTEX_4); |
glDisable(GL_MAP2_INDEX); |
glDisable(GL_MAP2_COLOR_4); |
glDisable(GL_MAP2_NORMAL); |
glDisable(GL_MAP2_TEXTURE_COORD_1); |
glDisable(GL_MAP2_TEXTURE_COORD_2); |
glDisable(GL_MAP2_TEXTURE_COORD_3); |
glDisable(GL_MAP2_TEXTURE_COORD_4); |
/* glDisable(GL_MAP1_VERTEX_3); |
glDisable(GL_MAP1_VERTEX_4); |
glDisable(GL_MAP1_INDEX); |
glDisable(GL_MAP1_COLOR_4); |
glDisable(GL_MAP1_NORMAL); |
glDisable(GL_MAP1_TEXTURE_COORD_1); |
glDisable(GL_MAP1_TEXTURE_COORD_2); |
glDisable(GL_MAP1_TEXTURE_COORD_3); |
glDisable(GL_MAP1_TEXTURE_COORD_4);*/ |
do_nurbs_surface(nobj); |
glPopAttrib(); |
break; |
default: |
call_user_error(nobj, GLU_NURBS_ERROR8); |
} |
nobj->nurbs_type = GLU_NURBS_NONE; |
} |
void GLAPIENTRY |
gluNurbsSurface(GLUnurbsObj * nobj, |
GLint sknot_count, GLfloat * sknot, |
GLint tknot_count, GLfloat * tknot, |
GLint s_stride, GLint t_stride, |
GLfloat * ctrlarray, GLint sorder, GLint torder, GLenum type) |
{ |
if (nobj->nurbs_type == GLU_NURBS_NO_TRIM |
|| nobj->nurbs_type == GLU_NURBS_TRIM |
|| nobj->nurbs_type == GLU_NURBS_TRIM_DONE) { |
if (type == GL_MAP2_VERTEX_3 || type == GL_MAP2_VERTEX_4) { |
call_user_error(nobj, GLU_NURBS_ERROR8); |
return; |
} |
} |
else if (nobj->nurbs_type != GLU_NURBS_SURFACE) { |
call_user_error(nobj, GLU_NURBS_ERROR11); |
return; |
} |
switch (type) { |
case GL_MAP2_VERTEX_3: |
case GL_MAP2_VERTEX_4: |
nobj->surface.geom.sknot_count = sknot_count; |
nobj->surface.geom.sknot = sknot; |
nobj->surface.geom.tknot_count = tknot_count; |
nobj->surface.geom.tknot = tknot; |
nobj->surface.geom.s_stride = s_stride; |
nobj->surface.geom.t_stride = t_stride; |
nobj->surface.geom.ctrlarray = ctrlarray; |
nobj->surface.geom.sorder = sorder; |
nobj->surface.geom.torder = torder; |
nobj->surface.geom.type = type; |
nobj->nurbs_type = GLU_NURBS_NO_TRIM; |
break; |
case GL_MAP2_INDEX: |
case GL_MAP2_COLOR_4: |
nobj->surface.color.sknot_count = sknot_count; |
nobj->surface.color.sknot = sknot; |
nobj->surface.color.tknot_count = tknot_count; |
nobj->surface.color.tknot = tknot; |
nobj->surface.color.s_stride = s_stride; |
nobj->surface.color.t_stride = t_stride; |
nobj->surface.color.ctrlarray = ctrlarray; |
nobj->surface.color.sorder = sorder; |
nobj->surface.color.torder = torder; |
nobj->surface.color.type = type; |
break; |
case GL_MAP2_NORMAL: |
nobj->surface.normal.sknot_count = sknot_count; |
nobj->surface.normal.sknot = sknot; |
nobj->surface.normal.tknot_count = tknot_count; |
nobj->surface.normal.tknot = tknot; |
nobj->surface.normal.s_stride = s_stride; |
nobj->surface.normal.t_stride = t_stride; |
nobj->surface.normal.ctrlarray = ctrlarray; |
nobj->surface.normal.sorder = sorder; |
nobj->surface.normal.torder = torder; |
nobj->surface.normal.type = type; |
break; |
case GL_MAP2_TEXTURE_COORD_1: |
case GL_MAP2_TEXTURE_COORD_2: |
case GL_MAP2_TEXTURE_COORD_3: |
case GL_MAP2_TEXTURE_COORD_4: |
nobj->surface.texture.sknot_count = sknot_count; |
nobj->surface.texture.sknot = sknot; |
nobj->surface.texture.tknot_count = tknot_count; |
nobj->surface.texture.tknot = tknot; |
nobj->surface.texture.s_stride = s_stride; |
nobj->surface.texture.t_stride = t_stride; |
nobj->surface.texture.ctrlarray = ctrlarray; |
nobj->surface.texture.sorder = sorder; |
nobj->surface.texture.torder = torder; |
nobj->surface.texture.type = type; |
break; |
default: |
call_user_error(nobj, GLU_INVALID_ENUM); |
} |
} |
void GLAPIENTRY |
gluNurbsCallback(GLUnurbsObj * nobj, GLenum which, void (GLCALLBACK * fn) ()) |
{ |
nobj->error_callback = (void (GLCALLBACKPCAST) (GLenum)) fn; |
if (which != GLU_ERROR) |
call_user_error(nobj, GLU_INVALID_ENUM); |
} |
void GLAPIENTRY |
gluBeginTrim(GLUnurbsObj * nobj) |
{ |
#if 0 |
nurbs_trim *ptr; |
#endif |
if (nobj->nurbs_type != GLU_NURBS_TRIM_DONE) |
if (nobj->nurbs_type != GLU_NURBS_NO_TRIM) { |
call_user_error(nobj, GLU_NURBS_ERROR15); |
return; |
} |
nobj->nurbs_type = GLU_NURBS_TRIM; |
fprintf(stderr, "NURBS - trimming not supported yet\n"); |
#if 0 |
if ((ptr = (nurbs_trim *) malloc(sizeof(nurbs_trim))) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return; |
} |
if (nobj->trim) { |
nurbs_trim *tmp_ptr; |
for (tmp_ptr = nobj->trim; tmp_ptr->next; tmp_ptr = tmp_ptr->next); |
tmp_ptr->next = ptr; |
} |
else |
nobj->trim = ptr; |
ptr->trim_loop = NULL; |
ptr->segments = NULL; |
ptr->next = NULL; |
#endif |
} |
void GLAPIENTRY |
gluPwlCurve(GLUnurbsObj * nobj, GLint count, GLfloat * array, GLint stride, |
GLenum type) |
{ |
#if 0 |
nurbs_trim *ptr1; |
trim_list *ptr2; |
#endif |
if (nobj->nurbs_type == GLU_NURBS_CURVE) { |
call_user_error(nobj, GLU_NURBS_ERROR9); |
return; |
} |
if (nobj->nurbs_type == GLU_NURBS_NONE) { |
call_user_error(nobj, GLU_NURBS_ERROR19); |
return; |
} |
if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) { |
call_user_error(nobj, GLU_NURBS_ERROR14); |
return; |
} |
#if 0 |
for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next); |
if (ptr1->trim_loop) { |
for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next); |
if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return; |
} |
ptr2 = ptr2->next; |
} |
else { |
if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) { |
call_user_error(nobj, GLU_OUT_OF_MEMORY); |
return; |
} |
ptr1->trim_loop = ptr2; |
} |
ptr2->trim_type = GLU_TRIM_PWL; |
ptr2->curve.pwl_curve.pt_count = count; |
ptr2->curve.pwl_curve.ctrlarray = array; |
ptr2->curve.pwl_curve.stride = stride; |
ptr2->curve.pwl_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3); |
ptr2->curve.pwl_curve.type = type; |
ptr2->next = NULL; |
#endif |
} |
void GLAPIENTRY |
gluEndTrim(GLUnurbsObj * nobj) |
{ |
if (nobj->nurbs_type != GLU_NURBS_TRIM) { |
call_user_error(nobj, GLU_NURBS_ERROR17); |
return; |
} |
nobj->nurbs_type = GLU_NURBS_TRIM_DONE; |
} |
/shark/tags/rel_0_4/ports/mesa/src-glu/gluP.h |
---|
0,0 → 1,143 |
/* $Id: gluP.h,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file allows the GLU code to be compiled either with the Mesa |
* headers or with the real OpenGL headers. |
*/ |
#ifndef GLUP_H |
#define GLUP_H |
#include <GL/gl.h> |
#include <GL/glu.h> |
#include <string.h> |
#include <kernel/mem.h> //SHARK |
#include <stdlib.h> |
#if defined(_WIN32) && !defined(__WIN32__) |
# define __WIN32__ |
#endif |
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) |
# pragma warning( disable : 4068 ) /* unknown pragma */ |
# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ |
# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ |
# pragma warning( disable : 4127 ) /* conditional expression is constant */ |
# if defined(MESA_MINWARN) |
# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ |
# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ |
# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ |
# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ |
# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ |
# endif |
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ |
# define GLAPI __declspec(dllexport) |
# define WGLAPI __declspec(dllexport) |
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ |
# define GLAPI __declspec(dllimport) |
# define WGLAPI __declspec(dllimport) |
# else /* for use with static link lib build of Win32 edition only */ |
# define GLAPI extern |
# define WGLAPI __declspec(dllimport) |
# endif /* _STATIC_MESA support */ |
# define GLAPIENTRY __stdcall |
# define GLAPIENTRYP __stdcall * |
# define GLCALLBACK __stdcall |
# define GLCALLBACKP __stdcall * |
# if defined(__CYGWIN__) |
# define GLCALLBACKPCAST * |
# else |
# define GLCALLBACKPCAST __stdcall * |
# endif |
# define GLWINAPI __stdcall |
# define GLWINAPIV __cdecl |
#else |
/* non-Windows compilation */ |
# define GLAPI extern |
# define GLAPIENTRY |
# define GLAPIENTRYP * |
# define GLCALLBACK |
# define GLCALLBACKP * |
# define GLCALLBACKPCAST * |
# define GLWINAPI |
# define GLWINAPIV |
#endif /* WIN32 / CYGWIN bracket */ |
/* compatability guard so we don't need to change client code */ |
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) |
# define CALLBACK GLCALLBACK |
typedef int (GLAPIENTRY *PROC)(); |
typedef void *HGLRC; |
typedef void *HDC; |
typedef unsigned long COLORREF; |
#endif |
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) |
# define WGL_FONT_LINES 0 |
# define WGL_FONT_POLYGONS 1 |
#ifndef _GNU_H_WINDOWS32_FUNCTIONS |
# ifdef UNICODE |
# define wglUseFontBitmaps wglUseFontBitmapsW |
# define wglUseFontOutlines wglUseFontOutlinesW |
# else |
# define wglUseFontBitmaps wglUseFontBitmapsA |
# define wglUseFontOutlines wglUseFontOutlinesA |
# endif /* !UNICODE */ |
#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ |
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; |
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; |
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; |
#include <gl/mesa_wgl.h> |
#endif |
#ifndef GLU_TESS_ERROR9 |
/* If we're using the real OpenGL header files... */ |
# define GLU_TESS_ERROR9 100159 |
#endif |
#define GLU_NO_ERROR GL_NO_ERROR |
/* for Sun: */ |
#ifdef SUNOS4 |
#define MEMCPY( DST, SRC, BYTES) \ |
memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) ) |
#else |
#define MEMCPY( DST, SRC, BYTES) \ |
memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) ) |
#endif |
#ifndef NULL |
# define NULL 0 |
#endif |
#endif |
/shark/tags/rel_0_4/ports/mesa/src-glu/all.h |
---|
0,0 → 1,55 |
/* $Id: all.h,v 1.1 2003-02-28 11:42:07 pj Exp $ */ |
/* |
* Mesa 3-D graphics library |
* Version: 3.3 |
* Copyright (C) 1995-2000 Brian Paul |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
* License as published by the Free Software Foundation; either |
* version 2 of the License, or (at your option) any later version. |
* |
* This library is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* Library General Public License for more details. |
* |
* You should have received a copy of the GNU Library General Public |
* License along with this library; if not, write to the Free |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
*/ |
/* |
* This file includes all .h files needed for the GLU source code for |
* the purpose of precompiled headers. |
* |
* If the preprocessor symbol PCH is defined at compile time then each |
* of the .c files will #include "all.h" only, instead of a bunch of |
* individual .h files. |
*/ |
#ifndef GLU_ALL_H |
#define GLU_ALL_H |
#ifndef PC_HEADER |
This is an error. all.h should be included only if PCH is defined. |
#endif |
#include <assert.h> |
#include <math.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "GL/gl.h" |
#include "GL/glu.h" |
#include "gluP.h" |
#include "nurbs.h" |
#include "tess.h" |
#endif /*GLU_ALL_H */ |
/shark/tags/rel_0_4/ports/mesa/readme |
---|
0,0 → 1,16 |
Project: S.Ha.R.K. |
Mesa-5.0 Porting |
Coordinators: |
Giorgio Buttazzo <giorgio@sssup.it> |
Paolo Gai <pj@gandalf.sssup.it> |
Authors: |
Giacomo Guidi <giacomo@gandalf.sssup.it> |
This is the alpha version of the Mesa libraries (Release 5.0) porting |
under SHARK. |
/shark/tags/rel_0_4/ports/mesa/makefile |
---|
0,0 → 1,43 |
dirs := $(filter-out CVS cvs makefile readme include, $(wildcard *)) |
p_all := $(addprefix prefixall_, $(dirs)) |
p_install := $(addprefix prefixinstall_, $(dirs)) |
p_clean := $(addprefix prefixclean_, $(dirs)) |
pcleanall := $(addprefix prefixcleanall_, $(dirs)) |
pdepend := $(addprefix prefixdepend_, $(dirs)) |
.PHONY: all install clean cleanall depend |
install: $(p_install) |
all: $(p_all) |
clean: $(p_clean) |
cleanall: $(p_cleanall) |
depend: $(pdepend) |
prefixinstall_%: |
make -C $* install |
prefixall_%: |
make -C $* all |
prefixclean_%: |
make -C $* clean |
prefixcleanall_%: |
make -C $* cleanall |
prefixdepend_%: |
make -C $* depend |
/shark/tags/rel_0_4/ports/fftw/rfftw/makefile |
---|
3,6 → 3,7 |
ifndef BASE |
BASE=../../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = fftr |
/shark/tags/rel_0_4/ports/fftw/fftw/makefile |
---|
3,6 → 3,7 |
ifndef BASE |
BASE=../../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = fftc |
/shark/tags/rel_0_4/ports/fftw/makefile |
---|
1,12 → 1,6 |
.PHONY: all install clean cleanall depend |
all install:: |
@echo |
@echo These files have been ported to Hartik |
@echo You have to expect some warnings!!! |
@echo |
all install clean cleanall depend:: |
make -C rfftw $@ |
make -C fftw $@ |
/shark/tags/rel_0_4/ports/mpeg/makefile |
---|
7,6 → 7,7 |
ifndef BASE |
BASE=../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = mpeg |
/shark/tags/rel_0_4/ports/mpg123/mpg123.h |
---|
1,4 → 1,3 |
#define exit l1_exit |
/* |
* mpg123 defines |
* used source: musicout.h from mpegaudio package |
5,6 → 4,7 |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <signal.h> |
#include <math.h> |
/shark/tags/rel_0_4/ports/mpg123/makefile |
---|
7,6 → 7,7 |
ifndef BASE |
BASE=../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = mp3 |
/shark/tags/rel_0_4/ports/makefile |
---|
1,5 → 1,5 |
dirs := $(filter-out CVS makefile, $(wildcard *)) |
dirs := $(filter-out CVS cvs makefile, $(wildcard *)) |
p_all := $(addprefix prefixall_, $(dirs)) |
p_install := $(addprefix prefixinstall_, $(dirs)) |
p_clean := $(addprefix prefixclean_, $(dirs)) |
17,7 → 17,7 |
cleanall: $(p_cleanall) |
depend: $(p_depend) |
depend: $(pdepend) |
prefixinstall_%: |
make -C $* install |