}
}
+ (void) caveat;
+
/*
* Since we're only simulating the GLX extension this function will never
* find any real GL visuals. Instead, all we can do is try to find an RGB
}
}
+ /* not used at this time */
+ (void) useLargest;
+ (void) preserveContents;
+
if (width == 0 || height == 0)
return 0;
}
}
+ /* not used at this time */
+ (void) useLargest;
+ (void) preserveContents;
+
xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
/* A GLXPbuffer handle must be an X Drawable because that's what
* glXMakeCurrent takes.
static GLboolean setup_dithered_color( int client, XMesaVisual v,
XMesaBuffer buffer, XMesaColormap cmap )
{
+ (void) DitherValues; /* silence warning */
+
if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) {
return GL_FALSE;
}
else if (bufferBit == BACK_LEFT_BIT) {
ASSERT(target->db_state);
if (target->backpixmap) {
- /* back buffer is a pixmape */
- target->buffer = target->backpixmap; /* incompatible types? */
+ /* back buffer is a pixmap */
+ target->buffer = (XMesaDrawable) target->backpixmap;
}
else if (target->backimage) {
/* back buffer is an XImage */
const GLubyte r = xmesa->clearcolor[0];
const GLubyte g = xmesa->clearcolor[1];
const GLubyte b = xmesa->clearcolor[2];
+#if 0 /* See below */
register GLuint clearPixel;
if (xmesa->swapbytes) {
clearPixel = (b << 16) | (g << 8) | r;
else {
clearPixel = (r << 16) | (g << 8) | b;
}
+#endif
if (all) {
if (r==g && g==b) {
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
{
GLint baseFormat;
- GLint i, components;
+ GLint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
return;
}
- components = _mesa_components_in_format(format);
- assert(components > 0); /* this should have been caught earlier */
+ /* this should have been caught earlier */
+ assert(_mesa_components_in_format(format));
ctx->Convolution2D.Format = format;
ctx->Convolution2D.InternalFormat = internalFormat;
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_convolution_attrib *conv;
GLuint c;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
c = 0;
- conv = &ctx->Convolution1D;
break;
case GL_CONVOLUTION_2D:
c = 1;
- conv = &ctx->Convolution2D;
break;
case GL_SEPARABLE_2D:
c = 2;
- conv = &ctx->Separable2D;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)");
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_convolution_attrib *conv;
GLuint c;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
c = 0;
- conv = &ctx->Convolution1D;
break;
case GL_CONVOLUTION_2D:
c = 1;
- conv = &ctx->Convolution2D;
break;
case GL_SEPARABLE_2D:
c = 2;
- conv = &ctx->Separable2D;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)");
#include "mtypes.h"
-#define F(x) (int)&(((struct gl_extensions *)0)->x)
+#define F(x) (int)(unsigned long)&(((struct gl_extensions *)0)->x)
#define ON GL_TRUE
#define OFF GL_FALSE
GLint xoffset, GLint x, GLint y, GLsizei width )
{
struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
return;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
ASSERT(texImage);
GLint x, GLint y, GLsizei width, GLsizei height )
{
struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
return;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
ASSERT(texImage);
GLint x, GLint y, GLsizei width, GLsizei height )
{
struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
return;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
ASSERT(texImage);
GLsizei height, GLsizei depth, GLint border,
GLsizei imageSize)
{
- GLboolean isProxy = GL_FALSE;
GLint expectedSize, maxLevels = 0, maxTextureSize;
if (dimensions == 1) {
else if (dimensions == 2) {
if (target == GL_PROXY_TEXTURE_2D) {
maxLevels = ctx->Const.MaxTextureLevels;
- isProxy = GL_TRUE;
}
else if (target == GL_TEXTURE_2D) {
maxLevels = ctx->Const.MaxTextureLevels;
if (!ctx->Extensions.ARB_texture_cube_map)
return GL_INVALID_ENUM; /*target*/
maxLevels = ctx->Const.MaxCubeTextureLevels;
- isProxy = GL_TRUE;
}
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLsizei imageSize)
{
- GLboolean isProxy = GL_FALSE;
GLint expectedSize, maxLevels = 0, maxTextureSize;
if (dimensions == 1) {
else if (dimensions == 2) {
if (target == GL_PROXY_TEXTURE_2D) {
maxLevels = ctx->Const.MaxTextureLevels;
- isProxy = GL_TRUE;
}
else if (target == GL_TEXTURE_2D) {
maxLevels = ctx->Const.MaxTextureLevels;
if (!ctx->Extensions.ARB_texture_cube_map)
return GL_INVALID_ENUM; /*target*/
maxLevels = ctx->Const.MaxCubeTextureLevels;
- isProxy = GL_TRUE;
}
else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
error = compressed_subtexture_error_check(ctx, 2, target, level,
xoffset, yoffset, 0, width, height, 1, format, imageSize);
if (error) {
+ /* XXX proxy target? */
_mesa_error(ctx, error, "glCompressedTexSubImage2D");
return;
}
srcPacking, srcAddr,
dstAddr);
assert(b);
+ (void) b;
}
else if (dimensions == 2) {
GLboolean b;
srcPacking, srcAddr,
dstAddr);
assert(b);
+ (void) b;
}
else {
GLboolean b;
srcFormat, srcType,
srcPacking, srcAddr, dstAddr);
assert(b);
+ (void) b;
}
}
else {
DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage +
(convert->yoffset * convert->dstImageWidth +
convert->xoffset) * DST_TEXEL_BYTES);
- GLint adjust;
- GLint row, col = 0;
- (void) col;
-
- adjust = convert->dstImageWidth - convert->width;
+ GLint row;
+#ifndef CONVERT_DIRECT
+ GLint adjust = convert->dstImageWidth - convert->width;
+#endif
#if DEBUG_TEXUTIL
_mesa_debug( NULL, __FUNCTION__ ":\n" );
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n",
convert->xoffset, convert->yoffset, convert->width,
convert->height, convert->dstImageWidth );
- _mesa_debug( NULL, " adjust=%d\n", adjust );
#endif
for ( row = 0 ; row < convert->height ; row++ ) {
dst += convert->dstImageWidth;
#else
const GLubyte *srcRow = src;
+ GLint col;
for ( col = 0 ; col < convert->width ; col++ ) {
CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
((convert->zoffset * convert->dstImageHeight +
convert->yoffset) * convert->dstImageWidth +
convert->xoffset) * DST_TEXEL_BYTES);
- GLint adjust;
- GLint row, col = 0, img;
- (void) col;
-
- adjust = convert->dstImageWidth - convert->width;
+ GLint row, img;
+#ifndef CONVERT_DIRECT
+ GLint adjust = convert->dstImageWidth - convert->width;
+#endif
#if DEBUG_TEXUTIL
_mesa_debug( NULL, __FUNCTION__ ":\n" );
_mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n",
convert->xoffset, convert->yoffset, convert->width,
convert->height, convert->dstImageWidth );
- _mesa_debug( NULL, " adjust=%d\n", adjust );
#endif
for ( img = 0 ; img < convert->depth ; img++ ) {
dst += convert->dstImageWidth;
#else
const GLubyte *srcRow = src;
+ GLint col;
for ( col = 0 ; col < convert->width ; col++ ) {
CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
GLint skipPixels = unpack->SkipPixels;
GLint skipRows = unpack->SkipRows;
GLint rowLength;
- GLdepth zSpan[MAX_WIDTH]; /* only used when zooming */
GLint zoomY0 = 0;
if (unpack->RowLength > 0)
return GL_TRUE;
}
else {
- /* setup array of fragment Z value to pass to zoom function */
- GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF);
- GLint i;
if (drawWidth > MAX_WIDTH)
return GL_FALSE; /* fall back to general case path */
- for (i=0; i<drawWidth; i++)
- zSpan[i] = z;
/* save Y value of first row */
zoomY0 = IROUND(ctx->Current.RasterPos[1]);
#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE)
GLfloat size;
#endif
-#if FLAGS & ATTENUATE
+#if FLAGS & RGBA
+#if (FLAGS & ATTENUATE) && (FLAGS & SMOOTH)
GLfloat alphaAtten;
#endif
-#if FLAGS & RGBA
const GLchan red = vert->color[0];
const GLchan green = vert->color[1];
const GLchan blue = vert->color[2];
#if FLAGS & ATTENUATE
if (vert->pointSize >= ctx->Point.Threshold) {
size = MIN2(vert->pointSize, ctx->Point.MaxSize);
+#if (FLAGS & RGBA) && (FLAGS & SMOOTH)
alphaAtten = 1.0F;
+#endif
}
else {
+#if (FLAGS & RGBA) && (FLAGS & SMOOTH)
GLfloat dsize = vert->pointSize / ctx->Point.Threshold;
- size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
alphaAtten = dsize * dsize;
+#endif
+ size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
}
#elif FLAGS & (LARGE | SMOOTH | SPRITE)
size = ctx->Point._Size;
GLuint changed_state = pipe->run_state_changes;
GLuint changed_inputs = pipe->run_input_changes;
GLboolean running = GL_TRUE;
+#ifdef HAVE_FAST_MATH
unsigned short __tmp;
+#endif
pipe->run_state_changes = 0;
pipe->run_input_changes = 0;
*/
ASSERT(pipe->build_state_changes == 0);
+#ifdef HAVE_FAST_MATH
START_FAST_MATH(__tmp);
+#endif
/* If something changes in the pipeline, tag all subsequent stages
* using this value for recalculation. Inactive stages have their
}
}
+#ifdef HAVE_FAST_MATH
END_FAST_MATH(__tmp);
+#endif
}
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
- GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
+#if IDX & LIGHT_TWOSIDE
+ GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data;
+#endif
const GLuint nr = VB->Count;
VB->SecondaryColorPtr[0] = &store->LitSecondary[0];
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE) {
- VB->ColorPtr[1] = &store->LitColor[1];
- VB->SecondaryColorPtr[1] = &store->LitSecondary[1];
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
+#if IDX & LIGHT_TWOSIDE
+ VB->ColorPtr[1] = &store->LitColor[1];
+ VB->SecondaryColorPtr[1] = &store->LitSecondary[1];
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
/* Side-effects done, can we finish now?
*/
GLfloat sum[2][3], spec[2][3];
struct gl_light *light;
- if ( IDX & LIGHT_MATERIAL ) {
- update_materials( ctx, store );
- sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE)
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
+#if IDX & LIGHT_MATERIAL
+ update_materials( ctx, store );
+ sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
+#endif
COPY_3V(sum[0], base[0]);
ZERO_3V(spec[0]);
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V(sum[1], base[1]);
- ZERO_3V(spec[1]);
- }
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(sum[1], base[1]);
+ ZERO_3V(spec[1]);
+#endif
/* Add contribution from each enabled light source */
foreach (light, &ctx->Light.EnabledList) {
/* Which side gets the diffuse & specular terms? */
if (n_dot_VP < 0.0F) {
ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
- if (!(IDX & LIGHT_TWOSIDE)) {
- continue;
- }
+#if IDX & LIGHT_TWOSIDE
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
+#else
+ continue;
+#endif
}
else {
- if (IDX & LIGHT_TWOSIDE) {
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
- }
+#if IDX & LIGHT_TWOSIDE
+ ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+#endif
side = 0;
correction = 1;
}
COPY_3V( Fspec[j], spec[0] );
Fcolor[j][3] = sumA[0];
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V( Bcolor[j], sum[1] );
- COPY_3V( Bspec[j], spec[1] );
- Bcolor[j][3] = sumA[1];
- }
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ COPY_3V( Bspec[j], spec[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
}
}
VB->ColorPtr[0] = &store->LitColor[0];
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE) {
- VB->ColorPtr[1] = &store->LitColor[1];
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
+#if IDX & LIGHT_TWOSIDE
+ VB->ColorPtr[1] = &store->LitColor[1];
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
if (stage->changed_inputs == 0)
return;
if ( IDX & LIGHT_MATERIAL ) {
update_materials( ctx, store );
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE)
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
}
COPY_3V(sum[0], base[0]);
/* which side are we lighting? */
if (n_dot_VP < 0.0F) {
ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]);
-
- if (!(IDX & LIGHT_TWOSIDE))
- continue;
-
+#if IDX & LIGHT_TWOSIDE
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
+#else
+ continue;
+#endif
}
else {
- if (IDX & LIGHT_TWOSIDE) {
- ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
- }
+#if IDX & LIGHT_TWOSIDE
+ ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]);
+#endif
side = 0;
correction = 1;
}
COPY_3V( Fcolor[j], sum[0] );
Fcolor[j][3] = sumA[0];
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
- }
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
}
}
const GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+#if IDX & LIGHT_TWOSIDE
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+#endif
const struct gl_light *light = ctx->Light.EnabledList.next;
GLuint j = 0;
GLfloat base[2][3];
(void) nstride;
VB->ColorPtr[0] = &store->LitColor[0];
- if (IDX & LIGHT_TWOSIDE)
- VB->ColorPtr[1] = &store->LitColor[1];
+#if IDX & LIGHT_TWOSIDE
+ VB->ColorPtr[1] = &store->LitColor[1];
+#endif
if (stage->changed_inputs == 0)
return;
ACC_3V(base[0], ctx->Light._BaseColor[0] );
base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V(base[1], light->_MatAmbient[1]);
- ACC_3V(base[1], ctx->Light._BaseColor[1]);
- base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(base[1], light->_MatAmbient[1]);
+ ACC_3V(base[1], ctx->Light._BaseColor[1]);
+ base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
}
n_dot_VP = DOT3(normal, light->_VP_inf_norm);
if (n_dot_VP < 0.0F) {
- if (IDX & LIGHT_TWOSIDE) {
- GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
- GLfloat sum[3];
- COPY_3V(sum, base[1]);
- ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
- if (n_dot_h > 0.0F) {
- GLfloat spec;
- GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
- ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
- }
- COPY_3V(Bcolor[j], sum );
- Bcolor[j][3] = base[1][3];
- }
+#if IDX & LIGHT_TWOSIDE
+ GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm);
+ GLfloat sum[3];
+ COPY_3V(sum, base[1]);
+ ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]);
+ if (n_dot_h > 0.0F) {
+ GLfloat spec;
+ GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec );
+ ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]);
+ }
+ COPY_3V(Bcolor[j], sum );
+ Bcolor[j][3] = base[1][3];
+#endif
COPY_4FV(Fcolor[j], base[0]);
}
else {
}
COPY_3V(Fcolor[j], sum );
Fcolor[j][3] = base[0][3];
- if (IDX & LIGHT_TWOSIDE) COPY_4FV(Bcolor[j], base[1]);
+#if IDX & LIGHT_TWOSIDE
+ COPY_4FV(Bcolor[j], base[1]);
+#endif
}
}
}
const GLuint nstride = VB->NormalPtr->stride;
const GLfloat *normal = (GLfloat *)VB->NormalPtr->data;
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
+#if IDX & LIGHT_TWOSIDE
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
+#endif
GLuint j = 0;
const GLuint nr = VB->Count;
const struct gl_light *light;
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
VB->ColorPtr[0] = &store->LitColor[0];
- if (IDX & LIGHT_TWOSIDE)
- VB->ColorPtr[1] = &store->LitColor[1];
+#if IDX & LIGHT_TWOSIDE
+ VB->ColorPtr[1] = &store->LitColor[1];
+#endif
if (stage->changed_inputs == 0)
return;
update_materials( ctx, store );
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
- if (IDX & LIGHT_TWOSIDE)
- sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#if IDX & LIGHT_TWOSIDE
+ sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
+#endif
}
COPY_3V(sum[0], ctx->Light._BaseColor[0]);
- if (IDX & LIGHT_TWOSIDE)
- COPY_3V(sum[1], ctx->Light._BaseColor[1]);
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V(sum[1], ctx->Light._BaseColor[1]);
+#endif
foreach (light, &ctx->Light.EnabledList) {
GLfloat n_dot_h, n_dot_VP, spec;
ACC_3V(sum[0], light->_MatAmbient[0]);
- if (IDX & LIGHT_TWOSIDE)
- ACC_3V(sum[1], light->_MatAmbient[1]);
+#if IDX & LIGHT_TWOSIDE
+ ACC_3V(sum[1], light->_MatAmbient[1]);
+#endif
n_dot_VP = DOT3(normal, light->_VP_inf_norm);
ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]);
}
}
- else if (IDX & LIGHT_TWOSIDE) {
+#if IDX & LIGHT_TWOSIDE
+ else {
ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]);
n_dot_h = -DOT3(normal, light->_h_inf_norm);
if (n_dot_h > 0.0F) {
ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]);
}
}
+#endif
}
COPY_3V( Fcolor[j], sum[0] );
Fcolor[j][3] = sumA[0];
- if (IDX & LIGHT_TWOSIDE) {
- COPY_3V( Bcolor[j], sum[1] );
- Bcolor[j][3] = sumA[1];
- }
+#if IDX & LIGHT_TWOSIDE
+ COPY_3V( Bcolor[j], sum[1] );
+ Bcolor[j][3] = sumA[1];
+#endif
}
}
(void) vstride;
VB->IndexPtr[0] = &store->LitIndex[0];
- if (IDX & LIGHT_TWOSIDE)
- VB->IndexPtr[1] = &store->LitIndex[1];
+#if IDX & LIGHT_TWOSIDE
+ VB->IndexPtr[1] = &store->LitIndex[1];
+#endif
if (stage->changed_inputs == 0)
return;
indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data;
- if (IDX & LIGHT_TWOSIDE)
- indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data;
+#if IDX & LIGHT_TWOSIDE
+ indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data;
+#endif
/* loop over vertices */
for (j=0; j<nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal, nstride)) {
/* which side are we lighting? */
if (n_dot_VP < 0.0F) {
- if (!(IDX & LIGHT_TWOSIDE))
- continue;
+#if IDX & LIGHT_TWOSIDE
side = 1;
correction = -1;
n_dot_VP = -n_dot_VP;
+#else
+ continue;
+#endif
}
/* accumulate diffuse term */
#endif
#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__))
-#define CONCAT(x, y) x ## y
+#define CONCAT(x, y) x ## y
+#define CONCAT3(x, y, z) x ## y ## z
#else
-#define CONCAT(x, y) x/**/y
+#define CONCAT(x, y) x/**/y
+#define CONCAT3(x, y, z) x/**/y/**/z
#endif
#ifdef ACK_ASSEMBLER
#define P_XMM6 xmm6
#define P_XMM7 xmm7
-#define CONCAT(x, y) x ## y
+#define CONCAT(x, y) x ## y
+#define CONCAT3(x, y, z) x ## y ## z
#if defined(NASM_ASSEMBLER)
/* Added by BrianP for FreeBSD (per David Dawes) */
#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__)
#define LLBL(a) CONCAT(.L,a)
+#define LLBL2(a,b) CONCAT3(.L,a,b)
#else
#define LLBL(a) a
+#define LLBL2(a,b) CONCAT(a,b)
#endif
/* Segment overrides */
/* Blend transparency function
*/
-#define TAG(x) x##_transparency
+#define TAG(x) CONCAT(x,_transparency)
+#define LLTAG(x) LLBL2(x,_transparency)
#define INIT \
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */
* FIXME: Add some loop unrolling here...
*/
-#define TAG(x) x##_add
+#define TAG(x) CONCAT(x,_add)
+#define LLTAG(x) LLBL2(x,_add)
#define INIT
/* Blend min function
*/
-#define TAG(x) x##_min
+#define TAG(x) CONCAT(x,_min)
+#define LLTAG(x) LLBL2(x,_min)
#define INIT \
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
/* Blend max function
*/
-#define TAG(x) x##_max
+#define TAG(x) CONCAT(x,_max)
+#define LLTAG(x) LLBL2(x,_max)
#define INIT \
MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/
/* Blend modulate function
*/
-#define TAG(x) x##_modulate
+#define TAG(x) CONCAT(x,_modulate)
+#define LLTAG(x) LLBL2(x,_modulate)
#define INIT \
PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\
MOV_L ( REGOFF(12, EBP), ECX ) /* n */
CMP_L ( CONST(0), ECX)
- JE ( LLBL ( TAG(GMB_return) ) )
+ JE ( LLTAG(GMB_return) )
MOV_L ( REGOFF(16, EBP), EBX ) /* mask */
MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */
INIT
TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */
- JZ ( LLBL ( TAG(GMB_align_end) ) )
+ JZ ( LLTAG(GMB_align_end) )
CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */
- JE ( LLBL ( TAG(GMB_align_continue) ) )
+ JE ( LLTAG(GMB_align_continue) )
/* runin */
#define ONE(x) x
#undef ONE
#undef TWO
-LLBL ( TAG(GMB_align_continue) ):
+LLTAG(GMB_align_continue):
DEC_L ( ECX ) /* n -= 1 */
INC_L ( EBX ) /* mask += 1 */
ADD_L ( CONST(4), EDI ) /* rgba += 1 */
ADD_L ( CONST(4), ESI ) /* dest += 1 */
-LLBL ( TAG(GMB_align_end) ):
+LLTAG(GMB_align_end):
CMP_L ( CONST(2), ECX)
- JB ( LLBL ( TAG(GMB_loop_end) ) )
+ JB ( LLTAG(GMB_loop_end) )
ALIGNTEXT16
-LLBL ( TAG(GMB_loop_begin) ):
+LLTAG(GMB_loop_begin):
CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */
- JE ( LLBL ( TAG(GMB_loop_continue) ) )
+ JE ( LLTAG(GMB_loop_continue) )
/* main loop */
#define ONE(x)
#undef ONE
#undef TWO
-LLBL ( TAG(GMB_loop_continue) ):
+LLTAG(GMB_loop_continue):
DEC_L ( ECX )
DEC_L ( ECX ) /* n -= 2 */
ADD_L ( CONST(8), EDI ) /* rgba += 2 */
ADD_L ( CONST(8), ESI ) /* dest += 2 */
CMP_L ( CONST(2), ECX )
- JAE ( LLBL ( TAG(GMB_loop_begin) ) )
+ JAE ( LLTAG(GMB_loop_begin) )
-LLBL ( TAG(GMB_loop_end) ):
+LLTAG(GMB_loop_end):
CMP_L ( CONST(1), ECX )
- JB ( LLBL ( TAG(GMB_done) ) )
+ JB ( LLTAG(GMB_done) )
CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */
- JE ( LLBL ( TAG(GMB_done) ) )
+ JE ( LLTAG(GMB_done) )
/* runout */
#define ONE(x) x
#undef ONE
#undef TWO
-LLBL ( TAG(GMB_done) ):
+LLTAG(GMB_done):
EMMS
-LLBL ( TAG(GMB_return) ):
+LLTAG(GMB_return):
POP_L ( EBX )
POP_L ( EDI )
RET
#undef TAG
+#undef LLTAG
#undef INIT
#undef MAIN