mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 18:50:10 +01:00
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
This commit is contained in:
parent
d1ff1f6798
commit
cab974cf6c
126 changed files with 19488 additions and 6511 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $
|
||||
# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
|
|
@ -21,29 +21,9 @@ LIBDIR = ../lib
|
|||
|
||||
|
||||
CORE_SOURCES = \
|
||||
tnl/t_vtxfmt.c \
|
||||
tnl/t_bbox.c \
|
||||
tnl/t_clip.c \
|
||||
tnl/t_context.c \
|
||||
tnl/t_cva.c \
|
||||
tnl/t_debug.c \
|
||||
tnl/t_dlist.c \
|
||||
tnl/t_eval.c \
|
||||
tnl/t_fog.c \
|
||||
tnl/t_light.c \
|
||||
tnl/t_pipeline.c \
|
||||
tnl/t_shade.c \
|
||||
tnl/t_stages.c \
|
||||
tnl/t_texture.c \
|
||||
tnl/t_trans_elt.c \
|
||||
tnl/t_varray.c \
|
||||
tnl/t_vb.c \
|
||||
tnl/t_vbcull.c \
|
||||
tnl/t_vbindirect.c \
|
||||
tnl/t_vbrender.c \
|
||||
tnl/t_vbxform.c \
|
||||
api_loopback.c \
|
||||
api_noop.c \
|
||||
api_validate.c \
|
||||
accum.c \
|
||||
alpha.c \
|
||||
attrib.c \
|
||||
|
|
@ -106,6 +86,40 @@ CORE_SOURCES = \
|
|||
X86/common_x86.c \
|
||||
X86/3dnow.c \
|
||||
X86/katmai.c \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
math/m_debug_xform.c \
|
||||
math/m_eval.c \
|
||||
math/m_matrix.c \
|
||||
math/m_translate.c \
|
||||
math/m_vector.c \
|
||||
math/m_vertices.c \
|
||||
math/m_xform.c \
|
||||
array_cache/ac_context.c \
|
||||
array_cache/ac_import.c \
|
||||
tnl/t_array_api.c \
|
||||
tnl/t_array_import.c \
|
||||
tnl/t_context.c \
|
||||
tnl/t_eval_api.c \
|
||||
tnl/t_imm_alloc.c \
|
||||
tnl/t_imm_api.c \
|
||||
tnl/t_imm_debug.c \
|
||||
tnl/t_imm_dlist.c \
|
||||
tnl/t_imm_elt.c \
|
||||
tnl/t_imm_eval.c \
|
||||
tnl/t_imm_exec.c \
|
||||
tnl/t_imm_fixup.c \
|
||||
tnl/t_pipeline.c \
|
||||
tnl/t_vb_fog.c \
|
||||
tnl/t_vb_light.c \
|
||||
tnl/t_vb_material.c \
|
||||
tnl/t_vb_normals.c \
|
||||
tnl/t_vb_points.c \
|
||||
tnl/t_vb_render.c \
|
||||
tnl/t_vb_texgen.c \
|
||||
tnl/t_vb_texmat.c \
|
||||
tnl/t_vb_vertex.c \
|
||||
swrast/s_aaline.c \
|
||||
swrast/s_aatriangle.c \
|
||||
swrast/s_accum.c \
|
||||
|
|
@ -134,32 +148,18 @@ CORE_SOURCES = \
|
|||
swrast/s_stencil.c \
|
||||
swrast/s_texture.c \
|
||||
swrast/s_triangle.c \
|
||||
swrast/s_zoom.c \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
math/m_debug_xform.c \
|
||||
math/m_matrix.c \
|
||||
math/m_translate.c \
|
||||
math/m_vector.c \
|
||||
math/m_vertices.c \
|
||||
math/m_xform.c
|
||||
|
||||
swrast/s_zoom.c
|
||||
|
||||
|
||||
DRIVER_SOURCES = \
|
||||
FX/fxvtxfmt.c \
|
||||
FX/fxvtxprims.c \
|
||||
FX/fxapi.c \
|
||||
FX/fxdd.c \
|
||||
FX/fxddspan.c \
|
||||
FX/fxddtex.c \
|
||||
FX/fxfastpath.c \
|
||||
FX/fxpipeline.c \
|
||||
FX/fxsetup.c \
|
||||
FX/fxtexman.c \
|
||||
FX/fxtrifuncs.c \
|
||||
FX/fxvsetup.c \
|
||||
FX/fxtris.c \
|
||||
FX/fxvb.c \
|
||||
FX/fxglidew.c \
|
||||
X/glxapi.c \
|
||||
X/fakeglx.c \
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ void GGIMesaSwapBuffers(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void gl_ggiUpdateState(GLcontext *ctx)
|
||||
static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state)
|
||||
{
|
||||
void *func;
|
||||
|
||||
|
|
@ -589,9 +589,9 @@ static void gl_ggiUpdateState(GLcontext *ctx)
|
|||
/* Propogate statechange information to swrast and swrast_setup
|
||||
* modules. The GGI driver has no internal GL-dependent state.
|
||||
*/
|
||||
_swrast_InvalidateState(ctx, ctx->NewState);
|
||||
_swsetup_InvalidateState(ctx, ctx->NewState);
|
||||
_tnl_InvalidateState(ctx, ctx->NewState);
|
||||
_swrast_InvalidateState(ctx, new_state);
|
||||
_swsetup_InvalidateState(ctx, new_state);
|
||||
_tnl_InvalidateState(ctx, new_state);
|
||||
|
||||
func = (void *)CTX_OPMESA(ctx)->update_state;
|
||||
|
||||
|
|
|
|||
|
|
@ -581,55 +581,52 @@ void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext fxMesa)
|
|||
*/
|
||||
void GLAPIENTRY fxMesaDestroyContext(fxMesaContext fxMesa)
|
||||
{
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxMesaDestroyContext()\n");
|
||||
}
|
||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||
fprintf(stderr,"fxmesa: fxMesaDestroyContext()\n");
|
||||
}
|
||||
|
||||
if(fxMesa) {
|
||||
_mesa_destroy_visual(fxMesa->glVis);
|
||||
_mesa_destroy_context(fxMesa->glCtx);
|
||||
_mesa_destroy_framebuffer(fxMesa->glBuffer);
|
||||
if(!fxMesa)
|
||||
return;
|
||||
|
||||
glbTotNumCtx--;
|
||||
|
||||
fxCloseHardware();
|
||||
FX_grSstWinClose(fxMesa->glideContext);
|
||||
|
||||
if(fxMesa->verbose) {
|
||||
if(fxMesa->verbose) {
|
||||
fprintf(stderr,"Misc Stats:\n");
|
||||
fprintf(stderr," # swap buffer: %u\n",fxMesa->stats.swapBuffer);
|
||||
|
||||
if(!fxMesa->stats.swapBuffer)
|
||||
fxMesa->stats.swapBuffer=1;
|
||||
fxMesa->stats.swapBuffer=1;
|
||||
|
||||
fprintf(stderr,"Textures Stats:\n");
|
||||
fprintf(stderr," Free texture memory on TMU0: %d:\n",fxMesa->freeTexMem[FX_TMU0]);
|
||||
if(fxMesa->haveTwoTMUs)
|
||||
fprintf(stderr," Free texture memory on TMU1: %d:\n",fxMesa->freeTexMem[FX_TMU1]);
|
||||
fprintf(stderr," Free texture memory on TMU1: %d:\n",fxMesa->freeTexMem[FX_TMU1]);
|
||||
fprintf(stderr," # request to TMM to upload a texture objects: %u\n",
|
||||
fxMesa->stats.reqTexUpload);
|
||||
fxMesa->stats.reqTexUpload);
|
||||
fprintf(stderr," # request to TMM to upload a texture objects per swapbuffer: %.2f\n",
|
||||
fxMesa->stats.reqTexUpload/(float)fxMesa->stats.swapBuffer);
|
||||
fxMesa->stats.reqTexUpload/(float)fxMesa->stats.swapBuffer);
|
||||
fprintf(stderr," # texture objects uploaded: %u\n",
|
||||
fxMesa->stats.texUpload);
|
||||
fxMesa->stats.texUpload);
|
||||
fprintf(stderr," # texture objects uploaded per swapbuffer: %.2f\n",
|
||||
fxMesa->stats.texUpload/(float)fxMesa->stats.swapBuffer);
|
||||
fxMesa->stats.texUpload/(float)fxMesa->stats.swapBuffer);
|
||||
fprintf(stderr," # MBs uploaded to texture memory: %.2f\n",
|
||||
fxMesa->stats.memTexUpload/(float)(1<<20));
|
||||
fxMesa->stats.memTexUpload/(float)(1<<20));
|
||||
fprintf(stderr," # MBs uploaded to texture memory per swapbuffer: %.2f\n",
|
||||
(fxMesa->stats.memTexUpload/(float)fxMesa->stats.swapBuffer)/(float)(1<<20));
|
||||
}
|
||||
if (fxMesa->state)
|
||||
free(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
free(fxMesa->fogTable);
|
||||
fxTMClose(fxMesa);
|
||||
|
||||
free(fxMesa);
|
||||
}
|
||||
(fxMesa->stats.memTexUpload/(float)fxMesa->stats.swapBuffer)/(float)(1<<20));
|
||||
}
|
||||
|
||||
if(fxMesa==fxMesaCurrentCtx)
|
||||
fxMesaCurrentCtx=NULL;
|
||||
glbTotNumCtx--;
|
||||
|
||||
fxDDDestroyFxMesaContext(fxMesa);
|
||||
_mesa_destroy_visual(fxMesa->glVis);
|
||||
_mesa_destroy_context(fxMesa->glCtx);
|
||||
_mesa_destroy_framebuffer(fxMesa->glBuffer);
|
||||
|
||||
fxCloseHardware();
|
||||
FX_grSstWinClose(fxMesa->glideContext);
|
||||
|
||||
free(fxMesa);
|
||||
|
||||
if(fxMesa==fxMesaCurrentCtx)
|
||||
fxMesaCurrentCtx=NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "tnl/tnl.h"
|
||||
#include "array_cache/acache.h"
|
||||
|
||||
/* These lookup table are used to extract RGB values in [0,255] from
|
||||
* 16-bit pixel values.
|
||||
|
|
@ -644,9 +645,38 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static const struct gl_pipeline_stage * const fx_pipeline[] = {
|
||||
&_tnl_update_material_stage,
|
||||
&_tnl_vertex_transform_stage,
|
||||
&_tnl_normal_transform_stage,
|
||||
&_tnl_lighting_stage, /* OMIT: fog coordinate stage */
|
||||
&_tnl_texgen_stage,
|
||||
&_tnl_texture_transform_stage,
|
||||
&_tnl_point_attenuation_stage,
|
||||
&_fx_fast_render_stage, /* ADD: the fastpath as a render stage */
|
||||
&_tnl_render_stage, /* KEEP: the old render stage for fallbacks */
|
||||
0
|
||||
};
|
||||
#else
|
||||
/* Need to turn off tnl fogging, both the stage and the clipping in
|
||||
* _tnl_render_stage. Could insert a dummy stage that did nothing but
|
||||
* provided storage that clipping could spin on?
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
||||
{
|
||||
static int firsttime = 1;
|
||||
|
||||
if (firsttime) {
|
||||
fxDDSetupInit();
|
||||
fxDDTrifuncInit();
|
||||
/* fxDDFastPathInit(); */
|
||||
firsttime = 0;
|
||||
}
|
||||
|
||||
FX_setupGrVertexLayout();
|
||||
|
||||
|
|
@ -734,18 +764,14 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
|||
fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
|
||||
fxMesa->new_state = _NEW_ALL;
|
||||
|
||||
fxDDSetupInit();
|
||||
fxDDTrifuncInit();
|
||||
fxDDFastPathInit();
|
||||
|
||||
|
||||
/* Initialize the software rasterizer and helper modules.
|
||||
*/
|
||||
fxMesa->glCtx->Driver.RegisterVB = fxDDRegisterVB;
|
||||
|
||||
_swrast_CreateContext( fxMesa->glCtx );
|
||||
_swsetup_CreateContext( fxMesa->glCtx );
|
||||
_ac_CreateContext( fxMesa->glCtx );
|
||||
_tnl_CreateContext( fxMesa->glCtx );
|
||||
_swsetup_CreateContext( fxMesa->glCtx );
|
||||
|
||||
fxAllocVB( fxMesa->glCtx );
|
||||
|
||||
fxSetupDDPointers(fxMesa->glCtx);
|
||||
|
||||
|
|
@ -755,22 +781,36 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
|
|||
_swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE );
|
||||
|
||||
fxDDInitExtensions(fxMesa->glCtx);
|
||||
|
||||
#ifdef FXVTXFMT
|
||||
fxDDInitVtxfmt(fxMesa->glCtx);
|
||||
#endif
|
||||
|
||||
FX_grGlideGetState((GrState*)fxMesa->state);
|
||||
|
||||
/* XXX Fix me too: need to have the 'struct dd' prepared prior to
|
||||
* creating the context... The below is broken if you try to insert
|
||||
* new stages.
|
||||
*/
|
||||
fxDDRegisterPipelineStages( fxMesa->glCtx );
|
||||
|
||||
/* Run the config file */
|
||||
_mesa_context_initialize( fxMesa->glCtx );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Undo the above.
|
||||
*/
|
||||
void fxDDDestroyFxMesaContext( fxMesaContext fxMesa )
|
||||
{
|
||||
_swsetup_DestroyContext( fxMesa->glCtx );
|
||||
_tnl_DestroyContext( fxMesa->glCtx );
|
||||
_ac_DestroyContext( fxMesa->glCtx );
|
||||
_swrast_DestroyContext( fxMesa->glCtx );
|
||||
|
||||
if (fxMesa->state)
|
||||
free(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
free(fxMesa->fogTable);
|
||||
fxTMClose(fxMesa);
|
||||
fxFreeVB(fxMesa->glCtx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -784,6 +824,9 @@ void fxDDInitExtensions( GLcontext *ctx )
|
|||
gl_extensions_disable(ctx, "GL_EXT_blend_color");
|
||||
gl_extensions_disable(ctx, "GL_EXT_fog_coord");
|
||||
|
||||
if (1)
|
||||
gl_extensions_disable(ctx, "GL_EXT_point_parameters");
|
||||
|
||||
gl_extensions_add(ctx, GL_TRUE, "3DFX_set_global_palette", 0);
|
||||
|
||||
if (!fxMesa->haveTwoTMUs)
|
||||
|
|
@ -922,14 +965,14 @@ static void update_texture_scales( GLcontext *ctx )
|
|||
}
|
||||
}
|
||||
|
||||
static void fxDDUpdateDDPointers(GLcontext *ctx)
|
||||
static void fxDDUpdateDDPointers(GLcontext *ctx, GLuint new_state)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
GLuint new_state = ctx->NewState;
|
||||
|
||||
_swrast_InvalidateState( ctx, new_state );
|
||||
_swsetup_InvalidateState( ctx, new_state );
|
||||
_ac_InvalidateState( ctx, new_state );
|
||||
_tnl_InvalidateState( ctx, new_state );
|
||||
_swsetup_InvalidateState( ctx, new_state );
|
||||
|
||||
/* Recalculate fog table on projection matrix changes. This used to
|
||||
* be triggered by the NearFar callback.
|
||||
|
|
@ -954,22 +997,22 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
|
|||
fxDDChooseRenderState( ctx );
|
||||
|
||||
if (new_state & _FX_NEW_SETUP_FUNCTION)
|
||||
ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx);
|
||||
ctx->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts;
|
||||
|
||||
if (new_state & _NEW_TEXTURE)
|
||||
update_texture_scales( ctx );
|
||||
|
||||
}
|
||||
|
||||
#ifdef FXVTXFMT
|
||||
if (fxMesa->allow_vfmt) {
|
||||
if (new_state & _NEW_LIGHT)
|
||||
fx_update_lighting( ctx );
|
||||
|
||||
if (new_state & _FX_NEW_VTXFMT)
|
||||
fxDDCheckVtxfmt( ctx );
|
||||
else if (fxMesa->vtxfmt_fallback_count > 1)
|
||||
fxMesa->vtxfmt_fallback_count--;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1006,6 +1049,7 @@ void fxSetupDDPointers(GLcontext *ctx)
|
|||
|
||||
ctx->Driver.RenderStart=fxSetupFXUnits;
|
||||
ctx->Driver.RenderFinish=_swrast_flush;
|
||||
ctx->Driver.ResetLineStipple=_swrast_ResetLineStipple;
|
||||
|
||||
ctx->Driver.TexImage2D = fxDDTexImage2D;
|
||||
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
|
||||
|
|
@ -1028,14 +1072,10 @@ void fxSetupDDPointers(GLcontext *ctx)
|
|||
ctx->Driver.ShadeModel=fxDDShadeModel;
|
||||
ctx->Driver.Enable=fxDDEnable;
|
||||
|
||||
ctx->Driver.RegisterVB=fxDDRegisterVB;
|
||||
ctx->Driver.UnregisterVB=fxDDUnregisterVB;
|
||||
|
||||
if (!getenv("FX_NO_FAST"))
|
||||
ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline;
|
||||
|
||||
|
||||
fxSetupDDSpanPointers(ctx);
|
||||
fxDDUpdateDDPointers(ctx);
|
||||
fxDDUpdateDDPointers(ctx,~0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -333,11 +333,6 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj)
|
|||
|
||||
FREE(ti);
|
||||
tObj->DriverData = NULL;
|
||||
|
||||
/* Pushed into core: Set _NEW_TEXTURE whenever a bound texture is
|
||||
* deleted (changes bound texture id).
|
||||
*/
|
||||
/* ctx->NewState |= _NEW_TEXTURE; */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -824,6 +819,23 @@ static GLboolean fxIsTexSupported(GLenum target, GLint internalFormat,
|
|||
/**** NEW TEXTURE IMAGE FUNCTIONS ****/
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
static void PrintTexture(int w, int h, int c, const GLubyte *data)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
if (c==2)
|
||||
printf("%02x %02x ", data[0], data[1]);
|
||||
else if (c==3)
|
||||
printf("%02x %02x %02x ", data[0], data[1], data[2]);
|
||||
data += c;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum format, GLenum type, const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing,
|
||||
|
|
@ -960,6 +972,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ti->validated && ti->isInTM) {
|
||||
/*printf("reloadmipmaplevels\n");*/
|
||||
fxTMReloadMipMapLevel(fxMesa, texObj, level);
|
||||
|
|
@ -1082,21 +1095,6 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
|
|||
}
|
||||
|
||||
|
||||
static void PrintTexture(int w, int h, int c, const GLubyte *data)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
if (c==2)
|
||||
printf("%02x %02x ", data[0], data[1]);
|
||||
else if (c==3)
|
||||
printf("%02x %02x %02x ", data[0], data[1], data[2]);
|
||||
data += c;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
|
||||
const struct gl_texture_object *texObj,
|
||||
|
|
|
|||
|
|
@ -142,8 +142,9 @@ typedef void (*vfmt_interpolate_func)( GLfloat t,
|
|||
#define SETUP_TMU0 0x1
|
||||
#define SETUP_TMU1 0x2
|
||||
#define SETUP_RGBA 0x4
|
||||
#define SETUP_XYZW 0x8
|
||||
#define MAX_SETUP 0x10
|
||||
#define SETUP_SNAP 0x8
|
||||
#define SETUP_XYZW 0x10
|
||||
#define MAX_SETUP 0x20
|
||||
|
||||
|
||||
#define FX_NUM_TMU 2
|
||||
|
|
@ -291,19 +292,7 @@ typedef struct {
|
|||
#define FX_NEW_COLOR_MASK 0x40
|
||||
#define FX_NEW_CULL 0x80
|
||||
|
||||
/* FX struct stored in VB->driver_data.
|
||||
*/
|
||||
struct tfxMesaVertexBuffer {
|
||||
GLvector1ui clipped_elements;
|
||||
|
||||
fxVertex *verts;
|
||||
fxVertex *last_vert;
|
||||
void *vert_store;
|
||||
|
||||
GLuint size;
|
||||
};
|
||||
|
||||
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
|
||||
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
|
||||
#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->_Current)
|
||||
|
||||
|
|
@ -350,10 +339,13 @@ struct tfxMesaVertexBuffer {
|
|||
|
||||
/* Covers the state referenced in fxDDCheckVtxfmt.
|
||||
*/
|
||||
#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \
|
||||
_NEW_TEXTURE_MATRIX | \
|
||||
_NEW_TRANSFORM | \
|
||||
_NEW_LIGHT | \
|
||||
#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \
|
||||
_NEW_TEXTURE_MATRIX | \
|
||||
_NEW_TRANSFORM | \
|
||||
_NEW_LIGHT | \
|
||||
_NEW_PROJECTION | \
|
||||
_NEW_MODELVIEW | \
|
||||
_TNL_NEW_NEED_EYE_COORDS | \
|
||||
_FX_NEW_RENDERSTATE)
|
||||
|
||||
|
||||
|
|
@ -365,10 +357,10 @@ extern GLubyte FX_PixelToG[0x10000];
|
|||
extern GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
|
||||
typedef void (*fx_tri_func)( GLcontext *, const fxVertex *, const fxVertex *, const fxVertex * );
|
||||
typedef void (*fx_tri_func)( GLcontext *, const fxVertex *,
|
||||
const fxVertex *, const fxVertex * );
|
||||
typedef void (*fx_line_func)( GLcontext *, const fxVertex *, const fxVertex * );
|
||||
typedef void (*fx_point_func)( GLcontext *, const fxVertex * );
|
||||
typedef void (*fxRenderEltsFunc)( struct vertex_buffer * );
|
||||
|
||||
struct tfxMesaContext {
|
||||
GuTexPalette glbPalette;
|
||||
|
|
@ -392,18 +384,11 @@ struct tfxMesaContext {
|
|||
tfxUnitsState unitsState;
|
||||
tfxUnitsState restoreUnitsState; /* saved during multipass */
|
||||
|
||||
GLuint tmu_source[FX_NUM_TMU];
|
||||
GLuint tex_dest[MAX_TEXTURE_UNITS];
|
||||
GLuint render_index;
|
||||
GLuint setupindex;
|
||||
GLuint setupdone;
|
||||
GLuint stw_hint_state; /* for grHints */
|
||||
GLuint is_in_hardware;
|
||||
|
||||
GLuint new_state;
|
||||
GLuint using_fast_path, passes, multipass;
|
||||
|
||||
/* Texture Memory Manager Data */
|
||||
|
||||
/* Texture Memory Manager Data
|
||||
*/
|
||||
GLuint texBindNumber;
|
||||
GLint tmuSrc;
|
||||
GLuint lastUnitsMode;
|
||||
|
|
@ -417,14 +402,28 @@ struct tfxMesaContext {
|
|||
GrFog_t *fogTable;
|
||||
GLint textureAlign;
|
||||
|
||||
/* Acc. functions */
|
||||
/* Vertex building and storage:
|
||||
*/
|
||||
GLuint tmu_source[FX_NUM_TMU];
|
||||
GLuint tex_dest[MAX_TEXTURE_UNITS];
|
||||
GLuint setupindex;
|
||||
GLuint setup_gone; /* for multipass */
|
||||
GLuint stw_hint_state; /* for grHints */
|
||||
fxVertex *verts;
|
||||
|
||||
|
||||
/* Rasterization:
|
||||
*/
|
||||
GLuint render_index;
|
||||
GLuint passes, multipass;
|
||||
GLuint is_in_hardware;
|
||||
|
||||
/* Current rasterization functions
|
||||
*/
|
||||
fx_point_func draw_point;
|
||||
fx_line_func draw_line;
|
||||
fx_tri_func draw_tri;
|
||||
|
||||
fxRenderEltsFunc RenderElementsRaw;
|
||||
|
||||
/* System to turn culling on/off for tris/lines/points.
|
||||
*/
|
||||
fx_point_func initial_point;
|
||||
|
|
@ -435,6 +434,8 @@ struct tfxMesaContext {
|
|||
fx_line_func subsequent_line;
|
||||
fx_tri_func subsequent_tri;
|
||||
|
||||
/* Keep texture scales somewhere handy:
|
||||
*/
|
||||
GLfloat s0scale;
|
||||
GLfloat s1scale;
|
||||
GLfloat t0scale;
|
||||
|
|
@ -445,8 +446,9 @@ struct tfxMesaContext {
|
|||
GLfloat inv_t0scale;
|
||||
GLfloat inv_t1scale;
|
||||
|
||||
/* Glide stuff
|
||||
*/
|
||||
tfxStats stats;
|
||||
|
||||
void *state;
|
||||
|
||||
/* Options */
|
||||
|
|
@ -476,7 +478,6 @@ struct tfxMesaContext {
|
|||
GLboolean allow_vfmt;
|
||||
GLvertexformat vtxfmt;
|
||||
fxClipVertex current;
|
||||
fxClipVertex verts[4];
|
||||
fxClipVertex *vert; /* points into verts[] */
|
||||
void (*fire_on_vertex)( GLcontext * );
|
||||
void (*fire_on_end)( GLcontext * );
|
||||
|
|
@ -492,29 +493,42 @@ struct tfxMesaContext {
|
|||
|
||||
GLuint accel_light;
|
||||
GLfloat basecolor[4];
|
||||
|
||||
|
||||
/* Projected vertices, fastpath data:
|
||||
*/
|
||||
GLvector1ui clipped_elements;
|
||||
fxVertex *last_vert;
|
||||
GLuint size;
|
||||
};
|
||||
|
||||
typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
|
||||
typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint, GLuint);
|
||||
|
||||
extern GrHwConfiguration glbHWConfig;
|
||||
extern int glbCurrentBoard;
|
||||
|
||||
extern void fxPrintSetupFlags( const char *msg, GLuint flags );
|
||||
extern void fxSetupFXUnits(GLcontext *);
|
||||
extern void fxSetupDDPointers(GLcontext *);
|
||||
|
||||
/* fxvsetup:
|
||||
*/
|
||||
extern void fxDDSetupInit(void);
|
||||
extern void fxDDCvaInit(void);
|
||||
extern void fxDDTrifuncInit(void);
|
||||
extern void fxDDFastPathInit(void);
|
||||
extern void fxAllocVB( GLcontext *ctx );
|
||||
extern void fxFreeVB( GLcontext *ctx );
|
||||
extern void fxPrintSetupFlags( const char *msg, GLuint flags );
|
||||
extern void fx_BuildProjVerts( GLcontext *ctx,
|
||||
GLuint start, GLuint count,
|
||||
GLuint newinputs );
|
||||
extern void fx_validate_BuildProjVerts(GLcontext *ctx,
|
||||
GLuint start, GLuint count,
|
||||
GLuint newinputs );
|
||||
|
||||
/* fxtrifuncs:
|
||||
*/
|
||||
extern void fxDDTrifuncInit(void);
|
||||
extern void fxDDChooseRenderState( GLcontext *ctx );
|
||||
|
||||
|
||||
extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *);
|
||||
|
||||
extern void fxDDRenderInit(GLcontext *);
|
||||
|
||||
extern void fxUpdateDDSpanPointers(GLcontext *);
|
||||
extern void fxSetupDDSpanPointers(GLcontext *);
|
||||
|
||||
|
|
@ -550,18 +564,6 @@ extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
|
|||
extern void fxDDDepthMask(GLcontext *, GLboolean);
|
||||
extern void fxDDDepthFunc(GLcontext *, GLenum);
|
||||
|
||||
extern void fxDDRegisterVB( struct vertex_buffer *VB );
|
||||
extern void fxDDUnregisterVB( struct vertex_buffer *VB );
|
||||
extern void fxDDResizeVB( struct vertex_buffer *VB, GLuint size );
|
||||
|
||||
extern void fxDDPartialRasterSetup( struct vertex_buffer *VB );
|
||||
|
||||
extern void fxDDDoRasterSetup( struct vertex_buffer *VB );
|
||||
|
||||
extern void fxDDRegisterPipelineStages( GLcontext *ctx );
|
||||
|
||||
extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx );
|
||||
|
||||
extern void fxDDInitExtensions( GLcontext *ctx );
|
||||
|
||||
#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
|
||||
|
|
@ -601,8 +603,6 @@ extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
|
|||
const GLint x[], const GLint y[],
|
||||
GLdepth depth[]);
|
||||
|
||||
extern void fxDDFastPath( struct vertex_buffer *VB );
|
||||
|
||||
extern void fxDDShadeModel(GLcontext *ctx, GLenum mode);
|
||||
|
||||
extern void fxDDCullFace(GLcontext *ctx, GLenum mode);
|
||||
|
|
@ -611,9 +611,10 @@ extern void fxDDFrontFace(GLcontext *ctx, GLenum mode);
|
|||
extern void fxPrintRenderState( const char *msg, GLuint state );
|
||||
extern void fxPrintHintState( const char *msg, GLuint state );
|
||||
|
||||
extern void fxDDDoRenderVB( struct vertex_buffer *VB );
|
||||
|
||||
extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
|
||||
extern void fxDDDestroyFxMesaContext( fxMesaContext fxMesa );
|
||||
|
||||
|
||||
|
||||
|
||||
extern void fxSetScissorValues(GLcontext *ctx);
|
||||
|
|
@ -622,6 +623,9 @@ extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
|
|||
GLint where);
|
||||
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
|
||||
|
||||
|
||||
/* fxvtxfmt:
|
||||
*/
|
||||
extern void fxDDCheckVtxfmt( GLcontext *ctx );
|
||||
extern void fx_update_lighting( GLcontext *ctx );
|
||||
extern void fxDDInitVtxfmt( GLcontext *ctx );
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static void fxSetupScissor(GLcontext *ctx);
|
|||
static void fxSetupCull(GLcontext *ctx);
|
||||
static void fx_print_state_flags( const char *msg, GLuint flags);
|
||||
/*static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint);*/
|
||||
static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
|
||||
static GLboolean fxMultipassTexture( GLcontext *, GLuint );
|
||||
|
||||
static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
|
||||
{
|
||||
|
|
@ -1671,7 +1671,7 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
|
|||
case 2:
|
||||
/* Reset everything back to normal */
|
||||
fxMesa->unitsState = fxMesa->restoreUnitsState;
|
||||
fxMesa->setupdone &= XXX;
|
||||
fxMesa->setup_gone |= XXX;
|
||||
fxSetupTextureSingleTMU(ctx, XXX);
|
||||
fxSetupBlend(ctx);
|
||||
fxSetupDepthTest(ctx);
|
||||
|
|
@ -1694,12 +1694,12 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
|
|||
* voodoo 1. In all other cases for both voodoo 1 and 2, we fall back
|
||||
* to software rendering, satisfying the spec if not the user.
|
||||
*/
|
||||
static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass )
|
||||
static GLboolean fxMultipassTexture( GLcontext *ctx, GLuint pass )
|
||||
{
|
||||
GLcontext *ctx = VB->ctx;
|
||||
fxVertex *v = FX_DRIVER_DATA(VB)->verts;
|
||||
fxVertex *last = FX_DRIVER_DATA(VB)->last_vert;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
fxVertex *v = fxMesa->verts;
|
||||
fxVertex *last = fxMesa->verts + tnl->vb.Count;
|
||||
|
||||
switch (pass) {
|
||||
case 1:
|
||||
|
|
@ -1742,7 +1742,7 @@ static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass )
|
|||
*/
|
||||
fxMesa->tmu_source[0] = 0;
|
||||
fxMesa->unitsState = fxMesa->restoreUnitsState;
|
||||
fxMesa->setupdone &= ~SETUP_TMU0;
|
||||
fxMesa->setup_gone |= SETUP_TMU0;
|
||||
fxSetupTextureSingleTMU( ctx, 0 );
|
||||
fxSetupBlend( ctx );
|
||||
fxSetupDepthTest( ctx );
|
||||
|
|
|
|||
568
src/mesa/drivers/glide/fxtris.c
Normal file
568
src/mesa/drivers/glide/fxtris.c
Normal file
|
|
@ -0,0 +1,568 @@
|
|||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
|
||||
#if defined(FX)
|
||||
|
||||
#include "mmath.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
||||
#include "tnl/t_context.h"
|
||||
|
||||
#include "fxdrv.h"
|
||||
#include "fxglidew.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
fx_draw_point( GLcontext *ctx, const fxVertex *v )
|
||||
{
|
||||
GLfloat sz = ctx->Point._Size;
|
||||
|
||||
if ( sz <= 1.0 )
|
||||
{
|
||||
grDrawPoint( &(v->v) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GrVertex verts[4];
|
||||
|
||||
sz *= .5;
|
||||
|
||||
verts[0] = v->v;
|
||||
verts[1] = v->v;
|
||||
verts[2] = v->v;
|
||||
verts[3] = v->v;
|
||||
|
||||
verts[0].x = v->v.x - sz;
|
||||
verts[0].y = v->v.y - sz;
|
||||
|
||||
verts[1].x = v->v.x + sz;
|
||||
verts[1].y = v->v.y - sz;
|
||||
|
||||
verts[2].x = v->v.x + sz;
|
||||
verts[2].y = v->v.y + sz;
|
||||
|
||||
verts[3].x = v->v.x - sz;
|
||||
verts[3].y = v->v.y + sz;
|
||||
|
||||
grDrawTriangle( &verts[0], &verts[1], &verts[3] );
|
||||
grDrawTriangle( &verts[1], &verts[2], &verts[3] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
|
||||
{
|
||||
float width = ctx->Line.Width;
|
||||
|
||||
if ( width <= 1.0 )
|
||||
{
|
||||
grDrawLine( &(v0->v), &(v1->v) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GrVertex verts[4];
|
||||
float dx, dy, ix, iy;
|
||||
|
||||
dx = v0->v.x - v1->v.x;
|
||||
dy = v0->v.y - v1->v.y;
|
||||
|
||||
if (dx * dx > dy * dy) {
|
||||
iy = width * .5;
|
||||
ix = 0;
|
||||
} else {
|
||||
iy = 0;
|
||||
ix = width * .5;
|
||||
}
|
||||
|
||||
|
||||
verts[0] = v0->v;
|
||||
verts[0].x -= ix;
|
||||
verts[0].y -= iy;
|
||||
|
||||
verts[1] = v0->v;
|
||||
verts[1].x += ix;
|
||||
verts[1].y += iy;
|
||||
|
||||
verts[2] = v1->v;
|
||||
verts[2].x += ix;
|
||||
verts[2].y += iy;
|
||||
|
||||
verts[3] = v1->v;
|
||||
verts[3].x -= ix;
|
||||
verts[3].y -= iy;
|
||||
|
||||
grDrawTriangle( &verts[0], &verts[1], &verts[3] );
|
||||
grDrawTriangle( &verts[1], &verts[2], &verts[3] );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fx_draw_tri( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1,
|
||||
const fxVertex *v2 )
|
||||
{
|
||||
grDrawTriangle( &(v0->v), &(v1->v), &(v2->v) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define FX_COLOR(vert, c) { \
|
||||
GLubyte *col = c; \
|
||||
vert->v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
|
||||
vert->v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
|
||||
vert->v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
|
||||
vert->v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
|
||||
}
|
||||
|
||||
#define FX_COPY_COLOR( dst, src ) { \
|
||||
dst->v.r = src->v.r; \
|
||||
dst->v.g = src->v.g; \
|
||||
dst->v.b = src->v.b; \
|
||||
dst->v.a = src->v.a; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define FX_FLAT_BIT 0x01
|
||||
#define FX_OFFSET_BIT 0x02
|
||||
#define FX_TWOSIDE_BIT 0x04
|
||||
#define FX_UNFILLED_BIT 0x10
|
||||
#define FX_FALLBACK_BIT 0x20
|
||||
#define FX_MAX_TRIFUNC 0x40
|
||||
|
||||
static struct {
|
||||
points_func points;
|
||||
line_func line;
|
||||
triangle_func triangle;
|
||||
quad_func quad;
|
||||
} rast_tab[FX_MAX_TRIFUNC];
|
||||
|
||||
|
||||
#define IND (0)
|
||||
#define TAG(x) x
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FLAT_BIT)
|
||||
#define TAG(x) x##_flat
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT)
|
||||
#define TAG(x) x##_offset
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FLAT_BIT)
|
||||
#define TAG(x) x##_offset_flat
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT)
|
||||
#define TAG(x) x##_twoside
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT)
|
||||
#define TAG(x) x##_twoside_flat
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT)
|
||||
#define TAG(x) x##_twoside_offset
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT)
|
||||
#define TAG(x) x##_twoside_offset_flat
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FLAT_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_flat_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_offset_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_offset_flat_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_twoside_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_twoside_flat_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_twoside_offset_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT)
|
||||
#define TAG(x) x##_twoside_offset_flat_fallback
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FLAT_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_flat_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_offset_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_offset_flat_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_flat_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_offset_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_offset_flat_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_flat_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_offset_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_offset_flat_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_flat_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_offset_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT)
|
||||
#define TAG(x) x##_twoside_offset_flat_fallback_unfilled
|
||||
#include "fxtritmp.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void fxDDTrifuncInit( void )
|
||||
{
|
||||
init();
|
||||
init_flat();
|
||||
init_offset();
|
||||
init_offset_flat();
|
||||
init_twoside();
|
||||
init_twoside_flat();
|
||||
init_twoside_offset();
|
||||
init_twoside_offset_flat();
|
||||
init_fallback();
|
||||
init_flat_fallback();
|
||||
init_offset_fallback();
|
||||
init_offset_flat_fallback();
|
||||
init_twoside_fallback();
|
||||
init_twoside_flat_fallback();
|
||||
init_twoside_offset_fallback();
|
||||
init_twoside_offset_flat_fallback();
|
||||
|
||||
init_unfilled();
|
||||
init_flat_unfilled();
|
||||
init_offset_unfilled();
|
||||
init_offset_flat_unfilled();
|
||||
init_twoside_unfilled();
|
||||
init_twoside_flat_unfilled();
|
||||
init_twoside_offset_unfilled();
|
||||
init_twoside_offset_flat_unfilled();
|
||||
init_fallback_unfilled();
|
||||
init_flat_fallback_unfilled();
|
||||
init_offset_fallback_unfilled();
|
||||
init_offset_flat_fallback_unfilled();
|
||||
init_twoside_fallback_unfilled();
|
||||
init_twoside_flat_fallback_unfilled();
|
||||
init_twoside_offset_fallback_unfilled();
|
||||
init_twoside_offset_flat_fallback_unfilled();
|
||||
}
|
||||
|
||||
|
||||
/* Build an SWvertex from a GrVertex. This is workable because in
|
||||
* states where the GrVertex is insufficent (eg seperate-specular),
|
||||
* the driver initiates a total fallback, and builds SWvertices
|
||||
* directly -- it recognizes that it will never have use for the
|
||||
* GrVertex.
|
||||
*
|
||||
* This code is hit only when a mix of accelerated and unaccelerated
|
||||
* primitives are being drawn, and only for the unaccelerated
|
||||
* primitives.
|
||||
*/
|
||||
static void
|
||||
fx_translate_vertex(GLcontext *ctx, const fxVertex *src, SWvertex *dst)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
GLuint ts0 = fxMesa->tmu_source[0];
|
||||
GLuint ts1 = fxMesa->tmu_source[1];
|
||||
GLfloat w = 1.0 / src->v.oow;
|
||||
|
||||
dst->win[0] = src->v.x;
|
||||
dst->win[1] = src->v.y;
|
||||
dst->win[2] = src->v.ooz;
|
||||
dst->win[3] = src->v.oow;
|
||||
|
||||
dst->color[0] = (GLubyte) src->v.r;
|
||||
dst->color[1] = (GLubyte) src->v.g;
|
||||
dst->color[2] = (GLubyte) src->v.b;
|
||||
dst->color[3] = (GLubyte) src->v.a;
|
||||
|
||||
dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->v.tmuvtx[0].sow * w;
|
||||
dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->v.tmuvtx[0].tow * w;
|
||||
|
||||
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU0)
|
||||
dst->texcoord[ts0][3] = src->v.tmuvtx[0].oow * w;
|
||||
else
|
||||
dst->texcoord[ts0][3] = 1.0;
|
||||
|
||||
dst->texcoord[ts1][0] = fxMesa->inv_s1scale * src->v.tmuvtx[1].sow * w;
|
||||
dst->texcoord[ts1][1] = fxMesa->inv_t1scale * src->v.tmuvtx[1].tow * w;
|
||||
|
||||
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1)
|
||||
dst->texcoord[ts1][3] = src->v.tmuvtx[1].oow * w;
|
||||
else
|
||||
dst->texcoord[ts1][3] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_fallback_tri( GLcontext *ctx,
|
||||
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
|
||||
{
|
||||
SWvertex v[3];
|
||||
fx_translate_vertex( ctx, v0, &v[0] );
|
||||
fx_translate_vertex( ctx, v1, &v[1] );
|
||||
fx_translate_vertex( ctx, v2, &v[2] );
|
||||
_swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_fallback_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
|
||||
{
|
||||
SWvertex v[2];
|
||||
fx_translate_vertex( ctx, v0, &v[0] );
|
||||
fx_translate_vertex( ctx, v1, &v[1] );
|
||||
_swrast_Line( ctx, &v[0], &v[1] );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_fallback_point( GLcontext *ctx, const fxVertex *v0 )
|
||||
{
|
||||
SWvertex v[1];
|
||||
fx_translate_vertex( ctx, v0, &v[0] );
|
||||
_swrast_Point( ctx, &v[0] );
|
||||
}
|
||||
|
||||
|
||||
/* System to turn culling off for rasterized lines and points, and
|
||||
* back on for rasterized triangles.
|
||||
*/
|
||||
static void
|
||||
fx_cull_draw_tri( GLcontext *ctx,
|
||||
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
|
||||
FX_grCullMode(fxMesa->cullMode);
|
||||
|
||||
fxMesa->draw_line = fxMesa->initial_line;
|
||||
fxMesa->draw_point = fxMesa->initial_point;
|
||||
fxMesa->draw_tri = fxMesa->subsequent_tri;
|
||||
|
||||
fxMesa->draw_tri( ctx, v0, v1, v2 );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_cull_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
|
||||
FX_grCullMode( GR_CULL_DISABLE );
|
||||
|
||||
fxMesa->draw_point = fxMesa->initial_point;
|
||||
fxMesa->draw_tri = fxMesa->initial_tri;
|
||||
fxMesa->draw_line = fxMesa->subsequent_line;
|
||||
|
||||
fxMesa->draw_line( ctx, v0, v1 );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_cull_draw_point( GLcontext *ctx, const fxVertex *v0 )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
|
||||
FX_grCullMode(GR_CULL_DISABLE);
|
||||
|
||||
fxMesa->draw_line = fxMesa->initial_line;
|
||||
fxMesa->draw_tri = fxMesa->initial_tri;
|
||||
fxMesa->draw_point = fxMesa->subsequent_point;
|
||||
|
||||
fxMesa->draw_point( ctx, v0 );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fx_null_tri( GLcontext *ctx,
|
||||
const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 )
|
||||
{
|
||||
(void) v0;
|
||||
(void) v1;
|
||||
(void) v2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define POINT_FALLBACK (DD_POINT_SMOOTH )
|
||||
#define LINE_FALLBACK (DD_LINE_STIPPLE)
|
||||
#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_STIPPLE )
|
||||
#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK)
|
||||
|
||||
|
||||
#define ANY_RENDER_FLAGS (DD_FLATSHADE | \
|
||||
DD_TRI_LIGHT_TWOSIDE | \
|
||||
DD_TRI_OFFSET | \
|
||||
DD_TRI_UNFILLED)
|
||||
|
||||
|
||||
|
||||
/* Setup the Point, Line, Triangle and Quad functions based on the
|
||||
* current rendering state. Wherever possible, use the hardware to
|
||||
* render the primitive. Otherwise, fallback to software rendering.
|
||||
*/
|
||||
void fxDDChooseRenderState( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT( ctx );
|
||||
GLuint flags = ctx->_TriangleCaps;
|
||||
GLuint index = 0;
|
||||
|
||||
if ( !fxMesa->is_in_hardware ) {
|
||||
/* Build software vertices directly. No acceleration is
|
||||
* possible. GrVertices may be insufficient for this mode.
|
||||
*/
|
||||
ctx->Driver.PointsFunc = _swsetup_Points;
|
||||
ctx->Driver.LineFunc = _swsetup_Line;
|
||||
ctx->Driver.TriangleFunc = _swsetup_Triangle;
|
||||
ctx->Driver.QuadFunc = _swsetup_Quad;
|
||||
|
||||
fxMesa->render_index = FX_FALLBACK_BIT;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( flags & ANY_RENDER_FLAGS ) {
|
||||
if ( flags & DD_FLATSHADE ) index |= FX_FLAT_BIT;
|
||||
if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= FX_TWOSIDE_BIT;
|
||||
if ( flags & DD_TRI_OFFSET ) index |= FX_OFFSET_BIT;
|
||||
if ( flags & DD_TRI_UNFILLED ) index |= FX_UNFILLED_BIT;
|
||||
}
|
||||
|
||||
if ( flags & (ANY_FALLBACK|
|
||||
DD_LINE_WIDTH|
|
||||
DD_POINT_SIZE|
|
||||
DD_TRI_CULL_FRONT_BACK) ) {
|
||||
|
||||
/* Hook in fallbacks for specific primitives.
|
||||
*
|
||||
* Set up a system to turn culling on/off for wide points and
|
||||
* lines. Alternately: figure out what tris to send so that
|
||||
* culling isn't a problem.
|
||||
*
|
||||
* This replaces the ReducedPrimitiveChange mechanism.
|
||||
*/
|
||||
index |= FX_FALLBACK_BIT;
|
||||
fxMesa->initial_point = fx_cull_draw_point;
|
||||
fxMesa->initial_line = fx_cull_draw_line;
|
||||
fxMesa->initial_tri = fx_cull_draw_tri;
|
||||
|
||||
fxMesa->subsequent_point = fx_draw_point;
|
||||
fxMesa->subsequent_line = fx_draw_line;
|
||||
fxMesa->subsequent_tri = fx_draw_tri;
|
||||
|
||||
if ( flags & POINT_FALLBACK )
|
||||
fxMesa->initial_point = fx_fallback_point;
|
||||
|
||||
if ( flags & LINE_FALLBACK )
|
||||
fxMesa->initial_line = fx_fallback_line;
|
||||
|
||||
if ((flags & DD_LINE_SMOOTH) && ctx->Line.Width != 1.0)
|
||||
fxMesa->initial_line = fx_fallback_line;
|
||||
|
||||
if ( flags & TRI_FALLBACK )
|
||||
fxMesa->initial_tri = fx_fallback_tri;
|
||||
|
||||
if ( flags & DD_TRI_CULL_FRONT_BACK )
|
||||
fxMesa->initial_tri = fx_null_tri;
|
||||
|
||||
fxMesa->draw_point = fxMesa->initial_point;
|
||||
fxMesa->draw_line = fxMesa->initial_line;
|
||||
fxMesa->draw_tri = fxMesa->initial_tri;
|
||||
}
|
||||
else if (fxMesa->render_index & FX_FALLBACK_BIT) {
|
||||
FX_grCullMode(fxMesa->cullMode);
|
||||
}
|
||||
|
||||
ctx->Driver.PointsFunc = rast_tab[index].points;
|
||||
ctx->Driver.LineFunc = rast_tab[index].line;
|
||||
ctx->Driver.TriangleFunc = rast_tab[index].triangle;
|
||||
ctx->Driver.QuadFunc = rast_tab[index].quad;
|
||||
fxMesa->render_index = index;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
* Need this to provide at least one external definition.
|
||||
*/
|
||||
|
||||
extern int gl_fx_dummy_function_trifuncs(void);
|
||||
int gl_fx_dummy_function_trifuncs(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* FX */
|
||||
403
src/mesa/drivers/glide/fxvb.c
Normal file
403
src/mesa/drivers/glide/fxvb.c
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Author:
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*/
|
||||
|
||||
|
||||
/* fxvsetup.c - 3Dfx VooDoo vertices setup functions */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
#endif
|
||||
|
||||
#if defined(FX)
|
||||
|
||||
#include "fxdrv.h"
|
||||
#include "mmath.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
||||
#include "tnl/t_context.h"
|
||||
#include "tnl/t_pipeline.h"
|
||||
|
||||
|
||||
void fxPrintSetupFlags( const char *msg, GLuint flags )
|
||||
{
|
||||
fprintf(stderr, "%s: %d %s%s%s%s%s\n",
|
||||
msg,
|
||||
flags,
|
||||
(flags & SETUP_XYZW) ? " xyzw," : "",
|
||||
(flags & SETUP_SNAP) ? " snap," : "",
|
||||
(flags & SETUP_RGBA) ? " rgba," : "",
|
||||
(flags & SETUP_TMU0) ? " tmu0," : "",
|
||||
(flags & SETUP_TMU1) ? " tmu1," : "");
|
||||
}
|
||||
|
||||
static void project_texcoords( fxVertex *v,
|
||||
struct vertex_buffer *VB,
|
||||
GLuint tmu_nr, GLuint tc_nr,
|
||||
GLuint start, GLuint count )
|
||||
{
|
||||
GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]);
|
||||
GLvector4f *vec = VB->TexCoordPtr[tc_nr];
|
||||
|
||||
GLuint i;
|
||||
GLuint stride = vec->stride;
|
||||
GLfloat *data = VEC_ELT(vec, GLfloat, start);
|
||||
|
||||
for (i = start ; i < count ; i++, STRIDE_F(data, stride), v++) {
|
||||
tmu->oow = v->v.oow * data[3];
|
||||
tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void copy_w( fxVertex *v,
|
||||
struct vertex_buffer *VB,
|
||||
GLuint tmu_nr,
|
||||
GLuint start, GLuint count )
|
||||
{
|
||||
GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]);
|
||||
GLuint i;
|
||||
|
||||
for (i = start ; i < count ; i++, v++) {
|
||||
tmu->oow = v->v.oow;
|
||||
tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex));
|
||||
}
|
||||
}
|
||||
|
||||
/* need to compute W values for fogging purposes
|
||||
*/
|
||||
static void fx_fake_fog_w( GLcontext *ctx,
|
||||
fxVertex *verts,
|
||||
struct vertex_buffer *VB,
|
||||
GLuint start, GLuint end )
|
||||
{
|
||||
const GLfloat m10 = ctx->ProjectionMatrix.m[10];
|
||||
const GLfloat m14 = ctx->ProjectionMatrix.m[14];
|
||||
GLfloat (*clip)[4] = VB->ClipPtr->data;
|
||||
GLubyte *clipmask = VB->ClipMask;
|
||||
GLuint i;
|
||||
|
||||
for ( i = start ; i < end ; i++) {
|
||||
if (clipmask[i] == 0) {
|
||||
verts[i].v.oow = - m10 / (clip[i][2] - m14); /* -1/zEye */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static tfxSetupFunc setupfuncs[MAX_SETUP];
|
||||
|
||||
|
||||
#define IND (SETUP_XYZW)
|
||||
#define INPUTS (VERT_CLIP)
|
||||
#define NAME fxsetupXYZW
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA)
|
||||
#define NAME fxsetupXYZWRGBA
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU0)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWT0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU1)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWT1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_TMU0)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWT0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWRGBAT0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWRGBAT1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZWRGBAT0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP)
|
||||
#define INPUTS (VERT_CLIP)
|
||||
#define NAME fxsetupXYZW_SNAP
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA)
|
||||
#define NAME fxsetupXYZW_SNAP_RGBA
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU0)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_T0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0)
|
||||
#define INPUTS (VERT_CLIP|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_T0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_RGBAT0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_RGBAT1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupXYZW_SNAP_RGBAT0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
|
||||
|
||||
#define IND (SETUP_RGBA)
|
||||
#define INPUTS (VERT_RGBA)
|
||||
#define NAME fxsetupRGBA
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU0)
|
||||
#define INPUTS (VERT_TEX_ANY)
|
||||
#define NAME fxsetupT0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU1)
|
||||
#define INPUTS (VERT_TEX_ANY)
|
||||
#define NAME fxsetupT1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU1|SETUP_TMU0)
|
||||
#define INPUTS (VERT_TEX_ANY)
|
||||
#define NAME fxsetupT0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupRGBAT0
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU1|SETUP_RGBA)
|
||||
#define INPUTS (VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupRGBAT1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_RGBA)
|
||||
#define INPUTS (VERT_RGBA|VERT_TEX_ANY)
|
||||
#define NAME fxsetupRGBAT0T1
|
||||
#include "fxvbtmp.h"
|
||||
|
||||
|
||||
static void
|
||||
fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
|
||||
{
|
||||
fprintf(stderr, "fxMesa: invalid setup function\n");
|
||||
(void) (ctx && start && end && newinputs);
|
||||
}
|
||||
|
||||
|
||||
void fxDDSetupInit( void )
|
||||
{
|
||||
GLuint i;
|
||||
for (i = 0 ; i < Elements(setupfuncs) ; i++)
|
||||
setupfuncs[i] = fxsetup_invalid;
|
||||
|
||||
setupfuncs[SETUP_XYZW] = fxsetupXYZW;
|
||||
setupfuncs[SETUP_XYZW|SETUP_RGBA] = fxsetupXYZWRGBA;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU0] = fxsetupXYZWT0;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU1] = fxsetupXYZWT1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU0|SETUP_RGBA] = fxsetupXYZWRGBAT0;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_RGBA] = fxsetupXYZWRGBAT1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0] = fxsetupXYZWT0T1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] =
|
||||
fxsetupXYZWRGBAT0T1;
|
||||
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP] = fxsetupXYZW_SNAP;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_RGBA] = fxsetupXYZW_SNAP_RGBA;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0] = fxsetupXYZW_SNAP_T0;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1] = fxsetupXYZW_SNAP_T1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0|SETUP_RGBA] =
|
||||
fxsetupXYZW_SNAP_RGBAT0;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_RGBA] =
|
||||
fxsetupXYZW_SNAP_RGBAT1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0] =
|
||||
fxsetupXYZW_SNAP_T0T1;
|
||||
setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] =
|
||||
fxsetupXYZW_SNAP_RGBAT0T1;
|
||||
|
||||
setupfuncs[SETUP_RGBA] = fxsetupRGBA;
|
||||
setupfuncs[SETUP_TMU0] = fxsetupT0;
|
||||
setupfuncs[SETUP_TMU1] = fxsetupT1;
|
||||
setupfuncs[SETUP_TMU1|SETUP_TMU0] = fxsetupT0T1;
|
||||
setupfuncs[SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0;
|
||||
setupfuncs[SETUP_TMU1|SETUP_RGBA] = fxsetupRGBAT1;
|
||||
setupfuncs[SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0T1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fx_validate_BuildProjVerts(GLcontext *ctx, GLuint start, GLuint count,
|
||||
GLuint newinputs )
|
||||
{
|
||||
GLuint setupindex = SETUP_XYZW;
|
||||
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
|
||||
|
||||
if (!fxMesa->is_in_hardware)
|
||||
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
|
||||
else {
|
||||
fxMesa->tmu_source[0] = 0;
|
||||
fxMesa->tmu_source[1] = 1;
|
||||
fxMesa->tex_dest[0] = SETUP_TMU0;
|
||||
fxMesa->tex_dest[1] = SETUP_TMU1;
|
||||
|
||||
/* For flat and two-side-lit triangles, colors will always be added
|
||||
* to vertices in the triangle functions. Vertices will *always*
|
||||
* have rbga values, but only sometimes will they come from here.
|
||||
*/
|
||||
if ((ctx->_TriangleCaps & (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE)) == 0)
|
||||
setupindex |= SETUP_RGBA;
|
||||
|
||||
if (ctx->Texture._ReallyEnabled & TEXTURE0_2D)
|
||||
setupindex |= SETUP_TMU0;
|
||||
|
||||
if (ctx->Texture._ReallyEnabled & TEXTURE1_2D) {
|
||||
if ((ctx->Texture._ReallyEnabled & TEXTURE0_2D) == 0) {
|
||||
fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[0] = SETUP_TMU1;
|
||||
fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[1] = SETUP_TMU0;
|
||||
setupindex |= SETUP_TMU0;
|
||||
} else {
|
||||
setupindex |= SETUP_TMU1;
|
||||
}
|
||||
}
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE))
|
||||
fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
|
||||
|
||||
fxMesa->setupindex = setupindex;
|
||||
ctx->Driver.BuildProjectedVertices = fx_BuildProjVerts;
|
||||
}
|
||||
ctx->Driver.BuildProjectedVertices( ctx, start, count, newinputs );
|
||||
}
|
||||
|
||||
|
||||
void fx_BuildProjVerts( GLcontext *ctx, GLuint start, GLuint count,
|
||||
GLuint newinputs )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
GLuint ind = fxMesa->setup_gone;
|
||||
|
||||
fxMesa->setup_gone = 0;
|
||||
|
||||
if (newinputs & VERT_CLIP)
|
||||
ind = fxMesa->setupindex; /* clipmask has changed - invalidated all */
|
||||
else {
|
||||
if (newinputs & VERT_TEX0)
|
||||
ind |= fxMesa->tex_dest[0];
|
||||
|
||||
if (newinputs & VERT_TEX1)
|
||||
ind |= fxMesa->tex_dest[1];
|
||||
|
||||
if (newinputs & VERT_RGBA)
|
||||
ind |= SETUP_RGBA;
|
||||
|
||||
ind &= fxMesa->setupindex;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
_tnl_print_vert_flags("newinputs", newinputs);
|
||||
fxPrintSetupFlags("setup function", ind);
|
||||
}
|
||||
|
||||
if (fxMesa->new_state)
|
||||
fxSetupFXUnits( ctx );
|
||||
|
||||
if (VB->importable_data)
|
||||
VB->import_data( ctx, VB->importable_data & newinputs,
|
||||
(VB->ClipOrMask
|
||||
? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
|
||||
: VEC_BAD_STRIDE));
|
||||
|
||||
setupfuncs[ind]( ctx, start, count, newinputs );
|
||||
}
|
||||
|
||||
|
||||
void fxAllocVB( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
fxMesa->verts = ALIGN_MALLOC( tnl->vb.Size * sizeof(fxMesa->verts[0]), 32 );
|
||||
}
|
||||
|
||||
void fxFreeVB( GLcontext *ctx )
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
if (fxMesa->verts)
|
||||
ALIGN_FREE( fxMesa->verts );
|
||||
fxMesa->verts = 0;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
/*
|
||||
* Need this to provide at least one external definition.
|
||||
*/
|
||||
|
||||
extern int gl_fx_dummy_function_vsetup(void);
|
||||
int gl_fx_dummy_function_vsetup(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* FX */
|
||||
143
src/mesa/drivers/glide/fxvbtmp.h
Normal file
143
src/mesa/drivers/glide/fxvbtmp.h
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author:
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*/
|
||||
|
||||
|
||||
static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
|
||||
fxVertex *verts = fxMesa->verts;
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
GLuint tmu0_source = fxMesa->tmu_source[0];
|
||||
GLuint tmu1_source = fxMesa->tmu_source[1];
|
||||
GLfloat (*tmu0_data)[4];
|
||||
GLfloat (*tmu1_data)[4];
|
||||
GLubyte (*color)[4];
|
||||
GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
|
||||
fxVertex *v = &verts[start];
|
||||
GLfloat sscale0 = fxMesa->s0scale;
|
||||
GLfloat tscale0 = fxMesa->t0scale;
|
||||
GLfloat sscale1 = fxMesa->s1scale;
|
||||
GLfloat tscale1 = fxMesa->t1scale;
|
||||
GLubyte *clipmask = VB->ClipMask;
|
||||
GLuint i;
|
||||
const GLfloat * const s = ctx->Viewport._WindowMap.m;
|
||||
|
||||
if (IND & SETUP_TMU0)
|
||||
tmu0_data = VB->TexCoordPtr[tmu0_source]->data;
|
||||
|
||||
if (IND & SETUP_TMU1)
|
||||
tmu1_data = VB->TexCoordPtr[tmu1_source]->data;
|
||||
|
||||
if (IND & SETUP_RGBA)
|
||||
color = VB->ColorPtr[0]->data;
|
||||
|
||||
for (i = start ; i < end ; i++, v++) {
|
||||
if (!clipmask[i]) {
|
||||
if (IND & SETUP_XYZW) {
|
||||
v->v.x = s[0] * proj[i][0] + s[12];
|
||||
v->v.y = s[5] * proj[i][1] + s[13];
|
||||
v->v.ooz = s[10] * proj[i][2] + s[14];
|
||||
v->v.oow = proj[i][3];
|
||||
|
||||
if (IND & SETUP_SNAP) {
|
||||
#if defined(USE_IEEE)
|
||||
const float snapper = (3L<<18);
|
||||
v->v.x += snapper;
|
||||
v->v.x -= snapper;
|
||||
v->v.y += snapper;
|
||||
v->v.y -= snapper;
|
||||
#else
|
||||
v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f);
|
||||
v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (IND & SETUP_RGBA) {
|
||||
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.r, color[i][0]);
|
||||
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.g, color[i][1]);
|
||||
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.b, color[i][2]);
|
||||
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]);
|
||||
}
|
||||
if (IND & SETUP_TMU0) {
|
||||
v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow;
|
||||
v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow;
|
||||
}
|
||||
if (IND & SETUP_TMU1) {
|
||||
v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow;
|
||||
v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((IND & SETUP_XYZW) &&
|
||||
ctx->ProjectionMatrix.m[15] != 0.0F &&
|
||||
ctx->Fog.Enabled)
|
||||
{
|
||||
fx_fake_fog_w( ctx, v, VB, start, end );
|
||||
}
|
||||
|
||||
/* Check for and enable projective texturing in each texture unit.
|
||||
*/
|
||||
if (IND & (SETUP_TMU0|SETUP_TMU1)) {
|
||||
GLuint tmu0_sz = 2;
|
||||
GLuint tmu1_sz = 2;
|
||||
GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 |
|
||||
GR_STWHINT_W_DIFF_TMU1);
|
||||
|
||||
if (VB->TexCoordPtr[tmu0_source])
|
||||
tmu0_sz = VB->TexCoordPtr[tmu0_source]->size;
|
||||
|
||||
if (VB->TexCoordPtr[tmu1_source])
|
||||
tmu1_sz = VB->TexCoordPtr[tmu1_source]->size;
|
||||
|
||||
if (tmu0_sz == 4) {
|
||||
project_texcoords( v, VB, 0, tmu0_source, start, end );
|
||||
if (tmu1_sz == 4)
|
||||
project_texcoords( v, VB, 1, tmu1_source, start, end );
|
||||
else
|
||||
copy_w( v, VB, 1, start, end );
|
||||
hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1);
|
||||
}
|
||||
else if (tmu1_sz == 4) {
|
||||
project_texcoords( v, VB, 1, tmu1_source, start, end );
|
||||
hs |= GR_STWHINT_W_DIFF_TMU1;
|
||||
}
|
||||
|
||||
if (hs != fxMesa->stw_hint_state) {
|
||||
fxMesa->stw_hint_state = hs;
|
||||
FX_grHints(GR_HINT_STWHINT, hs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#undef IND
|
||||
#undef NAME
|
||||
#undef INPUTS
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: osmesa.c,v 1.34 2000/11/22 08:55:52 joukj Exp $ */
|
||||
/* $Id: osmesa.c,v 1.35 2000/12/26 05:09:30 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -87,7 +87,7 @@ struct osmesa_context {
|
|||
|
||||
|
||||
/* A forward declaration: */
|
||||
static void osmesa_update_state( GLcontext *ctx );
|
||||
static void osmesa_update_state( GLcontext *ctx, GLuint newstate );
|
||||
static void osmesa_register_swrast_functions( GLcontext *ctx );
|
||||
|
||||
|
||||
|
|
@ -311,11 +311,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
|
|||
{
|
||||
GLcontext *ctx = &osmesa->gl_ctx;
|
||||
|
||||
ctx->Driver.RegisterVB = _swsetup_RegisterVB;
|
||||
|
||||
_swrast_CreateContext( ctx );
|
||||
_swsetup_CreateContext( ctx );
|
||||
_tnl_CreateContext( ctx );
|
||||
_swsetup_CreateContext( ctx );
|
||||
|
||||
osmesa_register_swrast_functions( ctx );
|
||||
}
|
||||
|
|
@ -439,7 +437,7 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
osmesa_update_state( &ctx->gl_ctx );
|
||||
osmesa_update_state( &ctx->gl_ctx, 0 );
|
||||
_mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer );
|
||||
|
||||
ctx->buffer = buffer;
|
||||
|
|
@ -1687,7 +1685,7 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name )
|
|||
}
|
||||
|
||||
|
||||
static void osmesa_update_state( GLcontext *ctx )
|
||||
static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||
{
|
||||
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
|
||||
|
||||
|
|
@ -1709,7 +1707,7 @@ static void osmesa_update_state( GLcontext *ctx )
|
|||
ctx->Driver.LineFunc = _swsetup_Line;
|
||||
ctx->Driver.TriangleFunc = _swsetup_Triangle;
|
||||
ctx->Driver.QuadFunc = _swsetup_Quad;
|
||||
ctx->Driver.RasterSetup = _swsetup_RasterSetup;
|
||||
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
|
||||
|
||||
|
||||
/* RGB(A) span/pixel functions */
|
||||
|
|
@ -1751,7 +1749,7 @@ static void osmesa_update_state( GLcontext *ctx )
|
|||
ctx->Driver.ReadCI32Span = read_index_span;
|
||||
ctx->Driver.ReadCI32Pixels = read_index_pixels;
|
||||
|
||||
_swrast_InvalidateState( ctx, ctx->NewState );
|
||||
_swsetup_InvalidateState( ctx, ctx->NewState );
|
||||
_tnl_InvalidateState( ctx, ctx->NewState );
|
||||
_swrast_InvalidateState( ctx, new_state );
|
||||
_swsetup_InvalidateState( ctx, new_state );
|
||||
_tnl_InvalidateState( ctx, new_state );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: svgamesa.c,v 1.10 2000/11/22 08:55:53 joukj Exp $ */
|
||||
/* $Id: svgamesa.c,v 1.11 2000/12/26 05:09:30 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -274,7 +274,7 @@ static void set_read_buffer( GLcontext *ctx, GLframebuffer *colorBuffer,
|
|||
/***** *****/
|
||||
/**********************************************************************/
|
||||
|
||||
static void svgamesa_update_state( GLcontext *ctx )
|
||||
static void svgamesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||
{
|
||||
/* Initialize all the pointers in the DD struct. Do this whenever */
|
||||
/* a new context is made current or we change buffers via set_buffer! */
|
||||
|
|
@ -457,7 +457,7 @@ void SVGAMesaMakeCurrent( SVGAMesaContext ctx )
|
|||
{
|
||||
#ifndef DEV
|
||||
SVGAMesa = ctx;
|
||||
svgamesa_update_state( ctx->gl_ctx );
|
||||
svgamesa_update_state( ctx->gl_ctx, ~0 );
|
||||
_mesa_make_current( ctx->gl_ctx, ctx->gl_buffer );
|
||||
|
||||
if (ctx->width==0 || ctx->height==0) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xm_api.c,v 1.12 2000/12/13 00:47:10 brianp Exp $ */
|
||||
/* $Id: xm_api.c,v 1.13 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -78,6 +78,7 @@
|
|||
#include "macros.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "array_cache/acache.h"
|
||||
#include "tnl/tnl.h"
|
||||
|
||||
#ifndef GLX_NONE_EXT
|
||||
|
|
@ -1665,8 +1666,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
|
|||
/* Initialize the software rasterizer and helper modules.
|
||||
*/
|
||||
_swrast_CreateContext( ctx );
|
||||
_swsetup_CreateContext( ctx );
|
||||
_ac_CreateContext( ctx );
|
||||
_tnl_CreateContext( ctx );
|
||||
_swsetup_CreateContext( ctx );
|
||||
|
||||
xmesa_register_swrast_functions( ctx );
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xm_dd.c,v 1.7 2000/11/22 07:32:18 joukj Exp $ */
|
||||
/* $Id: xm_dd.c,v 1.8 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
#include "tnl/tnl.h"
|
||||
#include "array_cache/acache.h"
|
||||
|
||||
/*
|
||||
* Return the size (width,height of the current color buffer.
|
||||
|
|
@ -862,16 +863,17 @@ enable( GLcontext *ctx, GLenum pname, GLboolean state )
|
|||
}
|
||||
|
||||
|
||||
void xmesa_update_state( GLcontext *ctx )
|
||||
void xmesa_update_state( GLcontext *ctx, GLuint new_state )
|
||||
{
|
||||
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
|
||||
|
||||
/* Propogate statechange information to swrast and swrast_setup
|
||||
* modules. The X11 driver has no internal GL-dependent state.
|
||||
*/
|
||||
_swrast_InvalidateState( ctx, ctx->NewState );
|
||||
_swsetup_InvalidateState( ctx, ctx->NewState );
|
||||
_tnl_InvalidateState( ctx, ctx->NewState );
|
||||
_swrast_InvalidateState( ctx, new_state );
|
||||
_ac_InvalidateState( ctx, new_state );
|
||||
_tnl_InvalidateState( ctx, new_state );
|
||||
_swsetup_InvalidateState( ctx, new_state );
|
||||
|
||||
|
||||
/* setup pointers to front and back buffer clear functions */
|
||||
|
|
@ -937,9 +939,7 @@ void xmesa_init_pointers( GLcontext *ctx )
|
|||
ctx->Driver.LineFunc = _swsetup_Line;
|
||||
ctx->Driver.TriangleFunc = _swsetup_Triangle;
|
||||
ctx->Driver.QuadFunc = _swsetup_Quad;
|
||||
ctx->Driver.RasterSetup = _swsetup_RasterSetup;
|
||||
ctx->Driver.RegisterVB = _swsetup_RegisterVB;
|
||||
ctx->Driver.UnregisterVB = _swsetup_UnregisterVB;
|
||||
|
||||
ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
|
||||
ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
|
||||
(void) DitherValues; /* silenced unused var warning */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: xmesaP.h,v 1.17 2000/11/22 08:55:53 joukj Exp $ */
|
||||
/* $Id: xmesaP.h,v 1.18 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -519,7 +519,7 @@ xmesa_color_to_pixel( XMesaContext xmesa,
|
|||
extern void xmesa_alloc_back_buffer( XMesaBuffer b );
|
||||
|
||||
extern void xmesa_init_pointers( GLcontext *ctx );
|
||||
extern void xmesa_update_state( GLcontext *ctx );
|
||||
extern void xmesa_update_state( GLcontext *ctx, GLuint new_state );
|
||||
|
||||
extern void xmesa_update_span_funcs( GLcontext *ctx );
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $
|
||||
# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
|
|
@ -21,29 +21,9 @@ LIBDIR = ../lib
|
|||
|
||||
|
||||
CORE_SOURCES = \
|
||||
tnl/t_vtxfmt.c \
|
||||
tnl/t_bbox.c \
|
||||
tnl/t_clip.c \
|
||||
tnl/t_context.c \
|
||||
tnl/t_cva.c \
|
||||
tnl/t_debug.c \
|
||||
tnl/t_dlist.c \
|
||||
tnl/t_eval.c \
|
||||
tnl/t_fog.c \
|
||||
tnl/t_light.c \
|
||||
tnl/t_pipeline.c \
|
||||
tnl/t_shade.c \
|
||||
tnl/t_stages.c \
|
||||
tnl/t_texture.c \
|
||||
tnl/t_trans_elt.c \
|
||||
tnl/t_varray.c \
|
||||
tnl/t_vb.c \
|
||||
tnl/t_vbcull.c \
|
||||
tnl/t_vbindirect.c \
|
||||
tnl/t_vbrender.c \
|
||||
tnl/t_vbxform.c \
|
||||
api_loopback.c \
|
||||
api_noop.c \
|
||||
api_validate.c \
|
||||
accum.c \
|
||||
alpha.c \
|
||||
attrib.c \
|
||||
|
|
@ -106,6 +86,40 @@ CORE_SOURCES = \
|
|||
X86/common_x86.c \
|
||||
X86/3dnow.c \
|
||||
X86/katmai.c \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
math/m_debug_xform.c \
|
||||
math/m_eval.c \
|
||||
math/m_matrix.c \
|
||||
math/m_translate.c \
|
||||
math/m_vector.c \
|
||||
math/m_vertices.c \
|
||||
math/m_xform.c \
|
||||
array_cache/ac_context.c \
|
||||
array_cache/ac_import.c \
|
||||
tnl/t_array_api.c \
|
||||
tnl/t_array_import.c \
|
||||
tnl/t_context.c \
|
||||
tnl/t_eval_api.c \
|
||||
tnl/t_imm_alloc.c \
|
||||
tnl/t_imm_api.c \
|
||||
tnl/t_imm_debug.c \
|
||||
tnl/t_imm_dlist.c \
|
||||
tnl/t_imm_elt.c \
|
||||
tnl/t_imm_eval.c \
|
||||
tnl/t_imm_exec.c \
|
||||
tnl/t_imm_fixup.c \
|
||||
tnl/t_pipeline.c \
|
||||
tnl/t_vb_fog.c \
|
||||
tnl/t_vb_light.c \
|
||||
tnl/t_vb_material.c \
|
||||
tnl/t_vb_normals.c \
|
||||
tnl/t_vb_points.c \
|
||||
tnl/t_vb_render.c \
|
||||
tnl/t_vb_texgen.c \
|
||||
tnl/t_vb_texmat.c \
|
||||
tnl/t_vb_vertex.c \
|
||||
swrast/s_aaline.c \
|
||||
swrast/s_aatriangle.c \
|
||||
swrast/s_accum.c \
|
||||
|
|
@ -134,32 +148,18 @@ CORE_SOURCES = \
|
|||
swrast/s_stencil.c \
|
||||
swrast/s_texture.c \
|
||||
swrast/s_triangle.c \
|
||||
swrast/s_zoom.c \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
math/m_debug_xform.c \
|
||||
math/m_matrix.c \
|
||||
math/m_translate.c \
|
||||
math/m_vector.c \
|
||||
math/m_vertices.c \
|
||||
math/m_xform.c
|
||||
|
||||
swrast/s_zoom.c
|
||||
|
||||
|
||||
DRIVER_SOURCES = \
|
||||
FX/fxvtxfmt.c \
|
||||
FX/fxvtxprims.c \
|
||||
FX/fxapi.c \
|
||||
FX/fxdd.c \
|
||||
FX/fxddspan.c \
|
||||
FX/fxddtex.c \
|
||||
FX/fxfastpath.c \
|
||||
FX/fxpipeline.c \
|
||||
FX/fxsetup.c \
|
||||
FX/fxtexman.c \
|
||||
FX/fxtrifuncs.c \
|
||||
FX/fxvsetup.c \
|
||||
FX/fxtris.c \
|
||||
FX/fxvb.c \
|
||||
FX/fxglidew.c \
|
||||
X/glxapi.c \
|
||||
X/fakeglx.c \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: accum.c,v 1.32 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: accum.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -44,24 +44,30 @@
|
|||
void
|
||||
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
|
||||
{
|
||||
GLfloat tmp[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 );
|
||||
ctx->Accum.ClearColor[1] = CLAMP( green, -1.0, 1.0 );
|
||||
ctx->Accum.ClearColor[2] = CLAMP( blue, -1.0, 1.0 );
|
||||
ctx->Accum.ClearColor[3] = CLAMP( alpha, -1.0, 1.0 );
|
||||
ctx->NewState |= _NEW_ACCUM;
|
||||
tmp[0] = CLAMP( red, -1.0, 1.0 );
|
||||
tmp[1] = CLAMP( green, -1.0, 1.0 );
|
||||
tmp[2] = CLAMP( blue, -1.0, 1.0 );
|
||||
tmp[3] = CLAMP( alpha, -1.0, 1.0 );
|
||||
|
||||
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, "glAccum");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->Visual.AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glAccum");
|
||||
|
|
|
|||
284
src/mesa/main/api_arrayelt.c
Normal file
284
src/mesa/main/api_arrayelt.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
#include "glheader.h"
|
||||
#include "api_noop.h"
|
||||
#include "context.h"
|
||||
#include "colormac.h"
|
||||
#include "light.h"
|
||||
#include "macros.h"
|
||||
#include "mmath.h"
|
||||
#include "mtypes.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
GLint unit;
|
||||
struct gl_client_array *array;
|
||||
void *func;
|
||||
} AAtexarray;
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct gl_client_array *array;
|
||||
void *func;
|
||||
} AAarray;
|
||||
|
||||
typedef struct {
|
||||
AAtexarray texarrays[MAX_TEXTURE_UNITS+1];
|
||||
AAarray arrays[10];
|
||||
GLuint NewState;
|
||||
} AAcontext;
|
||||
|
||||
|
||||
static void *colorfuncs[2][7] = {
|
||||
{ glColor3bv,
|
||||
glColor3ub,
|
||||
glColor3sv,
|
||||
glColor3usv,
|
||||
glColor3iv,
|
||||
glColor3fv,
|
||||
glColor3dv },
|
||||
|
||||
{ glColor4bv,
|
||||
glColor4ub,
|
||||
glColor4sv,
|
||||
glColor4usv,
|
||||
glColor4iv,
|
||||
glColor4fv,
|
||||
glColor4dv }
|
||||
};
|
||||
|
||||
static void *vertexfuncs[3][7] = {
|
||||
{ glVertex3bv,
|
||||
glVertex3ub,
|
||||
glVertex3sv,
|
||||
glVertex3usv,
|
||||
glVertex3iv,
|
||||
glVertex3fv,
|
||||
glVertex3dv },
|
||||
|
||||
{ glVertex3bv,
|
||||
glVertex3ub,
|
||||
glVertex3sv,
|
||||
glVertex3usv,
|
||||
glVertex3iv,
|
||||
glVertex3fv,
|
||||
glVertex3dv },
|
||||
|
||||
{ glVertex4bv,
|
||||
glVertex4ub,
|
||||
glVertex4sv,
|
||||
glVertex4usv,
|
||||
glVertex4iv,
|
||||
glVertex4fv,
|
||||
glVertex4dv }
|
||||
};
|
||||
|
||||
|
||||
static void *multitexfuncs[4][7] = {
|
||||
{ glMultiTexCoord1bv,
|
||||
glMultiTexCoord1ub,
|
||||
glMultiTexCoord1sv,
|
||||
glMultiTexCoord1usv,
|
||||
glMultiTexCoord1iv,
|
||||
glMultiTexCoord1fv,
|
||||
glMultiTexCoord1dv },
|
||||
|
||||
{ glMultiTexCoord2bv,
|
||||
glMultiTexCoord2ub,
|
||||
glMultiTexCoord2sv,
|
||||
glMultiTexCoord2usv,
|
||||
glMultiTexCoord2iv,
|
||||
glMultiTexCoord2fv,
|
||||
glMultiTexCoord2dv },
|
||||
|
||||
{ glMultiTexCoord3bv,
|
||||
glMultiTexCoord3ub,
|
||||
glMultiTexCoord3sv,
|
||||
glMultiTexCoord3usv,
|
||||
glMultiTexCoord3iv,
|
||||
glMultiTexCoord3fv,
|
||||
glMultiTexCoord3dv },
|
||||
|
||||
{ glMultiTexCoord4bv,
|
||||
glMultiTexCoord4ub,
|
||||
glMultiTexCoord4sv,
|
||||
glMultiTexCoord4usv,
|
||||
glMultiTexCoord4iv,
|
||||
glMultiTexCoord4fv,
|
||||
glMultiTexCoord4dv }
|
||||
};
|
||||
|
||||
static void *indexfuncs[7] = {
|
||||
{ glIndexbv,
|
||||
glIndexub,
|
||||
glIndexsv,
|
||||
glIndexusv,
|
||||
glIndexiv,
|
||||
glIndexfv,
|
||||
glIndexdv },
|
||||
};
|
||||
|
||||
static void *edgeflagfuncs[7] = {
|
||||
{ glEdgeFlagbv,
|
||||
glEdgeFlagub,
|
||||
glEdgeFlagsv,
|
||||
glEdgeFlagusv,
|
||||
glEdgeFlagiv,
|
||||
glEdgeFlagfv,
|
||||
glEdgeFlagdv },
|
||||
};
|
||||
|
||||
static void *normalfuncs[7] = {
|
||||
{ glNormal3bv,
|
||||
glNormal3ub,
|
||||
glNormal3sv,
|
||||
glNormal3usv,
|
||||
glNormal3iv,
|
||||
glNormal3fv,
|
||||
glNormal3dv },
|
||||
};
|
||||
|
||||
static void *fogcoordfuncs[7] = {
|
||||
{ glFogCoordbv,
|
||||
glFogCoordub,
|
||||
glFogCoordsv,
|
||||
glFogCoordusv,
|
||||
glFogCoordiv,
|
||||
glFogCoordfv,
|
||||
glFogCoorddv },
|
||||
};
|
||||
|
||||
static void *secondarycolorfuncs[7] = {
|
||||
{ glSecondaryColor3bv,
|
||||
glSecondaryColor3ub,
|
||||
glSecondaryColor3sv,
|
||||
glSecondaryColor3usv,
|
||||
glSecondaryColor3iv,
|
||||
glSecondaryColor3fv,
|
||||
glSecondaryColor3dv },
|
||||
};
|
||||
|
||||
|
||||
void _aa_create_context( GLcontext *ctx )
|
||||
{
|
||||
ctx->aa_context = MALLOC( sizeof(AAcontext) );
|
||||
AA_CONTEXT(ctx)->NewState = ~0;
|
||||
}
|
||||
|
||||
static void _aa_update_state( GLcontext *ctx )
|
||||
{
|
||||
AAcontext *actx = AA_CONTEXT(ctx);
|
||||
AAtexarray *ta = actx->texarrays;
|
||||
AAarray *aa = actx->arrays;
|
||||
int 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 = edgeflagfuncs[TYPE_IDX(aa->array->Type)];
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static void _aa_loopback_array_elt( GLint elt )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
AAcontext *actx = AA_CONTEXT(ctx);
|
||||
AAtexarray *ta;
|
||||
AAarray *aa;
|
||||
|
||||
for (ta = actx->texarrays ; ta->func ; ta++) {
|
||||
void (*func)( GLint, const void * ) =
|
||||
(void (*)( GLint, const void * )) ta->func;
|
||||
func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->SizeB );
|
||||
}
|
||||
|
||||
for (aa = actx->arrays ; aa->func ; aa++) {
|
||||
void (*func)( GLint, const void * ) =
|
||||
(void (*)( GLint, const void * )) aa->func;
|
||||
func( (char *)aa->array->Ptr + elt * aa->array->SizeB );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _aa_exec_array_elt( GLint elt )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
AAcontext *actx = AA_CONTEXT(ctx);
|
||||
|
||||
if (actx->NewState)
|
||||
_aa_update_state( ctx );
|
||||
|
||||
ctx->Exec->ArrayElement = _aa_loopback_array_elt;
|
||||
_aa_loopback_array_elt( elt );
|
||||
}
|
||||
|
||||
/* This works for save as well:
|
||||
*/
|
||||
void _aa_save_array_elt( GLint elt )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
AAcontext *actx = AA_CONTEXT(ctx);
|
||||
|
||||
if (actx->NewState)
|
||||
_aa_update_state( ctx );
|
||||
|
||||
ctx->Save->ArrayElement = _aa_loopback_array_elt;
|
||||
_aa_loopback_array_elt( elt );
|
||||
}
|
||||
|
||||
|
||||
void aa_invalidate_state( GLcontext *ctx, GLuint new_state )
|
||||
{
|
||||
if (AA_CONTEXT(ctx))
|
||||
AA_CONTEXT(ctx)->NewState |= new_state;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: api_loopback.c,v 1.3 2000/11/27 18:17:09 brianp Exp $ */
|
||||
/* $Id: api_loopback.c,v 1.4 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -548,7 +548,7 @@ loopback_Indexd( GLdouble c )
|
|||
static void
|
||||
loopback_Indexf( GLfloat c )
|
||||
{
|
||||
INDEX( (GLint) c );
|
||||
INDEX( (GLuint) (GLint) c );
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1362,6 +1362,7 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v )
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_loopback_prefer_float( struct _glapi_table *dest,
|
||||
GLboolean prefer_float_colors )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "glheader.h"
|
||||
#include "api_noop.h"
|
||||
#include "api_validate.h"
|
||||
#include "context.h"
|
||||
#include "colormac.h"
|
||||
#include "light.h"
|
||||
|
|
@ -468,7 +469,7 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
|
|||
{
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "_mesa_noop_Rectf");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
}
|
||||
|
||||
glBegin( GL_QUADS );
|
||||
|
|
@ -480,32 +481,22 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/* Some very basic support for arrays. Drivers without explicit array
|
||||
* support can hook these in, but it may be more efficient to fall
|
||||
* back to swtnl. Particularly if the driver is implementing a
|
||||
* software fastpath rather than driving a hardware t&l unit.
|
||||
* support can hook these in, but still need to supply an array-elt
|
||||
* implementation.
|
||||
*/
|
||||
|
||||
/* A codegen implementation of this which hardwires the multiplies and
|
||||
* inlines the called functions would fly:
|
||||
*/
|
||||
void _mesa_noop_ArrayElement( GLint elt )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
int i;
|
||||
for (i = 0 ; i < ctx->Array._nr_enabled ; i++) {
|
||||
struct gl_client_array *a = ctx->Array._enabled[i];
|
||||
a->_EltFunc( a->Data + elt * a->StrideB );
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -515,12 +506,10 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
if (count <= 0) {
|
||||
if (count < 0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
|
||||
}
|
||||
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
|
||||
return;
|
||||
}
|
||||
|
||||
glBegin(mode);
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
|
|
@ -539,13 +528,20 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
|||
gl_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)
|
||||
void _mesa_noop_DrawRangeElements(GLenum mode,
|
||||
GLuint start, GLuint end,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
glDrawElements( mode, count, type, indices );
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (_mesa_validate_DrawRangeElements( ctx, mode,
|
||||
start, end,
|
||||
count, type, indices ))
|
||||
glDrawElements( mode, count, type, indices );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -98,4 +98,15 @@ extern void _mesa_noop_TexCoord4fv( GLfloat *v );
|
|||
*/
|
||||
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
|
||||
|
|
|
|||
137
src/mesa/main/api_validate.c
Normal file
137
src/mesa/main/api_validate.c
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
|
||||
/* $Id: api_validate.c,v 1.1 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "context.h"
|
||||
#include "mtypes.h"
|
||||
#include "api_validate.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)
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (mode < 0 ||
|
||||
mode > GL_POLYGON) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (type != GL_UNSIGNED_INT &&
|
||||
type != GL_UNSIGNED_BYTE &&
|
||||
type != GL_UNSIGNED_SHORT)
|
||||
{
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (ctx->NewState)
|
||||
gl_update_state( ctx );
|
||||
|
||||
if (!ctx->Array.Vertex.Enabled)
|
||||
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)
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (mode < 0 || mode > GL_POLYGON) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (end < start) {
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (type != GL_UNSIGNED_INT &&
|
||||
type != GL_UNSIGNED_BYTE &&
|
||||
type != GL_UNSIGNED_SHORT)
|
||||
{
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (ctx->NewState)
|
||||
gl_update_state( ctx );
|
||||
|
||||
if (!ctx->Array.Vertex.Enabled)
|
||||
return GL_FALSE;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
GLboolean
|
||||
_mesa_validate_DrawArrays(GLcontext *ctx,
|
||||
GLenum mode, GLint start, GLsizei count)
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||
|
||||
if (count<0) {
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (mode < 0 || mode > GL_POLYGON) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (ctx->NewState)
|
||||
gl_update_state( ctx );
|
||||
|
||||
if (!ctx->Array.Vertex.Enabled)
|
||||
return GL_FALSE;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
50
src/mesa/main/api_validate.h
Normal file
50
src/mesa/main/api_validate.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* $Id: api_validate.h,v 1.1 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: attrib.c,v 1.38 2000/12/14 20:25:56 brianp Exp $ */
|
||||
/* $Id: attrib.c,v 1.39 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -100,7 +100,7 @@ _mesa_PushAttrib(GLbitfield mask)
|
|||
struct gl_attrib_node *head;
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushAttrib");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glPushAttrib %x\n", (int)mask);
|
||||
|
|
@ -136,9 +136,7 @@ _mesa_PushAttrib(GLbitfield mask)
|
|||
|
||||
if (mask & GL_CURRENT_BIT) {
|
||||
struct gl_current_attrib *attr;
|
||||
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
|
||||
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 );
|
||||
|
|
@ -257,6 +255,7 @@ _mesa_PushAttrib(GLbitfield mask)
|
|||
|
||||
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 );
|
||||
|
|
@ -546,9 +545,7 @@ _mesa_PopAttrib(void)
|
|||
{
|
||||
struct gl_attrib_node *attr, *next;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopAttrib");
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->AttribStackDepth==0) {
|
||||
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
|
||||
|
|
@ -616,7 +613,7 @@ _mesa_PopAttrib(void)
|
|||
}
|
||||
break;
|
||||
case GL_CURRENT_BIT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT( ctx, 0 );
|
||||
MEMCPY( &ctx->Current, attr->data,
|
||||
sizeof(struct gl_current_attrib) );
|
||||
break;
|
||||
|
|
@ -872,7 +869,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
|
|||
struct gl_attrib_node *head;
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushClientAttrib");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->ClientAttribStackDepth>=MAX_CLIENT_ATTRIB_STACK_DEPTH) {
|
||||
gl_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
|
||||
|
|
@ -923,7 +920,7 @@ _mesa_PopClientAttrib(void)
|
|||
struct gl_attrib_node *attr, *next;
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopClientAttrib");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->ClientAttribStackDepth==0) {
|
||||
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
|
||||
|
|
@ -938,14 +935,17 @@ _mesa_PopClientAttrib(void)
|
|||
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:
|
||||
gl_problem( ctx, "Bad attrib flag in PopClientAttrib");
|
||||
|
|
@ -958,7 +958,6 @@ _mesa_PopClientAttrib(void)
|
|||
attr = next;
|
||||
}
|
||||
|
||||
ctx->NewState = _NEW_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: blend.c,v 1.26 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: blend.c,v 1.27 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -41,8 +41,9 @@
|
|||
void
|
||||
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
|
||||
{
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glBlendFunc %s %s\n",
|
||||
|
|
@ -70,7 +71,6 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" );
|
||||
|
|
@ -97,18 +97,24 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Driver.BlendFunc) {
|
||||
(*ctx->Driver.BlendFunc)( ctx, sfactor, dfactor );
|
||||
}
|
||||
if (ctx->Color.BlendDstRGB == dfactor &&
|
||||
ctx->Color.BlendSrcRGB == sfactor &&
|
||||
ctx->Color.BlendDstA == dfactor &&
|
||||
ctx->Color.BlendSrcA == sfactor)
|
||||
return;
|
||||
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,7 +124,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
GLenum sfactorA, GLenum dfactorA )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glBlendFuncSeperate %s %s %s %s\n",
|
||||
|
|
@ -148,7 +154,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendSrcRGB = sfactorRGB;
|
||||
break;
|
||||
default:
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)");
|
||||
|
|
@ -175,7 +180,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendDstRGB = dfactorRGB;
|
||||
break;
|
||||
default:
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)");
|
||||
|
|
@ -203,7 +207,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendSrcA = sfactorA;
|
||||
break;
|
||||
default:
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)");
|
||||
|
|
@ -230,14 +233,24 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
|||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
case GL_CONSTANT_ALPHA:
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
ctx->Color.BlendDstA = dfactorA;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)" );
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
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,
|
||||
|
|
@ -252,7 +265,7 @@ void
|
|||
_mesa_BlendEquation( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glBlendEquation %s\n",
|
||||
|
|
@ -262,22 +275,15 @@ _mesa_BlendEquation( GLenum mode )
|
|||
case GL_MIN_EXT:
|
||||
case GL_MAX_EXT:
|
||||
case GL_FUNC_ADD_EXT:
|
||||
if (ctx->Extensions.EXT_blend_minmax) {
|
||||
ctx->Color.BlendEquation = mode;
|
||||
}
|
||||
else {
|
||||
if (!ctx->Extensions.EXT_blend_minmax) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
|
||||
return;
|
||||
}
|
||||
case GL_LOGIC_OP:
|
||||
ctx->Color.BlendEquation = mode;
|
||||
break;
|
||||
case GL_FUNC_SUBTRACT_EXT:
|
||||
case GL_FUNC_REVERSE_SUBTRACT_EXT:
|
||||
if (ctx->Extensions.EXT_blend_subtract) {
|
||||
ctx->Color.BlendEquation = mode;
|
||||
}
|
||||
else {
|
||||
if (!ctx->Extensions.EXT_blend_subtract) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
|
||||
return;
|
||||
}
|
||||
|
|
@ -287,17 +293,17 @@ _mesa_BlendEquation( GLenum mode )
|
|||
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.
|
||||
*/
|
||||
if (mode==GL_LOGIC_OP && ctx->Color.BlendEnabled) {
|
||||
ctx->Color.ColorLogicOpEnabled = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
ctx->Color.ColorLogicOpEnabled = GL_FALSE;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
ctx->Color.ColorLogicOpEnabled = (mode==GL_LOGIC_OP &&
|
||||
ctx->Color.BlendEnabled);
|
||||
|
||||
if (ctx->Driver.BlendEquation)
|
||||
ctx->Driver.BlendEquation( ctx, mode );
|
||||
|
|
@ -308,11 +314,19 @@ _mesa_BlendEquation( GLenum mode )
|
|||
void
|
||||
_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
|
||||
{
|
||||
GLfloat tmp[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F );
|
||||
ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F );
|
||||
ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F );
|
||||
ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0F, 1.0F );
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
tmp[0] = CLAMP( red, 0.0, 1.0 );
|
||||
tmp[1] = CLAMP( green, 0.0, 1.0 );
|
||||
tmp[2] = CLAMP( blue, 0.0, 1.0 );
|
||||
tmp[3] = CLAMP( alpha, 0.0, 1.0 );
|
||||
|
||||
if (TEST_EQ_4V(tmp, ctx->Color.BlendColor))
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
COPY_4FV( ctx->Color.BlendColor, tmp );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: buffers.c,v 1.20 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: buffers.c,v 1.21 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -49,9 +49,14 @@ void
|
|||
_mesa_ClearIndex( GLfloat c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->Color.ClearIndex == (GLuint)c)
|
||||
return;
|
||||
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.ClearIndex = (GLuint) c;
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
|
||||
if (!ctx->Visual.RGBAflag) {
|
||||
/* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
|
||||
|
|
@ -65,14 +70,20 @@ void
|
|||
_mesa_ClearColor( GLclampf red, GLclampf green,
|
||||
GLclampf blue, GLclampf alpha )
|
||||
{
|
||||
GLfloat tmp[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F );
|
||||
ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F );
|
||||
ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
|
||||
ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
|
||||
ctx->NewState |= _NEW_COLOR;
|
||||
tmp[0] = CLAMP( red, 0.0, 1.0 );
|
||||
tmp[1] = CLAMP( green, 0.0, 1.0 );
|
||||
tmp[2] = CLAMP( blue, 0.0, 1.0 );
|
||||
tmp[3] = CLAMP( alpha, 0.0, 1.0 );
|
||||
|
||||
if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
COPY_4FV( ctx->Color.ClearColor, tmp );
|
||||
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF);
|
||||
|
|
@ -92,7 +103,7 @@ void
|
|||
_mesa_Clear( GLbitfield mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glClear 0x%x\n", mask);
|
||||
|
|
@ -149,7 +160,8 @@ void
|
|||
_mesa_DrawBuffer( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
|
||||
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
|
@ -301,7 +313,7 @@ void
|
|||
_mesa_ReadBuffer( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: clip.c,v 1.18 2000/11/27 18:22:13 brianp Exp $ */
|
||||
/* $Id: clip.c,v 1.19 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -56,7 +56,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint p;
|
||||
GLfloat equation[4];
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
|
||||
if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
|
||||
|
|
@ -80,9 +80,13 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
|
|||
if (ctx->ModelView.flags & MAT_DIRTY)
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
|
||||
gl_transform_vector( ctx->Transform.EyeUserPlane[p], equation,
|
||||
ctx->ModelView.inv );
|
||||
gl_transform_vector( equation, equation, ctx->ModelView.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
|
||||
|
|
@ -97,8 +101,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq )
|
|||
ctx->ProjectionMatrix.inv );
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_TRANSFORM;
|
||||
|
||||
if (ctx->Driver.ClipPlane)
|
||||
ctx->Driver.ClipPlane( ctx, plane, equation );
|
||||
}
|
||||
|
|
@ -109,9 +111,7 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint p;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane");
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
p = (GLint) (plane - GL_CLIP_PLANE0);
|
||||
if (p < 0 || p >= ctx->Const.MaxClipPlanes) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: colortab.c,v 1.32 2000/12/10 19:23:19 brianp Exp $ */
|
||||
/* $Id: colortab.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -213,8 +213,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
|
|||
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, "glColorTable");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
|
|
@ -460,8 +459,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
|
|||
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, "glColorSubTable");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
|
|
@ -630,7 +628,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat,
|
|||
{
|
||||
GLchan data[MAX_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
/* Select buffer to read from */
|
||||
(*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
|
||||
|
|
@ -661,7 +659,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start,
|
|||
{
|
||||
GLchan data[MAX_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
/* Select buffer to read from */
|
||||
(*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
|
||||
|
|
@ -693,8 +691,7 @@ _mesa_GetColorTable( GLenum target, GLenum format,
|
|||
struct gl_color_table *table = NULL;
|
||||
GLchan rgba[MAX_COLOR_TABLE_SIZE][4];
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState) {
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -865,7 +862,7 @@ void
|
|||
_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_COLOR_TABLE_SGI:
|
||||
|
|
@ -960,8 +957,7 @@ _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, "glGetColorTableParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
|
|
@ -1091,8 +1087,7 @@ _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, "glGetColorTableParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: config.h,v 1.24 2000/11/20 18:06:11 brianp Exp $ */
|
||||
/* $Id: config.h,v 1.25 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -175,28 +175,6 @@
|
|||
|
||||
|
||||
|
||||
/* Vertex buffer size. KW: no restrictions on the divisibility of
|
||||
* this number, though things may go better for you if you choose a
|
||||
* value of 12n + 3.
|
||||
*/
|
||||
#define VB_START 3
|
||||
|
||||
#define VB_MAX (216 + VB_START)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actual vertex buffer size.
|
||||
*
|
||||
* Arrays must also accomodate new vertices from clipping, and
|
||||
* potential overflow from primitives which don't fit into neatly into
|
||||
* VB_MAX vertices. (This only happens when mixed primitives are
|
||||
* sharing the vb).
|
||||
*/
|
||||
#define VB_MAX_CLIPPED_VERTS ((2 * (6 + MAX_CLIP_PLANES))+1)
|
||||
#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS)
|
||||
|
||||
|
||||
/*
|
||||
* Language/compiler stuff
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: context.c,v 1.113 2000/12/16 00:21:28 brianp Exp $ */
|
||||
/* $Id: context.c,v 1.114 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -77,7 +77,6 @@ int MESA_VERBOSE = 0
|
|||
/* | VERBOSE_API */
|
||||
/* | VERBOSE_DRIVER */
|
||||
/* | VERBOSE_STATE */
|
||||
/* | VERBOSE_CULL */
|
||||
/* | VERBOSE_DISPLAY_LIST */
|
||||
;
|
||||
#endif
|
||||
|
|
@ -603,7 +602,7 @@ init_light( struct gl_light *l, GLuint n )
|
|||
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;
|
||||
gl_compute_spot_exp_table( l );
|
||||
gl_invalidate_spot_exp_table( l );
|
||||
l->SpotCutoff = 180.0;
|
||||
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
|
||||
l->ConstantAttenuation = 1.0;
|
||||
|
|
@ -993,15 +992,6 @@ init_attrib_groups( GLcontext *ctx )
|
|||
s->refcount = 0;
|
||||
insert_at_tail( ctx->_ShineTabList, s );
|
||||
}
|
||||
for (i = 0 ; i < 4 ; i++) {
|
||||
ctx->_ShineTable[i] = ctx->_ShineTabList->prev;
|
||||
ctx->_ShineTable[i]->refcount++;
|
||||
}
|
||||
|
||||
gl_compute_shine_table( ctx, 0, ctx->Light.Material[0].Shininess );
|
||||
gl_compute_shine_table( ctx, 2, ctx->Light.Material[0].Shininess * .5 );
|
||||
gl_compute_shine_table( ctx, 1, ctx->Light.Material[1].Shininess );
|
||||
gl_compute_shine_table( ctx, 3, ctx->Light.Material[1].Shininess * .5 );
|
||||
|
||||
|
||||
/* Line group */
|
||||
|
|
@ -1105,10 +1095,9 @@ init_attrib_groups( GLcontext *ctx )
|
|||
ctx->Polygon.CullFlag = GL_FALSE;
|
||||
ctx->Polygon.CullFaceMode = GL_BACK;
|
||||
ctx->Polygon.FrontFace = GL_CCW;
|
||||
ctx->Polygon.FrontBit = 0;
|
||||
ctx->Polygon._FrontBit = 0;
|
||||
ctx->Polygon.FrontMode = GL_FILL;
|
||||
ctx->Polygon.BackMode = GL_FILL;
|
||||
ctx->Polygon._Unfilled = GL_FALSE;
|
||||
ctx->Polygon.SmoothFlag = GL_FALSE;
|
||||
ctx->Polygon.StippleFlag = GL_FALSE;
|
||||
ctx->Polygon.OffsetFactor = 0.0F;
|
||||
|
|
@ -1848,7 +1837,7 @@ _mesa_get_current_context( void )
|
|||
void
|
||||
_mesa_swapbuffers(GLcontext *ctx)
|
||||
{
|
||||
FLUSH_TNL( ctx, FLUSH_STORED_VERTICES );
|
||||
FLUSH_VERTICES( ctx, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1989,7 +1978,7 @@ void
|
|||
_mesa_Finish( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFinish");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
if (ctx->Driver.Finish) {
|
||||
(*ctx->Driver.Finish)( ctx );
|
||||
}
|
||||
|
|
@ -2001,7 +1990,7 @@ void
|
|||
_mesa_Flush( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFlush");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
if (ctx->Driver.Flush) {
|
||||
(*ctx->Driver.Flush)( ctx );
|
||||
}
|
||||
|
|
@ -2009,7 +1998,7 @@ _mesa_Flush( void )
|
|||
|
||||
|
||||
|
||||
const char *_mesa_prim_name[GL_POLYGON+2] = {
|
||||
const char *_mesa_prim_name[GL_POLYGON+4] = {
|
||||
"GL_POINTS",
|
||||
"GL_LINES",
|
||||
"GL_LINE_LOOP",
|
||||
|
|
@ -2020,7 +2009,9 @@ const char *_mesa_prim_name[GL_POLYGON+2] = {
|
|||
"GL_QUADS",
|
||||
"GL_QUAD_STRIP",
|
||||
"GL_POLYGON",
|
||||
"culled primitive"
|
||||
"outside begin/end",
|
||||
"inside unkown primitive",
|
||||
"unknown state"
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: convolve.c,v 1.16 2000/12/10 19:23:19 brianp Exp $ */
|
||||
/* $Id: convolve.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -112,7 +112,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G
|
|||
{
|
||||
GLenum baseFormat;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter1D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target != GL_CONVOLUTION_1D) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)");
|
||||
|
|
@ -186,7 +186,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
|
|||
GLenum baseFormat;
|
||||
GLint i, components;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target != GL_CONVOLUTION_2D) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)");
|
||||
|
|
@ -268,8 +268,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint c;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterf");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -313,8 +312,7 @@ _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, "glConvolutionParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -369,8 +367,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint c;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteri");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -414,8 +411,7 @@ _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, "glConvolutionParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -474,7 +470,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi
|
|||
GLenum baseFormat;
|
||||
GLchan rgba[MAX_CONVOLUTION_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target != GL_CONVOLUTION_1D) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)");
|
||||
|
|
@ -511,7 +507,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi
|
|||
struct gl_pixelstore_attrib packSave;
|
||||
GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target != GL_CONVOLUTION_2D) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)");
|
||||
|
|
@ -570,7 +566,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im
|
|||
const struct gl_convolution_attrib *filter;
|
||||
GLint row;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->NewState) {
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -620,8 +616,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
const struct gl_convolution_attrib *conv;
|
||||
GLuint c;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -682,8 +677,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
const struct gl_convolution_attrib *conv;
|
||||
GLuint c;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (target) {
|
||||
case GL_CONVOLUTION_1D:
|
||||
|
|
@ -753,7 +747,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row,
|
|||
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
|
||||
const struct gl_convolution_attrib *filter;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetSeparableFilter");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->NewState) {
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -811,7 +805,7 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs
|
|||
const GLint colStart = MAX_CONVOLUTION_WIDTH * 4;
|
||||
GLenum baseFormat;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSeparableFilter2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target != GL_SEPARABLE_2D) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dd.h,v 1.43 2000/11/24 10:25:05 keithw Exp $ */
|
||||
/* $Id: dd.h,v 1.44 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -31,12 +31,7 @@
|
|||
|
||||
/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */
|
||||
|
||||
|
||||
struct gl_pixelstore_attrib;
|
||||
struct vertex_buffer;
|
||||
struct gl_pipeline;
|
||||
struct gl_pipeline_stage;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -139,11 +134,6 @@ typedef void (*triangle_func)( GLcontext *ctx,
|
|||
typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
|
||||
GLuint v3, GLuint v4, GLuint pv );
|
||||
|
||||
typedef void (*render_func)( struct vertex_buffer *VB,
|
||||
GLuint start,
|
||||
GLuint count,
|
||||
GLuint parity );
|
||||
|
||||
|
||||
/*
|
||||
* Device Driver function table.
|
||||
|
|
@ -161,7 +151,7 @@ struct dd_function_table {
|
|||
* NULL can be returned.
|
||||
*/
|
||||
|
||||
void (*UpdateState)( GLcontext *ctx );
|
||||
void (*UpdateState)( GLcontext *ctx, GLuint new_state );
|
||||
/*
|
||||
* UpdateState() is called whenver Mesa thinks the device driver should
|
||||
* update its state and/or the other pointers (such as PointsFunc,
|
||||
|
|
@ -752,49 +742,39 @@ struct dd_function_table {
|
|||
*/
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*** Accelerated point, line, polygon and quad functions:
|
||||
***/
|
||||
|
||||
points_func PointsFunc;
|
||||
line_func LineFunc;
|
||||
triangle_func TriangleFunc;
|
||||
quad_func QuadFunc;
|
||||
|
||||
|
||||
/***
|
||||
*** Transformation/Rendering functions
|
||||
***/
|
||||
|
||||
void (*RenderStart)( GLcontext *ctx );
|
||||
void (*RenderFinish)( GLcontext *ctx );
|
||||
/* KW: These replace Begin and End, and have more relaxed semantics.
|
||||
* They are called prior-to and after one or more vb flush, and are
|
||||
* thus decoupled from the gl_begin/gl_end pairs, which are possibly
|
||||
* more frequent. If a begin/end pair covers >1 vertex buffer, these
|
||||
* are called at most once for the pair. (a bit broken at present)
|
||||
*/
|
||||
/* Wrap around all rendering functions. Suitable for
|
||||
* grabbing/releasing hardware locks.
|
||||
*/
|
||||
|
||||
void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
|
||||
/* This function, if not NULL, is called whenever new window coordinates
|
||||
* are put in the vertex buffer. The vertices in question are those n
|
||||
* such that start <= n < end.
|
||||
* The device driver can convert the window coords to its own specialized
|
||||
* format. The 3Dfx driver uses this.
|
||||
|
||||
|
||||
/***
|
||||
*** Parameters for _tnl_render_stage
|
||||
***/
|
||||
points_func PointsFunc; /* must now respect vb->elts */
|
||||
line_func LineFunc;
|
||||
triangle_func TriangleFunc;
|
||||
quad_func QuadFunc;
|
||||
|
||||
void (*ResetLineStipple)( GLcontext *ctx );
|
||||
|
||||
|
||||
void (*BuildProjectedVertices)( GLcontext *ctx,
|
||||
GLuint start, GLuint end,
|
||||
GLuint new_inputs);
|
||||
/* This function, if not NULL, 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.
|
||||
*
|
||||
* Note: Deprecated in favour of RegisterPipelineStages, below.
|
||||
* This function is called only from _tnl_render_stage in tnl/t_render.c.
|
||||
*/
|
||||
|
||||
render_func *RenderVBClippedTab;
|
||||
render_func *RenderVBCulledTab;
|
||||
render_func *RenderVBRawTab;
|
||||
/* These function tables allow the device driver to rasterize an
|
||||
* entire begin/end group of primitives at once. See the
|
||||
* gl_render_vb() function in vbrender.c for more details.
|
||||
*/
|
||||
|
||||
GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno );
|
||||
GLboolean (*MultipassFunc)( 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
|
||||
|
|
@ -804,51 +784,41 @@ struct dd_function_table {
|
|||
* This function will be first invoked with passno == 1.
|
||||
*/
|
||||
|
||||
/***
|
||||
*** NEW in Mesa 3.x
|
||||
***/
|
||||
|
||||
void (*RegisterVB)( struct vertex_buffer *VB );
|
||||
void (*UnregisterVB)( struct vertex_buffer *VB );
|
||||
/* When Mesa creates a new vertex buffer it calls Driver.RegisterVB()
|
||||
* so the device driver can allocate its own vertex buffer data and
|
||||
* hook it to the VB->driver_data pointer.
|
||||
* When Mesa destroys a vertex buffer it calls Driver.UnegisterVB()
|
||||
* so the driver can deallocate its own data attached to VB->driver_data.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx );
|
||||
GLboolean (*BuildEltPipeline)( GLcontext *ctx );
|
||||
/* Perform the full pipeline build, or return false.
|
||||
*/
|
||||
|
||||
|
||||
/***
|
||||
*** Support for multiple t&l engines
|
||||
***/
|
||||
|
||||
#define FLUSH_INSIDE_BEGIN_END 0x1
|
||||
#define FLUSH_STORED_VERTICES 0x2
|
||||
#define FLUSH_UPDATE_CURRENT 0x4
|
||||
|
||||
GLuint NeedFlush;
|
||||
/* Set by the driver-supplied t&l engine.
|
||||
* Bitflags defined above are set whenever
|
||||
* - the engine *might* be inside a begin/end object.
|
||||
* - there *might* be buffered vertices to be flushed.
|
||||
* - the ctx->Current values *might* not be uptodate.
|
||||
*
|
||||
* The FlushVertices() call below may be used to resolve
|
||||
* these conditions.
|
||||
#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 GL_POLYGON+1 when
|
||||
* outside begin/end.
|
||||
*/
|
||||
|
||||
GLboolean (*FlushVertices)( GLcontext *ctx, GLuint flags );
|
||||
/* If inside begin/end, returns GL_FALSE.
|
||||
GLuint CurrentSavePrimitive;
|
||||
/* Current state of an inprogress compilation.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#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,
|
||||
* if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
|
||||
* and ctx->Light.Material
|
||||
* returns GL_TRUE.
|
||||
*
|
||||
* Note that the default t&l engine never clears the
|
||||
|
|
@ -866,6 +836,11 @@ struct dd_function_table {
|
|||
* in time to make changes to dispatch tables, etc.
|
||||
*/
|
||||
|
||||
void (*BeginCallList)( GLcontext *ctx, GLuint list );
|
||||
void (*EndCallList)( GLcontext *ctx );
|
||||
/* Notify the t&l component before and after calling a display list.
|
||||
*/
|
||||
|
||||
void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer );
|
||||
/* Let the t&l component know when the context becomes current.
|
||||
|
|
@ -973,7 +948,7 @@ typedef struct {
|
|||
void (*EdgeFlag)( GLboolean );
|
||||
void (*EdgeFlagv)( const GLboolean * );
|
||||
void (*EvalCoord1f)( GLfloat ); /* NOTE */
|
||||
void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
|
||||
void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */
|
||||
void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */
|
||||
void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */
|
||||
void (*EvalPoint1)( GLint ); /* NOTE */
|
||||
|
|
@ -1053,7 +1028,10 @@ typedef struct {
|
|||
* provide partial t&l acceleration.
|
||||
*
|
||||
* Mesa will provide a set of helper functions to do eval within
|
||||
* accelerated vertex formats, eventually...
|
||||
* accelerated vertex formats, eventually...
|
||||
*
|
||||
* Update: There seem to be issues re. maintaining correct values
|
||||
* for 'ctx->Current' in the face of Eval and T&L fallbacks...
|
||||
*/
|
||||
|
||||
GLboolean prefer_float_colors;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
void gl_print_state( const char *msg, GLuint state )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%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%s%s\n",
|
||||
"%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%s\n",
|
||||
msg,
|
||||
state,
|
||||
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
|
||||
|
|
@ -19,7 +19,6 @@ void gl_print_state( const char *msg, GLuint state )
|
|||
(state & _NEW_HINT) ? "ctx->Hint, " : "",
|
||||
(state & _NEW_LIGHT) ? "ctx->Light, " : "",
|
||||
(state & _NEW_LINE) ? "ctx->Line, " : "",
|
||||
(state & _NEW_FEEDBACK_SELECT) ? "ctx->Feedback/Select, " : "",
|
||||
(state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
|
||||
(state & _NEW_POINT) ? "ctx->Point, " : "",
|
||||
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
|
||||
|
|
@ -39,11 +38,9 @@ void gl_print_state( const char *msg, GLuint state )
|
|||
void gl_print_enable_flags( const char *msg, GLuint flags )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
msg,
|
||||
flags,
|
||||
(flags & ENABLE_TEX0) ? "tex-0, " : "",
|
||||
(flags & ENABLE_TEX1) ? "tex-1, " : "",
|
||||
(flags & ENABLE_LIGHT) ? "light, " : "",
|
||||
(flags & ENABLE_FOG) ? "fog, " : "",
|
||||
(flags & ENABLE_USERCLIP) ? "userclip, " : "",
|
||||
|
|
@ -51,10 +48,18 @@ void gl_print_enable_flags( const char *msg, GLuint flags )
|
|||
(flags & ENABLE_TEXGEN1) ? "tex-gen-1, " : "",
|
||||
(flags & ENABLE_TEXGEN2) ? "tex-gen-2, " : "",
|
||||
(flags & ENABLE_TEXGEN3) ? "tex-gen-3, " : "",
|
||||
(flags & ENABLE_TEXGEN4) ? "tex-gen-4, " : "",
|
||||
(flags & ENABLE_TEXGEN5) ? "tex-gen-5, " : "",
|
||||
(flags & ENABLE_TEXGEN6) ? "tex-gen-6, " : "",
|
||||
(flags & ENABLE_TEXGEN7) ? "tex-gen-7, " : "",
|
||||
(flags & ENABLE_TEXMAT0) ? "tex-mat-0, " : "",
|
||||
(flags & ENABLE_TEXMAT1) ? "tex-mat-1, " : "",
|
||||
(flags & ENABLE_TEXMAT2) ? "tex-mat-2, " : "",
|
||||
(flags & ENABLE_TEXMAT3) ? "tex-mat-3, " : "",
|
||||
(flags & ENABLE_TEXMAT4) ? "tex-mat-4, " : "",
|
||||
(flags & ENABLE_TEXMAT5) ? "tex-mat-5, " : "",
|
||||
(flags & ENABLE_TEXMAT6) ? "tex-mat-6, " : "",
|
||||
(flags & ENABLE_TEXMAT7) ? "tex-mat-7, " : "",
|
||||
(flags & ENABLE_NORMALIZE) ? "normalize, " : "",
|
||||
(flags & ENABLE_RESCALE) ? "rescale, " : "");
|
||||
}
|
||||
|
|
@ -62,19 +67,17 @@ void gl_print_enable_flags( const char *msg, GLuint flags )
|
|||
void gl_print_tri_caps( const char *name, GLuint flags )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
name,
|
||||
flags,
|
||||
(flags & DD_FEEDBACK) ? "feedback, " : "",
|
||||
(flags & DD_SELECT) ? "select, " : "",
|
||||
(flags & DD_FLATSHADE) ? "flat-shade, " : "",
|
||||
(flags & DD_MULTIDRAW) ? "multidraw, " : "",
|
||||
(flags & DD_SEPERATE_SPECULAR) ? "seperate-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_CULL) ? "tri-bf-cull, " : "",
|
||||
(flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
|
||||
(flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
|
||||
(flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
|
||||
|
|
@ -82,7 +85,6 @@ void gl_print_tri_caps( const char *name, GLuint flags )
|
|||
(flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
|
||||
(flags & DD_POINT_SIZE) ? "point-size, " : "",
|
||||
(flags & DD_POINT_ATTEN) ? "point-atten, " : "",
|
||||
(flags & DD_LIGHTING_CULL) ? "lighting-cull, " : "",
|
||||
(flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "",
|
||||
(flags & DD_STENCIL) ? "stencil, " : ""
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: depth.c,v 1.24 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: depth.c,v 1.25 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -49,11 +49,16 @@ void
|
|||
_mesa_ClearDepth( GLclampd depth )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth");
|
||||
ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 );
|
||||
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 );
|
||||
ctx->NewState |= _NEW_DEPTH;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -62,41 +67,39 @@ void
|
|||
_mesa_DepthFunc( GLenum func )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glDepthFunc %s\n", gl_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:
|
||||
if (ctx->Depth.Func != func) {
|
||||
ctx->Depth.Func = func;
|
||||
ctx->NewState |= _NEW_DEPTH;
|
||||
ctx->_TriangleCaps &= ~DD_Z_NEVER;
|
||||
if (ctx->Driver.DepthFunc) {
|
||||
(*ctx->Driver.DepthFunc)( ctx, func );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_NEVER:
|
||||
if (ctx->Depth.Func != func) {
|
||||
ctx->Depth.Func = func;
|
||||
ctx->NewState |= _NEW_DEPTH;
|
||||
ctx->_TriangleCaps |= DD_Z_NEVER;
|
||||
if (ctx->Driver.DepthFunc) {
|
||||
(*ctx->Driver.DepthFunc)( ctx, func );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDepth.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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Depth.Func == func)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_DEPTH);
|
||||
ctx->Depth.Func = func;
|
||||
|
||||
if (func == GL_NEVER)
|
||||
ctx->_TriangleCaps |= DD_Z_NEVER;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_Z_NEVER;
|
||||
|
||||
if (ctx->Driver.DepthFunc)
|
||||
ctx->Driver.DepthFunc( ctx, func );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -105,7 +108,7 @@ void
|
|||
_mesa_DepthMask( GLboolean flag )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glDepthMask %d\n", flag);
|
||||
|
|
@ -114,13 +117,14 @@ _mesa_DepthMask( GLboolean flag )
|
|||
* GL_TRUE indicates depth buffer writing is enabled (default)
|
||||
* GL_FALSE indicates depth buffer writing is disabled
|
||||
*/
|
||||
if (ctx->Depth.Mask != flag) {
|
||||
ctx->Depth.Mask = flag;
|
||||
ctx->NewState |= _NEW_DEPTH;
|
||||
if (ctx->Driver.DepthMask) {
|
||||
(*ctx->Driver.DepthMask)( ctx, flag );
|
||||
}
|
||||
}
|
||||
if (ctx->Depth.Mask == flag)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_DEPTH);
|
||||
ctx->Depth.Mask = flag;
|
||||
|
||||
if (ctx->Driver.DepthMask)
|
||||
ctx->Driver.DepthMask( ctx, flag );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dispatch.c,v 1.16 2000/09/05 20:17:37 brianp Exp $ */
|
||||
/* $Id: dispatch.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -97,6 +97,8 @@ trace(void)
|
|||
|
||||
#else
|
||||
|
||||
#ifdef THREADS
|
||||
|
||||
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
|
|
@ -107,6 +109,19 @@ trace(void)
|
|||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
return (dispatch->FUNC) ARGS
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#define DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||
__asm__ ("jmp *(%%eax) ;" : : "a" (&(_glapi_Dispatch->FUNC)) )
|
||||
|
||||
#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch;\
|
||||
return (dispatch->FUNC) ARGS
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -114,5 +129,6 @@ trace(void)
|
|||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#define DO_GEOMETRY
|
||||
#include "glapitemp.h"
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dlist.h,v 1.9 2000/11/24 15:21:59 keithw Exp $ */
|
||||
/* $Id: dlist.h,v 1.10 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -32,6 +32,30 @@
|
|||
#include "mtypes.h"
|
||||
|
||||
|
||||
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
|
||||
do { \
|
||||
if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { \
|
||||
gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
|
||||
ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx,)
|
||||
|
||||
#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 gl_init_lists( void );
|
||||
|
||||
extern void gl_destroy_list( GLcontext *ctx, GLuint list );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: drawpix.c,v 1.46 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: drawpix.c,v 1.47 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -53,7 +53,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
|
|||
GLenum format, GLenum type, const GLvoid *pixels )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "_mesa_DrawPixels" );
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->RenderMode==GL_RENDER) {
|
||||
GLint x, y;
|
||||
|
|
@ -88,8 +88,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
|
|||
GLfloat color[4];
|
||||
GLfloat texcoord[4], invq;
|
||||
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
color[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
|
||||
color[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
|
||||
color[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: eval.c,v 1.16 2000/11/22 07:32:16 joukj Exp $ */
|
||||
/* $Id: eval.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -234,104 +234,6 @@ GLfloat *gl_copy_map_points2d(GLenum target,
|
|||
}
|
||||
|
||||
|
||||
#if 00
|
||||
/*
|
||||
* This function is called by the display list deallocator function to
|
||||
* specify that a given set of control points are no longer needed.
|
||||
*/
|
||||
void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data )
|
||||
{
|
||||
struct gl_1d_map *map1 = NULL;
|
||||
struct gl_2d_map *map2 = NULL;
|
||||
|
||||
switch (target) {
|
||||
case GL_MAP1_VERTEX_3:
|
||||
map1 = &ctx->EvalMap.Map1Vertex3;
|
||||
break;
|
||||
case GL_MAP1_VERTEX_4:
|
||||
map1 = &ctx->EvalMap.Map1Vertex4;
|
||||
break;
|
||||
case GL_MAP1_INDEX:
|
||||
map1 = &ctx->EvalMap.Map1Index;
|
||||
break;
|
||||
case GL_MAP1_COLOR_4:
|
||||
map1 = &ctx->EvalMap.Map1Color4;
|
||||
break;
|
||||
case GL_MAP1_NORMAL:
|
||||
map1 = &ctx->EvalMap.Map1Normal;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_1:
|
||||
map1 = &ctx->EvalMap.Map1Texture1;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_2:
|
||||
map1 = &ctx->EvalMap.Map1Texture2;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_3:
|
||||
map1 = &ctx->EvalMap.Map1Texture3;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_4:
|
||||
map1 = &ctx->EvalMap.Map1Texture4;
|
||||
break;
|
||||
case GL_MAP2_VERTEX_3:
|
||||
map2 = &ctx->EvalMap.Map2Vertex3;
|
||||
break;
|
||||
case GL_MAP2_VERTEX_4:
|
||||
map2 = &ctx->EvalMap.Map2Vertex4;
|
||||
break;
|
||||
case GL_MAP2_INDEX:
|
||||
map2 = &ctx->EvalMap.Map2Index;
|
||||
break;
|
||||
case GL_MAP2_COLOR_4:
|
||||
map2 = &ctx->EvalMap.Map2Color4;
|
||||
break;
|
||||
case GL_MAP2_NORMAL:
|
||||
map2 = &ctx->EvalMap.Map2Normal;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_1:
|
||||
map2 = &ctx->EvalMap.Map2Texture1;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_2:
|
||||
map2 = &ctx->EvalMap.Map2Texture2;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_3:
|
||||
map2 = &ctx->EvalMap.Map2Texture3;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_4:
|
||||
map2 = &ctx->EvalMap.Map2Texture4;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "gl_free_control_points" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (map1) {
|
||||
if (data==map1->Points) {
|
||||
/* The control points in the display list are currently */
|
||||
/* being used so we can mark them as discard-able. */
|
||||
map1->Retain = GL_FALSE;
|
||||
}
|
||||
else {
|
||||
/* The control points in the display list are not currently */
|
||||
/* being used. */
|
||||
FREE( data );
|
||||
}
|
||||
}
|
||||
if (map2) {
|
||||
if (data==map2->Points) {
|
||||
/* The control points in the display list are currently */
|
||||
/* being used so we can mark them as discard-able. */
|
||||
map2->Retain = GL_FALSE;
|
||||
}
|
||||
else {
|
||||
/* The control points in the display list are not currently */
|
||||
/* being used. */
|
||||
FREE( data );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
|
@ -349,8 +251,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint k;
|
||||
GLfloat *pnts;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1");
|
||||
struct gl_1d_map *map = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
assert(type == GL_FLOAT || type == GL_DOUBLE);
|
||||
|
||||
|
|
@ -377,99 +279,54 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
|
|||
return;
|
||||
}
|
||||
|
||||
switch (target) {
|
||||
case GL_MAP1_VERTEX_3:
|
||||
map = &ctx->EvalMap.Map1Vertex3;
|
||||
break;
|
||||
case GL_MAP1_VERTEX_4:
|
||||
map = &ctx->EvalMap.Map1Vertex4;
|
||||
break;
|
||||
case GL_MAP1_INDEX:
|
||||
map = &ctx->EvalMap.Map1Index;
|
||||
break;
|
||||
case GL_MAP1_COLOR_4:
|
||||
map = &ctx->EvalMap.Map1Color4;
|
||||
break;
|
||||
case GL_MAP1_NORMAL:
|
||||
map = &ctx->EvalMap.Map1Normal;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_1:
|
||||
map = &ctx->EvalMap.Map1Texture1;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_2:
|
||||
map = &ctx->EvalMap.Map1Texture2;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_3:
|
||||
map = &ctx->EvalMap.Map1Texture3;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_4:
|
||||
map = &ctx->EvalMap.Map1Texture4;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* make copy of the control points */
|
||||
if (type == GL_FLOAT)
|
||||
pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points);
|
||||
else
|
||||
pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points);
|
||||
|
||||
switch (target) {
|
||||
case GL_MAP1_VERTEX_3:
|
||||
ctx->EvalMap.Map1Vertex3.Order = uorder;
|
||||
ctx->EvalMap.Map1Vertex3.u1 = u1;
|
||||
ctx->EvalMap.Map1Vertex3.u2 = u2;
|
||||
ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Vertex3.Points)
|
||||
FREE( ctx->EvalMap.Map1Vertex3.Points );
|
||||
ctx->EvalMap.Map1Vertex3.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_VERTEX_4:
|
||||
ctx->EvalMap.Map1Vertex4.Order = uorder;
|
||||
ctx->EvalMap.Map1Vertex4.u1 = u1;
|
||||
ctx->EvalMap.Map1Vertex4.u2 = u2;
|
||||
ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Vertex4.Points)
|
||||
FREE( ctx->EvalMap.Map1Vertex4.Points );
|
||||
ctx->EvalMap.Map1Vertex4.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_INDEX:
|
||||
ctx->EvalMap.Map1Index.Order = uorder;
|
||||
ctx->EvalMap.Map1Index.u1 = u1;
|
||||
ctx->EvalMap.Map1Index.u2 = u2;
|
||||
ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Index.Points)
|
||||
FREE( ctx->EvalMap.Map1Index.Points );
|
||||
ctx->EvalMap.Map1Index.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_COLOR_4:
|
||||
ctx->EvalMap.Map1Color4.Order = uorder;
|
||||
ctx->EvalMap.Map1Color4.u1 = u1;
|
||||
ctx->EvalMap.Map1Color4.u2 = u2;
|
||||
ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Color4.Points)
|
||||
FREE( ctx->EvalMap.Map1Color4.Points );
|
||||
ctx->EvalMap.Map1Color4.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_NORMAL:
|
||||
ctx->EvalMap.Map1Normal.Order = uorder;
|
||||
ctx->EvalMap.Map1Normal.u1 = u1;
|
||||
ctx->EvalMap.Map1Normal.u2 = u2;
|
||||
ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Normal.Points)
|
||||
FREE( ctx->EvalMap.Map1Normal.Points );
|
||||
ctx->EvalMap.Map1Normal.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_1:
|
||||
ctx->EvalMap.Map1Texture1.Order = uorder;
|
||||
ctx->EvalMap.Map1Texture1.u1 = u1;
|
||||
ctx->EvalMap.Map1Texture1.u2 = u2;
|
||||
ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Texture1.Points)
|
||||
FREE( ctx->EvalMap.Map1Texture1.Points );
|
||||
ctx->EvalMap.Map1Texture1.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_2:
|
||||
ctx->EvalMap.Map1Texture2.Order = uorder;
|
||||
ctx->EvalMap.Map1Texture2.u1 = u1;
|
||||
ctx->EvalMap.Map1Texture2.u2 = u2;
|
||||
ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Texture2.Points)
|
||||
FREE( ctx->EvalMap.Map1Texture2.Points );
|
||||
ctx->EvalMap.Map1Texture2.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_3:
|
||||
ctx->EvalMap.Map1Texture3.Order = uorder;
|
||||
ctx->EvalMap.Map1Texture3.u1 = u1;
|
||||
ctx->EvalMap.Map1Texture3.u2 = u2;
|
||||
ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Texture3.Points)
|
||||
FREE( ctx->EvalMap.Map1Texture3.Points );
|
||||
ctx->EvalMap.Map1Texture3.Points = pnts;
|
||||
break;
|
||||
case GL_MAP1_TEXTURE_COORD_4:
|
||||
ctx->EvalMap.Map1Texture4.Order = uorder;
|
||||
ctx->EvalMap.Map1Texture4.u1 = u1;
|
||||
ctx->EvalMap.Map1Texture4.u2 = u2;
|
||||
ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1);
|
||||
if (ctx->EvalMap.Map1Texture4.Points)
|
||||
FREE( ctx->EvalMap.Map1Texture4.Points );
|
||||
ctx->EvalMap.Map1Texture4.Points = pnts;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" );
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_EVAL;
|
||||
FLUSH_VERTICES(ctx, _NEW_EVAL);
|
||||
map->Order = uorder;
|
||||
map->u1 = u1;
|
||||
map->u2 = u2;
|
||||
map->du = 1.0 / (u2 - u1);
|
||||
if (map->Points)
|
||||
FREE( map->Points );
|
||||
map->Points = pnts;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -498,8 +355,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint k;
|
||||
GLfloat *pnts;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2");
|
||||
struct gl_2d_map *map = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (u1==u2) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );
|
||||
|
|
@ -535,6 +392,39 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
|
|||
return;
|
||||
}
|
||||
|
||||
switch (target) {
|
||||
case GL_MAP2_VERTEX_3:
|
||||
map = &ctx->EvalMap.Map2Vertex3;
|
||||
break;
|
||||
case GL_MAP2_VERTEX_4:
|
||||
map = &ctx->EvalMap.Map2Vertex4;
|
||||
break;
|
||||
case GL_MAP2_INDEX:
|
||||
map = &ctx->EvalMap.Map2Index;
|
||||
break;
|
||||
case GL_MAP2_COLOR_4:
|
||||
map = &ctx->EvalMap.Map2Color4;
|
||||
break;
|
||||
case GL_MAP2_NORMAL:
|
||||
map = &ctx->EvalMap.Map2Normal;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_1:
|
||||
map = &ctx->EvalMap.Map2Texture1;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_2:
|
||||
map = &ctx->EvalMap.Map2Texture2;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_3:
|
||||
map = &ctx->EvalMap.Map2Texture3;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_4:
|
||||
map = &ctx->EvalMap.Map2Texture4;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* make copy of the control points */
|
||||
if (type == GL_FLOAT)
|
||||
pnts = gl_copy_map_points2f(target, ustride, uorder,
|
||||
|
|
@ -542,130 +432,20 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
|
|||
else
|
||||
pnts = gl_copy_map_points2d(target, ustride, uorder,
|
||||
vstride, vorder, (GLdouble*) points);
|
||||
|
||||
switch (target) {
|
||||
case GL_MAP2_VERTEX_3:
|
||||
ctx->EvalMap.Map2Vertex3.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Vertex3.u1 = u1;
|
||||
ctx->EvalMap.Map2Vertex3.u2 = u2;
|
||||
ctx->EvalMap.Map2Vertex3.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Vertex3.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Vertex3.v1 = v1;
|
||||
ctx->EvalMap.Map2Vertex3.v2 = v2;
|
||||
ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Vertex3.Points)
|
||||
FREE( ctx->EvalMap.Map2Vertex3.Points );
|
||||
ctx->EvalMap.Map2Vertex3.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_VERTEX_4:
|
||||
ctx->EvalMap.Map2Vertex4.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Vertex4.u1 = u1;
|
||||
ctx->EvalMap.Map2Vertex4.u2 = u2;
|
||||
ctx->EvalMap.Map2Vertex4.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Vertex4.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Vertex4.v1 = v1;
|
||||
ctx->EvalMap.Map2Vertex4.v2 = v2;
|
||||
ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Vertex4.Points)
|
||||
FREE( ctx->EvalMap.Map2Vertex4.Points );
|
||||
ctx->EvalMap.Map2Vertex4.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_INDEX:
|
||||
ctx->EvalMap.Map2Index.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Index.u1 = u1;
|
||||
ctx->EvalMap.Map2Index.u2 = u2;
|
||||
ctx->EvalMap.Map2Index.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Index.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Index.v1 = v1;
|
||||
ctx->EvalMap.Map2Index.v2 = v2;
|
||||
ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Index.Points)
|
||||
FREE( ctx->EvalMap.Map2Index.Points );
|
||||
ctx->EvalMap.Map2Index.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_COLOR_4:
|
||||
ctx->EvalMap.Map2Color4.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Color4.u1 = u1;
|
||||
ctx->EvalMap.Map2Color4.u2 = u2;
|
||||
ctx->EvalMap.Map2Color4.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Color4.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Color4.v1 = v1;
|
||||
ctx->EvalMap.Map2Color4.v2 = v2;
|
||||
ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Color4.Points)
|
||||
FREE( ctx->EvalMap.Map2Color4.Points );
|
||||
ctx->EvalMap.Map2Color4.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_NORMAL:
|
||||
ctx->EvalMap.Map2Normal.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Normal.u1 = u1;
|
||||
ctx->EvalMap.Map2Normal.u2 = u2;
|
||||
ctx->EvalMap.Map2Normal.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Normal.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Normal.v1 = v1;
|
||||
ctx->EvalMap.Map2Normal.v2 = v2;
|
||||
ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Normal.Points)
|
||||
FREE( ctx->EvalMap.Map2Normal.Points );
|
||||
ctx->EvalMap.Map2Normal.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_1:
|
||||
ctx->EvalMap.Map2Texture1.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Texture1.u1 = u1;
|
||||
ctx->EvalMap.Map2Texture1.u2 = u2;
|
||||
ctx->EvalMap.Map2Texture1.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Texture1.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Texture1.v1 = v1;
|
||||
ctx->EvalMap.Map2Texture1.v2 = v2;
|
||||
ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Texture1.Points)
|
||||
FREE( ctx->EvalMap.Map2Texture1.Points );
|
||||
ctx->EvalMap.Map2Texture1.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_2:
|
||||
ctx->EvalMap.Map2Texture2.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Texture2.u1 = u1;
|
||||
ctx->EvalMap.Map2Texture2.u2 = u2;
|
||||
ctx->EvalMap.Map2Texture2.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Texture2.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Texture2.v1 = v1;
|
||||
ctx->EvalMap.Map2Texture2.v2 = v2;
|
||||
ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Texture2.Points)
|
||||
FREE( ctx->EvalMap.Map2Texture2.Points );
|
||||
ctx->EvalMap.Map2Texture2.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_3:
|
||||
ctx->EvalMap.Map2Texture3.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Texture3.u1 = u1;
|
||||
ctx->EvalMap.Map2Texture3.u2 = u2;
|
||||
ctx->EvalMap.Map2Texture3.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Texture3.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Texture3.v1 = v1;
|
||||
ctx->EvalMap.Map2Texture3.v2 = v2;
|
||||
ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Texture3.Points)
|
||||
FREE( ctx->EvalMap.Map2Texture3.Points );
|
||||
ctx->EvalMap.Map2Texture3.Points = pnts;
|
||||
break;
|
||||
case GL_MAP2_TEXTURE_COORD_4:
|
||||
ctx->EvalMap.Map2Texture4.Uorder = uorder;
|
||||
ctx->EvalMap.Map2Texture4.u1 = u1;
|
||||
ctx->EvalMap.Map2Texture4.u2 = u2;
|
||||
ctx->EvalMap.Map2Texture4.du = 1.0 / (u2 - u1);
|
||||
ctx->EvalMap.Map2Texture4.Vorder = vorder;
|
||||
ctx->EvalMap.Map2Texture4.v1 = v1;
|
||||
ctx->EvalMap.Map2Texture4.v2 = v2;
|
||||
ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1);
|
||||
if (ctx->EvalMap.Map2Texture4.Points)
|
||||
FREE( ctx->EvalMap.Map2Texture4.Points );
|
||||
ctx->EvalMap.Map2Texture4.Points = pnts;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_EVAL;
|
||||
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_EVAL);
|
||||
map->Uorder = uorder;
|
||||
map->u1 = u1;
|
||||
map->u2 = u2;
|
||||
map->du = 1.0 / (u2 - u1);
|
||||
map->Vorder = vorder;
|
||||
map->v1 = v1;
|
||||
map->v2 = v2;
|
||||
map->dv = 1.0 / (v2 - v1);
|
||||
if (map->Points)
|
||||
FREE( map->Points );
|
||||
map->Points = pnts;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -698,6 +478,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i, n;
|
||||
GLfloat *data;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (query) {
|
||||
case GL_COEFF:
|
||||
|
|
@ -971,6 +752,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i, n;
|
||||
GLfloat *data;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (query) {
|
||||
case GL_COEFF:
|
||||
|
|
@ -1244,6 +1026,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint i, n;
|
||||
GLfloat *data;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (query) {
|
||||
case GL_COEFF:
|
||||
|
|
@ -1516,18 +1299,17 @@ void
|
|||
_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (un<1) {
|
||||
gl_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;
|
||||
|
||||
ctx->NewState |= _NEW_EVAL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1543,7 +1325,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
|
|||
GLint vn, GLfloat v1, GLfloat v2 )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (un<1) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" );
|
||||
return;
|
||||
|
|
@ -1552,6 +1335,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
|
|||
gl_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;
|
||||
|
|
@ -1560,8 +1345,6 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
|
|||
ctx->Eval.MapGrid2v1 = v1;
|
||||
ctx->Eval.MapGrid2v2 = v2;
|
||||
ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn;
|
||||
|
||||
ctx->NewState |= _NEW_EVAL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: feedback.c,v 1.17 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: feedback.c,v 1.18 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -52,7 +52,7 @@ void
|
|||
_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glFeedbackBuffer" );
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->RenderMode==GL_FEEDBACK) {
|
||||
gl_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" );
|
||||
|
|
@ -65,45 +65,41 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
|
|||
}
|
||||
if (!buffer) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" );
|
||||
ctx->Feedback.BufferSize = 0;
|
||||
ctx->Feedback.BufferSize = 0; /* XXX -- Sould this be here??? */
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GL_2D:
|
||||
ctx->Feedback.Mask = 0;
|
||||
ctx->Feedback.Type = type;
|
||||
ctx->Feedback._Mask = 0;
|
||||
break;
|
||||
case GL_3D:
|
||||
ctx->Feedback.Mask = FB_3D;
|
||||
ctx->Feedback.Type = type;
|
||||
ctx->Feedback._Mask = FB_3D;
|
||||
break;
|
||||
case GL_3D_COLOR:
|
||||
ctx->Feedback.Mask = FB_3D
|
||||
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX);
|
||||
ctx->Feedback.Type = type;
|
||||
ctx->Feedback._Mask = (FB_3D |
|
||||
(ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX));
|
||||
break;
|
||||
case GL_3D_COLOR_TEXTURE:
|
||||
ctx->Feedback.Mask = FB_3D
|
||||
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
|
||||
| FB_TEXTURE;
|
||||
ctx->Feedback.Type = type;
|
||||
ctx->Feedback._Mask = (FB_3D |
|
||||
(ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) |
|
||||
FB_TEXTURE);
|
||||
break;
|
||||
case GL_4D_COLOR_TEXTURE:
|
||||
ctx->Feedback.Mask = FB_3D | FB_4D
|
||||
| (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)
|
||||
| FB_TEXTURE;
|
||||
ctx->Feedback.Type = type;
|
||||
ctx->Feedback._Mask = (FB_3D | FB_4D |
|
||||
(ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) |
|
||||
FB_TEXTURE);
|
||||
break;
|
||||
default:
|
||||
ctx->Feedback.Mask = 0;
|
||||
gl_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;
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
ctx->Feedback.Count = 0; /* Becaues of this. */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -112,9 +108,10 @@ void
|
|||
_mesa_PassThrough( GLfloat token )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPassThrough");
|
||||
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 );
|
||||
}
|
||||
|
|
@ -133,22 +130,22 @@ void gl_feedback_vertex( GLcontext *ctx,
|
|||
{
|
||||
FEEDBACK_TOKEN( ctx, win[0] );
|
||||
FEEDBACK_TOKEN( ctx, win[1] );
|
||||
if (ctx->Feedback.Mask & FB_3D) {
|
||||
if (ctx->Feedback._Mask & FB_3D) {
|
||||
FEEDBACK_TOKEN( ctx, win[2] );
|
||||
}
|
||||
if (ctx->Feedback.Mask & FB_4D) {
|
||||
if (ctx->Feedback._Mask & FB_4D) {
|
||||
FEEDBACK_TOKEN( ctx, win[3] );
|
||||
}
|
||||
if (ctx->Feedback.Mask & FB_INDEX) {
|
||||
if (ctx->Feedback._Mask & FB_INDEX) {
|
||||
FEEDBACK_TOKEN( ctx, (GLfloat) index );
|
||||
}
|
||||
if (ctx->Feedback.Mask & FB_COLOR) {
|
||||
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) {
|
||||
if (ctx->Feedback._Mask & FB_TEXTURE) {
|
||||
FEEDBACK_TOKEN( ctx, texcoord[0] );
|
||||
FEEDBACK_TOKEN( ctx, texcoord[1] );
|
||||
FEEDBACK_TOKEN( ctx, texcoord[2] );
|
||||
|
|
@ -168,19 +165,20 @@ void
|
|||
_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->RenderMode==GL_SELECT) {
|
||||
gl_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;
|
||||
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -235,7 +233,8 @@ void
|
|||
_mesa_InitNames( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames");
|
||||
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) {
|
||||
|
|
@ -246,7 +245,7 @@ _mesa_InitNames( void )
|
|||
ctx->Select.HitFlag = GL_FALSE;
|
||||
ctx->Select.HitMinZ = 1.0;
|
||||
ctx->Select.HitMaxZ = 0.0;
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
ctx->NewState |= _NEW_RENDERMODE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -255,7 +254,8 @@ void
|
|||
_mesa_LoadName( GLuint name )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->RenderMode != GL_SELECT) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -263,6 +263,9 @@ _mesa_LoadName( GLuint name )
|
|||
gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
|
||||
|
||||
if (ctx->Select.HitFlag) {
|
||||
write_hit_record( ctx );
|
||||
}
|
||||
|
|
@ -272,7 +275,6 @@ _mesa_LoadName( GLuint name )
|
|||
else {
|
||||
ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name;
|
||||
}
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -280,20 +282,21 @@ void
|
|||
_mesa_PushName( GLuint name )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName");
|
||||
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) {
|
||||
ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
|
||||
}
|
||||
else {
|
||||
if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) {
|
||||
gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" );
|
||||
}
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
else
|
||||
ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -302,20 +305,21 @@ void
|
|||
_mesa_PopName( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName");
|
||||
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) {
|
||||
ctx->Select.NameStackDepth--;
|
||||
}
|
||||
else {
|
||||
if (ctx->Select.NameStackDepth == 0) {
|
||||
gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" );
|
||||
}
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
else
|
||||
ctx->Select.NameStackDepth--;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -334,12 +338,12 @@ _mesa_RenderMode( GLenum mode )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint result;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glRenderMode", 0);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glRenderMode %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
|
||||
ctx->_TriangleCaps &= ~(DD_FEEDBACK|DD_SELECT);
|
||||
|
||||
switch (ctx->RenderMode) {
|
||||
|
|
@ -363,7 +367,6 @@ _mesa_RenderMode( GLenum mode )
|
|||
ctx->Select.BufferCount = 0;
|
||||
ctx->Select.Hits = 0;
|
||||
ctx->Select.NameStackDepth = 0;
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
break;
|
||||
case GL_FEEDBACK:
|
||||
if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {
|
||||
|
|
@ -374,7 +377,6 @@ _mesa_RenderMode( GLenum mode )
|
|||
result = ctx->Feedback.Count;
|
||||
}
|
||||
ctx->Feedback.Count = 0;
|
||||
ctx->NewState |= _NEW_FEEDBACK_SELECT;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
|
||||
|
|
@ -404,8 +406,6 @@ _mesa_RenderMode( GLenum mode )
|
|||
}
|
||||
|
||||
ctx->RenderMode = mode;
|
||||
ctx->NewState |= _NEW_RENDERMODE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fog.c,v 1.30 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: fog.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -84,39 +84,57 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLenum m;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFog");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (pname) {
|
||||
case GL_FOG_MODE:
|
||||
m = (GLenum) (GLint) *params;
|
||||
if (m==GL_LINEAR || m==GL_EXP || m==GL_EXP2) {
|
||||
ctx->Fog.Mode = m;
|
||||
}
|
||||
else {
|
||||
if (ctx->Fog.Mode == m)
|
||||
return;
|
||||
switch (m) {
|
||||
case GL_LINEAR:
|
||||
case GL_EXP:
|
||||
case GL_EXP2:
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
|
||||
return;
|
||||
}
|
||||
FLUSH_VERTICES(ctx, _NEW_FOG);
|
||||
ctx->Fog.Mode = m;
|
||||
break;
|
||||
case GL_FOG_DENSITY:
|
||||
if (*params<0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glFog" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Fog.Density = *params;
|
||||
}
|
||||
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:
|
||||
ctx->Fog.Index = *params;
|
||||
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];
|
||||
|
|
@ -124,10 +142,14 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params )
|
|||
break;
|
||||
case GL_FOG_COORDINATE_SOURCE_EXT: {
|
||||
GLenum p = (GLenum)(GLint) *params;
|
||||
if (p == GL_FOG_COORDINATE_EXT || p == GL_FRAGMENT_DEPTH_EXT)
|
||||
ctx->Fog.FogCoordinateSource = p;
|
||||
else
|
||||
if (ctx->Fog.FogCoordinateSource == p)
|
||||
return;
|
||||
if (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
|
||||
return;
|
||||
}
|
||||
FLUSH_VERTICES(ctx, _NEW_FOG);
|
||||
ctx->Fog.FogCoordinateSource = p;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: get.c,v 1.47 2000/12/09 20:35:32 brianp Exp $ */
|
||||
/* $Id: get.c,v 1.48 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -91,8 +91,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetBooleanv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
|
@ -228,18 +227,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
*params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode);
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = INT_TO_BOOL(ctx->Current.Color[0]);
|
||||
params[1] = INT_TO_BOOL(ctx->Current.Color[1]);
|
||||
params[2] = INT_TO_BOOL(ctx->Current.Color[2]);
|
||||
params[3] = INT_TO_BOOL(ctx->Current.Color[3]);
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = INT_TO_BOOL(ctx->Current.Index);
|
||||
break;
|
||||
case GL_CURRENT_NORMAL:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]);
|
||||
params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]);
|
||||
params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]);
|
||||
|
|
@ -272,7 +271,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
*params = ctx->Current.RasterPosValid;
|
||||
break;
|
||||
case GL_CURRENT_TEXTURE_COORDS:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][0]);
|
||||
params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][1]);
|
||||
params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][2]);
|
||||
|
|
@ -313,7 +312,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
*params = ENUM_TO_BOOL(ctx->Color.DrawBuffer);
|
||||
break;
|
||||
case GL_EDGE_FLAG:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = ctx->Current.EdgeFlag;
|
||||
break;
|
||||
case GL_FEEDBACK_BUFFER_SIZE:
|
||||
|
|
@ -554,10 +553,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
*params = INT_TO_BOOL(ctx->Const.MaxClipPlanes);
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
|
||||
*params = INT_TO_BOOL(VB_MAX);
|
||||
*params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
|
||||
*params = INT_TO_BOOL(VB_MAX);
|
||||
*params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize);
|
||||
break;
|
||||
case GL_MAX_EVAL_ORDER:
|
||||
*params = INT_TO_BOOL(MAX_EVAL_ORDER);
|
||||
|
|
@ -1271,7 +1270,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
*params = ctx->Fog.ColorSumEnabled;
|
||||
break;
|
||||
case GL_CURRENT_SECONDARY_COLOR_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]);
|
||||
params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]);
|
||||
params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]);
|
||||
|
|
@ -1291,7 +1290,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
|||
|
||||
/* GL_EXT_fog_coord */
|
||||
case GL_CURRENT_FOG_COORDINATE_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = FLOAT_TO_BOOL(ctx->Current.FogCoord);
|
||||
break;
|
||||
case GL_FOG_COORDINATE_ARRAY_EXT:
|
||||
|
|
@ -1331,8 +1330,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetDoublev");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
|
@ -1467,18 +1465,18 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
*params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
|
||||
params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
|
||||
params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
|
||||
params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLdouble) ctx->Current.Index;
|
||||
break;
|
||||
case GL_CURRENT_NORMAL:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = (GLdouble) ctx->Current.Normal[0];
|
||||
params[1] = (GLdouble) ctx->Current.Normal[1];
|
||||
params[2] = (GLdouble) ctx->Current.Normal[2];
|
||||
|
|
@ -1511,7 +1509,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
*params = (GLdouble) ctx->Current.RasterPosValid;
|
||||
break;
|
||||
case GL_CURRENT_TEXTURE_COORDS:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][0];
|
||||
params[1] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][1];
|
||||
params[2] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][2];
|
||||
|
|
@ -1552,7 +1550,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
*params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer);
|
||||
break;
|
||||
case GL_EDGE_FLAG:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLdouble) ctx->Current.EdgeFlag;
|
||||
break;
|
||||
case GL_FEEDBACK_BUFFER_SIZE:
|
||||
|
|
@ -1793,10 +1791,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
*params = (GLdouble) ctx->Const.MaxClipPlanes;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
|
||||
*params = (GLdouble) VB_MAX;
|
||||
*params = (GLdouble) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
|
||||
*params = (GLdouble) VB_MAX;
|
||||
*params = (GLdouble) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_EVAL_ORDER:
|
||||
*params = (GLdouble) MAX_EVAL_ORDER;
|
||||
|
|
@ -2510,7 +2508,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
*params = (GLdouble) ctx->Fog.ColorSumEnabled;
|
||||
break;
|
||||
case GL_CURRENT_SECONDARY_COLOR_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
|
||||
params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
|
||||
params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
|
||||
|
|
@ -2530,7 +2528,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
|
|||
|
||||
/* GL_EXT_fog_coord */
|
||||
case GL_CURRENT_FOG_COORDINATE_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLdouble) ctx->Current.FogCoord;
|
||||
break;
|
||||
case GL_FOG_COORDINATE_ARRAY_EXT:
|
||||
|
|
@ -2570,8 +2568,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetFloatv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
|
@ -2706,18 +2703,18 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
*params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]);
|
||||
params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]);
|
||||
params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]);
|
||||
params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]);
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLfloat) ctx->Current.Index;
|
||||
break;
|
||||
case GL_CURRENT_NORMAL:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = ctx->Current.Normal[0];
|
||||
params[1] = ctx->Current.Normal[1];
|
||||
params[2] = ctx->Current.Normal[2];
|
||||
|
|
@ -2750,7 +2747,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
*params = (GLfloat) ctx->Current.RasterPosValid;
|
||||
break;
|
||||
case GL_CURRENT_TEXTURE_COORDS:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][0];
|
||||
params[1] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][1];
|
||||
params[2] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][2];
|
||||
|
|
@ -2791,7 +2788,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
*params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer);
|
||||
break;
|
||||
case GL_EDGE_FLAG:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLfloat) ctx->Current.EdgeFlag;
|
||||
break;
|
||||
case GL_FEEDBACK_BUFFER_SIZE:
|
||||
|
|
@ -3032,10 +3029,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
*params = (GLfloat) ctx->Const.MaxClipPlanes;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
|
||||
*params = (GLfloat) VB_MAX;
|
||||
*params = (GLfloat) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
|
||||
*params = (GLfloat) VB_MAX;
|
||||
*params = (GLfloat) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_EVAL_ORDER:
|
||||
*params = (GLfloat) MAX_EVAL_ORDER;
|
||||
|
|
@ -3723,7 +3720,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
*params = (GLfloat) ctx->Fog.ColorSumEnabled;
|
||||
break;
|
||||
case GL_CURRENT_SECONDARY_COLOR_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]);
|
||||
params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]);
|
||||
params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]);
|
||||
|
|
@ -3743,7 +3740,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
|||
|
||||
/* GL_EXT_fog_coord */
|
||||
case GL_CURRENT_FOG_COORDINATE_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLfloat) ctx->Current.FogCoord;
|
||||
break;
|
||||
case GL_FOG_COORDINATE_ARRAY_EXT:
|
||||
|
|
@ -3783,8 +3780,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit;
|
||||
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetIntegerv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
|
@ -3921,18 +3917,18 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
*params = (GLint) ctx->Polygon.CullFaceMode;
|
||||
break;
|
||||
case GL_CURRENT_COLOR:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[0] ) );
|
||||
params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[1] ) );
|
||||
params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[2] ) );
|
||||
params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[3] ) );
|
||||
break;
|
||||
case GL_CURRENT_INDEX:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLint) ctx->Current.Index;
|
||||
break;
|
||||
case GL_CURRENT_NORMAL:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] );
|
||||
params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] );
|
||||
params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] );
|
||||
|
|
@ -3965,7 +3961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
*params = (GLint) ctx->Current.RasterPosValid;
|
||||
break;
|
||||
case GL_CURRENT_TEXTURE_COORDS:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = (GLint) ctx->Current.Texcoord[texTransformUnit][0];
|
||||
params[1] = (GLint) ctx->Current.Texcoord[texTransformUnit][1];
|
||||
params[2] = (GLint) ctx->Current.Texcoord[texTransformUnit][2];
|
||||
|
|
@ -4006,7 +4002,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
*params = (GLint) ctx->Color.DrawBuffer;
|
||||
break;
|
||||
case GL_EDGE_FLAG:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLint) ctx->Current.EdgeFlag;
|
||||
break;
|
||||
case GL_FEEDBACK_BUFFER_SIZE:
|
||||
|
|
@ -4247,10 +4243,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
*params = (GLint) ctx->Const.MaxClipPlanes;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */
|
||||
*params = VB_MAX;
|
||||
*params = (GLint) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */
|
||||
*params = VB_MAX;
|
||||
*params = (GLint) ctx->Const.MaxArrayLockSize;
|
||||
break;
|
||||
case GL_MAX_EVAL_ORDER:
|
||||
*params = (GLint) MAX_EVAL_ORDER;
|
||||
|
|
@ -4965,7 +4961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
*params = (GLint) ctx->Fog.ColorSumEnabled;
|
||||
break;
|
||||
case GL_CURRENT_SECONDARY_COLOR_EXT:
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) );
|
||||
params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) );
|
||||
params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) );
|
||||
|
|
@ -4986,7 +4982,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
|||
/* GL_EXT_fog_coord */
|
||||
case GL_CURRENT_FOG_COORDINATE_EXT:
|
||||
if (ctx->Extensions.EXT_fog_coord) {
|
||||
FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
*params = (GLint) ctx->Current.FogCoord;
|
||||
}
|
||||
else {
|
||||
|
|
@ -5041,8 +5037,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint texUnit = ctx->Texture.CurrentUnit;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPointerv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!params)
|
||||
return;
|
||||
|
|
@ -5100,8 +5095,7 @@ _mesa_GetString( GLenum name )
|
|||
static const char *vendor = "Brian Paul";
|
||||
static const char *renderer = "Mesa";
|
||||
static const char *version = "1.2 Mesa 3.5 beta";
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
|
||||
|
||||
/* this is a required driver function */
|
||||
assert(ctx->Driver.GetString);
|
||||
|
|
@ -5134,10 +5128,8 @@ GLenum
|
|||
_mesa_GetError( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
GLenum e = ctx->ErrorValue;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: hint.c,v 1.5 2000/10/30 13:32:00 keithw Exp $ */
|
||||
/* $Id: hint.c,v 1.6 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -41,6 +41,7 @@ void
|
|||
_mesa_Hint( GLenum target, GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
(void) _mesa_try_Hint( ctx, target, mode );
|
||||
}
|
||||
|
||||
|
|
@ -48,8 +49,6 @@ _mesa_Hint( GLenum target, GLenum mode )
|
|||
GLboolean
|
||||
_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glHint", GL_FALSE);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode);
|
||||
|
||||
|
|
@ -60,24 +59,42 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
|
||||
switch (target) {
|
||||
case GL_FOG_HINT:
|
||||
if (ctx->Hint.Fog == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.Fog = mode;
|
||||
break;
|
||||
case GL_LINE_SMOOTH_HINT:
|
||||
if (ctx->Hint.LineSmooth == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.LineSmooth = mode;
|
||||
break;
|
||||
case GL_PERSPECTIVE_CORRECTION_HINT:
|
||||
if (ctx->Hint.PerspectiveCorrection == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.PerspectiveCorrection = mode;
|
||||
break;
|
||||
case GL_POINT_SMOOTH_HINT:
|
||||
if (ctx->Hint.PointSmooth == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.PointSmooth = mode;
|
||||
break;
|
||||
case GL_POLYGON_SMOOTH_HINT:
|
||||
if (ctx->Hint.PolygonSmooth == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.PolygonSmooth = mode;
|
||||
break;
|
||||
case GL_PREFER_DOUBLEBUFFER_HINT_PGI:
|
||||
case GL_STRICT_DEPTHFUNC_HINT_PGI:
|
||||
break;
|
||||
case GL_STRICT_LIGHTING_HINT_PGI:
|
||||
if (ctx->Hint.StrictLighting == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.StrictLighting = mode;
|
||||
break;
|
||||
case GL_STRICT_SCISSOR_HINT_PGI:
|
||||
|
|
@ -88,6 +105,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
case GL_RECLAIM_MEMORY_HINT_PGI:
|
||||
break;
|
||||
case GL_ALWAYS_FAST_HINT_PGI:
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
if (mode) {
|
||||
ctx->Hint.AllowDrawWin = GL_TRUE;
|
||||
ctx->Hint.AllowDrawFrg = GL_FALSE;
|
||||
|
|
@ -99,6 +117,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
}
|
||||
break;
|
||||
case GL_ALWAYS_SOFT_HINT_PGI:
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.AllowDrawWin = GL_TRUE;
|
||||
ctx->Hint.AllowDrawFrg = GL_TRUE;
|
||||
ctx->Hint.AllowDrawMem = GL_TRUE;
|
||||
|
|
@ -106,12 +125,21 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
case GL_ALLOW_DRAW_OBJ_HINT_PGI:
|
||||
break;
|
||||
case GL_ALLOW_DRAW_WIN_HINT_PGI:
|
||||
if (ctx->Hint.AllowDrawWin == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.AllowDrawWin = mode;
|
||||
break;
|
||||
case GL_ALLOW_DRAW_FRG_HINT_PGI:
|
||||
if (ctx->Hint.AllowDrawFrg == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.AllowDrawFrg = mode;
|
||||
break;
|
||||
case GL_ALLOW_DRAW_MEM_HINT_PGI:
|
||||
if (ctx->Hint.AllowDrawMem == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.AllowDrawMem = mode;
|
||||
break;
|
||||
case GL_CLIP_NEAR_HINT_PGI:
|
||||
|
|
@ -123,17 +151,22 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
|
||||
/* GL_EXT_clip_volume_hint */
|
||||
case GL_CLIP_VOLUME_CLIPPING_HINT_EXT:
|
||||
if (ctx->Hint.ClipVolumeClipping == mode)
|
||||
return GL_TRUE;
|
||||
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) {
|
||||
ctx->Hint.TextureCompression = mode;
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glHint(target)");
|
||||
return GL_TRUE;
|
||||
}
|
||||
if (ctx->Hint.TextureCompression == mode)
|
||||
return GL_TRUE;
|
||||
FLUSH_VERTICES(ctx, _NEW_HINT);
|
||||
ctx->Hint.TextureCompression = mode;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -141,8 +174,6 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_HINT;
|
||||
|
||||
if (ctx->Driver.Hint) {
|
||||
(*ctx->Driver.Hint)( ctx, target, mode );
|
||||
}
|
||||
|
|
@ -155,7 +186,7 @@ void
|
|||
_mesa_HintPGI( GLenum target, GLint mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHintPGI");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: histogram.c,v 1.4 2000/12/13 23:13:45 brianp Exp $ */
|
||||
/* $Id: histogram.c,v 1.5 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -600,7 +600,7 @@ void
|
|||
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmax");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
|
||||
|
|
@ -617,6 +617,17 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
|
|||
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) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!values)
|
||||
return;
|
||||
|
||||
|
|
@ -644,7 +655,7 @@ void
|
|||
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
|
||||
|
|
@ -661,6 +672,17 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
|
|||
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) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!values)
|
||||
return;
|
||||
|
||||
|
|
@ -684,7 +706,7 @@ void
|
|||
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
|
||||
|
|
@ -731,7 +753,7 @@ void
|
|||
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
|
||||
|
|
@ -778,7 +800,7 @@ void
|
|||
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
|
||||
|
|
@ -804,7 +826,7 @@ void
|
|||
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
|
||||
|
|
@ -832,7 +854,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
|
|||
GLuint i;
|
||||
GLboolean error = GL_FALSE;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glHistogram");
|
||||
|
|
@ -913,7 +935,7 @@ void
|
|||
_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glMinmax");
|
||||
|
|
@ -929,9 +951,11 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
|
|||
gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ctx->MinMax.Sink == sink)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PIXEL);
|
||||
ctx->MinMax.Sink = sink;
|
||||
ctx->NewState |= _NEW_PIXEL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -940,7 +964,7 @@ _mesa_ResetHistogram(GLenum target)
|
|||
{
|
||||
GLuint i;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
|
||||
|
|
@ -967,7 +991,7 @@ void
|
|||
_mesa_ResetMinmax(GLenum target)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (!ctx->Extensions.EXT_histogram) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: light.c,v 1.30 2000/11/27 18:22:13 brianp Exp $ */
|
||||
/* $Id: light.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -54,28 +54,24 @@ void
|
|||
_mesa_ShadeModel( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
||||
if (mode == GL_FLAT || mode == GL_SMOOTH) {
|
||||
if (ctx->Light.ShadeModel != mode) {
|
||||
ctx->Light.ShadeModel = mode;
|
||||
if (ctx->Light.ShadeModel == GL_FLAT)
|
||||
SET_BITS(ctx->_TriangleCaps, DD_FLATSHADE);
|
||||
else
|
||||
CLEAR_BITS(ctx->_TriangleCaps, DD_FLATSHADE);
|
||||
|
||||
ctx->NewState |= _NEW_LIGHT;
|
||||
|
||||
if (ctx->Driver.ShadeModel)
|
||||
(*ctx->Driver.ShadeModel)( ctx, mode );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mode != GL_FLAT && mode != GL_SMOOTH) {
|
||||
gl_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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -94,92 +90,122 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
|||
GLint i = (GLint) (light - GL_LIGHT0);
|
||||
struct gl_light *l = &ctx->Light.Light[i];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight");
|
||||
|
||||
if (i < 0 || i >= ctx->Const.MaxLights) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pname) {
|
||||
case GL_AMBIENT:
|
||||
COPY_4V( l->Ambient, params );
|
||||
break;
|
||||
case GL_DIFFUSE:
|
||||
COPY_4V( l->Diffuse, params );
|
||||
break;
|
||||
case GL_SPECULAR:
|
||||
COPY_4V( l->Specular, params );
|
||||
break;
|
||||
case GL_POSITION:
|
||||
/* transform position by ModelView matrix */
|
||||
TRANSFORM_POINT( l->EyePosition, ctx->ModelView.m, params );
|
||||
if (l->EyePosition[3] != 0.0F)
|
||||
l->_Flags |= LIGHT_POSITIONAL;
|
||||
else
|
||||
l->_Flags &= ~LIGHT_POSITIONAL;
|
||||
break;
|
||||
case GL_SPOT_DIRECTION:
|
||||
/* transform direction by inverse modelview */
|
||||
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
TRANSFORM_NORMAL( l->EyeDirection, params, ctx->ModelView.inv );
|
||||
break;
|
||||
case GL_SPOT_EXPONENT:
|
||||
if (params[0]<0.0 || params[0]>128.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
if (l->SpotExponent != params[0]) {
|
||||
l->SpotExponent = params[0];
|
||||
gl_compute_spot_exp_table( l );
|
||||
}
|
||||
break;
|
||||
case GL_SPOT_CUTOFF:
|
||||
if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
l->SpotCutoff = params[0];
|
||||
l->_CosCutoff = 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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
l->ConstantAttenuation = params[0];
|
||||
break;
|
||||
case GL_LINEAR_ATTENUATION:
|
||||
if (params[0]<0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
l->LinearAttenuation = params[0];
|
||||
break;
|
||||
case GL_QUADRATIC_ATTENUATION:
|
||||
if (params[0]<0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
l->QuadraticAttenuation = params[0];
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
|
||||
return;
|
||||
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->ModelView.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->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
TRANSFORM_NORMAL( tmp, params, ctx->ModelView.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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
if (l->SpotExponent == params[0])
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
l->SpotExponent = params[0];
|
||||
gl_invalidate_spot_exp_table( l );
|
||||
break;
|
||||
case GL_SPOT_CUTOFF:
|
||||
if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
if (l->SpotCutoff == params[0])
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
l->SpotCutoff = params[0];
|
||||
l->_CosCutoff = 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) {
|
||||
gl_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) {
|
||||
gl_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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLight" );
|
||||
return;
|
||||
}
|
||||
if (l->QuadraticAttenuation == params[0])
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
l->QuadraticAttenuation = params[0];
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLight" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Driver.Lightfv)
|
||||
ctx->Driver.Lightfv( ctx, light, pname, params );
|
||||
|
||||
ctx->NewState |= _NEW_LIGHT;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,8 +263,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint l = (GLint) (light - GL_LIGHT0);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (l < 0 || l >= ctx->Const.MaxLights) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetLightfv" );
|
||||
|
|
@ -289,8 +314,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint l = (GLint) (light - GL_LIGHT0);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (l < 0 || l >= ctx->Const.MaxLights) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetLightiv" );
|
||||
|
|
@ -358,38 +382,46 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
|
|||
void
|
||||
_mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GLenum newenum;
|
||||
GLboolean newbool;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModelfv");
|
||||
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:
|
||||
if (params[0]==0.0)
|
||||
ctx->Light.Model.LocalViewer = GL_FALSE;
|
||||
else
|
||||
ctx->Light.Model.LocalViewer = GL_TRUE;
|
||||
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:
|
||||
if (params[0]==0.0)
|
||||
ctx->Light.Model.TwoSide = GL_FALSE;
|
||||
else
|
||||
ctx->Light.Model.TwoSide = GL_TRUE;
|
||||
newbool = (params[0]!=0.0);
|
||||
if (ctx->Light.Model.TwoSide == newbool)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
ctx->Light.Model.TwoSide = newbool;
|
||||
break;
|
||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||
if (params[0] == (GLfloat) GL_SINGLE_COLOR) {
|
||||
ctx->Light.Model.ColorControl = GL_SINGLE_COLOR;
|
||||
if (!ctx->Fog.ColorSumEnabled)
|
||||
CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
|
||||
}
|
||||
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) {
|
||||
ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR;
|
||||
SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR);
|
||||
}
|
||||
else {
|
||||
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 {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Light.Model.ColorControl == newenum)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
ctx->Light.Model.ColorControl = newenum;
|
||||
ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glLightModel" );
|
||||
|
|
@ -398,8 +430,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
|||
|
||||
if (ctx->Driver.LightModelfv)
|
||||
ctx->Driver.LightModelfv( ctx, pname, params );
|
||||
|
||||
ctx->NewState |= _NEW_LIGHT;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -407,8 +437,6 @@ void
|
|||
_mesa_LightModeliv( GLenum pname, const GLint *params )
|
||||
{
|
||||
GLfloat fparam[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModeliv");
|
||||
|
||||
switch (pname) {
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
|
|
@ -582,6 +610,9 @@ void gl_update_material( GLcontext *ctx,
|
|||
if (bitmask & FRONT_DIFFUSE_BIT) {
|
||||
struct gl_material *mat = &ctx->Light.Material[0];
|
||||
COPY_4FV( mat->Diffuse, src[0].Diffuse );
|
||||
/* fprintf(stderr, "FRONT_DIFFUSE %f %f %f %f\n", */
|
||||
/* mat->Diffuse[0], mat->Diffuse[1], */
|
||||
/* mat->Diffuse[2], mat->Diffuse[3]); */
|
||||
foreach (light, list) {
|
||||
SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse );
|
||||
}
|
||||
|
|
@ -590,6 +621,9 @@ void gl_update_material( GLcontext *ctx,
|
|||
if (bitmask & BACK_DIFFUSE_BIT) {
|
||||
struct gl_material *mat = &ctx->Light.Material[1];
|
||||
COPY_4FV( mat->Diffuse, src[1].Diffuse );
|
||||
/* fprintf(stderr, "BACK_DIFFUSE %f %f %f %f\n", */
|
||||
/* mat->Diffuse[0], mat->Diffuse[1], */
|
||||
/* mat->Diffuse[2], mat->Diffuse[3]); */
|
||||
foreach (light, list) {
|
||||
SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse );
|
||||
}
|
||||
|
|
@ -613,14 +647,13 @@ void gl_update_material( GLcontext *ctx,
|
|||
}
|
||||
|
||||
if (bitmask & FRONT_SHININESS_BIT) {
|
||||
GLfloat shininess = ctx->Light.Material[0].Shininess = src[0].Shininess;
|
||||
gl_compute_shine_table( ctx, 0, shininess );
|
||||
gl_compute_shine_table( ctx, 2, shininess * .5 );
|
||||
/* fprintf(stderr, "FRONT_SHININESS_BIT %f\n", src[0].Shininess); */
|
||||
ctx->Light.Material[0].Shininess = src[0].Shininess;
|
||||
gl_invalidate_shine_table( ctx, 0 );
|
||||
}
|
||||
if (bitmask & BACK_SHININESS_BIT) {
|
||||
GLfloat shininess = ctx->Light.Material[1].Shininess = src[1].Shininess;
|
||||
gl_compute_shine_table( ctx, 1, shininess );
|
||||
gl_compute_shine_table( ctx, 3, shininess * .5 );
|
||||
ctx->Light.Material[1].Shininess = src[1].Shininess;
|
||||
gl_invalidate_shine_table( ctx, 1 );
|
||||
}
|
||||
|
||||
if (bitmask & FRONT_INDEXES_BIT) {
|
||||
|
|
@ -790,8 +823,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
|
|||
FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT |
|
||||
FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT |
|
||||
FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorMaterial");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glColorMaterial %s %s\n",
|
||||
|
|
@ -800,18 +832,20 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
|
|||
|
||||
bitmask = gl_material_bitmask( ctx, face, mode, legal, "glColorMaterial" );
|
||||
|
||||
if (bitmask != 0) {
|
||||
ctx->Light.ColorMaterialBitmask = bitmask;
|
||||
ctx->Light.ColorMaterialFace = face;
|
||||
ctx->Light.ColorMaterialMode = mode;
|
||||
}
|
||||
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_TNL( ctx, FLUSH_UPDATE_CURRENT );
|
||||
FLUSH_CURRENT( ctx, 0 );
|
||||
gl_update_color_material( ctx, ctx->Current.Color );
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_LIGHT;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -823,8 +857,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint f;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
|
||||
|
||||
if (face==GL_FRONT) {
|
||||
f = 0;
|
||||
|
|
@ -869,8 +902,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint f;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */
|
||||
|
||||
if (face==GL_FRONT) {
|
||||
f = 0;
|
||||
|
|
@ -967,7 +999,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
|
|||
* this function to recompute the exponent lookup table.
|
||||
*/
|
||||
void
|
||||
gl_compute_spot_exp_table( struct gl_light *l )
|
||||
gl_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;
|
||||
|
|
@ -978,16 +1015,17 @@ gl_compute_spot_exp_table( struct gl_light *l )
|
|||
|
||||
for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
|
||||
if (clamp == 0) {
|
||||
tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
|
||||
if (tmp < FLT_MIN * 100.0) {
|
||||
tmp = 0.0;
|
||||
clamp = 1;
|
||||
}
|
||||
tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
|
||||
if (tmp < FLT_MIN * 100.0) {
|
||||
tmp = 0.0;
|
||||
clamp = 1;
|
||||
}
|
||||
}
|
||||
l->_SpotExpTable[i][0] = 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[i][1] = (l->_SpotExpTable[i+1][0] -
|
||||
l->_SpotExpTable[i][0]);
|
||||
}
|
||||
l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0;
|
||||
}
|
||||
|
|
@ -999,56 +1037,76 @@ gl_compute_spot_exp_table( struct gl_light *l )
|
|||
* lighting, and the cost of doing it early may be partially offset
|
||||
* by keeping a MRU cache of shine tables for various shine values.
|
||||
*/
|
||||
static void
|
||||
compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess )
|
||||
void
|
||||
gl_invalidate_shine_table( GLcontext *ctx, GLuint i )
|
||||
{
|
||||
GLint i;
|
||||
GLfloat *m = tab->tab;
|
||||
|
||||
m[0] = 0.0;
|
||||
if (shininess == 0.0) {
|
||||
for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
|
||||
m[i] = 1.0;
|
||||
}
|
||||
else {
|
||||
for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
|
||||
GLdouble t = pow(i / (GLfloat) (SHINE_TABLE_SIZE - 1), shininess);
|
||||
if (t > 1e-20)
|
||||
m[i] = t;
|
||||
else
|
||||
m[i] = 0.0;
|
||||
}
|
||||
m[SHINE_TABLE_SIZE] = 1.0;
|
||||
}
|
||||
|
||||
tab->shininess = shininess;
|
||||
if (ctx->_ShineTable[i])
|
||||
ctx->_ShineTable[i]->refcount--;
|
||||
ctx->_ShineTable[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
|
||||
static void validate_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
|
||||
{
|
||||
#define DISTSQR(a,b) ((a-b)*(a-b))
|
||||
struct gl_shine_tab *list = ctx->_ShineTabList;
|
||||
struct gl_shine_tab *s;
|
||||
|
||||
/* fprintf(stderr, "validate_shine_table %d, shininess %f\n", i, shininess); */
|
||||
|
||||
foreach(s, list)
|
||||
if ( DISTSQR(s->shininess, shininess) < 1e-4 )
|
||||
if ( s->shininess == shininess )
|
||||
break;
|
||||
|
||||
if (s == list) {
|
||||
GLint i;
|
||||
GLfloat *m;
|
||||
|
||||
foreach(s, list)
|
||||
if (s->refcount == 0)
|
||||
break;
|
||||
break;
|
||||
|
||||
compute_shine_table( s, shininess );
|
||||
m = s->tab;
|
||||
m[0] = 0.0;
|
||||
if (shininess == 0.0) {
|
||||
for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
|
||||
m[i] = 1.0;
|
||||
}
|
||||
else {
|
||||
for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
|
||||
GLdouble t = pow(i / (GLfloat)(SHINE_TABLE_SIZE-1), shininess);
|
||||
if (t > 1e-20)
|
||||
m[i] = t;
|
||||
else
|
||||
m[i] = 0.0;
|
||||
}
|
||||
m[SHINE_TABLE_SIZE] = 1.0;
|
||||
}
|
||||
|
||||
s->shininess = shininess;
|
||||
}
|
||||
|
||||
ctx->_ShineTable[i]->refcount--;
|
||||
if (ctx->_ShineTable[i])
|
||||
ctx->_ShineTable[i]->refcount--;
|
||||
|
||||
ctx->_ShineTable[i] = s;
|
||||
move_to_tail( list, s );
|
||||
s->refcount++;
|
||||
#undef DISTSQR
|
||||
}
|
||||
|
||||
void
|
||||
gl_validate_all_lighting_tables( GLcontext *ctx )
|
||||
{
|
||||
GLint i;
|
||||
GLfloat shininess;
|
||||
|
||||
shininess = ctx->Light.Material[0].Shininess;
|
||||
if (!ctx->_ShineTable[0]) validate_shine_table( ctx, 0, shininess );
|
||||
|
||||
shininess = ctx->Light.Material[1].Shininess;
|
||||
if (!ctx->_ShineTable[1]) 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] );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1064,7 +1122,7 @@ void
|
|||
gl_update_lighting( GLcontext *ctx )
|
||||
{
|
||||
struct gl_light *light;
|
||||
ctx->_TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
|
||||
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
||||
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT;
|
||||
ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT;
|
||||
ctx->Light._Flags = 0;
|
||||
|
|
@ -1075,7 +1133,7 @@ gl_update_lighting( GLcontext *ctx )
|
|||
ctx->_NeedNormals |= NEED_NORMALS_LIGHT;
|
||||
|
||||
if (ctx->Light.Model.TwoSide)
|
||||
ctx->_TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL);
|
||||
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
|
||||
|
||||
foreach(light, &ctx->Light.EnabledList) {
|
||||
ctx->Light._Flags |= light->_Flags;
|
||||
|
|
@ -1099,7 +1157,10 @@ gl_update_lighting( GLcontext *ctx )
|
|||
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT;
|
||||
|
||||
|
||||
/* Precompute some shading values.
|
||||
/* 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.RGBAflag) {
|
||||
GLuint sides = ctx->Light.Model.TwoSide ? 2 : 1;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: light.h,v 1.7 2000/11/24 10:25:05 keithw Exp $ */
|
||||
/* $Id: light.h,v 1.8 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -101,10 +101,11 @@ extern GLuint gl_material_bitmask( GLcontext *ctx,
|
|||
extern void gl_set_material( GLcontext *ctx, GLuint bitmask,
|
||||
const GLfloat *params);
|
||||
|
||||
extern void gl_compute_spot_exp_table( struct gl_light *l );
|
||||
|
||||
extern void gl_compute_shine_table( GLcontext *ctx, GLuint i,
|
||||
GLfloat shininess );
|
||||
extern void gl_invalidate_spot_exp_table( struct gl_light *l );
|
||||
extern void gl_invalidate_shine_table( GLcontext *ctx, GLuint i );
|
||||
extern void gl_validate_all_lighting_tables( GLcontext *ctx );
|
||||
|
||||
|
||||
extern void gl_update_lighting( GLcontext *ctx );
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: lines.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: lines.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -45,22 +45,26 @@ void
|
|||
_mesa_LineWidth( GLfloat width )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (width<=0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
|
||||
return;
|
||||
}
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineWidth");
|
||||
|
||||
if (ctx->Line.Width != width) {
|
||||
ctx->Line.Width = width;
|
||||
if (ctx->Line.Width == width)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_LINE);
|
||||
ctx->Line.Width = width;
|
||||
|
||||
if (width != 1.0)
|
||||
ctx->_TriangleCaps |= DD_LINE_WIDTH;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_LINE_WIDTH;
|
||||
if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH;
|
||||
|
||||
ctx->NewState |= _NEW_LINE;
|
||||
|
||||
if (ctx->Driver.LineWidth)
|
||||
(*ctx->Driver.LineWidth)(ctx, width);
|
||||
}
|
||||
if (ctx->Driver.LineWidth)
|
||||
(*ctx->Driver.LineWidth)(ctx, width);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -69,12 +73,16 @@ void
|
|||
_mesa_LineStipple( GLint factor, GLushort pattern )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->Line.StippleFactor == CLAMP( factor, 1, 256 ) &&
|
||||
ctx->Line.StipplePattern == pattern)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_LINE);
|
||||
ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
|
||||
ctx->Line.StipplePattern = pattern;
|
||||
|
||||
ctx->NewState |= _NEW_LINE;
|
||||
|
||||
if (ctx->Driver.LineStipple)
|
||||
ctx->Driver.LineStipple( ctx, factor, pattern );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: macros.h,v 1.15 2000/11/24 10:25:05 keithw Exp $ */
|
||||
/* $Id: macros.h,v 1.16 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -72,6 +72,7 @@
|
|||
*/
|
||||
#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_T(p, t, i) (p = (t *)((GLubyte *)p + i))
|
||||
|
||||
|
||||
|
|
@ -80,6 +81,23 @@
|
|||
#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 { \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: matrix.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */
|
||||
/* $Id: matrix.c,v 1.29 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -59,7 +59,6 @@
|
|||
|
||||
#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \
|
||||
do { \
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, where); \
|
||||
if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \
|
||||
switch (ctx->Transform.MatrixMode) { \
|
||||
case GL_MODELVIEW: \
|
||||
|
|
@ -91,6 +90,7 @@ _mesa_Frustum( GLdouble left, GLdouble right,
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glFrustrum" );
|
||||
|
||||
|
|
@ -115,6 +115,7 @@ _mesa_Ortho( GLdouble left, GLdouble right,
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glOrtho" );
|
||||
|
||||
|
|
@ -134,13 +135,17 @@ void
|
|||
_mesa_MatrixMode( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMatrixMode");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (mode) {
|
||||
case GL_MODELVIEW:
|
||||
case GL_PROJECTION:
|
||||
case GL_TEXTURE:
|
||||
case GL_COLOR:
|
||||
if (ctx->Transform.MatrixMode == mode)
|
||||
return;
|
||||
ctx->Transform.MatrixMode = mode;
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glMatrixMode" );
|
||||
|
|
@ -153,7 +158,7 @@ void
|
|||
_mesa_PushMatrix( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushMatrix");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glPushMatrix %s\n",
|
||||
|
|
@ -206,7 +211,7 @@ void
|
|||
_mesa_PopMatrix( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopMatrix");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glPopMatrix %s\n",
|
||||
|
|
@ -265,6 +270,7 @@ _mesa_LoadIdentity( void )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity");
|
||||
_math_matrix_set_identity( mat );
|
||||
}
|
||||
|
|
@ -275,6 +281,7 @@ _mesa_LoadMatrixf( const GLfloat *m )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix");
|
||||
_math_matrix_loadf( mat, m );
|
||||
}
|
||||
|
|
@ -300,6 +307,7 @@ _mesa_MultMatrixf( const GLfloat *m )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" );
|
||||
_math_matrix_mul_floats( mat, m );
|
||||
}
|
||||
|
|
@ -328,6 +336,7 @@ 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) {
|
||||
GLmatrix *mat = 0;
|
||||
GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glRotate" );
|
||||
|
|
@ -350,6 +359,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale");
|
||||
_math_matrix_scale( mat, x, y, z );
|
||||
}
|
||||
|
|
@ -370,6 +380,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLmatrix *mat = 0;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate");
|
||||
_math_matrix_translate( mat, x, y, z );
|
||||
}
|
||||
|
|
@ -425,6 +436,7 @@ void
|
|||
_mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
gl_Viewport(ctx, x, y, width, height);
|
||||
}
|
||||
|
||||
|
|
@ -441,8 +453,6 @@ _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
|
|||
void
|
||||
gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport");
|
||||
|
||||
if (width<0 || height<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glViewport" );
|
||||
return;
|
||||
|
|
@ -461,7 +471,9 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
|
|||
ctx->Viewport.Y = y;
|
||||
ctx->Viewport.Height = height;
|
||||
|
||||
/* compute scale and bias values */
|
||||
/* 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;
|
||||
|
|
@ -500,7 +512,7 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval )
|
|||
*/
|
||||
GLfloat n, f;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthRange");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glDepthRange %f %f\n", nearval, farval);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mtypes.h,v 1.6 2000/12/14 20:25:56 brianp Exp $ */
|
||||
/* $Id: mtypes.h,v 1.7 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -101,6 +101,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* 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)
|
||||
|
||||
/*
|
||||
* Depth buffer data type:
|
||||
*/
|
||||
|
|
@ -220,10 +225,6 @@ struct gl_lightmodel {
|
|||
};
|
||||
|
||||
|
||||
/* Move to using pointers to this struct in the immediate structs -
|
||||
* this is too big to keep 94 unused copies (7K) lying around in
|
||||
* display lists.
|
||||
*/
|
||||
struct gl_material
|
||||
{
|
||||
GLfloat Ambient[4];
|
||||
|
|
@ -237,15 +238,11 @@ struct gl_material
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
};
|
||||
|
|
@ -296,8 +293,7 @@ struct gl_colorbuffer_attrib {
|
|||
|
||||
|
||||
struct gl_current_attrib {
|
||||
/* These values valid only when FLUSH_TNL( FLUSH_UPDATE_CURRENT )
|
||||
* has been called.
|
||||
/* These values valid only when FLUSH_VERTICES has been called.
|
||||
*/
|
||||
GLfloat Normal[3]; /* Current vertex normal */
|
||||
GLchan Color[4]; /* Current RGBA color */
|
||||
|
|
@ -480,7 +476,11 @@ struct gl_convolution_attrib {
|
|||
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 */
|
||||
|
|
@ -492,7 +492,7 @@ struct gl_light_attrib {
|
|||
|
||||
/* Derived for optimizations: */
|
||||
GLboolean _NeedVertices; /* Use fast shader? */
|
||||
GLuint _Flags; /* State, see below */
|
||||
GLuint _Flags; /* LIGHT_* flags, see below */
|
||||
GLfloat _BaseColor[2][3];
|
||||
GLchan _BaseAlpha[2];
|
||||
};
|
||||
|
|
@ -616,10 +616,8 @@ 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; /* */
|
||||
GLboolean _Unfilled; /* True if back or front mode is not GL_FILL */
|
||||
GLboolean _FrontBit; /* */
|
||||
GLboolean CullFlag; /* Culling on/off flag */
|
||||
GLubyte _CullBits; /* Used for cull testing */
|
||||
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 */
|
||||
|
|
@ -680,6 +678,26 @@ struct gl_stencil_attrib {
|
|||
#define TEXTURE3_3D (TEXTURE0_3D << 12)
|
||||
#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
|
||||
#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
|
||||
#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 3 */
|
||||
#define TEXTURE4_2D (TEXTURE0_2D << 16)
|
||||
#define TEXTURE4_3D (TEXTURE0_3D << 16)
|
||||
#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
|
||||
#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
|
||||
#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 3 */
|
||||
#define TEXTURE5_2D (TEXTURE0_2D << 20)
|
||||
#define TEXTURE5_3D (TEXTURE0_3D << 20)
|
||||
#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
|
||||
#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
|
||||
#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 3 */
|
||||
#define TEXTURE6_2D (TEXTURE0_2D << 24)
|
||||
#define TEXTURE6_3D (TEXTURE0_3D << 24)
|
||||
#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
|
||||
#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
|
||||
#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 3 */
|
||||
#define TEXTURE7_2D (TEXTURE0_2D << 28)
|
||||
#define TEXTURE7_3D (TEXTURE0_3D << 28)
|
||||
#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
|
||||
#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
|
||||
|
||||
/* Bitmap versions of the GL_ constants.
|
||||
*/
|
||||
|
|
@ -708,33 +726,42 @@ struct gl_stencil_attrib {
|
|||
|
||||
/* A selection of state flags to make driver and module's lives easier.
|
||||
*/
|
||||
#define ENABLE_TEX0 0x000f /* TEXTURE0_ANY */
|
||||
#define ENABLE_TEX1 0x00f0 /* TEXTURE1_ANY */
|
||||
#define ENABLE_TEX2 0x0f00 /* TEXTURE2_ANY */
|
||||
#define ENABLE_TEX3 0xf000 /* TEXTURE3_ANY */
|
||||
#define ENABLE_TEXGEN0 0x10000
|
||||
#define ENABLE_TEXGEN1 0x20000
|
||||
#define ENABLE_TEXGEN2 0x40000
|
||||
#define ENABLE_TEXGEN3 0x80000
|
||||
#define ENABLE_TEXMAT0 0x100000 /* Ie. not the identity matrix */
|
||||
#define ENABLE_TEXMAT1 0x200000
|
||||
#define ENABLE_TEXMAT2 0x400000
|
||||
#define ENABLE_TEXMAT3 0x800000
|
||||
#define ENABLE_LIGHT 0x1000000
|
||||
#define ENABLE_FOG 0x2000000
|
||||
#define ENABLE_USERCLIP 0x4000000
|
||||
#define ENABLE_NORMALIZE 0x10000000
|
||||
#define ENABLE_RESCALE 0x20000000
|
||||
#define ENABLE_POINT_ATTEN 0x40000000
|
||||
#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 0x100 /* Ie. not the identity matrix */
|
||||
#define ENABLE_TEXMAT1 0x200
|
||||
#define ENABLE_TEXMAT2 0x400
|
||||
#define ENABLE_TEXMAT3 0x800
|
||||
#define ENABLE_TEXMAT4 0x1000
|
||||
#define ENABLE_TEXMAT5 0x2000
|
||||
#define ENABLE_TEXMAT6 0x4000
|
||||
#define ENABLE_TEXMAT7 0x8000
|
||||
#define ENABLE_LIGHT 0x10000
|
||||
#define ENABLE_FOG 0x20000
|
||||
#define ENABLE_USERCLIP 0x40000
|
||||
#define ENABLE_NORMALIZE 0x100000
|
||||
#define ENABLE_RESCALE 0x200000
|
||||
#define ENABLE_POINT_ATTEN 0x400000
|
||||
|
||||
|
||||
#define ENABLE_TEX_ANY (ENABLE_TEX0 | ENABLE_TEX1 | \
|
||||
ENABLE_TEX2 | ENABLE_TEX3)
|
||||
#define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \
|
||||
ENABLE_TEXGEN2 | ENABLE_TEXGEN3)
|
||||
#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \
|
||||
ENABLE_TEXMAT2 | ENABLE_TEXMAT3)
|
||||
ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \
|
||||
ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \
|
||||
ENABLE_TEXGEN6 | ENABLE_TEXGEN7)
|
||||
|
||||
#define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \
|
||||
ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \
|
||||
ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \
|
||||
ENABLE_TEXMAT6 | ENABLE_TEXMAT7)
|
||||
|
||||
#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
|
||||
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
|
||||
|
||||
/* Texture image record */
|
||||
struct gl_texture_image {
|
||||
|
|
@ -889,9 +916,6 @@ struct gl_texture_attrib {
|
|||
};
|
||||
|
||||
|
||||
|
||||
/* KW: Renamed ClipEquation to avoid having 'ClipClipEquation'
|
||||
*/
|
||||
struct gl_transform_attrib {
|
||||
GLenum MatrixMode; /* Matrix mode */
|
||||
GLfloat EyeUserPlane[MAX_CLIP_PLANES][4];
|
||||
|
|
@ -960,20 +984,13 @@ struct gl_array_attrib {
|
|||
struct gl_client_array TexCoord[MAX_TEXTURE_UNITS];
|
||||
struct gl_client_array EdgeFlag;
|
||||
|
||||
trans_4f_func _VertexFunc; /* conversion functions */
|
||||
trans_3f_func _NormalFunc;
|
||||
trans_4ub_func _ColorFunc;
|
||||
trans_1ui_func _IndexFunc;
|
||||
trans_1f_func _FogCoordFunc;
|
||||
trans_4ub_func _SecondaryColorFunc;
|
||||
trans_4f_func _TexCoordFunc[MAX_TEXTURE_UNITS];
|
||||
trans_1ub_func _EdgeFlagFunc;
|
||||
|
||||
GLint TexCoordInterleaveFactor;
|
||||
GLint ActiveTexture; /* Client Active Texture */
|
||||
|
||||
GLuint LockFirst;
|
||||
GLuint LockCount;
|
||||
|
||||
GLuint _Enabled; /* _NEW_ARRAY_* - bit set if array enabled */
|
||||
GLuint NewState; /* _NEW_ARRAY_* */
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -981,7 +998,7 @@ struct gl_array_attrib {
|
|||
|
||||
struct gl_feedback {
|
||||
GLenum Type;
|
||||
GLuint Mask;
|
||||
GLuint _Mask; /* FB_* bits */
|
||||
GLfloat *Buffer;
|
||||
GLuint BufferSize;
|
||||
GLuint Count;
|
||||
|
|
@ -1260,7 +1277,7 @@ struct gl_extensions {
|
|||
|
||||
|
||||
/*
|
||||
* Bits to indicate what state has changed.
|
||||
* Bits to indicate what state has changed. 6 unused flags.
|
||||
*/
|
||||
#define _NEW_MODELVIEW 0x1 /* ctx->ModelView */
|
||||
#define _NEW_PROJECTION 0x2 /* ctx->Projection */
|
||||
|
|
@ -1272,11 +1289,11 @@ struct gl_extensions {
|
|||
#define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */
|
||||
#define _NEW_FOG 0x100 /* ctx->Fog */
|
||||
#define _NEW_HINT 0x200 /* ctx->Hint */
|
||||
#define _NEW_400 0x400 /* unused */
|
||||
#define _NEW_400 0x400 /* */
|
||||
#define _NEW_LIGHT 0x800 /* ctx->Light */
|
||||
#define _NEW_1000 0x1000 /* unused */
|
||||
#define _NEW_1000 0x1000 /* */
|
||||
#define _NEW_LINE 0x2000 /* ctx->Line */
|
||||
#define _NEW_FEEDBACK_SELECT 0x4000 /* ctx->Feedback, ctx->Select */
|
||||
#define _NEW_4000 0x4000 /* */
|
||||
#define _NEW_PIXEL 0x8000 /* ctx->Pixel */
|
||||
#define _NEW_POINT 0x10000 /* ctx->Point */
|
||||
#define _NEW_POLYGON 0x20000 /* ctx->Polygon */
|
||||
|
|
@ -1289,36 +1306,53 @@ struct gl_extensions {
|
|||
#define _NEW_PACKUNPACK 0x1000000 /* ctx->Pack, ctx->Unpack */
|
||||
#define _NEW_ARRAY 0x2000000 /* ctx->Array */
|
||||
#define _NEW_COLORTABLE 0x4000000 /* ctx->{*}ColorTable */
|
||||
#define _NEW_RENDERMODE 0x8000000 /* ctx->RenderMode */
|
||||
#define _NEW_RENDERMODE 0x8000000 /* RenderMode, Feedback, Select */
|
||||
#define _NEW_BUFFERS 0x10000000 /* ctx->Visual, ctx->DrawBuffer, */
|
||||
|
||||
#define _NEW_ALL ~0
|
||||
|
||||
|
||||
|
||||
/* What can the driver do, what requires us to call render_triangle or
|
||||
* a non-driver rasterize function?
|
||||
/* Bits to track array state changes (also used to summarize array enabled)
|
||||
*/
|
||||
#define _NEW_ARRAY_VERTEX 0x1
|
||||
#define _NEW_ARRAY_COLOR 0x2
|
||||
#define _NEW_ARRAY_NORMAL 0x4
|
||||
#define _NEW_ARRAY_INDEX 0x8
|
||||
#define _NEW_ARRAY_EDGEFLAG 0x10
|
||||
#define _NEW_ARRAY_SECONDARYCOLOR 0x20
|
||||
#define _NEW_ARRAY_FOGCOORD 0x40
|
||||
#define _NEW_ARRAY_TEXCOORD_0 0x80
|
||||
#define _NEW_ARRAY_TEXCOORD_1 0x100
|
||||
#define _NEW_ARRAY_TEXCOORD_2 0x200
|
||||
#define _NEW_ARRAY_TEXCOORD_3 0x400
|
||||
#define _NEW_ARRAY_TEXCOORD_4 0x800
|
||||
#define _NEW_ARRAY_TEXCOORD_5 0x1000
|
||||
#define _NEW_ARRAY_TEXCOORD_6 0x2000
|
||||
#define _NEW_ARRAY_TEXCOORD_7 0x4000
|
||||
#define _NEW_ARRAY_ALL 0x7fff
|
||||
|
||||
#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0<<(i))
|
||||
|
||||
/* A bunch of flags that we think might be useful to drivers.
|
||||
*/
|
||||
#define DD_FEEDBACK 0x1
|
||||
#define DD_SELECT 0x2
|
||||
#define DD_FLATSHADE 0x4
|
||||
#define DD_MULTIDRAW 0x8
|
||||
#define DD_SEPERATE_SPECULAR 0x10
|
||||
#define DD_TRI_LIGHT_TWOSIDE 0x20
|
||||
#define DD_TRI_UNFILLED 0x40
|
||||
#define DD_TRI_SMOOTH 0x80
|
||||
#define DD_TRI_STIPPLE 0x100
|
||||
#define DD_TRI_OFFSET 0x200
|
||||
#define DD_TRI_CULL 0x400
|
||||
#define DD_LINE_SMOOTH 0x800
|
||||
#define DD_LINE_STIPPLE 0x1000
|
||||
#define DD_LINE_WIDTH 0x2000
|
||||
#define DD_POINT_SMOOTH 0x4000
|
||||
#define DD_POINT_SIZE 0x8000
|
||||
#define DD_POINT_ATTEN 0x10000
|
||||
#define DD_LIGHTING_CULL 0x20000
|
||||
#define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */
|
||||
#define DD_Z_NEVER 0x800000
|
||||
#define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */
|
||||
#define DD_Z_NEVER 0x800000 /* special case on some hw */
|
||||
#define DD_STENCIL 0x1000000
|
||||
|
||||
/* Define the state changes under which each of these bits might change
|
||||
|
|
@ -1333,7 +1367,6 @@ struct gl_extensions {
|
|||
#define _DD_NEW_TRI_SMOOTH _NEW_POLYGON
|
||||
#define _DD_NEW_TRI_STIPPLE _NEW_POLYGON
|
||||
#define _DD_NEW_TRI_OFFSET _NEW_POLYGON
|
||||
#define _DD_NEW_TRI_CULL _NEW_POLYGON
|
||||
#define _DD_NEW_LINE_SMOOTH _NEW_LINE
|
||||
#define _DD_NEW_LINE_STIPPLE _NEW_LINE
|
||||
#define _DD_NEW_LINE_WIDTH _NEW_LINE
|
||||
|
|
@ -1345,25 +1378,17 @@ struct gl_extensions {
|
|||
#define _DD_NEW_Z_NEVER _NEW_DEPTH
|
||||
#define _DD_NEW_STENCIL _NEW_STENCIL
|
||||
|
||||
#define _TNL_NEW_RENDERFLAGS (_NEW_TEXTURE | \
|
||||
_DD_NEW_SEPERATE_SPECULAR | \
|
||||
_NEW_POLYGON | \
|
||||
_NEW_FOG | \
|
||||
_NEW_RENDERMODE)
|
||||
|
||||
#define _TNL_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
|
||||
_NEW_TEXTURE| \
|
||||
_NEW_POINT| \
|
||||
_NEW_MODELVIEW)
|
||||
|
||||
#define _TNL_NEW_NEED_NORMALS (_NEW_LIGHT| \
|
||||
_NEW_TEXTURE)
|
||||
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \
|
||||
_NEW_TEXTURE| \
|
||||
_NEW_POINT| \
|
||||
_NEW_MODELVIEW)
|
||||
|
||||
#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW|_NEW_TRANSFORM| \
|
||||
_TNL_NEW_NEED_NORMALS)
|
||||
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \
|
||||
_NEW_TEXTURE)
|
||||
|
||||
#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL|_NEW_COLOR_MATRIX)
|
||||
|
||||
#define _TNL_NEW_SPACES (_TNL_NEW_NEED_NORMALS | \
|
||||
_TNL_NEW_NEED_EYE_COORDS )
|
||||
|
||||
#define NEED_NORMALS_TEXGEN 0x1
|
||||
#define NEED_NORMALS_LIGHT 0x2
|
||||
|
|
@ -1375,15 +1400,6 @@ struct gl_extensions {
|
|||
|
||||
|
||||
|
||||
#define DD_ANY_CULL (DD_TRI_CULL_FRONT_BACK| \
|
||||
DD_TRI_CULL| \
|
||||
DD_LIGHTING_CULL)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Forward declaration of display list datatypes:
|
||||
*/
|
||||
|
|
@ -1534,7 +1550,7 @@ struct __GLcontextRec {
|
|||
GLuint _NeedEyeCoords;
|
||||
GLuint _NeedNormals; /* Are vertex normal vectors needed? */
|
||||
|
||||
struct gl_shine_tab *_ShineTable[4]; /* Active shine tables */
|
||||
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 */
|
||||
|
|
@ -1568,13 +1584,14 @@ struct __GLcontextRec {
|
|||
void *swrast_context;
|
||||
void *swsetup_context;
|
||||
void *swtnl_context;
|
||||
void *swtnl_vb;
|
||||
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+2];
|
||||
extern const char *_mesa_prim_name[GL_POLYGON+4];
|
||||
extern GLenum gl_reduce_prim[];
|
||||
|
||||
|
||||
|
|
@ -1598,8 +1615,6 @@ enum _verbose {
|
|||
VERBOSE_DRIVER = 0x10,
|
||||
VERBOSE_STATE = 0x20,
|
||||
VERBOSE_API = 0x40,
|
||||
VERBOSE_TRIANGLE_CHECKS = 0x80,
|
||||
VERBOSE_CULL = 0x100,
|
||||
VERBOSE_DISPLAY_LIST = 0x200,
|
||||
VERBOSE_LIGHTING = 0x400
|
||||
};
|
||||
|
|
@ -1614,52 +1629,47 @@ enum _debug {
|
|||
#define Elements(x) sizeof(x)/sizeof(*(x))
|
||||
|
||||
|
||||
#define FLUSH_TNL( ctx, flags ) \
|
||||
|
||||
/* Eventually let the driver specify what statechanges require a flush:
|
||||
*/
|
||||
#define FLUSH_VERTICES(ctx, newstate) \
|
||||
do { \
|
||||
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 (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 != GL_POLYGON+1) { \
|
||||
gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0); FLUSH_VERTICES(ctx, 0)
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,); FLUSH_VERTICES(ctx, 0)
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
|
||||
do { \
|
||||
if (ctx->Driver.NeedFlush & flags) \
|
||||
ctx->Driver.FlushVertices( ctx, flags ); \
|
||||
} while (0)
|
||||
|
||||
#define FLUSH_TNL_RETURN( ctx, flags, where ) \
|
||||
do { \
|
||||
if (ctx->Driver.NeedFlush & flags) { \
|
||||
if (!ctx->Driver.FlushVertices( ctx, flags )) { \
|
||||
gl_error( ctx, GL_INVALID_OPERATION, where ); \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx); \
|
||||
FLUSH_VERTICES(ctx, 0); \
|
||||
} while (0)
|
||||
|
||||
#define FLUSH_TNL_RETVAL( ctx, flags, where, what ) \
|
||||
do { \
|
||||
if (ctx->Driver.NeedFlush & flags) { \
|
||||
if (!ctx->Driver.FlushVertices( ctx, flags )) { \
|
||||
gl_error( ctx, GL_INVALID_OPERATION, where ); \
|
||||
return what; \
|
||||
} \
|
||||
} \
|
||||
#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)
|
||||
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what ) \
|
||||
FLUSH_TNL_RETVAL( ctx, \
|
||||
(FLUSH_INSIDE_BEGIN_END| \
|
||||
FLUSH_STORED_VERTICES), \
|
||||
where, what )
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END( ctx, where ) \
|
||||
FLUSH_TNL_RETURN( ctx, \
|
||||
(FLUSH_INSIDE_BEGIN_END| \
|
||||
FLUSH_STORED_VERTICES), \
|
||||
where )
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, where ) \
|
||||
ASSERT_OUTSIDE_BEGIN_END( ctx, where );
|
||||
|
||||
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL( ctx, where, what ) \
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what );
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define RENDER_START(CTX) \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: pixel.c,v 1.21 2000/12/13 00:46:21 brianp Exp $ */
|
||||
/* $Id: pixel.c,v 1.22 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -49,11 +49,14 @@ void
|
|||
_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelZoom");
|
||||
|
||||
if (ctx->Pixel.ZoomX == xfactor &&
|
||||
ctx->Pixel.ZoomY == yfactor)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_PIXEL);
|
||||
ctx->Pixel.ZoomX = xfactor;
|
||||
ctx->Pixel.ZoomY = yfactor;
|
||||
ctx->NewState |= _NEW_PIXEL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -68,118 +71,162 @@ _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_AND_FLUSH(ctx, "glPixelStore");
|
||||
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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Pack.RowLength = param;
|
||||
}
|
||||
if (ctx->Pack.RowLength == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Pack.RowLength = param;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
if (param<0)
|
||||
if (param<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
else
|
||||
ctx->Pack.ImageHeight = 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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Pack.SkipPixels = param;
|
||||
}
|
||||
if (ctx->Pack.SkipPixels == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Pack.SkipPixels = param;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
if (param<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Pack.SkipRows = param;
|
||||
}
|
||||
if (ctx->Pack.SkipRows == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Pack.SkipRows = param;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
if (param<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Pack.SkipImages = param;
|
||||
}
|
||||
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) {
|
||||
ctx->Pack.Alignment = param;
|
||||
}
|
||||
else {
|
||||
if (param!=1 && param!=2 && param!=4 && param!=8) {
|
||||
gl_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_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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Unpack.RowLength = param;
|
||||
}
|
||||
if (ctx->Unpack.RowLength == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Unpack.RowLength = param;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
if (param<0)
|
||||
if (param<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
else
|
||||
ctx->Unpack.ImageHeight = 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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Unpack.SkipPixels = param;
|
||||
}
|
||||
if (ctx->Unpack.SkipPixels == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Unpack.SkipPixels = param;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
if (param<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Unpack.SkipRows = param;
|
||||
}
|
||||
if (ctx->Unpack.SkipRows == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Unpack.SkipRows = param;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
if (param < 0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ctx->Unpack.SkipImages = param;
|
||||
}
|
||||
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) {
|
||||
ctx->Unpack.Alignment = param;
|
||||
}
|
||||
else {
|
||||
if (param!=1 && param!=2 && param!=4 && param!=8) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Unpack.Alignment == param)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
|
||||
ctx->Unpack.Alignment = param;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_PACKUNPACK;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -202,8 +249,7 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
|
|||
{
|
||||
GLint i;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelMapfv");
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (mapsize<0 || mapsize>MAX_PIXEL_MAP_TABLE) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
|
||||
|
|
@ -226,6 +272,8 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
|
|||
}
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_PIXEL);
|
||||
|
||||
switch (map) {
|
||||
case GL_PIXEL_MAP_S_TO_S:
|
||||
ctx->Pixel.MapStoSsize = mapsize;
|
||||
|
|
@ -298,7 +346,6 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
|
|||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" );
|
||||
}
|
||||
ctx->NewState |= _NEW_PIXEL;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -348,8 +395,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (map) {
|
||||
case GL_PIXEL_MAP_I_TO_I:
|
||||
|
|
@ -397,8 +443,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (map) {
|
||||
case GL_PIXEL_MAP_I_TO_I:
|
||||
|
|
@ -458,8 +503,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (map) {
|
||||
case GL_PIXEL_MAP_I_TO_I:
|
||||
|
|
@ -532,107 +576,193 @@ void
|
|||
_mesa_PixelTransferf( GLenum pname, GLfloat param )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTransfer");
|
||||
|
||||
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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* signal to recompute the bitmask */
|
||||
ctx->NewState |= _NEW_PIXEL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: points.c,v 1.25 2000/12/08 00:20:15 brianp Exp $ */
|
||||
/* $Id: points.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -44,21 +44,22 @@ void
|
|||
_mesa_PointSize( GLfloat size )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (size <= 0.0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPointSize" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Point.Size != size) {
|
||||
ctx->Point.Size = size;
|
||||
ctx->Point._Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
|
||||
ctx->_TriangleCaps &= ~DD_POINT_SIZE;
|
||||
if (size != 1.0)
|
||||
ctx->_TriangleCaps |= DD_POINT_SIZE;
|
||||
ctx->NewState |= _NEW_POINT;
|
||||
}
|
||||
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);
|
||||
ctx->_TriangleCaps ^= DD_POINT_SIZE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -74,13 +75,22 @@ void
|
|||
_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (pname) {
|
||||
case GL_DISTANCE_ATTENUATION_EXT:
|
||||
{
|
||||
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);
|
||||
|
|
@ -88,7 +98,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
|||
if (tmp != ctx->Point._Attenuated) {
|
||||
ctx->_Enabled ^= ENABLE_POINT_ATTEN;
|
||||
ctx->_TriangleCaps ^= DD_POINT_ATTEN;
|
||||
/* XXX why is this here and not in state.c? */
|
||||
ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +107,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
|||
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Point.MinSize == *params)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_POINT);
|
||||
ctx->Point.MinSize = *params;
|
||||
break;
|
||||
case GL_POINT_SIZE_MAX_EXT:
|
||||
|
|
@ -105,6 +117,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
|||
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Point.MaxSize == *params)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_POINT);
|
||||
ctx->Point.MaxSize = *params;
|
||||
break;
|
||||
case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
|
||||
|
|
@ -112,13 +127,14 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
|
|||
gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
|
||||
return;
|
||||
}
|
||||
if (ctx->Point.Threshold == *params)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_POINT);
|
||||
ctx->Point.Threshold = *params;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_POINT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: polygon.c,v 1.16 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: polygon.c,v 1.17 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -44,7 +44,7 @@ void
|
|||
_mesa_CullFace( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glCullFace %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
|
@ -54,8 +54,11 @@ _mesa_CullFace( GLenum mode )
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctx->Polygon.CullFaceMode == mode)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
||||
ctx->Polygon.CullFaceMode = mode;
|
||||
ctx->NewState |= _NEW_POLYGON;
|
||||
|
||||
if (ctx->Driver.CullFace)
|
||||
ctx->Driver.CullFace( ctx, mode );
|
||||
|
|
@ -67,7 +70,7 @@ void
|
|||
_mesa_FrontFace( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glFrontFace %s\n", gl_lookup_enum_by_nr(mode));
|
||||
|
|
@ -77,9 +80,13 @@ _mesa_FrontFace( GLenum mode )
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctx->Polygon.FrontFace == mode)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_POLYGON);
|
||||
ctx->Polygon.FrontFace = mode;
|
||||
ctx->Polygon.FrontBit = (GLboolean) (mode == GL_CW);
|
||||
ctx->NewState |= _NEW_POLYGON;
|
||||
|
||||
ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
|
||||
|
||||
if (ctx->Driver.FrontFace)
|
||||
ctx->Driver.FrontFace( ctx, mode );
|
||||
|
|
@ -91,39 +98,47 @@ void
|
|||
_mesa_PolygonMode( GLenum face, GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glPolygonMode %s %s\n",
|
||||
gl_lookup_enum_by_nr(face),
|
||||
gl_lookup_enum_by_nr(mode));
|
||||
|
||||
if (face!=GL_FRONT && face!=GL_BACK && face!=GL_FRONT_AND_BACK) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
|
||||
return;
|
||||
}
|
||||
else if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
|
||||
if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (face==GL_FRONT || face==GL_FRONT_AND_BACK) {
|
||||
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;
|
||||
}
|
||||
if (face==GL_BACK || face==GL_FRONT_AND_BACK) {
|
||||
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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute a handy "shortcut" value: */
|
||||
ctx->_TriangleCaps &= ~DD_TRI_UNFILLED;
|
||||
ctx->Polygon._Unfilled = GL_FALSE;
|
||||
|
||||
if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) {
|
||||
ctx->Polygon._Unfilled = GL_TRUE;
|
||||
if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL)
|
||||
ctx->_TriangleCaps |= DD_TRI_UNFILLED;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_POLYGON;
|
||||
|
||||
if (ctx->Driver.PolygonMode) {
|
||||
(*ctx->Driver.PolygonMode)( ctx, face, mode );
|
||||
|
|
@ -136,15 +151,14 @@ void
|
|||
_mesa_PolygonStipple( const GLubyte *pattern )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glPolygonStipple\n");
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
|
||||
_mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
|
||||
|
||||
ctx->NewState |= _NEW_POLYGONSTIPPLE;
|
||||
|
||||
if (ctx->Driver.PolygonStipple)
|
||||
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple );
|
||||
}
|
||||
|
|
@ -155,7 +169,7 @@ void
|
|||
_mesa_GetPolygonStipple( GLubyte *dest )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "glGetPolygonStipple\n");
|
||||
|
|
@ -169,15 +183,19 @@ void
|
|||
_mesa_PolygonOffset( GLfloat factor, GLfloat units )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_API)
|
||||
fprintf(stderr, "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;
|
||||
ctx->Polygon.OffsetMRD = units * ctx->Visual.MRD;
|
||||
ctx->NewState |= _NEW_POLYGON;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -186,6 +204,5 @@ void
|
|||
_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT");
|
||||
_mesa_PolygonOffset(factor, bias * ctx->Visual.DepthMaxF );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rastpos.c,v 1.17 2000/11/27 18:22:13 brianp Exp $ */
|
||||
/* $Id: rastpos.c,v 1.18 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -241,14 +241,8 @@ static void raster_pos4f( GLcontext *ctx,
|
|||
GLfloat x, GLfloat y, GLfloat z, GLfloat w )
|
||||
{
|
||||
GLfloat v[4], eye[4], clip[4], ndc[3], d;
|
||||
|
||||
/* KW: Added this test, which is in the spec. We can't do this
|
||||
* inside begin/end any more because the ctx->Current values
|
||||
* aren't uptodate during that period.
|
||||
*/
|
||||
FLUSH_TNL_RETURN(ctx, (FLUSH_INSIDE_BEGIN_END|
|
||||
FLUSH_STORED_VERTICES|
|
||||
FLUSH_UPDATE_CURRENT), "raster_pos4f");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
|
||||
if (ctx->NewState)
|
||||
gl_update_state( ctx );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: state.c,v 1.52 2000/12/16 00:19:12 brianp Exp $ */
|
||||
/* $Id: state.c,v 1.53 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -26,8 +26,7 @@
|
|||
|
||||
|
||||
/*
|
||||
* This file initializes the immediate-mode dispatch table (which may
|
||||
* be state-dependant) and manages internal Mesa state update.
|
||||
* This file manages internal Mesa state update.
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -80,13 +79,11 @@
|
|||
#include "varray.h"
|
||||
#include "winpos.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "math/m_matrix.h"
|
||||
#include "math/m_xform.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static int
|
||||
generic_noop(void)
|
||||
{
|
||||
|
|
@ -112,6 +109,7 @@ _mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the given dispatch table with pointers to Mesa's
|
||||
* immediate-mode commands.
|
||||
|
|
@ -501,27 +499,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
|
|||
static void
|
||||
update_polygon( GLcontext *ctx )
|
||||
{
|
||||
ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK;
|
||||
ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
|
||||
|
||||
/* Setup CullBits bitmask */
|
||||
if (ctx->Polygon.CullFlag) {
|
||||
switch(ctx->Polygon.CullFaceMode) {
|
||||
case GL_BACK:
|
||||
ctx->Polygon._CullBits = 1;
|
||||
break;
|
||||
case GL_FRONT:
|
||||
ctx->Polygon._CullBits = 2;
|
||||
break;
|
||||
default:
|
||||
case GL_FRONT_AND_BACK:
|
||||
ctx->Polygon._CullBits = 0;
|
||||
ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ctx->Polygon._CullBits = 3;
|
||||
}
|
||||
/* if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) */
|
||||
/* ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; */
|
||||
|
||||
/* Any Polygon offsets enabled? */
|
||||
ctx->Polygon._OffsetAny = GL_FALSE;
|
||||
|
|
@ -587,8 +568,8 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
|
|||
else {
|
||||
GLuint new_state = ctx->NewState;
|
||||
|
||||
/* Recalculate that same state if and only if it has been
|
||||
* invalidated by other statechanges.
|
||||
/* Recalculate that same state only if it has been invalidated
|
||||
* by other statechanges.
|
||||
*/
|
||||
if (new_state & _NEW_MODELVIEW)
|
||||
update_modelview_scale(ctx);
|
||||
|
|
@ -652,7 +633,6 @@ update_projection( GLcontext *ctx )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return a bitmask of IMAGE_*_BIT flags which to indicate which
|
||||
* pixel transfer operations are enabled.
|
||||
|
|
@ -725,13 +705,17 @@ update_image_transfer_state(GLcontext *ctx)
|
|||
* rendering any primitive. Basically, function pointers and miscellaneous
|
||||
* flags are updated to reflect the current state of the state machine.
|
||||
*
|
||||
* Special care is taken with the derived value _NeedEyeCoords. These
|
||||
* 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.
|
||||
* and from nowhere else.
|
||||
*/
|
||||
void gl_update_state( GLcontext *ctx )
|
||||
{
|
||||
|
|
@ -755,7 +739,7 @@ void gl_update_state( GLcontext *ctx )
|
|||
|
||||
/* References ColorMatrix.type (derived above).
|
||||
*/
|
||||
if (new_state & (_NEW_PIXEL|_NEW_COLOR_MATRIX))
|
||||
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
|
||||
update_image_transfer_state(ctx);
|
||||
|
||||
/* Contributes to NeedEyeCoords, NeedNormals.
|
||||
|
|
@ -784,27 +768,20 @@ void gl_update_state( GLcontext *ctx )
|
|||
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
|
||||
}
|
||||
|
||||
/* point attenuation requires eye coords */
|
||||
if (new_state & _NEW_POINT) {
|
||||
if (ctx->Point._Attenuated) {
|
||||
ctx->_NeedEyeCoords |= NEED_EYE_POINT_ATTEN;
|
||||
}
|
||||
}
|
||||
|
||||
/* ctx->_NeedEyeCoords and ctx->_NeedEyeNormals are now uptodate.
|
||||
/* ctx->_NeedEyeCoords is now uptodate.
|
||||
*
|
||||
* If the truth value of either has changed, update for the new
|
||||
* lighting space and recompute the positions of lights and the
|
||||
* 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.
|
||||
* light positions & normal transforms for other reasons.
|
||||
*/
|
||||
if (new_state & (_NEW_MODELVIEW |
|
||||
_NEW_PROJECTION |
|
||||
_TNL_NEW_NORMAL_TRANSFORM |
|
||||
_NEW_LIGHT |
|
||||
_TNL_NEW_NEED_EYE_COORDS))
|
||||
_MESA_NEW_NEED_EYE_COORDS))
|
||||
update_tnl_spaces( ctx, oldneedeyecoords );
|
||||
|
||||
/*
|
||||
|
|
@ -812,7 +789,12 @@ void gl_update_state( GLcontext *ctx )
|
|||
* 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->Driver.UpdateState(ctx);
|
||||
ctx->NewState = 0;
|
||||
ctx->Driver.UpdateState(ctx, new_state);
|
||||
|
||||
ctx->Array.NewState = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stencil.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: stencil.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -45,9 +45,13 @@ void
|
|||
_mesa_ClearStencil( GLint s )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->Stencil.Clear == (GLstencil) s)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
||||
ctx->Stencil.Clear = (GLstencil) s;
|
||||
ctx->NewState |= _NEW_STENCIL;
|
||||
|
||||
if (ctx->Driver.ClearStencil) {
|
||||
(*ctx->Driver.ClearStencil)( ctx, s );
|
||||
|
|
@ -61,8 +65,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxref;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (func) {
|
||||
case GL_NEVER:
|
||||
|
|
@ -73,7 +76,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
|
|||
case GL_EQUAL:
|
||||
case GL_NOTEQUAL:
|
||||
case GL_ALWAYS:
|
||||
ctx->Stencil.Function = func;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glStencilFunc" );
|
||||
|
|
@ -81,9 +83,17 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
|
|||
}
|
||||
|
||||
maxref = (1 << STENCIL_BITS) - 1;
|
||||
ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref );
|
||||
ref = (GLstencil) CLAMP( ref, 0, maxref );
|
||||
|
||||
if (ctx->Stencil.Function == func &&
|
||||
ctx->Stencil.ValueMask == (GLstencil) mask &&
|
||||
ctx->Stencil.Ref == ref)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
||||
ctx->Stencil.Function = func;
|
||||
ctx->Stencil.Ref = ref;
|
||||
ctx->Stencil.ValueMask = (GLstencil) mask;
|
||||
ctx->NewState |= _NEW_STENCIL;
|
||||
|
||||
if (ctx->Driver.StencilFunc) {
|
||||
(*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask );
|
||||
|
|
@ -96,9 +106,13 @@ void
|
|||
_mesa_StencilMask( GLuint mask )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->Stencil.WriteMask == (GLstencil) mask)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
||||
ctx->Stencil.WriteMask = (GLstencil) mask;
|
||||
ctx->NewState |= _NEW_STENCIL;
|
||||
|
||||
if (ctx->Driver.StencilMask) {
|
||||
(*ctx->Driver.StencilMask)( ctx, mask );
|
||||
|
|
@ -111,7 +125,8 @@ void
|
|||
_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (fail) {
|
||||
case GL_KEEP:
|
||||
case GL_ZERO:
|
||||
|
|
@ -123,8 +138,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
|||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
case GL_DECR_WRAP_EXT:
|
||||
if (ctx->Extensions.EXT_stencil_wrap) {
|
||||
ctx->Stencil.FailFunc = fail;
|
||||
if (!ctx->Extensions.EXT_stencil_wrap) {
|
||||
break;
|
||||
}
|
||||
/* FALL-THROUGH */
|
||||
|
|
@ -139,12 +153,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
|||
case GL_INCR:
|
||||
case GL_DECR:
|
||||
case GL_INVERT:
|
||||
ctx->Stencil.ZFailFunc = zfail;
|
||||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
case GL_DECR_WRAP_EXT:
|
||||
if (ctx->Extensions.EXT_stencil_wrap) {
|
||||
ctx->Stencil.ZFailFunc = zfail;
|
||||
break;
|
||||
}
|
||||
/* FALL-THROUGH */
|
||||
|
|
@ -159,12 +171,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
|||
case GL_INCR:
|
||||
case GL_DECR:
|
||||
case GL_INVERT:
|
||||
ctx->Stencil.ZPassFunc = zpass;
|
||||
break;
|
||||
case GL_INCR_WRAP_EXT:
|
||||
case GL_DECR_WRAP_EXT:
|
||||
if (ctx->Extensions.EXT_stencil_wrap) {
|
||||
ctx->Stencil.ZPassFunc = zpass;
|
||||
break;
|
||||
}
|
||||
/* FALL-THROUGH */
|
||||
|
|
@ -173,7 +183,15 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_STENCIL;
|
||||
if (ctx->Stencil.ZFailFunc == zfail &&
|
||||
ctx->Stencil.ZPassFunc == zpass &&
|
||||
ctx->Stencil.FailFunc == fail)
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_STENCIL);
|
||||
ctx->Stencil.ZFailFunc = zfail;
|
||||
ctx->Stencil.ZPassFunc = zpass;
|
||||
ctx->Stencil.FailFunc = fail;
|
||||
|
||||
if (ctx->Driver.StencilOp) {
|
||||
(*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: teximage.c,v 1.68 2000/12/14 20:25:56 brianp Exp $ */
|
||||
/* $Id: teximage.c,v 1.69 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -1612,7 +1612,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
|
|||
{
|
||||
GLsizei postConvWidth = width;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
adjust_texture_size_for_convolution(ctx, 1, &postConvWidth, NULL);
|
||||
|
||||
|
|
@ -1743,7 +1743,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
|
|||
{
|
||||
GLsizei postConvWidth = width, postConvHeight = height;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
adjust_texture_size_for_convolution(ctx, 2, &postConvWidth,&postConvHeight);
|
||||
|
||||
|
|
@ -1884,7 +1884,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
|
|||
const GLvoid *pixels )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (target==GL_TEXTURE_3D_EXT) {
|
||||
struct gl_texture_unit *texUnit;
|
||||
|
|
@ -2169,7 +2169,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
|||
struct gl_texture_image *texImage;
|
||||
GLboolean discardImage;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" );
|
||||
|
|
@ -2648,7 +2648,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
|
|||
{
|
||||
GLsizei postConvWidth = width;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -2691,7 +2691,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
|
|||
{
|
||||
GLsizei postConvWidth = width, postConvHeight = height;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -2733,7 +2733,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
|
|||
{
|
||||
GLsizei postConvWidth = width;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -2783,7 +2783,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
|
|||
{
|
||||
GLsizei postConvWidth = width, postConvHeight = height;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -2833,7 +2833,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
|
|||
{
|
||||
GLsizei postConvWidth = width, postConvHeight = height;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (ctx->NewState & _NEW_PIXEL)
|
||||
gl_update_state(ctx);
|
||||
|
|
@ -2883,7 +2883,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
|
|||
const GLvoid *data)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_ALPHA_ARB:
|
||||
|
|
@ -3010,7 +3010,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
|
|||
const GLvoid *data)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_ALPHA_ARB:
|
||||
|
|
@ -3145,7 +3145,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
|
|||
GLsizei imageSize, const GLvoid *data)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_ALPHA_ARB:
|
||||
|
|
@ -3386,7 +3386,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
|
|||
const struct gl_texture_object *texObj;
|
||||
struct gl_texture_image *texImage;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)" );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texobj.c,v 1.36 2000/12/14 20:25:56 brianp Exp $ */
|
||||
/* $Id: texobj.c,v 1.37 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -420,8 +420,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint first;
|
||||
GLint i;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures");
|
||||
if (n < 0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
|
||||
return;
|
||||
|
|
@ -462,8 +462,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
|
||||
|
||||
if (!texName)
|
||||
return;
|
||||
|
|
@ -525,13 +524,12 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
|||
struct gl_texture_object *oldTexObj;
|
||||
struct gl_texture_object *newTexObj;
|
||||
GLuint targetDim;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glBindTexture %s %d\n",
|
||||
gl_lookup_enum_by_nr(target), (GLint) texName);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture");
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
targetDim = 1;
|
||||
|
|
@ -607,7 +605,11 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
|||
|
||||
newTexObj->RefCount++;
|
||||
|
||||
/* do the actual binding */
|
||||
|
||||
/* do the actual binding, but first flush outstanding vertices:
|
||||
*/
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
texUnit->Current1D = newTexObj;
|
||||
|
|
@ -625,8 +627,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
|||
gl_problem(ctx, "bad target in BindTexture");
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_TEXTURE;
|
||||
|
||||
/* Pass BindTexture call to device driver */
|
||||
if (ctx->Driver.BindTexture)
|
||||
(*ctx->Driver.BindTexture)( ctx, target, newTexObj );
|
||||
|
|
@ -654,8 +654,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
|
||||
if (n < 0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
|
||||
return;
|
||||
|
|
@ -691,9 +691,8 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLboolean allResident = GL_TRUE;
|
||||
GLint i;
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx,
|
||||
"glAreTexturesResident", GL_FALSE);
|
||||
if (n < 0) {
|
||||
gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
|
||||
return GL_FALSE;
|
||||
|
|
@ -737,13 +736,7 @@ GLboolean
|
|||
_mesa_IsTexture( GLuint texture )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
|
||||
GL_FALSE);
|
||||
if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
|
||||
return GL_TRUE;
|
||||
}
|
||||
else {
|
||||
return GL_FALSE;
|
||||
}
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||
return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texstate.c,v 1.25 2000/11/24 10:25:06 keithw Exp $ */
|
||||
/* $Id: texstate.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -69,259 +69,294 @@ _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_AND_FLUSH(ctx, "glTexEnv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (target==GL_TEXTURE_ENV) {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_ENV_MODE:
|
||||
{
|
||||
GLenum mode = (GLenum) (GLint) *param;
|
||||
switch (mode) {
|
||||
case GL_MODULATE:
|
||||
case GL_BLEND:
|
||||
case GL_DECAL:
|
||||
case GL_REPLACE:
|
||||
case GL_ADD:
|
||||
case GL_COMBINE_EXT:
|
||||
if (mode == GL_ADD &&
|
||||
!ctx->Extensions.EXT_texture_env_add) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
|
||||
return;
|
||||
}
|
||||
if (mode == GL_COMBINE_EXT &&
|
||||
!ctx->Extensions.EXT_texture_env_combine) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
|
||||
return;
|
||||
}
|
||||
if (texUnit->EnvMode == mode)
|
||||
return; /* no change */
|
||||
texUnit->EnvMode = mode;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_ENV_COLOR:
|
||||
texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F );
|
||||
texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F );
|
||||
texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F );
|
||||
texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F );
|
||||
break;
|
||||
case GL_COMBINE_RGB_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
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:
|
||||
if (texUnit->CombineModeRGB == mode)
|
||||
return; /* no change */
|
||||
texUnit->CombineModeRGB = mode;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_COMBINE_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
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:
|
||||
if (texUnit->CombineModeA == mode)
|
||||
return; /* no change */
|
||||
texUnit->CombineModeA = mode;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(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) {
|
||||
GLenum source = (GLenum) (GLint) *param;
|
||||
GLuint s = pname - GL_SOURCE0_RGB_EXT;
|
||||
switch (source) {
|
||||
case GL_TEXTURE:
|
||||
case GL_CONSTANT_EXT:
|
||||
case GL_PRIMARY_COLOR_EXT:
|
||||
case GL_PREVIOUS_EXT:
|
||||
if (texUnit->CombineSourceRGB[s] == source)
|
||||
return; /* no change */
|
||||
texUnit->CombineSourceRGB[s] = source;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(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) {
|
||||
GLenum source = (GLenum) (GLint) *param;
|
||||
GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
|
||||
switch (source) {
|
||||
case GL_TEXTURE:
|
||||
case GL_CONSTANT_EXT:
|
||||
case GL_PRIMARY_COLOR_EXT:
|
||||
case GL_PREVIOUS_EXT:
|
||||
if (texUnit->CombineSourceA[s] == source) return;
|
||||
texUnit->CombineSourceA[s] = source;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND0_RGB_EXT:
|
||||
case GL_OPERAND1_RGB_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
GLenum operand = (GLenum) (GLint) *param;
|
||||
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:
|
||||
texUnit->CombineOperandRGB[s] = operand;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND0_ALPHA_EXT:
|
||||
case GL_OPERAND1_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
GLenum operand = (GLenum) (GLint) *param;
|
||||
switch (operand) {
|
||||
case GL_SRC_ALPHA:
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT]
|
||||
= operand;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND2_RGB_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
|
||||
texUnit->CombineOperandRGB[2] = (GLenum) (GLint) *param;
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND2_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
if ((GLenum) (GLint) *param == GL_SRC_ALPHA) {
|
||||
texUnit->CombineOperandA[2] = (GLenum) (GLint) *param;
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_RGB_SCALE_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
if (*param == 1.0) {
|
||||
texUnit->CombineScaleShiftRGB = 0;
|
||||
}
|
||||
else if (*param == 2.0) {
|
||||
texUnit->CombineScaleShiftRGB = 1;
|
||||
}
|
||||
else if (*param == 4.0) {
|
||||
texUnit->CombineScaleShiftRGB = 2;
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_ALPHA_SCALE:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
if (*param == 1.0) {
|
||||
texUnit->CombineScaleShiftA = 0;
|
||||
}
|
||||
else if (*param == 2.0) {
|
||||
texUnit->CombineScaleShiftA = 1;
|
||||
}
|
||||
else if (*param == 4.0) {
|
||||
texUnit->CombineScaleShiftA = 2;
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
|
||||
return;
|
||||
case GL_TEXTURE_ENV_MODE: {
|
||||
GLenum mode = (GLenum) (GLint) *param;
|
||||
|
||||
switch (mode) {
|
||||
case GL_ADD:
|
||||
if (!ctx->Extensions.EXT_texture_env_add) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_COMBINE_EXT:
|
||||
if (!ctx->Extensions.EXT_texture_env_combine) {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_MODULATE:
|
||||
case GL_BLEND:
|
||||
case GL_DECAL:
|
||||
case GL_REPLACE:
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (texUnit->EnvMode == mode)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->EnvMode = mode;
|
||||
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) {
|
||||
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:
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
if (texUnit->CombineModeRGB == mode)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineModeRGB = mode;
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
case GL_COMBINE_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
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:
|
||||
if (texUnit->CombineModeA == mode)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineModeA = mode;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(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) {
|
||||
GLenum source = (GLenum) (GLint) *param;
|
||||
GLuint s = pname - GL_SOURCE0_RGB_EXT;
|
||||
switch (source) {
|
||||
case GL_TEXTURE:
|
||||
case GL_CONSTANT_EXT:
|
||||
case GL_PRIMARY_COLOR_EXT:
|
||||
case GL_PREVIOUS_EXT:
|
||||
if (texUnit->CombineSourceRGB[s] == source)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineSourceRGB[s] = source;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(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) {
|
||||
GLenum source = (GLenum) (GLint) *param;
|
||||
GLuint s = pname - GL_SOURCE0_ALPHA_EXT;
|
||||
switch (source) {
|
||||
case GL_TEXTURE:
|
||||
case GL_CONSTANT_EXT:
|
||||
case GL_PRIMARY_COLOR_EXT:
|
||||
case GL_PREVIOUS_EXT:
|
||||
if (texUnit->CombineSourceA[s] == source) return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineSourceA[s] = source;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND0_RGB_EXT:
|
||||
case GL_OPERAND1_RGB_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
GLenum operand = (GLenum) (GLint) *param;
|
||||
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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND0_ALPHA_EXT:
|
||||
case GL_OPERAND1_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND2_RGB_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
GLenum operand = (GLenum) (GLint) *param;
|
||||
switch (operand) {
|
||||
case GL_SRC_ALPHA:
|
||||
if (texUnit->CombineOperandRGB[2] == operand)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineOperandRGB[2] = operand;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_OPERAND2_ALPHA_EXT:
|
||||
if (ctx->Extensions.EXT_texture_env_combine) {
|
||||
GLenum operand = (GLenum) (GLint) *param;
|
||||
switch (operand) {
|
||||
case GL_SRC_ALPHA:
|
||||
if (texUnit->CombineOperandA[2] == operand)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineOperandA[2] = operand;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_RGB_SCALE_EXT:
|
||||
if (ctx->Extensions.EXT_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 {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
if (texUnit->CombineScaleShiftRGB == newshift)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineScaleShiftRGB = newshift;
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_ALPHA_SCALE:
|
||||
if (ctx->Extensions.EXT_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 {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
if (texUnit->CombineScaleShiftA == newshift)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->CombineScaleShiftA = newshift;
|
||||
}
|
||||
else {
|
||||
gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) {
|
||||
|
|
@ -329,10 +364,14 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
|
|||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" );
|
||||
return;
|
||||
}
|
||||
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_LOD_BIAS_EXT:
|
||||
if (texUnit->LodBias == param[0])
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
texUnit->LodBias = param[0];
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
|
||||
return;
|
||||
}
|
||||
|
|
@ -353,8 +392,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
|
|||
if (ctx->Driver.TexEnv) {
|
||||
(*ctx->Driver.TexEnv)( ctx, target, pname, param );
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_TEXTURE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -393,8 +430,7 @@ _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_AND_FLUSH(ctx, "glGetTexEnvfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (target!=GL_TEXTURE_ENV) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" );
|
||||
|
|
@ -447,8 +483,7 @@ _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_AND_FLUSH(ctx, "glGetTexEnviv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (target != GL_TEXTURE_ENV) {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" );
|
||||
|
|
@ -604,8 +639,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
|||
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_AND_FLUSH(ctx, "glTexParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "texPARAM %s %s %d...\n",
|
||||
|
|
@ -806,8 +840,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
const struct gl_texture_image *img = NULL;
|
||||
GLuint dimensions;
|
||||
GLboolean isProxy;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" );
|
||||
|
|
@ -919,8 +952,7 @@ _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_AND_FLUSH(ctx, "glGetTexParameterfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
obj = _mesa_select_tex_object(ctx, texUnit, target);
|
||||
if (!obj) {
|
||||
|
|
@ -987,8 +1019,7 @@ _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_AND_FLUSH(ctx, "glGetTexParameteriv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
obj = _mesa_select_tex_object(ctx, texUnit, target);
|
||||
if (!obj) {
|
||||
|
|
@ -1069,7 +1100,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "texGEN %s %s %x...\n",
|
||||
|
|
@ -1081,45 +1112,54 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
case GL_S:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
GLenum mode = (GLenum) (GLint) *params;
|
||||
GLuint bits;
|
||||
switch (mode) {
|
||||
case GL_OBJECT_LINEAR:
|
||||
texUnit->GenModeS = mode;
|
||||
texUnit->_GenBitS = TEXGEN_OBJ_LINEAR;
|
||||
bits = TEXGEN_OBJ_LINEAR;
|
||||
break;
|
||||
case GL_EYE_LINEAR:
|
||||
texUnit->GenModeS = mode;
|
||||
texUnit->_GenBitS = TEXGEN_EYE_LINEAR;
|
||||
bits = TEXGEN_EYE_LINEAR;
|
||||
break;
|
||||
case GL_REFLECTION_MAP_NV:
|
||||
texUnit->GenModeS = mode;
|
||||
texUnit->_GenBitS = TEXGEN_REFLECTION_MAP_NV;
|
||||
bits = TEXGEN_REFLECTION_MAP_NV;
|
||||
break;
|
||||
case GL_NORMAL_MAP_NV:
|
||||
texUnit->GenModeS = mode;
|
||||
texUnit->_GenBitS = TEXGEN_NORMAL_MAP_NV;
|
||||
bits = TEXGEN_NORMAL_MAP_NV;
|
||||
break;
|
||||
case GL_SPHERE_MAP:
|
||||
texUnit->GenModeS = mode;
|
||||
texUnit->_GenBitS = TEXGEN_SPHERE_MAP;
|
||||
bits = TEXGEN_SPHERE_MAP;
|
||||
break;
|
||||
default:
|
||||
gl_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->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
gl_transform_vector( texUnit->EyePlaneS, params,
|
||||
ctx->ModelView.inv );
|
||||
gl_transform_vector( tmp, params, ctx->ModelView.inv );
|
||||
if (TEST_EQ_4V(texUnit->EyePlaneS, tmp))
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
COPY_4FV(texUnit->EyePlaneS, tmp);
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
|
||||
|
|
@ -1129,45 +1169,53 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
case GL_T:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
GLenum mode = (GLenum) (GLint) *params;
|
||||
GLuint bitt;
|
||||
switch (mode) {
|
||||
case GL_OBJECT_LINEAR:
|
||||
texUnit->GenModeT = GL_OBJECT_LINEAR;
|
||||
texUnit->_GenBitT = TEXGEN_OBJ_LINEAR;
|
||||
bitt = TEXGEN_OBJ_LINEAR;
|
||||
break;
|
||||
case GL_EYE_LINEAR:
|
||||
texUnit->GenModeT = GL_EYE_LINEAR;
|
||||
texUnit->_GenBitT = TEXGEN_EYE_LINEAR;
|
||||
bitt = TEXGEN_EYE_LINEAR;
|
||||
break;
|
||||
case GL_REFLECTION_MAP_NV:
|
||||
texUnit->GenModeT = GL_REFLECTION_MAP_NV;
|
||||
texUnit->_GenBitT = TEXGEN_REFLECTION_MAP_NV;
|
||||
bitt = TEXGEN_REFLECTION_MAP_NV;
|
||||
break;
|
||||
case GL_NORMAL_MAP_NV:
|
||||
texUnit->GenModeT = GL_NORMAL_MAP_NV;
|
||||
texUnit->_GenBitT = TEXGEN_NORMAL_MAP_NV;
|
||||
bitt = TEXGEN_NORMAL_MAP_NV;
|
||||
break;
|
||||
case GL_SPHERE_MAP:
|
||||
texUnit->GenModeT = GL_SPHERE_MAP;
|
||||
texUnit->_GenBitT = TEXGEN_SPHERE_MAP;
|
||||
bitt = TEXGEN_SPHERE_MAP;
|
||||
break;
|
||||
default:
|
||||
gl_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->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
gl_transform_vector( texUnit->EyePlaneT, params,
|
||||
ctx->ModelView.inv );
|
||||
gl_transform_vector( tmp, params, ctx->ModelView.inv );
|
||||
if (TEST_EQ_4V(texUnit->EyePlaneT, tmp))
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
COPY_4FV(texUnit->EyePlaneT, tmp);
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
|
||||
|
|
@ -1177,41 +1225,50 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
case GL_R:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
GLenum mode = (GLenum) (GLint) *params;
|
||||
GLuint bitr;
|
||||
switch (mode) {
|
||||
case GL_OBJECT_LINEAR:
|
||||
texUnit->GenModeR = GL_OBJECT_LINEAR;
|
||||
texUnit->_GenBitR = TEXGEN_OBJ_LINEAR;
|
||||
bitr = TEXGEN_OBJ_LINEAR;
|
||||
break;
|
||||
case GL_REFLECTION_MAP_NV:
|
||||
texUnit->GenModeR = GL_REFLECTION_MAP_NV;
|
||||
texUnit->_GenBitR = TEXGEN_REFLECTION_MAP_NV;
|
||||
bitr = TEXGEN_REFLECTION_MAP_NV;
|
||||
break;
|
||||
case GL_NORMAL_MAP_NV:
|
||||
texUnit->GenModeR = GL_NORMAL_MAP_NV;
|
||||
texUnit->_GenBitR = TEXGEN_NORMAL_MAP_NV;
|
||||
bitr = TEXGEN_NORMAL_MAP_NV;
|
||||
break;
|
||||
case GL_EYE_LINEAR:
|
||||
texUnit->GenModeR = GL_EYE_LINEAR;
|
||||
texUnit->_GenBitR = TEXGEN_EYE_LINEAR;
|
||||
bitr = TEXGEN_EYE_LINEAR;
|
||||
break;
|
||||
default:
|
||||
gl_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->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
gl_transform_vector( texUnit->EyePlaneR, params,
|
||||
ctx->ModelView.inv );
|
||||
gl_transform_vector( tmp, params, ctx->ModelView.inv );
|
||||
if (TEST_EQ_4V(texUnit->EyePlaneR, tmp))
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
COPY_4FV(texUnit->EyePlaneR, tmp);
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
|
||||
|
|
@ -1221,33 +1278,44 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
case GL_Q:
|
||||
if (pname==GL_TEXTURE_GEN_MODE) {
|
||||
GLenum mode = (GLenum) (GLint) *params;
|
||||
GLuint bitq;
|
||||
switch (mode) {
|
||||
case GL_OBJECT_LINEAR:
|
||||
texUnit->GenModeQ = GL_OBJECT_LINEAR;
|
||||
texUnit->_GenBitQ = TEXGEN_OBJ_LINEAR;
|
||||
bitq = TEXGEN_OBJ_LINEAR;
|
||||
break;
|
||||
case GL_EYE_LINEAR:
|
||||
texUnit->GenModeQ = GL_EYE_LINEAR;
|
||||
texUnit->_GenBitQ = TEXGEN_EYE_LINEAR;
|
||||
bitq = TEXGEN_EYE_LINEAR;
|
||||
break;
|
||||
default:
|
||||
gl_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->ModelView.flags & MAT_DIRTY_INVERSE) {
|
||||
_math_matrix_analyse( &ctx->ModelView );
|
||||
}
|
||||
gl_transform_vector( texUnit->EyePlaneQ, params,
|
||||
ctx->ModelView.inv );
|
||||
gl_transform_vector( tmp, params, ctx->ModelView.inv );
|
||||
if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp))
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
COPY_4FV(texUnit->EyePlaneQ, tmp);
|
||||
}
|
||||
else {
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
|
||||
|
|
@ -1261,8 +1329,6 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
|
|||
|
||||
if (ctx->Driver.TexGen)
|
||||
ctx->Driver.TexGen( ctx, coord, pname, params );
|
||||
|
||||
ctx->NewState |= _NEW_TEXTURE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1319,8 +1385,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (coord) {
|
||||
case GL_S:
|
||||
|
|
@ -1397,8 +1462,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (coord) {
|
||||
case GL_S:
|
||||
|
|
@ -1475,8 +1539,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint tUnit = ctx->Texture.CurrentTransformUnit;
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv");
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
switch (coord) {
|
||||
case GL_S:
|
||||
|
|
@ -1575,25 +1638,23 @@ void
|
|||
_mesa_ActiveTextureARB( GLenum target )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxUnits = ctx->Const.MaxTextureUnits;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" );
|
||||
GLuint texUnit = target - GL_TEXTURE0_ARB;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "glActiveTexture %s\n",
|
||||
gl_lookup_enum_by_nr(target));
|
||||
|
||||
if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) {
|
||||
GLint texUnit = target - GL_TEXTURE0_ARB;
|
||||
ctx->Texture.CurrentUnit = texUnit;
|
||||
ctx->Texture.CurrentTransformUnit = texUnit;
|
||||
if (ctx->Driver.ActiveTexture) {
|
||||
(*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
|
||||
}
|
||||
ctx->NewState |= _NEW_TEXTURE;
|
||||
}
|
||||
else {
|
||||
if (texUnit > ctx->Const.MaxTextureUnits) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)");
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
ctx->Texture.CurrentUnit = texUnit;
|
||||
ctx->Texture.CurrentTransformUnit = texUnit;
|
||||
if (ctx->Driver.ActiveTexture) {
|
||||
(*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1603,16 +1664,14 @@ void
|
|||
_mesa_ClientActiveTextureARB( GLenum target )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint maxUnits = ctx->Const.MaxTextureUnits;
|
||||
GLuint texUnit = target - GL_TEXTURE0_ARB;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" );
|
||||
|
||||
if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) {
|
||||
GLint texUnit = target - GL_TEXTURE0_ARB;
|
||||
ctx->Array.ActiveTexture = texUnit;
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
}
|
||||
else {
|
||||
if (texUnit > ctx->Const.MaxTextureUnits) {
|
||||
gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)");
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_ARRAY);
|
||||
ctx->Array.ActiveTexture = texUnit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: texutil.c,v 1.10 2000/11/22 07:32:17 joukj Exp $ */
|
||||
/* $Id: texutil.c,v 1.11 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -135,6 +135,10 @@ _mesa_convert_teximage(MesaIntTexFormat dstFormat,
|
|||
GLubyte *dst = (GLubyte *) dstImage;
|
||||
GLint row;
|
||||
for (row = 0; row < dstHeight; row++) {
|
||||
GLuint i;
|
||||
for (i = 0 ; i < dstWidth ; i++)
|
||||
fprintf(stderr, "%02x ", src[i]);
|
||||
fprintf(stderr, "\n");
|
||||
MEMCPY(dst, src, dstWidth * sizeof(GLubyte));
|
||||
dst += dstRowStride;
|
||||
src += srcStride;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: varray.c,v 1.33 2000/11/24 10:25:06 keithw Exp $ */
|
||||
/* $Id: varray.c,v 1.34 2000/12/26 05:09:29 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -48,6 +48,7 @@ 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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" );
|
||||
|
|
@ -87,8 +88,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
ctx->Array.Vertex.Type = type;
|
||||
ctx->Array.Vertex.Stride = stride;
|
||||
ctx->Array.Vertex.Ptr = (void *) ptr;
|
||||
ctx->Array._VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.VertexPointer)
|
||||
ctx->Driver.VertexPointer( ctx, size, type, stride, ptr );
|
||||
|
|
@ -101,6 +102,7 @@ void
|
|||
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" );
|
||||
|
|
@ -138,8 +140,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
|
|||
ctx->Array.Normal.Type = type;
|
||||
ctx->Array.Normal.Stride = stride;
|
||||
ctx->Array.Normal.Ptr = (void *) ptr;
|
||||
ctx->Array._NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.NormalPointer)
|
||||
ctx->Driver.NormalPointer( ctx, type, stride, ptr );
|
||||
|
|
@ -151,6 +153,7 @@ 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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
|
||||
|
|
@ -202,8 +205,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
ctx->Array.Color.Type = type;
|
||||
ctx->Array.Color.Stride = stride;
|
||||
ctx->Array.Color.Ptr = (void *) ptr;
|
||||
ctx->Array._ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.ColorPointer)
|
||||
ctx->Driver.ColorPointer( ctx, size, type, stride, ptr );
|
||||
|
|
@ -215,6 +218,7 @@ void
|
|||
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" );
|
||||
|
|
@ -238,8 +242,8 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
ctx->Array.FogCoord.Type = type;
|
||||
ctx->Array.FogCoord.Stride = stride;
|
||||
ctx->Array.FogCoord.Ptr = (void *) ptr;
|
||||
ctx->Array._FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.FogCoordPointer)
|
||||
ctx->Driver.FogCoordPointer( ctx, type, stride, ptr );
|
||||
|
|
@ -250,6 +254,7 @@ void
|
|||
_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" );
|
||||
|
|
@ -282,8 +287,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
ctx->Array.Index.Type = type;
|
||||
ctx->Array.Index.Stride = stride;
|
||||
ctx->Array.Index.Ptr = (void *) ptr;
|
||||
ctx->Array._IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.IndexPointer)
|
||||
ctx->Driver.IndexPointer( ctx, type, stride, ptr );
|
||||
|
|
@ -295,6 +300,7 @@ _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) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" );
|
||||
|
|
@ -346,8 +352,8 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
|
|||
ctx->Array.SecondaryColor.Type = type;
|
||||
ctx->Array.SecondaryColor.Stride = stride;
|
||||
ctx->Array.SecondaryColor.Ptr = (void *) ptr;
|
||||
ctx->Array._SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.SecondaryColorPointer)
|
||||
ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr );
|
||||
|
|
@ -359,9 +365,8 @@ void
|
|||
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint texUnit;
|
||||
|
||||
texUnit = ctx->Array.ActiveTexture;
|
||||
GLuint texUnit = ctx->Array.ActiveTexture;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (size<1 || size>4) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" );
|
||||
|
|
@ -403,8 +408,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr
|
|||
ctx->Array.TexCoord[texUnit].Type = type;
|
||||
ctx->Array.TexCoord[texUnit].Stride = stride;
|
||||
ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr;
|
||||
ctx->Array._TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)];
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.TexCoordPointer)
|
||||
ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
|
||||
|
|
@ -418,6 +423,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
const GLboolean *ptr = (GLboolean *)vptr;
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (stride<0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" );
|
||||
|
|
@ -426,12 +432,8 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
|
|||
ctx->Array.EdgeFlag.Stride = stride;
|
||||
ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean);
|
||||
ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr;
|
||||
if (stride != sizeof(GLboolean)) {
|
||||
ctx->Array._EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)];
|
||||
} else {
|
||||
ctx->Array._EdgeFlagFunc = 0;
|
||||
}
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
|
||||
|
||||
if (ctx->Driver.EdgeFlagPointer)
|
||||
ctx->Driver.EdgeFlagPointer( ctx, stride, ptr );
|
||||
|
|
@ -511,6 +513,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
|||
GLint c, f;
|
||||
GLint coordUnitSave;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
f = sizeof(GLfloat);
|
||||
c = f * ((4*sizeof(GLubyte) + (f-1)) / f);
|
||||
|
||||
|
|
@ -645,8 +649,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
|||
for (i = 0; i < factor; i++) {
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
_mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glTexCoordPointer( tcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + i * coffset );
|
||||
_mesa_TexCoordPointer( tcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + i * coffset );
|
||||
}
|
||||
for (i = factor; i < ctx->Const.MaxTextureUnits; i++) {
|
||||
_mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) );
|
||||
|
|
@ -667,8 +671,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
|||
/* Color */
|
||||
if (cflag) {
|
||||
_mesa_EnableClientState( GL_COLOR_ARRAY );
|
||||
glColorPointer( ccomps, ctype, stride,
|
||||
(GLubyte*) pointer + coffset );
|
||||
_mesa_ColorPointer( ccomps, ctype, stride,
|
||||
(GLubyte*) pointer + coffset );
|
||||
}
|
||||
else {
|
||||
_mesa_DisableClientState( GL_COLOR_ARRAY );
|
||||
|
|
@ -678,29 +682,25 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
|||
/* Normals */
|
||||
if (nflag) {
|
||||
_mesa_EnableClientState( GL_NORMAL_ARRAY );
|
||||
glNormalPointer( GL_FLOAT, stride,
|
||||
(GLubyte*) pointer + noffset );
|
||||
_mesa_NormalPointer( GL_FLOAT, stride,
|
||||
(GLubyte*) pointer + noffset );
|
||||
}
|
||||
else {
|
||||
_mesa_DisableClientState( GL_NORMAL_ARRAY );
|
||||
}
|
||||
|
||||
_mesa_EnableClientState( GL_VERTEX_ARRAY );
|
||||
glVertexPointer( vcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + voffset );
|
||||
_mesa_VertexPointer( vcomps, GL_FLOAT, stride,
|
||||
(GLubyte *) pointer + voffset );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Transform the array components now, upto the setup call. When
|
||||
* actual draw commands arrive, the data will be merged prior to
|
||||
* calling render_vb.
|
||||
*/
|
||||
void
|
||||
_mesa_LockArraysEXT(GLint first, GLsizei count)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glLockArraysEXT" );
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glLockArrays %d %d\n", first, count);
|
||||
|
|
@ -715,6 +715,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count)
|
|||
}
|
||||
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= _NEW_ARRAY_ALL;
|
||||
|
||||
if (ctx->Driver.LockArraysEXT)
|
||||
ctx->Driver.LockArraysEXT( ctx, first, count );
|
||||
|
|
@ -725,7 +726,7 @@ void
|
|||
_mesa_UnlockArraysEXT( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glUnlockArraysEXT" );
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
fprintf(stderr, "glUnlockArrays\n");
|
||||
|
|
@ -733,6 +734,7 @@ _mesa_UnlockArraysEXT( void )
|
|||
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 );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_clip_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_clip_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -78,16 +78,16 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec,
|
|||
c++;
|
||||
tmpAndMask &= mask;
|
||||
tmpOrMask |= mask;
|
||||
vProj[i][0] = 0; /* no longer required? */
|
||||
vProj[i][0] = 0;
|
||||
vProj[i][1] = 0;
|
||||
vProj[i][2] = 0;
|
||||
vProj[i][3] = 1;
|
||||
} else {
|
||||
GLfloat oow = 1.0F / cw;
|
||||
vProj[i][3] = oow;
|
||||
vProj[i][0] = cx * oow;
|
||||
vProj[i][1] = cy * oow;
|
||||
vProj[i][2] = cz * oow;
|
||||
vProj[i][3] = oow;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec,
|
|||
*andMask = (GLubyte) (c < count ? 0 : tmpAndMask);
|
||||
|
||||
proj_vec->flags |= VEC_SIZE_4;
|
||||
proj_vec->size = 3;
|
||||
proj_vec->size = 4;
|
||||
proj_vec->count = clip_vec->count;
|
||||
return proj_vec;
|
||||
}
|
||||
|
|
@ -127,8 +127,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec,
|
|||
tmpAndMask &= mask;
|
||||
}
|
||||
|
||||
gl_vector4f_clean_elem(proj_vec, count, 3);
|
||||
|
||||
*orMask = tmpOrMask;
|
||||
*andMask = tmpAndMask;
|
||||
return clip_vec;
|
||||
|
|
@ -159,8 +157,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec,
|
|||
tmpAndMask &= mask;
|
||||
}
|
||||
|
||||
gl_vector4f_clean_elem(proj_vec, count, 3);
|
||||
|
||||
*orMask = tmpOrMask;
|
||||
*andMask = tmpAndMask;
|
||||
return clip_vec;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_copy_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_copy_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -51,24 +51,6 @@ static void TAG2(copy, BITS)(GLvector4f *to, const GLvector4f *f, \
|
|||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* static void TAG2(clean, BITS)(GLvector4f *to ) */
|
||||
/* { */
|
||||
/* GLfloat (*t)[4] = to->data; */
|
||||
/* GLuint i; */
|
||||
|
||||
/* if (BITS) */
|
||||
/* for (i = 0 ; i < VB_SIZE ; i++) { */
|
||||
/* if (BITS&1) t[i][0] = 0; */
|
||||
/* if (BITS&2) t[i][1] = 0; */
|
||||
/* if (BITS&4) t[i][2] = 0; */
|
||||
/* if (BITS&8) t[i][3] = 1; */
|
||||
/* } */
|
||||
/* to->flags &= ~BITS; */
|
||||
/* } */
|
||||
|
||||
|
||||
/* We got them all here:
|
||||
*/
|
||||
COPY_FUNC( 0x0 ) /* noop */
|
||||
|
|
@ -106,21 +88,4 @@ static void TAG2(init_copy, 0 ) ( void )
|
|||
gl_copy_tab[IDX][0xd] = TAG2(copy, 0xd);
|
||||
gl_copy_tab[IDX][0xe] = TAG2(copy, 0xe);
|
||||
gl_copy_tab[IDX][0xf] = TAG2(copy, 0xf);
|
||||
|
||||
/* gl_clean_tab[IDX][0x0] = TAG2(clean, 0x0); */
|
||||
/* gl_clean_tab[IDX][0x1] = TAG2(clean, 0x1); */
|
||||
/* gl_clean_tab[IDX][0x2] = TAG2(clean, 0x2); */
|
||||
/* gl_clean_tab[IDX][0x3] = TAG2(clean, 0x3); */
|
||||
/* gl_clean_tab[IDX][0x4] = TAG2(clean, 0x4); */
|
||||
/* gl_clean_tab[IDX][0x5] = TAG2(clean, 0x5); */
|
||||
/* gl_clean_tab[IDX][0x6] = TAG2(clean, 0x6); */
|
||||
/* gl_clean_tab[IDX][0x7] = TAG2(clean, 0x7); */
|
||||
/* gl_clean_tab[IDX][0x8] = TAG2(clean, 0x8); */
|
||||
/* gl_clean_tab[IDX][0x9] = TAG2(clean, 0x9); */
|
||||
/* gl_clean_tab[IDX][0xa] = TAG2(clean, 0xa); */
|
||||
/* gl_clean_tab[IDX][0xb] = TAG2(clean, 0xb); */
|
||||
/* gl_clean_tab[IDX][0xc] = TAG2(clean, 0xc); */
|
||||
/* gl_clean_tab[IDX][0xd] = TAG2(clean, 0xd); */
|
||||
/* gl_clean_tab[IDX][0xe] = TAG2(clean, 0xe); */
|
||||
/* gl_clean_tab[IDX][0xf] = TAG2(clean, 0xf); */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_dotprod_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_dotprod_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -31,18 +31,16 @@
|
|||
|
||||
/* Note - respects the stride of the output vector.
|
||||
*/
|
||||
static void TAG(dotprod_vec2)( GLvector4f *out_vec,
|
||||
GLuint elt,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
static void TAG(dotprod_vec2)( GLfloat *out,
|
||||
GLuint outstride,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
GLuint stride = coord_vec->stride;
|
||||
GLfloat *coord = coord_vec->start;
|
||||
GLuint count = coord_vec->count;
|
||||
|
||||
GLuint outstride = out_vec->stride;
|
||||
GLfloat *out = out_vec->start + elt;
|
||||
GLuint i;
|
||||
|
||||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3];
|
||||
|
|
@ -56,21 +54,18 @@ static void TAG(dotprod_vec2)( GLvector4f *out_vec,
|
|||
plane3);
|
||||
}
|
||||
}
|
||||
out_vec->count = coord_vec->count;
|
||||
}
|
||||
|
||||
static void TAG(dotprod_vec3)( GLvector4f *out_vec,
|
||||
GLuint elt,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
static void TAG(dotprod_vec3)( GLfloat *out,
|
||||
GLuint outstride,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
GLuint stride = coord_vec->stride;
|
||||
GLfloat *coord = coord_vec->start;
|
||||
GLuint count = coord_vec->count;
|
||||
|
||||
GLuint outstride = out_vec->stride;
|
||||
GLfloat *out = out_vec->start + elt;
|
||||
GLuint i;
|
||||
|
||||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
|
||||
|
|
@ -86,21 +81,17 @@ static void TAG(dotprod_vec3)( GLvector4f *out_vec,
|
|||
plane3);
|
||||
}
|
||||
}
|
||||
out_vec->count = coord_vec->count;
|
||||
}
|
||||
|
||||
static void TAG(dotprod_vec4)( GLvector4f *out_vec,
|
||||
GLuint elt,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
static void TAG(dotprod_vec4)( GLfloat *out,
|
||||
GLuint outstride,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[])
|
||||
{
|
||||
GLuint stride = coord_vec->stride;
|
||||
GLfloat *coord = coord_vec->start;
|
||||
GLuint count = coord_vec->count;
|
||||
|
||||
GLuint outstride = out_vec->stride;
|
||||
GLfloat *out = out_vec->start + elt;
|
||||
GLuint i;
|
||||
|
||||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
|
||||
|
|
@ -116,7 +107,6 @@ static void TAG(dotprod_vec4)( GLvector4f *out_vec,
|
|||
coord[3] * plane3);
|
||||
}
|
||||
}
|
||||
out_vec->count = coord_vec->count;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
501
src/mesa/math/m_eval.c
Normal file
501
src/mesa/math/m_eval.c
Normal file
|
|
@ -0,0 +1,501 @@
|
|||
/* $Id: m_eval.c,v 1.1 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
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[dim+k];
|
||||
|
||||
for(i=2, cp+=2*dim, powert=t*t; i<order; i++, powert*=t, cp +=dim)
|
||||
{
|
||||
bincoeff *= 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;
|
||||
GLuint j, k, bincoeff;
|
||||
|
||||
/* 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 = uorder-1;
|
||||
s = 1.0-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 *= 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.0-u, vs = 1.0-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.0 / i;
|
||||
}
|
||||
|
||||
79
src/mesa/math/m_eval.h
Normal file
79
src/mesa/math/m_eval.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
#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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_translate.c,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_translate.c,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -36,22 +36,67 @@
|
|||
|
||||
#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_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
|
||||
|
||||
trans_1f_func gl_trans_1f_tab[MAX_TYPES];
|
||||
trans_1ui_func gl_trans_1ui_tab[MAX_TYPES];
|
||||
trans_1ub_func gl_trans_1ub_tab[MAX_TYPES];
|
||||
trans_3f_func gl_trans_3f_tab[MAX_TYPES];
|
||||
trans_4ub_func gl_trans_4ub_tab[5][MAX_TYPES];
|
||||
trans_4f_func gl_trans_4f_tab[5][MAX_TYPES];
|
||||
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_4f_func _math_trans_4f_tab[5][MAX_TYPES];
|
||||
|
||||
|
||||
#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt])
|
||||
|
||||
|
||||
#define TAB(x) gl_trans##x##_tab
|
||||
#define TAB(x) _math_trans##x##_tab
|
||||
#define ARGS GLuint start, GLuint n
|
||||
#define SRC_START start
|
||||
#define DST_START 0
|
||||
|
|
@ -471,8 +516,73 @@ static void init_translate_raw(void)
|
|||
|
||||
|
||||
|
||||
void
|
||||
_math_init_translate( void )
|
||||
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_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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_translate.h,v 1.2 2000/11/17 21:01:49 brianp Exp $ */
|
||||
/* $Id: m_translate.h,v 1.3 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -31,66 +31,52 @@
|
|||
#include "config.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 );
|
||||
extern void _math_trans_1f(GLfloat *to,
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
GLenum type,
|
||||
GLuint start,
|
||||
GLuint n );
|
||||
|
||||
typedef void (*trans_1ub_func)(GLubyte *to,
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
GLuint start,
|
||||
GLuint n );
|
||||
extern void _math_trans_1ui(GLuint *to,
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
GLenum type,
|
||||
GLuint start,
|
||||
GLuint n );
|
||||
|
||||
typedef void (*trans_4ub_func)(GLubyte (*to)[4],
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
GLuint start,
|
||||
GLuint n );
|
||||
extern void _math_trans_1ub(GLubyte *to,
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
GLenum type,
|
||||
GLuint start,
|
||||
GLuint n );
|
||||
|
||||
typedef void (*trans_4f_func)(GLfloat (*to)[4],
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
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 );
|
||||
|
||||
typedef void (*trans_3f_func)(GLfloat (*to)[3],
|
||||
CONST void *ptr,
|
||||
GLuint stride,
|
||||
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 );
|
||||
|
||||
|
||||
|
||||
/* Translate GL_UNSIGNED_BYTE, etc to the indexes used in the arrays
|
||||
* below.
|
||||
*/
|
||||
#define TYPE_IDX(t) ((t) & 0xf)
|
||||
|
||||
#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
|
||||
|
||||
/* Only useful combinations are defined, thus there is no function to
|
||||
* translate eg, ubyte->float or ubyte->ubyte, which are never used.
|
||||
*/
|
||||
extern trans_1f_func gl_trans_1f_tab[MAX_TYPES];
|
||||
extern trans_1ui_func gl_trans_1ui_tab[MAX_TYPES];
|
||||
extern trans_1ub_func gl_trans_1ub_tab[MAX_TYPES];
|
||||
extern trans_3f_func gl_trans_3f_tab[MAX_TYPES];
|
||||
extern trans_4ub_func gl_trans_4ub_tab[5][MAX_TYPES];
|
||||
extern trans_4f_func gl_trans_4f_tab[5][MAX_TYPES];
|
||||
|
||||
|
||||
|
||||
extern void
|
||||
_math_init_translate( void );
|
||||
extern void _math_init_translate( void );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_vector.c,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_vector.c,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -85,7 +85,7 @@ void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] )
|
|||
v->data = storage;
|
||||
v->start = (GLfloat *) storage;
|
||||
v->count = 0;
|
||||
v->flags = size_bits[4] | flags | VEC_GOOD_STRIDE;
|
||||
v->flags = size_bits[4] | flags ;
|
||||
}
|
||||
|
||||
void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] )
|
||||
|
|
@ -94,7 +94,7 @@ void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] )
|
|||
v->data = storage;
|
||||
v->start = (GLfloat *) storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_GOOD_STRIDE;
|
||||
v->flags = flags ;
|
||||
}
|
||||
|
||||
void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage )
|
||||
|
|
@ -103,7 +103,7 @@ void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage )
|
|||
v->data = storage;
|
||||
v->start = (GLfloat *)storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_GOOD_STRIDE;
|
||||
v->flags = flags ;
|
||||
}
|
||||
|
||||
void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] )
|
||||
|
|
@ -112,7 +112,7 @@ void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] )
|
|||
v->data = storage;
|
||||
v->start = (GLubyte *) storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_GOOD_STRIDE;
|
||||
v->flags = flags ;
|
||||
}
|
||||
|
||||
void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage )
|
||||
|
|
@ -121,7 +121,7 @@ void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage )
|
|||
v->data = storage;
|
||||
v->start = (GLubyte *) storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_GOOD_STRIDE;
|
||||
v->flags = flags ;
|
||||
}
|
||||
|
||||
void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage )
|
||||
|
|
@ -130,7 +130,7 @@ void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage )
|
|||
v->data = storage;
|
||||
v->start = (GLuint *) storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_GOOD_STRIDE;
|
||||
v->flags = flags ;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ void gl_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count,
|
|||
v->start = (GLfloat *) v->storage;
|
||||
v->data = (GLfloat (*)[4]) v->storage;
|
||||
v->count = 0;
|
||||
v->flags = size_bits[4] | flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = size_bits[4] | flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count,
|
||||
|
|
@ -164,7 +164,7 @@ void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count,
|
|||
v->start = (GLfloat *) v->storage;
|
||||
v->data = (GLfloat (*)[3]) v->storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count,
|
||||
|
|
@ -175,7 +175,7 @@ void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count,
|
|||
ALIGN_MALLOC( count * sizeof(GLfloat), alignment );
|
||||
v->data = v->start;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
|
||||
|
|
@ -186,7 +186,7 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count,
|
|||
v->start = (GLubyte *) v->storage;
|
||||
v->data = (GLubyte (*)[4]) v->storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count,
|
||||
|
|
@ -197,7 +197,7 @@ void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count,
|
|||
v->start = (GLubyte *) v->storage;
|
||||
v->data = (GLubyte *) v->storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
|
||||
|
|
@ -208,7 +208,7 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count,
|
|||
v->start = (GLuint *) v->storage;
|
||||
v->data = (GLuint *) v->storage;
|
||||
v->count = 0;
|
||||
v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE;
|
||||
v->flags = flags | VEC_MALLOC ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_vector.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_vector.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -35,18 +35,13 @@
|
|||
#include "glheader.h"
|
||||
|
||||
|
||||
#define VEC_DIRTY_0 0x1 /* dirty flags not really used any more */
|
||||
#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_WRITABLE 0x20 /* keep both + and - bits for easy testing */
|
||||
#define VEC_NOT_WRITABLE 0x40
|
||||
#define VEC_GOOD_STRIDE 0x80
|
||||
#define VEC_BAD_STRIDE 0x100
|
||||
|
||||
#define VEC_WRITABLE_FLAGS (VEC_WRITABLE|VEC_NOT_WRITABLE)
|
||||
#define VEC_STRIDE_FLAGS (VEC_GOOD_STRIDE|VEC_BAD_STRIDE)
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_xform.c,v 1.4 2000/11/24 10:25:11 keithw Exp $ */
|
||||
/* $Id: m_xform.c,v 1.5 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
#include "macros.h"
|
||||
#include "mmath.h"
|
||||
|
||||
#include "m_eval.h"
|
||||
#include "m_matrix.h"
|
||||
#include "m_translate.h"
|
||||
#include "m_xform.h"
|
||||
|
|
@ -250,4 +251,5 @@ _math_init( void )
|
|||
_math_init_transformation();
|
||||
_math_init_translate();
|
||||
_math_init_vertices();
|
||||
_math_init_eval();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_xform.h,v 1.2 2000/11/17 21:01:49 brianp Exp $ */
|
||||
/* $Id: m_xform.h,v 1.3 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -75,8 +75,8 @@ do { \
|
|||
|
||||
|
||||
extern void gl_transform_vector( GLfloat u[4],
|
||||
const GLfloat v[4],
|
||||
const GLfloat m[16] );
|
||||
CONST GLfloat v[4],
|
||||
CONST GLfloat m[16] );
|
||||
|
||||
|
||||
extern void
|
||||
|
|
@ -132,37 +132,36 @@ _math_init_transformation( void );
|
|||
#define CLIP_NEAR_BIT 0x10
|
||||
#define CLIP_FAR_BIT 0x20
|
||||
#define CLIP_USER_BIT 0x40
|
||||
#define CLIP_CULLED_BIT 0x80 /* Vertex has been culled */
|
||||
#define CLIP_ALL_BITS 0x3f
|
||||
|
||||
|
||||
typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip,
|
||||
GLvector4f *vProj,
|
||||
GLubyte clipMask[],
|
||||
GLubyte *orMask,
|
||||
GLubyte *andMask );
|
||||
GLvector4f *vProj,
|
||||
GLubyte clipMask[],
|
||||
GLubyte *orMask,
|
||||
GLubyte *andMask );
|
||||
|
||||
typedef void (*dotprod_func)( GLvector4f *out_vec,
|
||||
GLuint elt,
|
||||
const GLvector4f *coord_vec,
|
||||
const GLfloat plane[4],
|
||||
const GLubyte mask[]);
|
||||
typedef void (*dotprod_func)( GLfloat *out,
|
||||
GLuint out_stride,
|
||||
CONST GLvector4f *coord_vec,
|
||||
CONST GLfloat plane[4],
|
||||
CONST GLubyte mask[]);
|
||||
|
||||
typedef void (*vec_copy_func)( GLvector4f *to,
|
||||
const GLvector4f *from,
|
||||
const GLubyte mask[]);
|
||||
CONST GLvector4f *from,
|
||||
CONST GLubyte mask[]);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Functions for transformation of normals in the VB.
|
||||
*/
|
||||
typedef void (_NORMAPIP normal_func)( const GLmatrix *mat,
|
||||
GLfloat scale,
|
||||
const GLvector3f *in,
|
||||
const GLfloat lengths[],
|
||||
const GLubyte mask[],
|
||||
GLvector3f *dest );
|
||||
typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat,
|
||||
GLfloat scale,
|
||||
CONST GLvector3f *in,
|
||||
CONST GLfloat lengths[],
|
||||
CONST GLubyte mask[],
|
||||
GLvector3f *dest );
|
||||
|
||||
|
||||
/* Flags for selecting a normal transformation function.
|
||||
|
|
@ -181,26 +180,27 @@ typedef void (_NORMAPIP normal_func)( const GLmatrix *mat,
|
|||
* parameter, to allow a unified interface.
|
||||
*/
|
||||
typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec,
|
||||
const GLfloat m[16],
|
||||
const GLvector4f *from_vec,
|
||||
const GLubyte *clipmask,
|
||||
const GLubyte flag );
|
||||
CONST GLfloat m[16],
|
||||
CONST GLvector4f *from_vec,
|
||||
CONST GLubyte *clipmask,
|
||||
CONST GLubyte flag );
|
||||
|
||||
|
||||
extern GLvector4f *gl_project_points( GLvector4f *to,
|
||||
const GLvector4f *from );
|
||||
CONST GLvector4f *from );
|
||||
|
||||
extern void gl_transform_bounds3( GLubyte *orMask, GLubyte *andMask,
|
||||
const GLfloat m[16],
|
||||
CONST GLfloat src[][3] );
|
||||
CONST GLfloat m[16],
|
||||
CONST GLfloat src[][3] );
|
||||
|
||||
extern void gl_transform_bounds2( GLubyte *orMask, GLubyte *andMask,
|
||||
const GLfloat m[16],
|
||||
CONST GLfloat src[][3] );
|
||||
CONST GLfloat m[16],
|
||||
CONST GLfloat src[][3] );
|
||||
|
||||
|
||||
extern dotprod_func gl_dotprod_tab[2][5];
|
||||
extern vec_copy_func gl_copy_tab[2][0x10];
|
||||
extern vec_copy_func gl_copy_clean_tab[2][5];
|
||||
extern clip_func gl_clip_tab[5];
|
||||
extern normal_func gl_normal_tab[0xf][0x4];
|
||||
|
||||
|
|
@ -210,17 +210,13 @@ extern normal_func gl_normal_tab[0xf][0x4];
|
|||
extern transform_func **(gl_transform_tab[2]);
|
||||
|
||||
|
||||
extern void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16],
|
||||
const GLfloat P[4], GLuint sz );
|
||||
extern void gl_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16],
|
||||
CONST GLfloat P[4], GLuint sz );
|
||||
|
||||
|
||||
#define TransformRaw( to, mat, from ) \
|
||||
( (*gl_transform_tab[0][(from)->size][(mat)->type])( to, (mat)->m, from, 0, 0 ), \
|
||||
(to) )
|
||||
|
||||
#define Transform( to, mat, from, mask, cull ) \
|
||||
( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, (mat)->m, from, mask, cull ), \
|
||||
(to) )
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: m_xform_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
|
||||
/* $Id: m_xform_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -457,10 +457,7 @@ TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
|
|||
to_vec->count = from_vec->count;
|
||||
}
|
||||
|
||||
/* This may not be called too often, but I wouldn't say it was dead
|
||||
* code. It's also hard to remove any of these functions if you are
|
||||
* attached to the assertions that have appeared in them.
|
||||
*/
|
||||
|
||||
static void _XFORMAPI
|
||||
TAG(transform_points2_perspective)( GLvector4f *to_vec,
|
||||
const GLfloat m[16],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_context.c,v 1.7 2000/12/09 22:09:50 brianp Exp $ */
|
||||
/* $Id: s_context.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -309,7 +309,7 @@ _swrast_invalidate_state( GLcontext *ctx, GLuint new_state )
|
|||
swrast->BlendFunc = _swrast_validate_blend_func;
|
||||
|
||||
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
|
||||
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
|
||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
|
||||
swrast->TextureSample[i] = _swrast_validate_texture_sample;
|
||||
}
|
||||
|
||||
|
|
@ -326,8 +326,8 @@ _swrast_validate_derived( GLcontext *ctx )
|
|||
_swrast_update_rasterflags( ctx );
|
||||
|
||||
if (swrast->NewState & _NEW_TEXTURE)
|
||||
swrast->_MultiTextureEnabled =
|
||||
(ctx->Texture._ReallyEnabled > ENABLE_TEX0);
|
||||
swrast->_MultiTextureEnabled = (ctx->Texture._ReallyEnabled &
|
||||
~TEXTURE0_ANY);
|
||||
|
||||
if (swrast->NewState & _NEW_POLYGON)
|
||||
_swrast_update_polygon( ctx );
|
||||
|
|
@ -357,6 +357,10 @@ void
|
|||
_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
|
||||
const SWvertex *v1, const SWvertex *v2 )
|
||||
{
|
||||
/* fprintf(stderr, "%s\n", __FUNCTION__); */
|
||||
/* _swrast_print_vertex( ctx, v0 ); */
|
||||
/* _swrast_print_vertex( ctx, v1 ); */
|
||||
/* _swrast_print_vertex( ctx, v2 ); */
|
||||
SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
|
||||
}
|
||||
|
||||
|
|
@ -385,6 +389,12 @@ _swrast_get_stipple_counter_ref( GLcontext *ctx )
|
|||
return &SWRAST_CONTEXT(ctx)->StippleCounter;
|
||||
}
|
||||
|
||||
void
|
||||
_swrast_ResetLineStipple( GLcontext *ctx )
|
||||
{
|
||||
SWRAST_CONTEXT(ctx)->StippleCounter = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
|
||||
{
|
||||
|
|
@ -459,3 +469,26 @@ _swrast_DestroyContext( GLcontext *ctx )
|
|||
ctx->swrast_context = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
|
||||
{
|
||||
GLuint i;
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
fprintf(stderr, "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++)
|
||||
fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i,
|
||||
v->texcoord[i][0], v->texcoord[i][1],
|
||||
v->texcoord[i][2], v->texcoord[i][3]);
|
||||
|
||||
fprintf(stderr, "color %d %d %d %d\n",
|
||||
v->color[0], v->color[1], v->color[2], v->color[3]);
|
||||
fprintf(stderr, "spec %d %d %d %d\n",
|
||||
v->specular[0], v->specular[1], v->specular[2], v->specular[3]);
|
||||
fprintf(stderr, "fog %f\n", v->fog);
|
||||
fprintf(stderr, "index %d\n", v->index);
|
||||
fprintf(stderr, "pointsize %f\n", v->pointSize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_copypix.c,v 1.7 2000/11/28 22:34:46 brianp Exp $ */
|
||||
/* $Id: s_copypix.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -244,7 +244,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
_mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
|
||||
s, t, r, q);
|
||||
gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
|
||||
|
|
@ -490,7 +490,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||
|
||||
MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
|
||||
|
||||
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
|
||||
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
|
||||
_mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
|
||||
s, t, r, q);
|
||||
gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: s_drawpix.c,v 1.4 2000/11/13 20:02:57 keithw Exp $ */
|
||||
/* $Id: s_drawpix.c,v 1.5 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -104,10 +104,6 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||
GLchan rgb[MAX_WIDTH][3];
|
||||
GLchan rgba[MAX_WIDTH][4];
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glDrawPixels",
|
||||
GL_FALSE);
|
||||
|
||||
|
||||
if (!ctx->Current.RasterPosValid) {
|
||||
return GL_TRUE; /* no-op */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ _swrast_Accum( GLcontext *ctx, GLenum op,
|
|||
extern GLuint *
|
||||
_swrast_get_stipple_counter_ref( GLcontext *ctx );
|
||||
|
||||
/* Reset the stipple pointer via a function call
|
||||
*/
|
||||
extern void
|
||||
_swrast_ResetLineStipple( GLcontext *ctx );
|
||||
|
||||
/* These will always render the correct point/line/triangle for the
|
||||
* current state.
|
||||
|
|
@ -160,4 +164,7 @@ _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
|
|||
extern void
|
||||
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
|
||||
|
||||
extern void
|
||||
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ss_context.c,v 1.4 2000/11/16 21:05:42 keithw Exp $ */
|
||||
/* $Id: ss_context.c,v 1.5 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -77,20 +77,19 @@ _swsetup_validate_points( GLcontext *ctx, GLuint first, GLuint last )
|
|||
|
||||
|
||||
static void
|
||||
_swsetup_validate_rastersetup( struct vertex_buffer *VB,
|
||||
GLuint start, GLuint end )
|
||||
_swsetup_validate_buildprojverts( GLcontext *ctx,
|
||||
GLuint start, GLuint end, GLuint new_inputs )
|
||||
{
|
||||
GLcontext *ctx = VB->ctx;
|
||||
_swsetup_choose_rastersetup_func( ctx );
|
||||
SWSETUP_CONTEXT(ctx)->RasterSetup( VB, start, end );
|
||||
SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs );
|
||||
}
|
||||
|
||||
|
||||
#define _SWSETUP_NEW_RASTERSETUP (_NEW_RENDERMODE| \
|
||||
_NEW_TEXTURE| \
|
||||
_NEW_COLOR| \
|
||||
_NEW_FOG| \
|
||||
_NEW_POINT)
|
||||
#define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \
|
||||
_NEW_TEXTURE| \
|
||||
_NEW_COLOR| \
|
||||
_NEW_FOG| \
|
||||
_NEW_POINT)
|
||||
|
||||
#define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT)
|
||||
|
||||
|
|
@ -118,8 +117,8 @@ _swsetup_invalidate_state( GLcontext *ctx, GLuint new_state )
|
|||
swsetup->Quad = _swsetup_validate_quad;
|
||||
}
|
||||
|
||||
if (new_state & _SWSETUP_NEW_RASTERSETUP) {
|
||||
swsetup->RasterSetup = _swsetup_validate_rastersetup;
|
||||
if (new_state & _SWSETUP_NEW_VERTS) {
|
||||
swsetup->BuildProjVerts = _swsetup_validate_buildprojverts;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -156,9 +155,10 @@ _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last )
|
|||
}
|
||||
|
||||
void
|
||||
_swsetup_RasterSetup( struct vertex_buffer *VB, GLuint start, GLuint end )
|
||||
_swsetup_BuildProjectedVertices( GLcontext *ctx, GLuint start, GLuint end,
|
||||
GLuint new_inputs )
|
||||
{
|
||||
SWSETUP_CONTEXT(VB->ctx)->RasterSetup( VB, start, end );
|
||||
SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -171,11 +171,18 @@ _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state )
|
|||
GLboolean
|
||||
_swsetup_CreateContext( GLcontext *ctx )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
|
||||
|
||||
|
||||
if (!swsetup)
|
||||
return GL_FALSE;
|
||||
|
||||
swsetup->verts = ALIGN_MALLOC( sizeof(SWvertex) * tnl->vb.Size, 32);
|
||||
if (!swsetup->verts) {
|
||||
FREE(swsetup);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ctx->swsetup_context = swsetup;
|
||||
|
||||
swsetup->NewState = ~0;
|
||||
|
|
@ -184,11 +191,11 @@ _swsetup_CreateContext( GLcontext *ctx )
|
|||
swsetup->Triangle = _swsetup_validate_triangle;
|
||||
swsetup->Line = _swsetup_validate_line;
|
||||
swsetup->Points = _swsetup_validate_points;
|
||||
swsetup->RasterSetup = _swsetup_validate_rastersetup;
|
||||
swsetup->BuildProjVerts = _swsetup_validate_buildprojverts;
|
||||
|
||||
_swsetup_vb_init( ctx );
|
||||
_swsetup_trifuncs_init( ctx );
|
||||
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -196,35 +203,12 @@ void
|
|||
_swsetup_DestroyContext( GLcontext *ctx )
|
||||
{
|
||||
if (SWSETUP_CONTEXT(ctx)) {
|
||||
if (SWSETUP_CONTEXT(ctx)->verts)
|
||||
ALIGN_FREE(SWSETUP_CONTEXT(ctx)->verts);
|
||||
|
||||
FREE(SWSETUP_CONTEXT(ctx));
|
||||
ctx->swsetup_context = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_swsetup_RegisterVB( struct vertex_buffer *VB )
|
||||
{
|
||||
SSvertexbuffer *ssvb = (SSvertexbuffer *)CALLOC(sizeof(SSvertexbuffer) );
|
||||
|
||||
ssvb->verts = ALIGN_MALLOC( sizeof(SWvertex) * VB->Size, 32);
|
||||
if (!ssvb->verts) {
|
||||
FREE(ssvb);
|
||||
/*return GL_FALSE;*/
|
||||
}
|
||||
|
||||
VB->swsetup_vb = ssvb;
|
||||
/*return GL_TRUE;*/
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_swsetup_UnregisterVB( struct vertex_buffer *VB )
|
||||
{
|
||||
SSvertexbuffer *ssvb = SWSETUP_VB(VB);
|
||||
|
||||
if (ssvb) {
|
||||
if (ssvb->verts) ALIGN_FREE(ssvb->verts);
|
||||
FREE(ssvb);
|
||||
VB->swsetup_vb = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ typedef struct {
|
|||
*/
|
||||
void (*InvalidateState)( GLcontext *ctx, GLuint new_state );
|
||||
|
||||
void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end );
|
||||
void (*BuildProjVerts)( GLcontext *ctx,
|
||||
GLuint start, GLuint end, GLuint new_inputs );
|
||||
|
||||
void (*Quad)( GLcontext *ctx, GLuint v0, GLuint v1,
|
||||
GLuint v2, GLuint v3, GLuint pv );
|
||||
|
|
@ -52,17 +53,10 @@ typedef struct {
|
|||
|
||||
void (*Points)( GLcontext *ctx, GLuint first, GLuint last );
|
||||
|
||||
} SScontext;
|
||||
|
||||
typedef struct {
|
||||
|
||||
SWvertex *verts;
|
||||
|
||||
} SSvertexbuffer;
|
||||
|
||||
} SScontext;
|
||||
|
||||
#define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context)
|
||||
#define SWSETUP_VB(VB) ((SSvertexbuffer *)VB->swsetup_vb)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,16 +34,15 @@
|
|||
#include "ss_triangle.h"
|
||||
#include "ss_context.h"
|
||||
|
||||
#define SS_FLAT_BIT 0x1
|
||||
#define SS_FLAT_BIT 0x1
|
||||
#define SS_OFFSET_BIT 0x2
|
||||
#define SS_TWOSIDE_BIT 0x4
|
||||
#define SS_UNFILLED_BIT 0x10
|
||||
#define SS_COPY_EXTRAS 0x20 /* optimization */
|
||||
#define SS_MAX_TRIFUNC 0x40
|
||||
#define SS_RGBA_BIT 0x20
|
||||
#define SS_MAX_TRIFUNC 0x80
|
||||
|
||||
static triangle_func tri_tab[SS_MAX_TRIFUNC];
|
||||
static line_func line_tab[SS_MAX_TRIFUNC];
|
||||
static points_func points_tab[SS_MAX_TRIFUNC];
|
||||
static quad_func quad_tab[SS_MAX_TRIFUNC];
|
||||
|
||||
|
||||
|
|
@ -115,68 +114,68 @@ static quad_func quad_tab[SS_MAX_TRIFUNC];
|
|||
#define TAG(x) x##_flat_offset_twoside_unfilled
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (0|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_spec
|
||||
#define IND (0|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_FLAT_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_spec
|
||||
#define IND (SS_FLAT_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_OFFSET_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_offset_spec
|
||||
#define IND (SS_OFFSET_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_offset_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_offset_spec
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_offset_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_twoside_spec
|
||||
#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_twoside_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_twoside_spec
|
||||
#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_twoside_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_offset_twoside_spec
|
||||
#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_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_offset_twoside_spec
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_offset_twoside_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_unfilled_spec
|
||||
#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_unfilled_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_unfilled_spec
|
||||
#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_unfilled_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_offset_unfilled_spec
|
||||
#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_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_offset_unfilled_spec
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_offset_unfilled_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_twoside_unfilled_spec
|
||||
#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_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_twoside_unfilled_spec
|
||||
#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_twoside_unfilled_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_offset_twoside_unfilled_spec
|
||||
#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"
|
||||
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS)
|
||||
#define TAG(x) x##_flat_offset_twoside_unfilled_spec
|
||||
#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
|
||||
#define TAG(x) x##_flat_offset_twoside_unfilled_rgba
|
||||
#include "ss_tritmp.h"
|
||||
|
||||
|
||||
|
|
@ -201,25 +200,42 @@ void _swsetup_trifuncs_init( GLcontext *ctx )
|
|||
init_offset_twoside_unfilled();
|
||||
init_flat_offset_twoside_unfilled();
|
||||
|
||||
init_spec();
|
||||
init_flat_spec();
|
||||
init_offset_spec();
|
||||
init_flat_offset_spec();
|
||||
init_twoside_spec();
|
||||
init_flat_twoside_spec();
|
||||
init_offset_twoside_spec();
|
||||
init_flat_offset_twoside_spec();
|
||||
init_unfilled_spec();
|
||||
init_flat_unfilled_spec();
|
||||
init_offset_unfilled_spec();
|
||||
init_flat_offset_unfilled_spec();
|
||||
init_twoside_unfilled_spec();
|
||||
init_flat_twoside_unfilled_spec();
|
||||
init_offset_twoside_unfilled_spec();
|
||||
init_flat_offset_twoside_unfilled_spec();
|
||||
init_rgba();
|
||||
init_flat_rgba();
|
||||
init_offset_rgba();
|
||||
init_flat_offset_rgba();
|
||||
init_twoside_rgba();
|
||||
init_flat_twoside_rgba();
|
||||
init_offset_twoside_rgba();
|
||||
init_flat_offset_twoside_rgba();
|
||||
init_unfilled_rgba();
|
||||
init_flat_unfilled_rgba();
|
||||
init_offset_unfilled_rgba();
|
||||
init_flat_offset_unfilled_rgba();
|
||||
init_twoside_unfilled_rgba();
|
||||
init_flat_twoside_unfilled_rgba();
|
||||
init_offset_twoside_unfilled_rgba();
|
||||
init_flat_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;
|
||||
int 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] );
|
||||
}
|
||||
}
|
||||
|
||||
void _swsetup_choose_trifuncs( GLcontext *ctx )
|
||||
{
|
||||
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
|
||||
|
|
@ -234,17 +250,15 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
|
|||
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
|
||||
ind |= SS_TWOSIDE_BIT;
|
||||
|
||||
if (ctx->Polygon._Unfilled)
|
||||
if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
|
||||
ind |= SS_UNFILLED_BIT;
|
||||
|
||||
if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) ||
|
||||
ctx->RenderMode == GL_SELECT ||
|
||||
!ctx->Visual.RGBAflag)
|
||||
ind |= SS_COPY_EXTRAS;
|
||||
if (ctx->Visual.RGBAflag)
|
||||
ind |= SS_RGBA_BIT;
|
||||
|
||||
swsetup->Triangle = tri_tab[ind];
|
||||
swsetup->Line = line_tab[ind];
|
||||
swsetup->Points = points_tab[ind];
|
||||
swsetup->Quad = quad_tab[ind];
|
||||
swsetup->Points = swsetup_points;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
GLuint e0, GLuint e1, GLuint e2,
|
||||
GLuint pv)
|
||||
{
|
||||
struct vertex_buffer *VB = TNL_VB(ctx);
|
||||
SWvertex *verts = SWSETUP_VB(VB)->verts;
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
|
||||
SWvertex *v[3];
|
||||
GLfloat offset;
|
||||
GLfloat z[3];
|
||||
|
|
@ -44,22 +44,22 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
v[2] = &verts[e2];
|
||||
|
||||
if (IND & (SS_TWOSIDE_BIT | SS_FLAT_BIT)) {
|
||||
SS_COLOR(c[0], v[0]->color);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_COLOR(c[1], v[1]->color);
|
||||
SS_COLOR(c[2], v[2]->color);
|
||||
}
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
SS_COLOR(c[0], v[0]->color);
|
||||
SS_SPEC(s[0], v[0]->specular);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_COLOR(c[1], v[1]->color);
|
||||
SS_COLOR(c[2], v[2]->color);
|
||||
|
||||
SS_SPEC(s[1], v[1]->specular);
|
||||
SS_SPEC(s[2], v[2]->specular);
|
||||
}
|
||||
} else {
|
||||
SS_IND(i[0], v[0]->index);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_SPEC(s[1], v[1]->specular);
|
||||
SS_IND(i[1], v[1]->index);
|
||||
|
||||
SS_SPEC(s[2], v[2]->specular);
|
||||
SS_IND(i[2], v[2]->index);
|
||||
}
|
||||
}
|
||||
|
|
@ -75,39 +75,45 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
|
||||
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
|
||||
{
|
||||
GLuint facing = (cc < 0.0) ^ ctx->Polygon.FrontBit;
|
||||
GLuint facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
|
||||
|
||||
if (IND & SS_UNFILLED_BIT)
|
||||
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
GLubyte (*vbcolor)[4] = VB->Color[facing]->data;
|
||||
GLubyte (*vbspec)[4] = VB->SecondaryColor[facing]->data;
|
||||
GLuint *vbindex = VB->Index[facing]->data;
|
||||
|
||||
if (IND & SS_FLAT_BIT) {
|
||||
SS_COLOR(v[0]->color, vbcolor[pv]);
|
||||
SS_COLOR(v[1]->color, vbcolor[pv]);
|
||||
SS_COLOR(v[2]->color, vbcolor[pv]);
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
|
||||
GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
|
||||
|
||||
SS_COLOR(v[0]->color, vbcolor[pv]);
|
||||
SS_COLOR(v[1]->color, vbcolor[pv]);
|
||||
SS_COLOR(v[2]->color, vbcolor[pv]);
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
SS_SPEC(v[0]->specular, vbspec[pv]);
|
||||
SS_SPEC(v[1]->specular, vbspec[pv]);
|
||||
SS_SPEC(v[2]->specular, vbspec[pv]);
|
||||
|
||||
} else {
|
||||
GLuint *vbindex = VB->IndexPtr[facing]->data;
|
||||
|
||||
SS_IND(v[0]->index, vbindex[pv]);
|
||||
SS_IND(v[1]->index, vbindex[pv]);
|
||||
SS_IND(v[2]->index, vbindex[pv]);
|
||||
}
|
||||
} else {
|
||||
SS_COLOR(v[0]->color, vbcolor[e0]);
|
||||
SS_COLOR(v[1]->color, vbcolor[e1]);
|
||||
SS_COLOR(v[2]->color, vbcolor[e2]);
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
|
||||
GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
|
||||
|
||||
SS_COLOR(v[0]->color, vbcolor[e0]);
|
||||
SS_COLOR(v[1]->color, vbcolor[e1]);
|
||||
SS_COLOR(v[2]->color, vbcolor[e2]);
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
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[facing]->data;
|
||||
|
||||
SS_IND(v[0]->index, vbindex[e0]);
|
||||
SS_IND(v[1]->index, vbindex[e1]);
|
||||
|
|
@ -139,14 +145,15 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
}
|
||||
else if (IND & SS_FLAT_BIT)
|
||||
{
|
||||
GLubyte *color = VB->Color[0]->data[pv];
|
||||
GLubyte *spec = VB->SecondaryColor[0]->data[pv];
|
||||
GLuint index = VB->Index[0]->data[pv];
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
GLubyte *color = VB->ColorPtr[0]->data[pv];
|
||||
GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
|
||||
|
||||
SS_COLOR(v[0]->color, color);
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
SS_COLOR(v[0]->color, color);
|
||||
SS_SPEC(v[0]->specular, spec);
|
||||
}
|
||||
else {
|
||||
GLuint index = VB->IndexPtr[0]->data[pv];
|
||||
SS_IND(v[0]->index, index);
|
||||
}
|
||||
}
|
||||
|
|
@ -158,9 +165,9 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
v[1]->win[2] += offset;
|
||||
v[2]->win[2] += offset;
|
||||
}
|
||||
if (ef[e0]&0x1) { ef[e0] &= ~0x1; _swrast_Point( ctx, v[0] ); }
|
||||
if (ef[e1]&0x1) { ef[e1] &= ~0x1; _swrast_Point( ctx, v[1] ); }
|
||||
if (ef[e2]&0x2) { ef[e2] &= ~0x2; _swrast_Point( ctx, v[2] ); }
|
||||
if (ef[e0]) _swrast_Point( ctx, v[0] );
|
||||
if (ef[e1]) _swrast_Point( ctx, v[1] );
|
||||
if (ef[e2]) _swrast_Point( ctx, v[2] );
|
||||
} else if (mode == GL_LINE) {
|
||||
GLubyte *ef = VB->EdgeFlagPtr->data;
|
||||
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
|
||||
|
|
@ -168,9 +175,9 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
v[1]->win[2] += offset;
|
||||
v[2]->win[2] += offset;
|
||||
}
|
||||
if (ef[e0]&0x1) { ef[e0] &= ~0x1; _swrast_Line( ctx, v[0], v[1] ); }
|
||||
if (ef[e1]&0x1) { ef[e1] &= ~0x1; _swrast_Line( ctx, v[1], v[2] ); }
|
||||
if (ef[e2]&0x2) { ef[e2] &= ~0x2; _swrast_Line( ctx, v[2], v[0] ); }
|
||||
if (ef[e0]) _swrast_Line( ctx, v[0], v[1] );
|
||||
if (ef[e1]) _swrast_Line( ctx, v[1], v[2] );
|
||||
if (ef[e2]) _swrast_Line( ctx, v[2], v[0] );
|
||||
} else {
|
||||
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) {
|
||||
v[0]->win[2] += offset;
|
||||
|
|
@ -187,22 +194,22 @@ static void TAG(triangle)(GLcontext *ctx,
|
|||
}
|
||||
|
||||
if (IND & (SS_FLAT_BIT | SS_TWOSIDE_BIT)) {
|
||||
SS_COLOR(v[0]->color, c[0]);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_COLOR(v[1]->color, c[1]);
|
||||
SS_COLOR(v[2]->color, c[2]);
|
||||
}
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
SS_COLOR(v[0]->color, c[0]);
|
||||
SS_SPEC(v[0]->specular, s[0]);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_COLOR(v[1]->color, c[1]);
|
||||
SS_COLOR(v[2]->color, c[2]);
|
||||
SS_SPEC(v[1]->specular, s[1]);
|
||||
SS_SPEC(v[2]->specular, s[2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SS_IND(v[0]->index, i[0]);
|
||||
|
||||
if (IND & SS_TWOSIDE_BIT) {
|
||||
SS_SPEC(v[1]->specular, s[1]);
|
||||
SS_IND(v[1]->index, i[1]);
|
||||
|
||||
SS_SPEC(v[2]->specular, s[2]);
|
||||
SS_IND(v[2]->index, i[2]);
|
||||
}
|
||||
}
|
||||
|
|
@ -217,15 +224,27 @@ static void TAG(quad)( GLcontext *ctx, GLuint v0,
|
|||
GLuint v1, GLuint v2, GLuint v3,
|
||||
GLuint pv )
|
||||
{
|
||||
TAG(triangle)( ctx, v0, v1, v3, pv );
|
||||
TAG(triangle)( ctx, v1, v2, v3, pv );
|
||||
if (IND & SS_UNFILLED_BIT) {
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
GLubyte ef1 = VB->EdgeFlagPtr->data[v1];
|
||||
GLubyte ef3 = VB->EdgeFlagPtr->data[v3];
|
||||
VB->EdgeFlagPtr->data[v1] = 0;
|
||||
TAG(triangle)( ctx, v0, v1, v3, pv );
|
||||
VB->EdgeFlagPtr->data[v1] = ef1;
|
||||
VB->EdgeFlagPtr->data[v3] = 0;
|
||||
TAG(triangle)( ctx, v1, v2, v3, pv );
|
||||
VB->EdgeFlagPtr->data[v3] = ef3;
|
||||
} else {
|
||||
TAG(triangle)( ctx, v0, v1, v3, pv );
|
||||
TAG(triangle)( ctx, v1, v2, v3, pv );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
|
||||
{
|
||||
struct vertex_buffer *VB = TNL_VB(ctx);
|
||||
SWvertex *verts = SWSETUP_VB(VB)->verts;
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
|
||||
GLubyte c[2][4], s[2][4];
|
||||
GLuint i[2];
|
||||
SWvertex *vert0 = &verts[v0];
|
||||
|
|
@ -233,16 +252,18 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
|
|||
|
||||
|
||||
if (IND & SS_FLAT_BIT) {
|
||||
GLubyte *color = VB->Color[0]->data[pv];
|
||||
GLubyte *spec = VB->SecondaryColor[0]->data[pv];
|
||||
GLuint index = VB->Index[0]->data[pv];
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
GLubyte *color = VB->ColorPtr[0]->data[pv];
|
||||
GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
|
||||
|
||||
SS_COLOR(c[0], vert0->color);
|
||||
SS_COLOR(vert0->color, color);
|
||||
SS_COLOR(c[0], vert0->color);
|
||||
SS_COLOR(vert0->color, color);
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
SS_SPEC(s[0], vert0->specular);
|
||||
SS_SPEC(vert0->specular, spec);
|
||||
}
|
||||
else {
|
||||
GLuint index = VB->IndexPtr[0]->data[pv];
|
||||
|
||||
SS_IND(i[0], vert0->index);
|
||||
SS_IND(vert0->index, index);
|
||||
|
|
@ -252,36 +273,23 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
|
|||
_swrast_Line( ctx, vert0, vert1 );
|
||||
|
||||
if (IND & SS_FLAT_BIT) {
|
||||
SS_COLOR(vert0->color, c[0]);
|
||||
|
||||
if (IND & SS_COPY_EXTRAS) {
|
||||
if (IND & SS_RGBA_BIT) {
|
||||
SS_COLOR(vert0->color, c[0]);
|
||||
SS_SPEC(vert0->specular, s[0]);
|
||||
}
|
||||
else {
|
||||
SS_IND(vert0->index, i[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
|
||||
{
|
||||
struct vertex_buffer *VB = TNL_VB(ctx);
|
||||
SWvertex *verts = SWSETUP_VB(VB)->verts;
|
||||
int i;
|
||||
|
||||
for(i=first;i<=last;i++)
|
||||
if(VB->ClipMask[i]==0)
|
||||
_swrast_Point( ctx, &verts[i] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void TAG(init)( void )
|
||||
{
|
||||
tri_tab[IND] = TAG(triangle);
|
||||
quad_tab[IND] = TAG(quad);
|
||||
line_tab[IND] = TAG(line);
|
||||
points_tab[IND] = TAG(points);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "swrast/swrast.h"
|
||||
|
||||
#include "tnl/t_context.h"
|
||||
#include "tnl/t_stages.h"
|
||||
|
||||
#include "math/m_vector.h"
|
||||
#include "ss_context.h"
|
||||
|
|
@ -44,8 +43,8 @@
|
|||
* in this module, but not the rest of the swrast module.
|
||||
*/
|
||||
|
||||
typedef void (*SetupFunc)( struct vertex_buffer *VB,
|
||||
GLuint start, GLuint end );
|
||||
typedef void (*SetupFunc)( GLcontext *ctx,
|
||||
GLuint start, GLuint end, GLuint newinputs );
|
||||
|
||||
#define COLOR 0x1
|
||||
#define INDEX 0x2
|
||||
|
|
@ -59,47 +58,145 @@ typedef void (*SetupFunc)( struct vertex_buffer *VB,
|
|||
static SetupFunc setup_func[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 (TEX0|COLOR)
|
||||
#define TAG(x) x##_tex0_color
|
||||
#define IND (INDEX|TEX0)
|
||||
#define TAG(x) x##_index_tex0
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (TEX0|COLOR|SPEC)
|
||||
#define TAG(x) x##_tex0_color_spec
|
||||
#define IND (INDEX|FOG)
|
||||
#define TAG(x) x##_index_fog
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (TEX0|COLOR|SPEC|FOG)
|
||||
#define TAG(x) x##_tex0_color_spec_fog
|
||||
#define IND (INDEX|TEX0|FOG)
|
||||
#define TAG(x) x##_index_tex0_fog
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (MULTITEX|COLOR)
|
||||
#define TAG(x) x##_multitex_color
|
||||
#define IND (INDEX|POINT)
|
||||
#define TAG(x) x##_index_point
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (MULTITEX|COLOR|SPEC|FOG)
|
||||
#define TAG(x) x##_multitex_color_spec_fog
|
||||
#define IND (INDEX|TEX0|POINT)
|
||||
#define TAG(x) x##_index_tex0_point
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (TEX0|COLOR|POINT)
|
||||
#define TAG(x) x##_tex0_color_point
|
||||
#define IND (INDEX|FOG|POINT)
|
||||
#define TAG(x) x##_index_fog_point
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (MULTITEX|COLOR|SPEC|INDEX|POINT|FOG)
|
||||
#define TAG(x) x##_multitex_color_spec_index_point_fog
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
#define IND (COLOR|INDEX|TEX0)
|
||||
#define TAG(x) x##_selection_feedback
|
||||
#define IND (INDEX|TEX0|FOG|POINT)
|
||||
#define TAG(x) x##_index_tex0_fog_point
|
||||
#include "ss_vbtmp.h"
|
||||
|
||||
|
||||
static void
|
||||
rs_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
|
||||
{
|
||||
fprintf(stderr, "swrast_setup: invalid setup function\n");
|
||||
(void) (ctx && start && end && newinputs);
|
||||
}
|
||||
|
||||
void
|
||||
_swsetup_vb_init( GLcontext *ctx )
|
||||
|
|
@ -108,45 +205,41 @@ _swsetup_vb_init( GLcontext *ctx )
|
|||
(void) ctx;
|
||||
|
||||
for (i = 0 ; i < Elements(setup_func) ; i++)
|
||||
setup_func[i] = rs_multitex_color_spec_index_point_fog;
|
||||
setup_func[i] = rs_invalid;
|
||||
|
||||
/* Some specialized cases:
|
||||
*/
|
||||
setup_func[0] = rs_color;
|
||||
setup_func[0] = rs_none;
|
||||
setup_func[COLOR] = rs_color;
|
||||
|
||||
setup_func[COLOR|SPEC] = rs_color_spec;
|
||||
setup_func[COLOR|FOG] = rs_color_fog;
|
||||
setup_func[COLOR|SPEC|FOG] = rs_color_spec_fog;
|
||||
setup_func[COLOR|TEX0] = rs_color_tex0;
|
||||
setup_func[COLOR|TEX0|SPEC] = rs_color_tex0_spec;
|
||||
setup_func[COLOR|TEX0|FOG] = rs_color_tex0_fog;
|
||||
setup_func[COLOR|TEX0|SPEC|FOG] = rs_color_tex0_spec_fog;
|
||||
setup_func[COLOR|MULTITEX] = rs_color_multitex;
|
||||
setup_func[COLOR|MULTITEX|SPEC] = rs_color_multitex_spec;
|
||||
setup_func[COLOR|MULTITEX|FOG] = rs_color_multitex_fog;
|
||||
setup_func[COLOR|MULTITEX|SPEC|FOG] = rs_color_multitex_spec_fog;
|
||||
setup_func[COLOR|POINT] = rs_color_point;
|
||||
setup_func[COLOR|SPEC|POINT] = rs_color_spec_point;
|
||||
setup_func[COLOR|FOG|POINT] = rs_color_fog_point;
|
||||
setup_func[COLOR|SPEC|FOG|POINT] = rs_color_spec_fog_point;
|
||||
setup_func[COLOR|TEX0|POINT] = rs_color_tex0_point;
|
||||
setup_func[COLOR|TEX0|SPEC|POINT] = rs_color_tex0_spec_point;
|
||||
setup_func[COLOR|TEX0|FOG|POINT] = rs_color_tex0_fog_point;
|
||||
setup_func[COLOR|TEX0|SPEC|FOG|POINT] = rs_color_tex0_spec_fog_point;
|
||||
setup_func[COLOR|MULTITEX|POINT] = rs_color_multitex_point;
|
||||
setup_func[COLOR|MULTITEX|SPEC|POINT] = rs_color_multitex_spec_point;
|
||||
setup_func[COLOR|MULTITEX|FOG|POINT] = rs_color_multitex_fog_point;
|
||||
setup_func[COLOR|MULTITEX|SPEC|FOG|POINT] = rs_color_multitex_spec_fog_point;
|
||||
setup_func[INDEX] = rs_index;
|
||||
|
||||
setup_func[TEX0] = rs_tex0_color;
|
||||
setup_func[TEX0|COLOR] = rs_tex0_color;
|
||||
|
||||
setup_func[SPEC] = rs_tex0_color_spec;
|
||||
setup_func[COLOR|SPEC] = rs_tex0_color_spec;
|
||||
setup_func[TEX0|SPEC] = rs_tex0_color_spec;
|
||||
setup_func[TEX0|COLOR|SPEC] = rs_tex0_color_spec;
|
||||
|
||||
setup_func[MULTITEX] = rs_multitex_color;
|
||||
setup_func[MULTITEX|COLOR] = rs_multitex_color;
|
||||
|
||||
setup_func[FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[COLOR|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[SPEC|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[COLOR|SPEC|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[TEX0|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[TEX0|COLOR|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[TEX0|SPEC|FOG] = rs_tex0_color_spec_fog;
|
||||
setup_func[TEX0|COLOR|SPEC|FOG] = rs_tex0_color_spec_fog;
|
||||
|
||||
setup_func[MULTITEX|SPEC] = rs_multitex_color_spec_fog;
|
||||
setup_func[MULTITEX|COLOR|SPEC] = rs_multitex_color_spec_fog;
|
||||
setup_func[MULTITEX|FOG] = rs_multitex_color_spec_fog;
|
||||
setup_func[MULTITEX|SPEC|FOG] = rs_multitex_color_spec_fog;
|
||||
setup_func[MULTITEX|COLOR|SPEC|FOG] = rs_multitex_color_spec_fog;
|
||||
|
||||
setup_func[TEX0|POINT] = rs_tex0_color_point;
|
||||
setup_func[TEX0|COLOR|POINT] = rs_tex0_color_point;
|
||||
|
||||
setup_func[COLOR|INDEX|TEX0] = rs_selection_feedback;
|
||||
setup_func[INDEX|TEX0] = rs_index_tex0;
|
||||
setup_func[INDEX|FOG] = rs_index_fog;
|
||||
setup_func[INDEX|TEX0|FOG] = rs_index_tex0_fog;
|
||||
setup_func[INDEX|POINT] = rs_index_point;
|
||||
setup_func[INDEX|TEX0|POINT] = rs_index_tex0_point;
|
||||
setup_func[INDEX|FOG|POINT] = rs_index_fog_point;
|
||||
setup_func[INDEX|TEX0|FOG|POINT] = rs_index_tex0_fog_point;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -154,7 +247,7 @@ void
|
|||
_swsetup_choose_rastersetup_func(GLcontext *ctx)
|
||||
{
|
||||
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
|
||||
int funcindex;
|
||||
int funcindex = 0;
|
||||
|
||||
if (ctx->RenderMode == GL_RENDER) {
|
||||
if (ctx->Visual.RGBAflag) {
|
||||
|
|
@ -179,11 +272,16 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx)
|
|||
if (ctx->Fog.Enabled)
|
||||
funcindex |= FOG;
|
||||
}
|
||||
else {
|
||||
/* feedback or section */
|
||||
funcindex = (COLOR | INDEX | TEX0);
|
||||
}
|
||||
else if (ctx->RenderMode == GL_FEEDBACK) {
|
||||
if (ctx->Visual.RGBAflag)
|
||||
funcindex = (COLOR | TEX0); /* is feedback color subject to fogging? */
|
||||
else
|
||||
funcindex = (INDEX | TEX0);
|
||||
}
|
||||
else
|
||||
funcindex = 0;
|
||||
|
||||
swsetup->RasterSetup = setup_func[funcindex];
|
||||
swsetup->BuildProjVerts = setup_func[funcindex];
|
||||
ASSERT(setup_func[funcindex] != rs_invalid);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,80 +26,92 @@
|
|||
*/
|
||||
|
||||
|
||||
static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end)
|
||||
static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
|
||||
{
|
||||
GLcontext *ctx = VB->ctx;
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
struct vertex_buffer *VB = &tnl->vb;
|
||||
SWvertex *v;
|
||||
GLfloat (*eye)[4];
|
||||
GLfloat (*win)[4];
|
||||
GLfloat (*proj)[4]; /* projected clip coordinates */
|
||||
GLfloat (*tc[MAX_TEXTURE_UNITS])[4];
|
||||
GLubyte (*color)[4];
|
||||
GLubyte (*spec)[4];
|
||||
GLuint *index;
|
||||
GLfloat *fog;
|
||||
GLfloat *pointSize;
|
||||
GLuint sz[MAX_TEXTURE_UNITS];
|
||||
GLuint szeye;
|
||||
GLuint tsz[MAX_TEXTURE_UNITS];
|
||||
int 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;
|
||||
|
||||
/* TODO: Do window map here.
|
||||
*/
|
||||
/* GLfloat *m = VB->ctx->Viewport.WindowMap.m; */
|
||||
/* const GLfloat sx = m[0]; */
|
||||
/* const GLfloat sy = m[5]; */
|
||||
/* const GLfloat sz = m[10] * ctx->Visual->DepthMaxF; */
|
||||
/* const GLfloat tx = m[12]; */
|
||||
/* const GLfloat ty = m[13]; */
|
||||
/* const GLfloat tz = m[14] * ctx->Visual->DepthMaxF; */
|
||||
|
||||
/* fprintf(stderr, "%s\n", __FUNCTION__); */
|
||||
|
||||
/* TODO: Get import_client_data to pad vectors out to 4 cleanly.
|
||||
*/
|
||||
_tnl_import_client_data( VB, tnl->_RenderFlags,
|
||||
(VB->ClipOrMask
|
||||
? /* VEC_CLEAN| */VEC_WRITABLE|VEC_GOOD_STRIDE
|
||||
: /* VEC_CLEAN| */VEC_GOOD_STRIDE));
|
||||
|
||||
if (VB->importable_data)
|
||||
VB->import_data( ctx, VB->importable_data & newinputs,
|
||||
(VB->ClipOrMask
|
||||
? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
|
||||
: VEC_BAD_STRIDE));
|
||||
|
||||
if (IND & TEX0) {
|
||||
tc[0] = VB->TexCoordPtr[0]->data;
|
||||
sz[0] = VB->TexCoordPtr[0]->size;
|
||||
tsz[0] = VB->TexCoordPtr[0]->size;
|
||||
}
|
||||
|
||||
if (IND & MULTITEX) {
|
||||
for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) {
|
||||
tc[i] = VB->TexCoordPtr[i]->data;
|
||||
sz[i] = VB->TexCoordPtr[i]->size;
|
||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
|
||||
if (VB->TexCoordPtr[i]) {
|
||||
maxtex = i+1;
|
||||
tc[i] = VB->TexCoordPtr[i]->data;
|
||||
tsz[i] = VB->TexCoordPtr[i]->size;
|
||||
}
|
||||
else tc[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fog = VB->FogCoordPtr->data;
|
||||
eye = VB->EyePtr->data;
|
||||
szeye = VB->EyePtr->size;
|
||||
win = VB->Win.data;
|
||||
color = VB->Color[0]->data;
|
||||
spec = VB->SecondaryColor[0]->data;
|
||||
index = VB->Index[0]->data;
|
||||
pointSize = VB->PointSize.data;
|
||||
/* Tie up some dangling pointers for flat/twoside code in ss_tritmp.h
|
||||
*/
|
||||
if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0) {
|
||||
VB->SecondaryColorPtr[0] = VB->ColorPtr[0];
|
||||
VB->SecondaryColorPtr[1] = VB->ColorPtr[1];
|
||||
}
|
||||
|
||||
|
||||
v = &(SWSETUP_VB(VB)->verts[start]);
|
||||
proj = VB->ProjectedClipPtr->data;
|
||||
if (IND & FOG)
|
||||
fog = VB->FogCoordPtr->data;
|
||||
if (IND & COLOR)
|
||||
color = VB->ColorPtr[0]->data;
|
||||
if (IND & SPEC)
|
||||
spec = VB->SecondaryColorPtr[0]->data;
|
||||
if (IND & INDEX)
|
||||
index = VB->IndexPtr[0]->data;
|
||||
if (IND & POINT)
|
||||
pointSize = VB->PointSizePtr->data;
|
||||
|
||||
v = &(SWSETUP_CONTEXT(ctx)->verts[start]);
|
||||
|
||||
for (i=start; i < end; i++, v++) {
|
||||
if (VB->ClipMask[i] == 0) {
|
||||
COPY_4FV( v->win, win[i] );
|
||||
v->win[0] = sx * proj[i][0] + tx;
|
||||
v->win[1] = sy * proj[i][1] + ty;
|
||||
v->win[2] = sz * proj[i][2] + tz;
|
||||
v->win[3] = proj[i][3];
|
||||
|
||||
#if 0
|
||||
if (IND & EYE)
|
||||
COPY_4FV( v->eye, eye[i] );
|
||||
#endif
|
||||
if (IND & TEX0)
|
||||
COPY_CLEAN_4V( v->texcoord[0], sz[0], tc[0][i] );
|
||||
COPY_CLEAN_4V( v->texcoord[0], tsz[0], tc[0][i] );
|
||||
|
||||
if (IND & MULTITEX) {
|
||||
GLuint u;
|
||||
for (u = 0 ; u < MAX_TEXTURE_UNITS ; u++)
|
||||
if (ctx->Texture.Unit[u]._ReallyEnabled)
|
||||
COPY_CLEAN_4V( v->texcoord[u], sz[u], tc[u][i] );
|
||||
for (u = 0 ; u < maxtex ; u++)
|
||||
if (tc[u])
|
||||
COPY_CLEAN_4V( v->texcoord[u], tsz[u], tc[u][i] );
|
||||
}
|
||||
|
||||
if (IND & COLOR)
|
||||
|
|
@ -122,3 +134,4 @@ static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end)
|
|||
|
||||
#undef TAG
|
||||
#undef IND
|
||||
#undef SETUP_FLAGS
|
||||
|
|
|
|||
|
|
@ -37,18 +37,14 @@ _swsetup_CreateContext( GLcontext *ctx );
|
|||
extern void
|
||||
_swsetup_DestroyContext( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
_swsetup_RegisterVB( struct vertex_buffer *VB );
|
||||
|
||||
extern void
|
||||
_swsetup_UnregisterVB( struct vertex_buffer *VB );
|
||||
|
||||
extern void
|
||||
_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
|
||||
|
||||
extern void
|
||||
_swsetup_RasterSetup( struct vertex_buffer *VB,
|
||||
GLuint start, GLuint end );
|
||||
_swsetup_BuildProjectedVertices( GLcontext *ctx,
|
||||
GLuint start,
|
||||
GLuint end,
|
||||
GLuint new_inputs );
|
||||
|
||||
extern void
|
||||
_swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1,
|
||||
|
|
@ -66,5 +62,8 @@ _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv );
|
|||
extern void
|
||||
_swsetup_Points( GLcontext *ctx, GLuint first, GLuint last );
|
||||
|
||||
extern void
|
||||
_swsetup_IndexedPoints( GLcontext *ctx, GLuint first, GLuint last );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
355
src/mesa/tnl/t_array_api.c
Normal file
355
src/mesa/tnl/t_array_api.c
Normal file
|
|
@ -0,0 +1,355 @@
|
|||
/* $Id: t_array_api.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keithw@valinux.com>
|
||||
*/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "api_validate.h"
|
||||
#include "context.h"
|
||||
#include "macros.h"
|
||||
#include "mmath.h"
|
||||
#include "mem.h"
|
||||
#include "state.h"
|
||||
#include "mtypes.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"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
struct vertex_buffer *VB = &tnl->vb;
|
||||
|
||||
/* 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 && count - start < ctx->Const.MaxArrayLockSize) {
|
||||
FLUSH_CURRENT( ctx, 0 );
|
||||
|
||||
if (ctx->Array.LockCount)
|
||||
{
|
||||
if (start < ctx->Array.LockFirst) start = ctx->Array.LockFirst;
|
||||
if (count > ctx->Array.LockCount) count = ctx->Array.LockCount;
|
||||
if (start >= count) return;
|
||||
|
||||
/* 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 - start;
|
||||
_tnl_run_pipeline( ctx );
|
||||
} else {
|
||||
/* The arrays are small enough to fit in a single VB; just bind
|
||||
* them and go. Any untransformed data will be copied on
|
||||
* clipping.
|
||||
*
|
||||
* Invalidate any locked data dependent on these arrays.
|
||||
*/
|
||||
_tnl_vb_bind_arrays( ctx, start, count );
|
||||
VB->FirstPrimitive = 0;
|
||||
VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST;
|
||||
VB->PrimitiveLength[0] = count - start;
|
||||
tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
|
||||
_tnl_run_pipeline( ctx );
|
||||
tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Need to produce immediate structs, either for compiling or
|
||||
* because the array range is too large to process in a single
|
||||
* VB. In GL_EXECUTE mode, this introduces two redundant
|
||||
* operations: producing the flag array and computing the orflag
|
||||
* of the flag array.
|
||||
*/
|
||||
#if 0
|
||||
if (_tnl_hard_begin( ctx, mode )) {
|
||||
GLuint j;
|
||||
for (j = 0 ; j < count ; ) {
|
||||
struct immediate *IM = TNL_CURRENT_IM(ctx);
|
||||
GLuint nr = MIN2( IMM_MAXDATA - IM->Start, count - j );
|
||||
GLuint sf = IM->Flag[IM->Start];
|
||||
|
||||
_tnl_fill_immediate_drawarrays( ctx, IM, j, j+nr );
|
||||
|
||||
if (j == 0) IM->Flag[IM->Start] |= sf;
|
||||
|
||||
IM->Count = IM->Start + nr;
|
||||
j += nr;
|
||||
|
||||
if (j == count)
|
||||
_tnl_end( ctx );
|
||||
|
||||
_tnl_flush_immediate( IM );
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Simple alternative to above code.
|
||||
*/
|
||||
/* if (_tnl_hard_begin( ctx, mode )) */
|
||||
_tnl_begin(ctx,mode);
|
||||
{
|
||||
GLuint i;
|
||||
for (i=start;i<count;i++) {
|
||||
_tnl_array_element( ctx, i );
|
||||
}
|
||||
_tnl_end( ctx );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 );
|
||||
|
||||
_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_run_pipeline( ctx );
|
||||
else {
|
||||
/* Note that arrays may have changed before/after execution.
|
||||
*/
|
||||
tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
|
||||
_tnl_run_pipeline( ctx );
|
||||
tnl->pipeline.run_input_changes |= ctx->Array._Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count,
|
||||
const GLuint *indices)
|
||||
{
|
||||
#if 1
|
||||
/* Optimized code that fakes the effect of calling
|
||||
* _tnl_array_element for each index in the list.
|
||||
*/
|
||||
if (_tnl_hard_begin( ctx, mode )) {
|
||||
GLuint i,j;
|
||||
for (j = 0 ; j < count ; ) {
|
||||
struct immediate *IM = TNL_CURRENT_IM(ctx);
|
||||
GLuint start = IM->Start;
|
||||
GLuint nr = MIN2( IMM_MAXDATA - start, count - j ) + start;
|
||||
GLuint sf = IM->Flag[start];
|
||||
IM->FlushElt |= 1;
|
||||
|
||||
for (i = start ; i < nr ; i++) {
|
||||
IM->Elt[i] = (GLuint) *indices++;
|
||||
IM->Flag[i] = VERT_ELT;
|
||||
}
|
||||
|
||||
if (j == 0) IM->Flag[start] |= sf;
|
||||
|
||||
IM->Count = nr;
|
||||
j += nr - start;
|
||||
|
||||
if (j == count)
|
||||
_tnl_end( ctx );
|
||||
|
||||
_tnl_flush_immediate( IM );
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Simple version of the above code.
|
||||
*/
|
||||
if (_tnl_hard_begin(ctx, mode)) {
|
||||
GLuint i;
|
||||
for (i = 0 ; i < count ; i++)
|
||||
_tnl_array_element( ctx, indices[i] );
|
||||
_tnl_end( ctx );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_tnl_DrawRangeElements(GLenum mode,
|
||||
GLuint start, GLuint end,
|
||||
GLsizei count, GLenum type, const GLvoid *indices)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
GLuint *ui_indices;
|
||||
|
||||
/* Check arguments, etc.
|
||||
*/
|
||||
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
|
||||
type, indices ))
|
||||
return;
|
||||
|
||||
if (tnl->pipeline.build_state_changes)
|
||||
_tnl_validate_pipeline( ctx );
|
||||
|
||||
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
|
||||
count, type, indices );
|
||||
|
||||
|
||||
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?
|
||||
*/
|
||||
gl_problem( ctx,
|
||||
"DrawRangeElements references "
|
||||
"elements outside locked range.");
|
||||
}
|
||||
}
|
||||
else if (end - 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, count, ui_indices );
|
||||
} else {
|
||||
/* Range is too big to optimize:
|
||||
*/
|
||||
_tnl_draw_elements( ctx, mode, count, ui_indices );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
GLuint *ui_indices;
|
||||
|
||||
/* Check arguments, etc.
|
||||
*/
|
||||
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
|
||||
return;
|
||||
|
||||
if (tnl->pipeline.build_state_changes)
|
||||
_tnl_validate_pipeline( ctx );
|
||||
|
||||
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
|
||||
count, type, indices );
|
||||
|
||||
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;
|
||||
GLuint 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 < count) /* do we want to use it? */
|
||||
_tnl_draw_range_elements( ctx, mode, 0, max_elt, count, ui_indices );
|
||||
else
|
||||
_tnl_draw_elements( ctx, mode, count, ui_indices );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
*/
|
||||
gl_vector4f_init( &tmp->Obj, 0, 0 );
|
||||
gl_vector3f_init( &tmp->Normal, 0, 0 );
|
||||
gl_vector4ub_init( &tmp->Color, 0, 0 );
|
||||
gl_vector4ub_init( &tmp->SecondaryColor, 0, 0 );
|
||||
gl_vector1f_init( &tmp->FogCoord, 0, 0 );
|
||||
gl_vector1ui_init( &tmp->Index, 0, 0 );
|
||||
gl_vector1ub_init( &tmp->EdgeFlag, 0, 0 );
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
|
||||
gl_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);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
47
src/mesa/tnl/t_array_api.h
Normal file
47
src/mesa/tnl/t_array_api.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* $Id: t_array_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#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
|
||||
521
src/mesa/tnl/t_array_import.c
Normal file
521
src/mesa/tnl/t_array_import.c
Normal file
|
|
@ -0,0 +1,521 @@
|
|||
/* $Id: t_array_import.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keithw@valinux.com>
|
||||
*/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "context.h"
|
||||
#include "macros.h"
|
||||
#include "mem.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"
|
||||
|
||||
|
||||
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 = 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 (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 = tmp->Ptr;
|
||||
inputs->Normal.start = (GLfloat *)tmp->Ptr;
|
||||
inputs->Normal.stride = tmp->StrideB;
|
||||
inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (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,
|
||||
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,
|
||||
GL_UNSIGNED_BYTE,
|
||||
stride ? 4*sizeof(GLubyte) : 0,
|
||||
4,
|
||||
writeable,
|
||||
&is_writeable);
|
||||
|
||||
inputs->Color.data = tmp->Ptr;
|
||||
inputs->Color.start = (GLubyte *)tmp->Ptr;
|
||||
inputs->Color.stride = tmp->StrideB;
|
||||
inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (stride != 4*sizeof(GLubyte))
|
||||
inputs->Color.flags |= VEC_BAD_STRIDE;
|
||||
if (!is_writeable)
|
||||
inputs->Color.flags |= VEC_NOT_WRITEABLE;
|
||||
}
|
||||
|
||||
|
||||
static void _tnl_import_secondarycolor( 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_secondarycolor(ctx, GL_UNSIGNED_BYTE,
|
||||
stride ? 4*sizeof(GLubyte) : 0,
|
||||
4,
|
||||
writeable,
|
||||
&is_writeable);
|
||||
|
||||
inputs->SecondaryColor.data = tmp->Ptr;
|
||||
inputs->SecondaryColor.start = (GLubyte *)tmp->Ptr;
|
||||
inputs->SecondaryColor.stride = tmp->StrideB;
|
||||
inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (stride != 4*sizeof(GLubyte))
|
||||
inputs->SecondaryColor.flags |= VEC_BAD_STRIDE;
|
||||
if (!is_writeable)
|
||||
inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE;
|
||||
}
|
||||
|
||||
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 = tmp->Ptr;
|
||||
inputs->FogCoord.start = (GLfloat *)tmp->Ptr;
|
||||
inputs->FogCoord.stride = tmp->StrideB;
|
||||
inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (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 = tmp->Ptr;
|
||||
inputs->Index.start = (GLuint *)tmp->Ptr;
|
||||
inputs->Index.stride = tmp->StrideB;
|
||||
inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (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 i,
|
||||
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, i, GL_FLOAT,
|
||||
stride ? 4*sizeof(GLfloat) : 0,
|
||||
0,
|
||||
writeable,
|
||||
&is_writeable);
|
||||
|
||||
inputs->TexCoord[i].data = tmp->Ptr;
|
||||
inputs->TexCoord[i].start = (GLfloat *)tmp->Ptr;
|
||||
inputs->TexCoord[i].stride = tmp->StrideB;
|
||||
inputs->TexCoord[i].size = tmp->Size;
|
||||
inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (stride != 4*sizeof(GLfloat))
|
||||
inputs->TexCoord[i].flags |= VEC_BAD_STRIDE;
|
||||
if (!is_writeable)
|
||||
inputs->TexCoord[i].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 = tmp->Ptr;
|
||||
inputs->EdgeFlag.start = (GLubyte *)tmp->Ptr;
|
||||
inputs->EdgeFlag.stride = tmp->StrideB;
|
||||
inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
|
||||
if (stride != sizeof(GLubyte))
|
||||
inputs->EdgeFlag.flags |= VEC_BAD_STRIDE;
|
||||
if (!is_writeable)
|
||||
inputs->EdgeFlag.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.
|
||||
*/
|
||||
static void _tnl_upgrade_client_data( GLcontext *ctx,
|
||||
GLuint required,
|
||||
GLuint flags )
|
||||
{
|
||||
GLuint i;
|
||||
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
|
||||
struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs;
|
||||
GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0;
|
||||
GLboolean stride = (flags & VEC_BAD_STRIDE) != 0;
|
||||
|
||||
if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr)
|
||||
required |= VERT_OBJ;
|
||||
|
||||
if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) {
|
||||
ASSERT(VB->ObjPtr == &inputs->Obj);
|
||||
_tnl_import_vertex( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) {
|
||||
ASSERT(VB->NormalPtr == &inputs->Normal);
|
||||
_tnl_import_normal( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) {
|
||||
ASSERT(VB->ColorPtr[0] == &inputs->Color);
|
||||
_tnl_import_color( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) {
|
||||
ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor);
|
||||
_tnl_import_secondarycolor( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) {
|
||||
ASSERT(VB->FogCoordPtr == &inputs->FogCoord);
|
||||
_tnl_import_fogcoord( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) {
|
||||
ASSERT(VB->IndexPtr[0] == &inputs->Index);
|
||||
_tnl_import_index( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
if (required & VERT_TEX_ANY)
|
||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
|
||||
if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) {
|
||||
ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]);
|
||||
_tnl_import_texcoord( ctx, i, writeable, stride );
|
||||
}
|
||||
|
||||
if ((required & VERT_EDGE) && (VB->EdgeFlagPtr->flags & flags)) {
|
||||
ASSERT(VB->EdgeFlagPtr == &inputs->EdgeFlag);
|
||||
_tnl_import_edgeflag( ctx, writeable, stride );
|
||||
}
|
||||
|
||||
VB->importable_data &= ~required;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
GLuint imports;
|
||||
struct vertex_arrays *tmp = &tnl->array_inputs;
|
||||
|
||||
if (ctx->Array.LockCount) {
|
||||
ASSERT(start == ctx->Array.LockFirst);
|
||||
ASSERT(count == ctx->Array.LockCount);
|
||||
}
|
||||
|
||||
imports = tnl->pipeline.inputs;
|
||||
|
||||
_ac_import_range( ctx, start, count );
|
||||
|
||||
VB->Count = count - start;
|
||||
VB->FirstClipped = VB->Count;
|
||||
|
||||
VB->Elts = 0;
|
||||
VB->MaterialMask = 0;
|
||||
VB->Material = 0;
|
||||
VB->Flag = 0;
|
||||
|
||||
/* _tnl_print_vert_flags("_tnl_print_vert_flags: inputs", inputs); */
|
||||
/* _tnl_print_vert_flags("_tnl_print_vert_flags: imports", imports); */
|
||||
/* _tnl_print_vert_flags("_tnl_print_vert_flags: _Enabled", ctx->Array._Enabled); */
|
||||
|
||||
if (inputs & VERT_OBJ) {
|
||||
if (imports & VERT_OBJ) {
|
||||
_tnl_import_vertex( ctx, 0, 0 );
|
||||
tmp->Obj.count = VB->Count;
|
||||
}
|
||||
VB->ObjPtr = &tmp->Obj;
|
||||
}
|
||||
|
||||
if (inputs & VERT_NORM) {
|
||||
if (imports & VERT_NORM) {
|
||||
_tnl_import_normal( ctx, 0, 0 );
|
||||
tmp->Normal.count = VB->Count;
|
||||
}
|
||||
VB->NormalPtr = &tmp->Normal;
|
||||
}
|
||||
|
||||
if (inputs & VERT_RGBA) {
|
||||
if (imports & VERT_RGBA) {
|
||||
_tnl_import_color( ctx, 0, 0 );
|
||||
tmp->Color.count = VB->Count;
|
||||
}
|
||||
VB->ColorPtr[0] = &tmp->Color;
|
||||
VB->ColorPtr[1] = 0;
|
||||
}
|
||||
|
||||
if (inputs & VERT_INDEX) {
|
||||
if (imports & VERT_INDEX) {
|
||||
_tnl_import_index( ctx, 0, 0 );
|
||||
tmp->Index.count = VB->Count;
|
||||
}
|
||||
VB->IndexPtr[0] = &tmp->Index;
|
||||
VB->IndexPtr[1] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (inputs & VERT_FOG_COORD) {
|
||||
if (imports & VERT_FOG_COORD) {
|
||||
_tnl_import_fogcoord( ctx, 0, 0 );
|
||||
tmp->FogCoord.count = VB->Count;
|
||||
}
|
||||
VB->FogCoordPtr = &tmp->FogCoord;
|
||||
}
|
||||
|
||||
if (inputs & VERT_EDGE) {
|
||||
if (imports & VERT_EDGE) {
|
||||
_tnl_import_edgeflag( ctx, 0, 0 );
|
||||
tmp->EdgeFlag.count = VB->Count;
|
||||
}
|
||||
VB->EdgeFlagPtr = &tmp->EdgeFlag;
|
||||
}
|
||||
|
||||
if (inputs & VERT_SPEC_RGB) {
|
||||
if (imports & VERT_SPEC_RGB) {
|
||||
_tnl_import_secondarycolor( ctx, 0, 0 );
|
||||
tmp->SecondaryColor.count = VB->Count;
|
||||
}
|
||||
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
|
||||
VB->SecondaryColorPtr[1] = 0;
|
||||
}
|
||||
|
||||
if (inputs & VERT_TEX_ANY) {
|
||||
GLuint i;
|
||||
for (i = 0; i < ctx->Const.MaxTextureUnits ; i++)
|
||||
if (inputs & VERT_TEX(i)) {
|
||||
if (imports & VERT_TEX(i)) {
|
||||
_tnl_import_texcoord( ctx, i, 0, 0 );
|
||||
tmp->TexCoord[i].count = VB->Count;
|
||||
}
|
||||
VB->TexCoordPtr[i] = &tmp->TexCoord[i];
|
||||
}
|
||||
}
|
||||
|
||||
VB->Primitive = tnl->tmp_primitive;
|
||||
VB->PrimitiveLength = tnl->tmp_primitive_length;
|
||||
VB->import_data = _tnl_upgrade_client_data;
|
||||
VB->importable_data = imports;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Function to fill an immediate struct with the effects of
|
||||
* consecutive calls to ArrayElement with consecutive indices.
|
||||
*/
|
||||
void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM,
|
||||
GLuint start, GLuint count )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
GLuint required = ctx->Array._Enabled;
|
||||
GLuint n = count - start;
|
||||
GLuint i;
|
||||
|
||||
if (!ctx->CompileFlag)
|
||||
required &= tnl->pipeline.inputs;
|
||||
|
||||
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
|
||||
fprintf(stderr, "exec_full_array_elements %d .. %d\n", start, count);
|
||||
|
||||
_math_trans_4f( IM->Obj + IM->Start,
|
||||
ctx->Array.Vertex.Ptr,
|
||||
ctx->Array.Vertex.StrideB,
|
||||
ctx->Array.Vertex.Type,
|
||||
ctx->Array.Vertex.Size,
|
||||
start, n );
|
||||
|
||||
if (ctx->Array.Vertex.Size == 4)
|
||||
required |= VERT_OBJ_234;
|
||||
else if (ctx->Array.Vertex.Size == 3)
|
||||
required |= VERT_OBJ_23;
|
||||
|
||||
|
||||
if (required & VERT_NORM) {
|
||||
_math_trans_3f( IM->Normal + IM->Start,
|
||||
ctx->Array.Normal.Ptr,
|
||||
ctx->Array.Normal.StrideB,
|
||||
ctx->Array.Normal.Type,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_EDGE) {
|
||||
_math_trans_1ub( IM->EdgeFlag + IM->Start,
|
||||
ctx->Array.EdgeFlag.Ptr,
|
||||
ctx->Array.EdgeFlag.StrideB,
|
||||
ctx->Array.EdgeFlag.Type,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_RGBA) {
|
||||
_math_trans_4ub( IM->Color + IM->Start,
|
||||
ctx->Array.Color.Ptr,
|
||||
ctx->Array.Color.StrideB,
|
||||
ctx->Array.Color.Type,
|
||||
ctx->Array.Color.Size,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_SPEC_RGB) {
|
||||
_math_trans_4ub( IM->SecondaryColor + IM->Start,
|
||||
ctx->Array.SecondaryColor.Ptr,
|
||||
ctx->Array.SecondaryColor.StrideB,
|
||||
ctx->Array.SecondaryColor.Type,
|
||||
ctx->Array.SecondaryColor.Size,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_FOG_COORD) {
|
||||
_math_trans_1f( IM->FogCoord + IM->Start,
|
||||
ctx->Array.FogCoord.Ptr,
|
||||
ctx->Array.FogCoord.StrideB,
|
||||
ctx->Array.FogCoord.Type,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_INDEX) {
|
||||
_math_trans_1ui( IM->Index + IM->Start,
|
||||
ctx->Array.Index.Ptr,
|
||||
ctx->Array.Index.StrideB,
|
||||
ctx->Array.Index.Type,
|
||||
start, n );
|
||||
}
|
||||
|
||||
if (required & VERT_TEX_ANY) {
|
||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
|
||||
if (required & VERT_TEX(i)) {
|
||||
_math_trans_4f( IM->TexCoord[i] + IM->Start,
|
||||
ctx->Array.TexCoord[i].Ptr,
|
||||
ctx->Array.TexCoord[i].StrideB,
|
||||
ctx->Array.TexCoord[i].Size,
|
||||
ctx->Array.TexCoord[i].Type,
|
||||
start, n );
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IM->Count = IM->Start + n;
|
||||
IM->Flag[IM->Start] |= required;
|
||||
for (i = IM->Start+1 ; i < IM->Count ; i++)
|
||||
IM->Flag[i] = required;
|
||||
}
|
||||
|
||||
|
||||
42
src/mesa/tnl/t_array_import.h
Normal file
42
src/mesa/tnl/t_array_import.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/* $Id: t_array_import.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#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_fill_immediate_drawarrays( GLcontext *ctx,
|
||||
struct immediate *IM,
|
||||
GLuint start, GLuint count ) ;
|
||||
|
||||
extern void _tnl_array_import_init( GLcontext *ctx );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,101 +1,74 @@
|
|||
/* $Id: t_context.c,v 1.7 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keithw@valinux.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "glheader.h"
|
||||
#include "macros.h"
|
||||
#include "mtypes.h"
|
||||
#include "mem.h"
|
||||
#include "dlist.h"
|
||||
#include "vtxfmt.h"
|
||||
|
||||
#include "t_context.h"
|
||||
#include "t_clip.h"
|
||||
#include "t_cva.h"
|
||||
#include "t_dlist.h"
|
||||
#include "t_eval.h"
|
||||
#include "t_array_api.h"
|
||||
#include "t_eval_api.h"
|
||||
#include "t_imm_alloc.h"
|
||||
#include "t_imm_exec.h"
|
||||
#include "t_imm_dlist.h"
|
||||
#include "t_pipeline.h"
|
||||
#include "t_shade.h"
|
||||
#include "t_light.h"
|
||||
#include "t_texture.h"
|
||||
#include "t_stages.h"
|
||||
#include "t_varray.h"
|
||||
#include "t_vb.h"
|
||||
#include "t_vbrender.h"
|
||||
#include "t_vbxform.h"
|
||||
#include "t_vtxfmt.h"
|
||||
#include "tnl.h"
|
||||
|
||||
#if !defined(THREADS)
|
||||
#ifndef THREADS
|
||||
struct immediate *_tnl_CurrentInput = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
GLboolean
|
||||
_tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
struct immediate *IM = TNL_CURRENT_IM(ctx);
|
||||
|
||||
if ((IM->Flag[IM->Count] & (VERT_BEGIN|VERT_END)) != VERT_END ||
|
||||
(flush_flags & (FLUSH_STORED_VERTICES|FLUSH_UPDATE_CURRENT)))
|
||||
{
|
||||
if (IM->Flag[IM->Start])
|
||||
_tnl_maybe_transform_vb( IM );
|
||||
|
||||
/* Although this code updates the ctx->Current values, that bit
|
||||
* is left set as there is no easy mechanism to set it
|
||||
* elsewhere. This means that each time core wants to examine
|
||||
* ctx->Current, this function will be called. After the first
|
||||
* time, however, it will be a no-op.
|
||||
*/
|
||||
ctx->Driver.NeedFlush &= ~(FLUSH_STORED_VERTICES |
|
||||
FLUSH_INSIDE_BEGIN_END);
|
||||
|
||||
return (tnl->_CurrentPrimitive == GL_POLYGON+1);
|
||||
}
|
||||
else
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
_tnl_MakeCurrent( GLcontext *ctx,
|
||||
GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer )
|
||||
{
|
||||
#ifndef THREADS
|
||||
SET_IMMEDIATE( ctx, TNL_VB(ctx)->IM );
|
||||
SET_IMMEDIATE( ctx, TNL_CURRENT_IM(ctx) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Update all state that references _NeedEyeCoords
|
||||
*/
|
||||
void
|
||||
_tnl_LightingSpaceChange( GLcontext *ctx )
|
||||
{
|
||||
_tnl_update_normal_transform( ctx );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
install_driver_callbacks( GLcontext *ctx )
|
||||
{
|
||||
ctx->Driver.RenderVBCulledTab = _tnl_render_tab_cull;
|
||||
ctx->Driver.RenderVBClippedTab = _tnl_render_tab_clipped;
|
||||
ctx->Driver.RenderVBRawTab = _tnl_render_tab_raw;
|
||||
ctx->Driver.NewList = _tnl_NewList;
|
||||
ctx->Driver.EndList = _tnl_EndList;
|
||||
ctx->Driver.FlushVertices = _tnl_flush_vertices;
|
||||
ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT;
|
||||
ctx->Driver.LightingSpaceChange = _tnl_LightingSpaceChange;
|
||||
ctx->Driver.MakeCurrent = _tnl_MakeCurrent;
|
||||
ctx->Driver.VertexPointer = _tnl_VertexPointer;
|
||||
ctx->Driver.NormalPointer = _tnl_NormalPointer;
|
||||
ctx->Driver.ColorPointer = _tnl_ColorPointer;
|
||||
ctx->Driver.FogCoordPointer = _tnl_FogCoordPointer;
|
||||
ctx->Driver.IndexPointer = _tnl_IndexPointer;
|
||||
ctx->Driver.SecondaryColorPointer = _tnl_SecondaryColorPointer;
|
||||
ctx->Driver.TexCoordPointer = _tnl_TexCoordPointer;
|
||||
ctx->Driver.EdgeFlagPointer = _tnl_EdgeFlagPointer;
|
||||
ctx->Driver.LockArraysEXT = _tnl_LockArraysEXT;
|
||||
ctx->Driver.UnlockArraysEXT = _tnl_UnlockArraysEXT;
|
||||
ctx->Driver.BeginCallList = _tnl_BeginCallList;
|
||||
ctx->Driver.EndCallList = _tnl_EndCallList;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -104,21 +77,6 @@ GLboolean
|
|||
_tnl_CreateContext( GLcontext *ctx )
|
||||
{
|
||||
TNLcontext *tnl;
|
||||
static int firsttime = 1;
|
||||
|
||||
/* Onetime initializations. Doesn't really matter if this gets
|
||||
* done twice: no need for mutexes.
|
||||
*/
|
||||
if (firsttime) {
|
||||
firsttime = 0;
|
||||
_tnl_clip_init();
|
||||
_tnl_eval_init();
|
||||
_tnl_shade_init();
|
||||
_tnl_texture_init();
|
||||
_tnl_trans_elt_init();
|
||||
_tnl_vbrender_init();
|
||||
_tnl_stages_init();
|
||||
}
|
||||
|
||||
/* Create the TNLcontext structure
|
||||
*/
|
||||
|
|
@ -127,43 +85,35 @@ _tnl_CreateContext( GLcontext *ctx )
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Create and hook in the data structures available from ctx.
|
||||
/* Initialize the VB.
|
||||
*/
|
||||
ctx->swtnl_vb = (void *)_tnl_vb_create_for_immediate( ctx );
|
||||
if (!ctx->swtnl_vb) {
|
||||
FREE(tnl);
|
||||
ctx->swtnl_context = 0;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
ctx->swtnl_im = (void *)TNL_VB(ctx)->IM;
|
||||
tnl->vb.Size = MAX2( IMM_SIZE,
|
||||
ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES);
|
||||
|
||||
|
||||
/* Initialize tnl state.
|
||||
/* Initialize tnl state and tnl->vtxfmt.
|
||||
*/
|
||||
_tnl_dlist_init( ctx );
|
||||
_tnl_pipeline_init( ctx );
|
||||
_tnl_vtxfmt_init( ctx );
|
||||
_tnl_cva_init( ctx );
|
||||
|
||||
_tnl_reset_vb( TNL_VB(ctx) );
|
||||
_tnl_reset_input( ctx, 0, 0 ); /* initially outside begin/end */
|
||||
|
||||
|
||||
tnl->_CurrentTex3Flag = 0;
|
||||
tnl->_CurrentTex4Flag = 0;
|
||||
tnl->_CurrentPrimitive = GL_POLYGON+1;
|
||||
_tnl_array_init( ctx );
|
||||
_tnl_imm_init( ctx );
|
||||
_tnl_eval_init( ctx );
|
||||
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
|
||||
|
||||
|
||||
/* Hook our functions into exec and compile dispatch tables.
|
||||
*/
|
||||
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
|
||||
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
|
||||
ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
|
||||
ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
|
||||
ctx->Save->Begin = _tnl_save_Begin;
|
||||
|
||||
/* Set a few default values in the driver struct.
|
||||
*/
|
||||
install_driver_callbacks(ctx);
|
||||
ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT|FLUSH_STORED_VERTICES;
|
||||
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
|
||||
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
@ -174,56 +124,45 @@ _tnl_DestroyContext( GLcontext *ctx )
|
|||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
|
||||
if (TNL_CURRENT_IM(ctx) != TNL_VB(ctx)->IM)
|
||||
_tnl_immediate_free( TNL_CURRENT_IM(ctx) );
|
||||
/* _tnl_dlist_destroy( ctx ); */
|
||||
_tnl_array_destroy( ctx );
|
||||
_tnl_imm_destroy( ctx );
|
||||
/* _tnl_eval_destroy( ctx ); */
|
||||
_tnl_destroy_pipeline( ctx );
|
||||
|
||||
_tnl_vb_free( TNL_VB(ctx) );
|
||||
|
||||
/* Free cache of immediate buffers. */
|
||||
while (tnl->nr_im_queued-- > 0) {
|
||||
struct immediate * next = tnl->freed_im_queue->next;
|
||||
ALIGN_FREE( tnl->freed_im_queue );
|
||||
tnl->freed_im_queue = next;
|
||||
}
|
||||
FREE(tnl);
|
||||
ctx->swtnl_context = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
|
||||
{
|
||||
if (new_state & _NEW_LIGHT)
|
||||
_tnl_update_lighting_function(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
|
||||
if (new_state & _NEW_ARRAY)
|
||||
_tnl_update_client_state( ctx );
|
||||
if (new_state & _NEW_ARRAY) {
|
||||
struct immediate *IM = TNL_CURRENT_IM(ctx);
|
||||
IM->ArrayEltFlags = ~ctx->Array._Enabled;
|
||||
IM->ArrayEltFlush = !ctx->Array.LockCount;
|
||||
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0;
|
||||
tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */
|
||||
}
|
||||
|
||||
if (new_state & _NEW_TEXTURE)
|
||||
if (ctx->_Enabled & ENABLE_TEXGEN_ANY)
|
||||
_tnl_update_texgen( ctx );
|
||||
tnl->pipeline.run_state_changes |= new_state;
|
||||
tnl->pipeline.build_state_changes |= (new_state &
|
||||
tnl->pipeline.build_state_trigger);
|
||||
|
||||
if (new_state & (_NEW_LIGHT|_NEW_TEXTURE|_NEW_FOG|
|
||||
_DD_NEW_TRI_LIGHT_TWOSIDE |
|
||||
_DD_NEW_SEPERATE_SPECULAR |
|
||||
_DD_NEW_TRI_UNFILLED ))
|
||||
_tnl_update_clipmask(ctx);
|
||||
|
||||
if (new_state & _TNL_NEW_NORMAL_TRANSFORM)
|
||||
_tnl_update_normal_transform( ctx );
|
||||
|
||||
_tnl_update_pipelines(ctx);
|
||||
tnl->eval.EvalNewState |= new_state;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_tnl_wakeup_exec( GLcontext *ctx )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
|
||||
#ifndef VMS
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
install_driver_callbacks(ctx);
|
||||
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
|
||||
|
||||
/* Hook our functions into exec and compile dispatch tables.
|
||||
*/
|
||||
|
|
@ -232,35 +171,23 @@ _tnl_wakeup_exec( GLcontext *ctx )
|
|||
/* Call all appropriate driver callbacks to revive state.
|
||||
*/
|
||||
_tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer );
|
||||
_tnl_UnlockArraysEXT( ctx );
|
||||
_tnl_LockArraysEXT( ctx, ctx->Array.LockFirst, ctx->Array.LockCount );
|
||||
|
||||
/* Equivalent to calling all _tnl_*Pointer functions:
|
||||
*/
|
||||
tnl->_ArrayNewState = ~0;
|
||||
|
||||
/* Assume we haven't been getting state updates either:
|
||||
*/
|
||||
_tnl_InvalidateState( ctx, ~0 );
|
||||
|
||||
/* Special state not restored by other methods:
|
||||
*/
|
||||
_tnl_validate_current_tex_flags( ctx, ~0 );
|
||||
|
||||
_tnl_InvalidateState( ctx, ~0 );
|
||||
tnl->pipeline.run_input_changes = ~0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_tnl_wakeup_save_exec( GLcontext *ctx )
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
|
||||
#ifndef VMS
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
_tnl_wakeup_exec( ctx );
|
||||
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
|
||||
ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
|
||||
ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
|
||||
ctx->Save->Begin = _tnl_save_Begin;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
/* $Id: t_context.h,v 1.6 2000/12/08 00:18:39 brianp Exp $ */
|
||||
/* $Id: t_context.h,v 1.7 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -23,6 +22,9 @@
|
|||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION 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 <keithw@valinux.com>
|
||||
*/
|
||||
|
||||
#ifndef _T_CONTEXT_H
|
||||
|
|
@ -35,99 +37,91 @@
|
|||
#include "math/m_vector.h"
|
||||
#include "math/m_xform.h"
|
||||
|
||||
#include "t_trans_elt.h"
|
||||
|
||||
#define MAX_PIPELINE_STAGES 30
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Bits to indicate which faces a vertex participates in,
|
||||
* what facing the primitive provoked by that vertex has,
|
||||
* and some misc. flags.
|
||||
/* Numbers for sizing immediate structs.
|
||||
*/
|
||||
#define VERT_FACE_FRONT 0x1 /* is in a front-color primitive */
|
||||
#define VERT_FACE_REAR 0x2 /* is in a rear-color primitive */
|
||||
#define PRIM_FACE_FRONT 0x4 /* use front color */
|
||||
#define PRIM_FACE_REAR 0x8 /* use rear color */
|
||||
#define PRIM_CLIPPED 0x10 /* needs clipping */
|
||||
#define PRIM_USER_CLIPPED CLIP_USER_BIT /* 0x40 */
|
||||
#define IMM_MAX_COPIED_VERTS 3
|
||||
#define IMM_MAXDATA (216 + IMM_MAX_COPIED_VERTS)
|
||||
#define IMM_SIZE (IMM_MAXDATA + MAX_CLIPPED_VERTICES)
|
||||
|
||||
|
||||
#define PRIM_FLAG_SHIFT 2
|
||||
#define PRIM_FACE_FLAGS (PRIM_FACE_FRONT|PRIM_FACE_REAR)
|
||||
#define VERT_FACE_FLAGS (VERT_FACE_FRONT|VERT_FACE_REAR)
|
||||
|
||||
#define PRIM_ANY_CLIP (PRIM_CLIPPED|PRIM_USER_CLIPPED)
|
||||
#define PRIM_NOT_CULLED (PRIM_ANY_CLIP|PRIM_FACE_FLAGS)
|
||||
|
||||
/* Flags for VB->CullMode.
|
||||
/* Values for IM->BeginState
|
||||
*/
|
||||
#define CULL_MASK_ACTIVE 0x1
|
||||
#define COMPACTED_NORMALS 0x2
|
||||
#define CLIP_MASK_ACTIVE 0x4
|
||||
#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 for selecting a shading function. The first two bits are
|
||||
* shared with the cull mode (ie. cull_mask_active and
|
||||
* compacted_normals.)
|
||||
|
||||
/* Flags to be added to the primitive enum in VB->Primitive.
|
||||
*/
|
||||
#define SHADE_TWOSIDE 0x4
|
||||
#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 */
|
||||
|
||||
|
||||
/* KW: Flags that describe the current vertex state, and the contents
|
||||
* of a vertex in a vertex-cassette.
|
||||
/* Flags that describe the inputs and outputs of pipeline stages, and
|
||||
* the contents of a vertex-cassette.
|
||||
*
|
||||
* For really major expansion, consider a 'VERT_ADDITIONAL_FLAGS' flag,
|
||||
* which means there is data in another flags array (eg, extra_flags[]).
|
||||
* 5 spare flags, rearrangement of eval flags can secure at least 3
|
||||
* more.
|
||||
*/
|
||||
#define VERT_OBJ _NEW_ARRAY_VERTEX
|
||||
#define VERT_RGBA _NEW_ARRAY_COLOR
|
||||
#define VERT_NORM _NEW_ARRAY_NORMAL
|
||||
#define VERT_INDEX _NEW_ARRAY_INDEX
|
||||
#define VERT_EDGE _NEW_ARRAY_EDGEFLAG
|
||||
#define VERT_SPEC_RGB _NEW_ARRAY_SECONDARYCOLOR
|
||||
#define VERT_FOG_COORD _NEW_ARRAY_FOGCOORD
|
||||
#define VERT_TEX0 _NEW_ARRAY_TEXCOORD_0
|
||||
#define VERT_TEX1 _NEW_ARRAY_TEXCOORD_1
|
||||
#define VERT_TEX2 _NEW_ARRAY_TEXCOORD_2
|
||||
#define VERT_TEX3 _NEW_ARRAY_TEXCOORD_3
|
||||
#define VERT_TEX4 _NEW_ARRAY_TEXCOORD_4
|
||||
#define VERT_TEX5 _NEW_ARRAY_TEXCOORD_5
|
||||
#define VERT_TEX6 _NEW_ARRAY_TEXCOORD_6
|
||||
#define VERT_TEX7 _NEW_ARRAY_TEXCOORD_7
|
||||
#define VERT_EVAL_C1 0x8000 /* imm only */
|
||||
#define VERT_EVAL_C2 0x10000 /* imm only */
|
||||
#define VERT_EVAL_P1 0x20000 /* imm only */
|
||||
#define VERT_EVAL_P2 0x40000 /* imm only */
|
||||
#define VERT_OBJ_3 0x80000 /* imm only */
|
||||
#define VERT_OBJ_4 0x100000 /* imm only */
|
||||
#define VERT_MATERIAL 0x200000 /* imm only, but tested in vb code */
|
||||
#define VERT_ELT 0x400000 /* imm only */
|
||||
#define VERT_BEGIN 0x800000 /* imm only, but tested in vb code */
|
||||
#define VERT_END 0x1000000 /* imm only, but tested in vb code */
|
||||
#define VERT_END_VB 0x2000000 /* imm only, but tested in vb code */
|
||||
#define VERT_POINT_SIZE 0x4000000 /* vb only, could reuse a bit */
|
||||
#define VERT_EYE VERT_BEGIN /* vb only, reuse imm bit */
|
||||
#define VERT_CLIP VERT_END /* vb only, reuse imm bit*/
|
||||
|
||||
#define VERT_OBJ_2 0x1 /* glVertex2 */
|
||||
#define VERT_OBJ_3 0x2 /* glVertex3 */
|
||||
#define VERT_OBJ_4 0x4 /* glVertex4 */
|
||||
#define VERT_BEGIN 0x8 /* glBegin */
|
||||
#define VERT_END 0x10 /* glEnd */
|
||||
#define VERT_ELT 0x20 /* glArrayElement */
|
||||
#define VERT_RGBA 0x40 /* glColor */
|
||||
#define VERT_NORM 0x80 /* glNormal */
|
||||
#define VERT_INDEX 0x100 /* glIndex */
|
||||
#define VERT_EDGE 0x200 /* glEdgeFlag */
|
||||
#define VERT_MATERIAL 0x400 /* glMaterial */
|
||||
#define VERT_END_VB 0x800 /* end vb marker */
|
||||
#define VERT_TEX0 0x1000
|
||||
#define VERT_TEX1 0x2000
|
||||
#define VERT_TEX2 0x3000
|
||||
#define VERT_TEX3 0x4000
|
||||
#define VERT_TEX4 0x10000
|
||||
#define VERT_TEX5 0x20000
|
||||
#define VERT_TEX6 0x30000
|
||||
#define VERT_TEX7 0x40000
|
||||
#define VERT_TEX8 0x100000
|
||||
#define VERT_TEX9 0x200000
|
||||
#define VERT_TEX10 0x300000
|
||||
#define VERT_TEX11 0x400000
|
||||
#define VERT_EVAL_C1 0x1000000 /* could reuse OBJ bits for this? */
|
||||
#define VERT_EVAL_C2 0x2000000 /* - or just use 3 bits */
|
||||
#define VERT_EVAL_P1 0x4000000 /* */
|
||||
#define VERT_EVAL_P2 0x8000000 /* */
|
||||
#define VERT_SPEC_RGB 0x10000000
|
||||
#define VERT_FOG_COORD 0x20000000
|
||||
#define VERT_POINT_SIZE 0x40000000
|
||||
|
||||
#define VERT_EYE VERT_BEGIN /* reuse */
|
||||
#define VERT_WIN VERT_END /* reuse */
|
||||
#define VERT_SETUP_FULL VERT_EVAL_P1 /* Rastersetup has been done */
|
||||
#define VERT_PRECALC_DATA VERT_END_VB /* reuse */
|
||||
/* Flags for IM->TexCoordSize. Enough flags for 16 units.
|
||||
*/
|
||||
#define TEX_0_SIZE_3 0x1
|
||||
#define TEX_0_SIZE_4 0x1000
|
||||
#define TEX_SIZE_3(unit) (TEX_0_SIZE_3<<unit)
|
||||
#define TEX_SIZE_4(unit) (TEX_0_SIZE_4<<unit)
|
||||
|
||||
|
||||
/* Shorthands.
|
||||
*/
|
||||
|
||||
#define VERT_EVAL_ANY (VERT_EVAL_C1|VERT_EVAL_P1| \
|
||||
VERT_EVAL_C2|VERT_EVAL_P2)
|
||||
|
||||
#define VERT_OBJ_23 (VERT_OBJ_3|VERT_OBJ_2)
|
||||
#define VERT_OBJ_23 (VERT_OBJ_3|VERT_OBJ)
|
||||
#define VERT_OBJ_234 (VERT_OBJ_4|VERT_OBJ_23)
|
||||
#define VERT_OBJ_ANY VERT_OBJ_2
|
||||
|
||||
#define VERT_TEX0_SHIFT 11
|
||||
|
||||
#define VERT_TEX(i) (VERT_TEX0 << i)
|
||||
|
||||
#define VERT_TEX_ANY (VERT_TEX0 | \
|
||||
VERT_TEX1 | \
|
||||
VERT_TEX2 | \
|
||||
|
|
@ -135,56 +129,87 @@
|
|||
VERT_TEX4 | \
|
||||
VERT_TEX5 | \
|
||||
VERT_TEX6 | \
|
||||
VERT_TEX7 | \
|
||||
VERT_TEX8 | \
|
||||
VERT_TEX9 | \
|
||||
VERT_TEX10 | \
|
||||
VERT_TEX11)
|
||||
VERT_TEX7)
|
||||
|
||||
#define VERT_FIXUP (VERT_TEX_ANY | \
|
||||
#define VERT_FIXUP (VERT_TEX_ANY | \
|
||||
VERT_RGBA | \
|
||||
VERT_SPEC_RGB | \
|
||||
VERT_FOG_COORD | \
|
||||
VERT_INDEX | \
|
||||
VERT_EDGE | \
|
||||
VERT_NORM)
|
||||
|
||||
#define VERT_CURRENT_DATA (VERT_FIXUP | \
|
||||
VERT_MATERIAL)
|
||||
|
||||
#define VERT_DATA (VERT_TEX_ANY | \
|
||||
VERT_RGBA | \
|
||||
VERT_SPEC_RGB | \
|
||||
VERT_FOG_COORD | \
|
||||
VERT_INDEX | \
|
||||
VERT_EDGE | \
|
||||
VERT_NORM)
|
||||
|
||||
#define VERT_DATA (VERT_TEX_ANY | \
|
||||
VERT_RGBA | \
|
||||
VERT_SPEC_RGB | \
|
||||
VERT_FOG_COORD | \
|
||||
VERT_INDEX | \
|
||||
VERT_EDGE | \
|
||||
VERT_NORM | \
|
||||
VERT_OBJ_ANY | \
|
||||
VERT_MATERIAL | \
|
||||
VERT_ELT | \
|
||||
VERT_EVAL_ANY | \
|
||||
VERT_FOG_COORD)
|
||||
VERT_NORM | \
|
||||
VERT_OBJ | \
|
||||
VERT_MATERIAL | \
|
||||
VERT_ELT | \
|
||||
VERT_EVAL_ANY)
|
||||
|
||||
|
||||
|
||||
|
||||
struct gl_pipeline;
|
||||
struct tnl_context;
|
||||
|
||||
/**
|
||||
** Vertex buffer/array structures
|
||||
**/
|
||||
|
||||
struct vertex_data
|
||||
/* 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
|
||||
{
|
||||
GLfloat (*Obj)[4];
|
||||
GLfloat (*Normal)[3];
|
||||
GLchan (*Color)[4];
|
||||
GLuint *Index;
|
||||
GLubyte *EdgeFlag;
|
||||
struct __GLcontextRec *backref;
|
||||
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;
|
||||
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;
|
||||
|
||||
|
||||
/* allocate storage for these on demand:
|
||||
*/
|
||||
struct gl_material (*Material)[2];
|
||||
GLuint *MaterialMask;
|
||||
GLfloat *NormalLengths;
|
||||
GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4];
|
||||
GLuint *Elt;
|
||||
GLfloat *FogCoord;
|
||||
GLubyte (*SecondaryColor)[4];
|
||||
|
||||
GLuint Primitive[IMM_SIZE]; /* BEGIN/END */
|
||||
GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */
|
||||
GLuint Flag[IMM_SIZE]; /* VERT_* flags */
|
||||
GLchan Color[IMM_SIZE][4];
|
||||
GLfloat Obj[IMM_SIZE][4];
|
||||
GLfloat Normal[IMM_SIZE][3];
|
||||
GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0 */
|
||||
GLuint Elt[IMM_SIZE];
|
||||
GLubyte EdgeFlag[IMM_SIZE];
|
||||
GLuint Index[IMM_SIZE];
|
||||
GLubyte SecondaryColor[IMM_SIZE][4];
|
||||
GLfloat FogCoord[IMM_SIZE];
|
||||
};
|
||||
|
||||
|
||||
struct vertex_arrays
|
||||
{
|
||||
GLvector4f Obj;
|
||||
|
|
@ -198,398 +223,193 @@ struct vertex_arrays
|
|||
GLvector1f FogCoord;
|
||||
};
|
||||
|
||||
struct vertex_array_pointers
|
||||
{
|
||||
GLvector4f *Obj;
|
||||
GLvector3f *Normal;
|
||||
GLvector4ub *Color;
|
||||
GLvector1ui *Index;
|
||||
GLvector1ub *EdgeFlag;
|
||||
GLvector4f *TexCoord[MAX_TEXTURE_UNITS];
|
||||
GLvector1ui *Elt;
|
||||
GLvector4ub *SecondaryColor;
|
||||
GLvector1f *FogCoord;
|
||||
};
|
||||
|
||||
/* Values for VB->Type */
|
||||
enum {
|
||||
VB_IMMEDIATE,
|
||||
VB_CVA_PRECALC
|
||||
};
|
||||
typedef struct gl_material GLmaterial;
|
||||
|
||||
|
||||
/* Values for immediate->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 */
|
||||
|
||||
/* KW: Represents everything that can take place between a begin and
|
||||
* end, and can represent multiple begin/end pairs. This plus *any*
|
||||
* state variable (GLcontext) should be all you need to replay the
|
||||
* represented begin/end pairs as if they took place in that state.
|
||||
*
|
||||
* Thus this is sufficient for both immediate and compiled modes, but
|
||||
* we could/should throw some elements away for compiled mode if we
|
||||
* know they were empty.
|
||||
*/
|
||||
struct immediate
|
||||
{
|
||||
struct immediate *next; /* for cache of free IM's */
|
||||
GLuint id, ref_count;
|
||||
|
||||
/* This must be saved when immediates are shared in display lists.
|
||||
*/
|
||||
GLuint Start, Count;
|
||||
GLuint LastData; /* count or count+1 */
|
||||
GLuint AndFlag, OrFlag;
|
||||
GLuint Tex3Flag, Tex4Flag; /* keep track of texcoord sizes */
|
||||
GLuint BeginState, SavedBeginState;
|
||||
GLuint LastPrimitive;
|
||||
|
||||
GLuint ArrayAndFlags; /* precalc'ed for glArrayElt */
|
||||
GLuint ArrayIncr;
|
||||
GLuint ArrayEltFlush;
|
||||
GLuint FlushElt;
|
||||
|
||||
GLuint Primitive[VB_SIZE]; /* GLubyte would do... */
|
||||
GLuint NextPrimitive[VB_SIZE];
|
||||
|
||||
/* allocate storage for these on demand:
|
||||
*/
|
||||
struct gl_material (*Material)[2];
|
||||
GLuint *MaterialMask;
|
||||
|
||||
GLfloat (*TexCoordPtr[MAX_TEXTURE_UNITS])[4];
|
||||
|
||||
struct vertex_arrays v;
|
||||
|
||||
struct __GLcontextRec *backref;
|
||||
|
||||
/* Normal lengths, zero if not available.
|
||||
*/
|
||||
GLfloat *NormalLengths;
|
||||
GLuint LastCalcedLength;
|
||||
|
||||
GLuint Flag[VB_SIZE]; /* bitwise-OR of VERT_ flags */
|
||||
GLchan Color[VB_SIZE][4];
|
||||
GLfloat Obj[VB_SIZE][4];
|
||||
GLfloat Normal[VB_SIZE][3];
|
||||
GLfloat TexCoord[MAX_TEXTURE_UNITS][VB_SIZE][4];
|
||||
GLuint Elt[VB_SIZE];
|
||||
GLubyte EdgeFlag[VB_SIZE];
|
||||
GLuint Index[VB_SIZE];
|
||||
GLubyte SecondaryColor[VB_SIZE][4];
|
||||
GLfloat FogCoord[VB_SIZE];
|
||||
};
|
||||
|
||||
|
||||
/* Not so big on storage these days, although still has pointers to
|
||||
* arrays used for temporary results.
|
||||
/* Contains the current state of a running pipeline.
|
||||
*/
|
||||
typedef struct vertex_buffer
|
||||
{
|
||||
/* Backpointers.
|
||||
/* Constant over life of the vertex_buffer.
|
||||
*/
|
||||
struct __GLcontextRec *ctx;
|
||||
struct tnl_context *tnlctx;
|
||||
GLuint Size;
|
||||
|
||||
/* Driver_data is allocated in Driver.RegisterVB(), if required.
|
||||
/* Constant over the pipeline.
|
||||
*/
|
||||
void *driver_data;
|
||||
GLuint Count; /* for everything except Elts */
|
||||
GLuint FirstClipped; /* temp verts for clipping */
|
||||
GLuint FirstPrimitive; /* usually zero */
|
||||
|
||||
/* List of operations to process vertices in current state.
|
||||
/* Pointers to current data.
|
||||
*/
|
||||
struct gl_pipeline *pipeline;
|
||||
GLuint *Elts; /* VERT_ELT */
|
||||
GLvector4f *ObjPtr; /* VERT_OBJ */
|
||||
GLvector4f *EyePtr; /* VERT_EYE */
|
||||
GLvector4f *ClipPtr; /* VERT_CLIP */
|
||||
GLvector4f *ProjectedClipPtr; /* VERT_CLIP (2) */
|
||||
GLubyte ClipOrMask; /* VERT_CLIP (3) */
|
||||
GLubyte *ClipMask; /* VERT_CLIP (4) */
|
||||
GLvector3f *NormalPtr; /* VERT_NORM */
|
||||
GLfloat *NormalLengthPtr; /* VERT_NORM (optional) */
|
||||
GLvector1ub *EdgeFlagPtr; /* VERT_EDGE */
|
||||
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
|
||||
GLvector1ui *IndexPtr[2]; /* VERT_INDEX */
|
||||
GLvector4ub *ColorPtr[2]; /* VERT_RGBA */
|
||||
GLvector4ub *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */
|
||||
GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */
|
||||
GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */
|
||||
GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */
|
||||
GLuint *MaterialMask; /* VERT_MATERIAL, optional */
|
||||
GLuint *Flag; /* VERT_* flags, optional */
|
||||
GLuint *Primitive; /* GL_(mode)|PRIM_* flags */
|
||||
GLuint *PrimitiveLength; /* integers */
|
||||
|
||||
/* Temporary storage used by immediate mode functions and various
|
||||
* operations in the pipeline.
|
||||
|
||||
GLuint importable_data;
|
||||
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.
|
||||
*/
|
||||
struct immediate *IM;
|
||||
struct vertex_array_pointers store;
|
||||
|
||||
/* Where to find outstanding untransformed vertices.
|
||||
GLuint LastClipped;
|
||||
void *interpfunc;
|
||||
/* Two pieces of private data from _tnl_render_stage that have no
|
||||
* business being in this struct.
|
||||
*/
|
||||
struct immediate *prev_buffer;
|
||||
|
||||
GLuint Type; /* Either VB_IMMEDIATE or VB_CVA_PRECALC */
|
||||
|
||||
GLuint Size, Start, Count;
|
||||
GLuint Free, FirstFree;
|
||||
GLuint CopyStart;
|
||||
GLuint Parity, Ovf;
|
||||
GLuint PurgeFlags;
|
||||
GLuint IndirectCount; /* defaults to count */
|
||||
GLuint OrFlag, SavedOrFlag;
|
||||
GLuint Tex3Flag, Tex4Flag;
|
||||
GLuint SavedTex3Flag, SavedTex4Flag;
|
||||
GLuint EarlyCull;
|
||||
GLuint Culled, CullDone;
|
||||
|
||||
/* Pointers to input data - default to buffers in 'im' above.
|
||||
*/
|
||||
GLvector4f *ObjPtr;
|
||||
GLvector3f *NormalPtr;
|
||||
GLvector4ub *ColorPtr;
|
||||
GLvector1ui *IndexPtr;
|
||||
GLvector1ub *EdgeFlagPtr;
|
||||
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS];
|
||||
GLvector1ui *EltPtr;
|
||||
GLvector4ub *SecondaryColorPtr;
|
||||
GLvector1f *FogCoordPtr;
|
||||
GLuint *Flag, FlagMax;
|
||||
struct gl_material (*Material)[2];
|
||||
GLuint *MaterialMask;
|
||||
|
||||
GLuint *NextPrimitive;
|
||||
GLuint *Primitive;
|
||||
GLuint LastPrimitive;
|
||||
|
||||
GLfloat (*BoundsPtr)[3]; /* Bounds for cull check */
|
||||
GLfloat *NormalLengthPtr; /* Array of precomputed inv. normal lengths */
|
||||
|
||||
/* Holds malloced storage for pipeline data not supplied by
|
||||
* the immediate struct.
|
||||
*/
|
||||
GLvector4f Eye;
|
||||
GLvector4f Clip;
|
||||
GLvector4f Win;
|
||||
GLvector1f PointSize;
|
||||
GLvector4ub BColor; /* not used in cva vb's */
|
||||
GLvector1ui BIndex; /* not used in cva vb's */
|
||||
GLvector4ub BSecondary; /* not used in cva vb's */
|
||||
|
||||
/* Temporary storage - may point into IM, or be dynamically
|
||||
* allocated (for cva).
|
||||
*/
|
||||
GLubyte *ClipMask;
|
||||
GLubyte *UserClipMask;
|
||||
|
||||
/* Internal values. Where these point depends on whether
|
||||
* there were any identity matrices defined as transformations
|
||||
* in the pipeline.
|
||||
*/
|
||||
GLvector4f *EyePtr;
|
||||
GLvector4f *ClipPtr;
|
||||
GLvector4f *Unprojected;
|
||||
GLvector4f *Projected;
|
||||
GLvector4f *CurrentTexCoord;
|
||||
GLuint *Indirect; /* For eval rescue and cva render */
|
||||
|
||||
/* Currently active colors
|
||||
*/
|
||||
GLvector4ub *Color[2];
|
||||
GLvector1ui *Index[2];
|
||||
GLvector4ub *SecondaryColor[2];
|
||||
|
||||
/* Storage for colors which have been lit but not yet fogged.
|
||||
* Required for CVA, just point into store for normal VB's.
|
||||
*/
|
||||
GLvector4ub *LitColor[2];
|
||||
GLvector1ui *LitIndex[2];
|
||||
GLvector4ub *LitSecondary[2];
|
||||
|
||||
/* Temporary values used in texgen.
|
||||
*/
|
||||
GLfloat (*tmp_f)[3];
|
||||
GLfloat *tmp_m;
|
||||
|
||||
/* Temporary values used in eval.
|
||||
*/
|
||||
GLuint *EvaluatedFlags;
|
||||
|
||||
/* Not used for cva:
|
||||
*/
|
||||
GLubyte *NormCullStart;
|
||||
GLubyte *CullMask; /* Results of vertex culling */
|
||||
GLubyte *NormCullMask; /* Compressed onto shared normals */
|
||||
|
||||
GLubyte ClipOrMask; /* bitwise-OR of all ClipMask[] values */
|
||||
GLubyte ClipAndMask; /* bitwise-AND of all ClipMask[] values */
|
||||
GLubyte CullFlag[2];
|
||||
GLubyte CullMode; /* see flags below */
|
||||
|
||||
GLuint CopyCount; /* max 3 vertices to copy after transform */
|
||||
GLuint Copy[3];
|
||||
GLfloat CopyProj[3][4]; /* temporary store for projected clip coords */
|
||||
|
||||
/* Hooks for module private data
|
||||
*/
|
||||
void *swsetup_vb;
|
||||
|
||||
} TNLvertexbuffer;
|
||||
|
||||
|
||||
typedef void (*shade_func)( struct vertex_buffer *VB );
|
||||
|
||||
typedef void (*clip_interp_func)( struct vertex_buffer *VB, GLuint dst,
|
||||
GLfloat t, GLuint in, GLuint out );
|
||||
|
||||
typedef GLuint (*clip_line_func)( struct vertex_buffer *VB,
|
||||
GLuint *i, GLuint *j,
|
||||
GLubyte mask);
|
||||
|
||||
typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB,
|
||||
GLuint n, GLuint vlist[],
|
||||
GLubyte mask );
|
||||
|
||||
|
||||
#define MAX_PIPELINE_STAGES 30
|
||||
|
||||
#define PIPE_IMMEDIATE 0x1
|
||||
#define PIPE_PRECALC 0x2
|
||||
|
||||
#define PIPE_OP_VERT_XFORM 0x1
|
||||
#define PIPE_OP_NORM_XFORM 0x2
|
||||
#define PIPE_OP_LIGHT 0x4
|
||||
#define PIPE_OP_FOG 0x8
|
||||
#define PIPE_OP_TEX 0x10
|
||||
#define PIPE_OP_RAST_SETUP_0 0x100
|
||||
#define PIPE_OP_RAST_SETUP_1 0x200
|
||||
#define PIPE_OP_RENDER 0x400
|
||||
#define PIPE_OP_CVA_PREPARE 0x800
|
||||
#define PIPE_OP_POINT_SIZE 0x1000
|
||||
|
||||
|
||||
/* Describes an individual operation on the pipeline.
|
||||
*/
|
||||
struct gl_pipeline_stage {
|
||||
const char *name;
|
||||
GLuint ops; /* PIPE_OP flags */
|
||||
GLuint type; /* VERT flags */
|
||||
GLuint special; /* VERT flags - force update_inputs() */
|
||||
GLuint state_change; /* state flags - trigger update_inputs() */
|
||||
GLuint cva_state_change; /* state flags - recalc cva buffer */
|
||||
GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */
|
||||
GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */
|
||||
GLuint active; /* VERT flags */
|
||||
GLuint inputs; /* VERT flags */
|
||||
GLuint outputs; /* VERT flags */
|
||||
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 *private;
|
||||
|
||||
/* 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 * );
|
||||
void (*run)( struct vertex_buffer *VB );
|
||||
|
||||
/* 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 state_change; /* state changes which require recalc */
|
||||
GLuint cva_state_change; /* ... which require re-run */
|
||||
GLuint forbidden_inputs; /* inputs which require recalc */
|
||||
GLuint ops; /* what gets done in this pipe */
|
||||
GLuint changed_ops;
|
||||
GLuint inputs;
|
||||
GLuint outputs;
|
||||
GLuint new_inputs;
|
||||
GLuint new_outputs;
|
||||
GLuint fallback;
|
||||
GLuint type;
|
||||
GLuint pipeline_valid:1;
|
||||
GLuint data_valid:1;
|
||||
GLuint copy_transformed_data:1;
|
||||
GLuint replay_copied_vertices:1;
|
||||
GLuint new_state; /* state changes since last recalc */
|
||||
struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES];
|
||||
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];
|
||||
GLuint nr_stages;
|
||||
};
|
||||
|
||||
|
||||
struct tnl_eval_store {
|
||||
GLuint EvalMap1Flags;
|
||||
GLuint EvalMap2Flags;
|
||||
GLuint EvalNewState;
|
||||
|
||||
/* All fields are derived.
|
||||
*/
|
||||
struct gl_cva {
|
||||
struct gl_pipeline pre;
|
||||
struct gl_pipeline elt;
|
||||
|
||||
struct gl_client_array Elt;
|
||||
trans_1ui_func EltFunc;
|
||||
|
||||
struct vertex_buffer *VB;
|
||||
struct vertex_arrays v;
|
||||
struct vertex_data store;
|
||||
|
||||
GLuint elt_count;
|
||||
GLenum elt_mode;
|
||||
GLuint elt_size;
|
||||
|
||||
GLuint forbidden_inputs;
|
||||
GLuint orflag;
|
||||
GLuint merge;
|
||||
|
||||
GLuint locked;
|
||||
GLuint lock_changed;
|
||||
GLuint last_orflag;
|
||||
GLuint last_array_flags;
|
||||
GLuint last_array_new_state;
|
||||
GLfloat Obj[IMM_SIZE][4];
|
||||
GLfloat TexCoord[IMM_SIZE][4];
|
||||
GLfloat Normal[IMM_SIZE][3];
|
||||
GLchan Color[IMM_SIZE][4];
|
||||
GLuint Index[IMM_SIZE];
|
||||
GLuint Flag[IMM_SIZE];
|
||||
GLuint Elts[IMM_SIZE];
|
||||
};
|
||||
|
||||
/* These are used to make the ctx->Current values look like
|
||||
* arrays (with zero StrideB).
|
||||
*/
|
||||
struct gl_fallback_arrays {
|
||||
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;
|
||||
};
|
||||
typedef struct {
|
||||
|
||||
|
||||
|
||||
typedef void (*texgen_func)( struct vertex_buffer *VB,
|
||||
GLuint textureSet);
|
||||
|
||||
|
||||
|
||||
typedef struct tnl_context {
|
||||
|
||||
GLuint _ArrayFlag[VB_SIZE]; /* crock */
|
||||
GLuint _ArrayFlags;
|
||||
GLuint _ArraySummary; /* Like flags, but no size information */
|
||||
GLuint _ArrayNewState; /* Tracks which arrays have been changed. */
|
||||
GLuint _ArrayTex3Flag;
|
||||
GLuint _ArrayTex4Flag;
|
||||
|
||||
|
||||
/* Pipeline stages - shared between the two pipelines,
|
||||
* which live in CVA.
|
||||
/* Track whether the module is active.
|
||||
*/
|
||||
struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES];
|
||||
GLuint NrPipelineStages;
|
||||
|
||||
/* Per-texunit derived state.
|
||||
*/
|
||||
GLuint _TexgenSize[MAX_TEXTURE_UNITS];
|
||||
GLuint _TexgenHoles[MAX_TEXTURE_UNITS];
|
||||
texgen_func *_TexgenFunc[MAX_TEXTURE_UNITS];
|
||||
|
||||
GLboolean bound_exec;
|
||||
|
||||
/* Display list extensions
|
||||
*/
|
||||
GLuint opcode_vertex_cassette;
|
||||
|
||||
/* Cva
|
||||
/* Pipeline
|
||||
*/
|
||||
struct gl_cva CVA;
|
||||
GLboolean CompileCVAFlag;
|
||||
struct gl_pipeline pipeline;
|
||||
struct vertex_buffer vb;
|
||||
|
||||
clip_poly_func *_poly_clip_tab;
|
||||
clip_line_func *_line_clip_tab;
|
||||
clip_interp_func _ClipInterpFunc; /* Clip interpolation function */
|
||||
normal_func *_NormalTransform;
|
||||
shade_func *_shade_func_tab; /* Current shading function table */
|
||||
/* GLvectors for binding to vb:
|
||||
*/
|
||||
struct vertex_arrays imm_inputs;
|
||||
struct vertex_arrays array_inputs;
|
||||
GLuint *tmp_primitive;
|
||||
GLuint *tmp_primitive_length;
|
||||
|
||||
GLenum _CurrentPrimitive; /* Prim or GL_POLYGON+1 */
|
||||
GLuint _CurrentTex3Flag;
|
||||
GLuint _CurrentTex4Flag;
|
||||
/* Set when executing an internally generated immediate.
|
||||
*/
|
||||
GLboolean ReplayHardBeginEnd;
|
||||
GLenum CurrentPrimitive;
|
||||
|
||||
GLboolean _ReplayHardBeginEnd; /* Display list execution of rect, etc */
|
||||
/* 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 _RenderFlags; /* Active inputs to render stage */
|
||||
GLuint DlistPrimitive;
|
||||
GLuint DlistPrimitiveLength;
|
||||
GLuint DlistLastPrimitive;
|
||||
|
||||
/* Cache of unused immediate structs */
|
||||
struct immediate *freed_im_queue;
|
||||
GLuint nr_im_queued;
|
||||
|
||||
struct gl_fallback_arrays Fallback;
|
||||
/* 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;
|
||||
|
||||
} TNLcontext;
|
||||
|
|
@ -598,19 +418,15 @@ typedef struct tnl_context {
|
|||
|
||||
#define TNL_CONTEXT(ctx) ((TNLcontext *)(ctx->swtnl_context))
|
||||
#define TNL_CURRENT_IM(ctx) ((struct immediate *)(ctx->swtnl_im))
|
||||
#define TNL_VB(ctx) ((struct vertex_buffer *)(ctx->swtnl_vb))
|
||||
|
||||
extern GLboolean _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags );
|
||||
|
||||
|
||||
extern void
|
||||
_tnl_MakeCurrent( GLcontext *ctx,
|
||||
GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer );
|
||||
#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 );
|
||||
|
||||
extern void
|
||||
_tnl_LightingSpaceChange( GLcontext *ctx );
|
||||
|
||||
/*
|
||||
* Macros for fetching current input buffer.
|
||||
|
|
@ -628,4 +444,5 @@ do { \
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
209
src/mesa/tnl/t_eval_api.c
Normal file
209
src/mesa/tnl/t_eval_api.c
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/* $Id: t_eval_api.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include "glheader.h"
|
||||
#include "colormac.h"
|
||||
#include "context.h"
|
||||
#include "macros.h"
|
||||
#include "mem.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);
|
||||
|
||||
switch (mode) {
|
||||
case GL_POINT:
|
||||
prim = GL_POINTS;
|
||||
break;
|
||||
case GL_LINE:
|
||||
prim = GL_LINE_STRIP;
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* No effect if vertex maps disabled.
|
||||
*/
|
||||
if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3)
|
||||
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.
|
||||
*/
|
||||
{
|
||||
GLboolean compiling = ctx->CompileFlag;
|
||||
struct immediate *im = TNL_CURRENT_IM(ctx);
|
||||
|
||||
if (compiling) {
|
||||
FLUSH_VERTICES( ctx, 0 );
|
||||
SET_IMMEDIATE( ctx, _tnl_alloc_immediate( ctx ) );
|
||||
ctx->CompileFlag = GL_FALSE;
|
||||
}
|
||||
|
||||
_tnl_begin( ctx, prim );
|
||||
for (i=i1;i<=i2;i++,u+=du) {
|
||||
_tnl_eval_coord1f( ctx, u );
|
||||
}
|
||||
_tnl_end(ctx);
|
||||
|
||||
if (compiling) {
|
||||
FLUSH_VERTICES( ctx, 0 );
|
||||
ASSERT( TNL_CURRENT_IM(ctx)->ref_count == 0 );
|
||||
_tnl_free_immediate( 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);
|
||||
|
||||
/* No effect if vertex maps disabled.
|
||||
*/
|
||||
if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3)
|
||||
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);
|
||||
|
||||
if (compiling) {
|
||||
FLUSH_VERTICES( ctx, 0 );
|
||||
SET_IMMEDIATE( ctx, _tnl_alloc_immediate( ctx ) );
|
||||
ctx->CompileFlag = GL_FALSE;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case GL_POINT:
|
||||
_tnl_begin( ctx, 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( ctx, 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( ctx, 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( ctx, 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:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (compiling) {
|
||||
FLUSH_VERTICES( ctx, 0 );
|
||||
_tnl_free_immediate( 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;
|
||||
}
|
||||
44
src/mesa/tnl/t_eval_api.h
Normal file
44
src/mesa/tnl/t_eval_api.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* $Id: t_eval_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#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
|
||||
104
src/mesa/tnl/t_imm_alloc.c
Normal file
104
src/mesa/tnl/t_imm_alloc.c
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/* $Id: t_imm_alloc.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keithw@valinux.com>
|
||||
*/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "mem.h"
|
||||
#include "mtypes.h"
|
||||
|
||||
#include "t_imm_alloc.h"
|
||||
|
||||
|
||||
|
||||
struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
|
||||
{
|
||||
static int id = 0;
|
||||
struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 );
|
||||
GLuint j;
|
||||
|
||||
if (!IM)
|
||||
return 0;
|
||||
|
||||
IM->id = id++;
|
||||
IM->ref_count = 0;
|
||||
IM->backref = ctx;
|
||||
IM->NormalLengths = 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->CopyTexSize = 0;
|
||||
IM->CopyStart = IM->Start;
|
||||
|
||||
|
||||
/* TexCoord0 is special.
|
||||
*/
|
||||
IM->TexCoord[0] = IM->TexCoord0;
|
||||
|
||||
for (j = 1; j < ctx->Const.MaxTextureUnits; j++)
|
||||
IM->TexCoord[j] = ALIGN_MALLOC( IMM_SIZE * sizeof(GLfloat) * 4, 32 );
|
||||
|
||||
/* KW: Removed initialization of normals as these are now treated
|
||||
* identically to all other data types.
|
||||
*/
|
||||
|
||||
MEMSET(IM->Flag, 0, sizeof(IM->Flag));
|
||||
|
||||
return IM;
|
||||
}
|
||||
|
||||
|
||||
void _tnl_free_immediate( struct immediate *IM )
|
||||
{
|
||||
GLuint j;
|
||||
|
||||
if (IM->NormalLengths) {
|
||||
FREE( IM->NormalLengths );
|
||||
IM->NormalLengths = 0;
|
||||
}
|
||||
|
||||
if (IM->Material) {
|
||||
FREE( IM->Material );
|
||||
FREE( IM->MaterialMask );
|
||||
IM->Material = 0;
|
||||
IM->MaterialMask = 0;
|
||||
|
||||
for (j = 1; j < IM->MaxTextureUnits; j++)
|
||||
ALIGN_FREE( IM->TexCoord[j] );
|
||||
}
|
||||
|
||||
ALIGN_FREE( IM );
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
src/mesa/tnl/t_imm_alloc.h
Normal file
40
src/mesa/tnl/t_imm_alloc.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* $Id: t_imm_alloc.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#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( struct immediate *im );
|
||||
|
||||
|
||||
#endif
|
||||
1398
src/mesa/tnl/t_imm_api.c
Normal file
1398
src/mesa/tnl/t_imm_api.c
Normal file
File diff suppressed because it is too large
Load diff
50
src/mesa/tnl/t_imm_api.h
Normal file
50
src/mesa/tnl/t_imm_api.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* $Id: t_imm_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _T_VTXFMT_H
|
||||
#define _T_VTXFMT_H
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "t_context.h"
|
||||
|
||||
|
||||
/* TNL-private internal functions for building higher-level operations:
|
||||
*/
|
||||
extern void _tnl_begin( GLcontext *ctx, GLenum p );
|
||||
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
|
||||
169
src/mesa/tnl/t_imm_debug.c
Normal file
169
src/mesa/tnl/t_imm_debug.c
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
/* $Id: t_imm_debug.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "t_context.h"
|
||||
#include "t_imm_debug.h"
|
||||
|
||||
void _tnl_print_vert_flags( const char *name, GLuint flags )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%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_CLIP) ? "clip/proj-clip/glend, " : "",
|
||||
(flags & VERT_EDGE) ? "edgeflag, " : "",
|
||||
(flags & VERT_ELT) ? "array-elt, " : "",
|
||||
(flags & VERT_END_VB) ? "end-vb, " : "",
|
||||
(flags & VERT_EVAL_ANY) ? "eval-coord, " : "",
|
||||
(flags & VERT_EYE) ? "eye/glbegin, " : "",
|
||||
(flags & VERT_FOG_COORD) ? "fog-coord, " : "",
|
||||
(flags & VERT_INDEX) ? "index, " : "",
|
||||
(flags & VERT_MATERIAL) ? "material, " : "",
|
||||
(flags & VERT_NORM) ? "normals, " : "",
|
||||
(flags & VERT_OBJ) ? "obj, " : "",
|
||||
(flags & VERT_OBJ_3) ? "obj-3, " : "",
|
||||
(flags & VERT_OBJ_4) ? "obj-4, " : "",
|
||||
(flags & VERT_POINT_SIZE) ? "point-size, " : "",
|
||||
(flags & VERT_RGBA) ? "colors, " : "",
|
||||
(flags & VERT_SPEC_RGB) ? "specular, " : "",
|
||||
(flags & VERT_TEX0) ? "texcoord0, " : "",
|
||||
(flags & VERT_TEX1) ? "texcoord1, " : "",
|
||||
(flags & VERT_TEX2) ? "texcoord2, " : "",
|
||||
(flags & VERT_TEX3) ? "texcoord3, " : "",
|
||||
(flags & VERT_TEX4) ? "texcoord4, " : "",
|
||||
(flags & VERT_TEX5) ? "texcoord5, " : "",
|
||||
(flags & VERT_TEX6) ? "texcoord6, " : "",
|
||||
(flags & VERT_TEX7) ? "texcoord7, " : ""
|
||||
);
|
||||
}
|
||||
|
||||
void _tnl_print_cassette( struct immediate *IM )
|
||||
{
|
||||
GLuint i;
|
||||
GLuint *flags = IM->Flag;
|
||||
GLuint andflag = IM->CopyAndFlag;
|
||||
GLuint orflag = IM->CopyOrFlag;
|
||||
GLuint state = IM->BeginState;
|
||||
GLuint req = ~0;
|
||||
|
||||
fprintf(stderr, "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);
|
||||
|
||||
fprintf(stderr, "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++) {
|
||||
fprintf(stderr, "%u: ", i);
|
||||
if (req & VERT_OBJ_234) {
|
||||
if (flags[i] & VERT_EVAL_C1)
|
||||
fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]);
|
||||
else if (flags[i] & VERT_EVAL_P1)
|
||||
fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]);
|
||||
else if (flags[i] & VERT_EVAL_C2)
|
||||
fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]);
|
||||
else if (flags[i] & VERT_EVAL_P2)
|
||||
fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]);
|
||||
else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) {
|
||||
fprintf(stderr, "Obj %f %f %f %f",
|
||||
IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]);
|
||||
}
|
||||
}
|
||||
|
||||
if (req & flags[i] & VERT_ELT)
|
||||
fprintf(stderr, " Elt %u\t", IM->Elt[i]);
|
||||
|
||||
if (req & flags[i] & VERT_NORM)
|
||||
fprintf(stderr, " Norm %f %f %f ",
|
||||
IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]);
|
||||
|
||||
if (req & flags[i] & VERT_TEX_ANY) {
|
||||
GLuint j;
|
||||
for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) {
|
||||
if (req & flags[i] & VERT_TEX(j)) {
|
||||
fprintf(stderr,
|
||||
"TC%d %f %f %f %f",
|
||||
j,
|
||||
IM->TexCoord[j][i][0], IM->TexCoord[j][i][1],
|
||||
IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (req & flags[i] & VERT_RGBA)
|
||||
fprintf(stderr, " Rgba %d %d %d %d ",
|
||||
IM->Color[i][0], IM->Color[i][1],
|
||||
IM->Color[i][2], IM->Color[i][3]);
|
||||
|
||||
if (req & flags[i] & VERT_SPEC_RGB)
|
||||
fprintf(stderr, " Spec %d %d %d ",
|
||||
IM->SecondaryColor[i][0], IM->SecondaryColor[i][1],
|
||||
IM->SecondaryColor[i][2]);
|
||||
|
||||
if (req & flags[i] & VERT_FOG_COORD)
|
||||
fprintf(stderr, " Fog %f ", IM->FogCoord[i]);
|
||||
|
||||
if (req & flags[i] & VERT_INDEX)
|
||||
fprintf(stderr, " Index %u ", IM->Index[i]);
|
||||
|
||||
if (req & flags[i] & VERT_EDGE)
|
||||
fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]);
|
||||
|
||||
if (req & flags[i] & VERT_MATERIAL)
|
||||
fprintf(stderr, " 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_END)
|
||||
fprintf(stderr, " END ");
|
||||
|
||||
if (req & flags[i] & VERT_BEGIN)
|
||||
fprintf(stderr, " 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," : "");
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
11
src/mesa/tnl/t_imm_debug.h
Normal file
11
src/mesa/tnl/t_imm_debug.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
#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
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue