@@ -1,4 +1,4 @@ | |||
/* $Id: stencil.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ | |||
/* $Id: stencil.c,v 1.7 1999/11/05 06:43:10 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -99,8 +99,8 @@ void gl_StencilFunc( GLcontext *ctx, GLenum func, GLint ref, GLuint mask ) | |||
} | |||
maxref = (1 << STENCIL_BITS) - 1; | |||
ctx->Stencil.Ref = CLAMP( ref, 0, maxref ); | |||
ctx->Stencil.ValueMask = mask; | |||
ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref ); | |||
ctx->Stencil.ValueMask = (GLstencil) mask; | |||
if (ctx->Driver.StencilFunc) { | |||
(*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask ); | |||
@@ -214,7 +214,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
{ | |||
const GLstencil ref = ctx->Stencil.Ref; | |||
const GLstencil wrtmask = ctx->Stencil.WriteMask; | |||
const GLstencil invmask = ~ctx->Stencil.WriteMask; | |||
const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask); | |||
GLstencil *stencil = STENCIL_ADDRESS( x, y ); | |||
GLuint i; | |||
@@ -233,7 +233,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
else { | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
stencil[i] = stencil[i] & invmask; | |||
stencil[i] = (GLstencil) (stencil[i] & invmask); | |||
} | |||
} | |||
} | |||
@@ -250,7 +250,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
stencil[i] = (invmask & s ) | (wrtmask & ref); | |||
stencil[i] = (GLstencil) ((invmask & s ) | (wrtmask & ref)); | |||
} | |||
} | |||
} | |||
@@ -261,7 +261,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
if (s < STENCIL_MAX) { | |||
stencil[i] = s+1; | |||
stencil[i] = (GLstencil) (s+1); | |||
} | |||
} | |||
} | |||
@@ -272,7 +272,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
/* VERIFY logic of adding 1 to a write-masked value */ | |||
GLstencil s = stencil[i]; | |||
if (s < STENCIL_MAX) { | |||
stencil[i] = (invmask & s) | (wrtmask & (s+1)); | |||
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1))); | |||
} | |||
} | |||
} | |||
@@ -284,7 +284,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
if (s>0) { | |||
stencil[i] = s-1; | |||
stencil[i] = (GLstencil) (s-1); | |||
} | |||
} | |||
} | |||
@@ -295,7 +295,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
/* VERIFY logic of subtracting 1 to a write-masked value */ | |||
GLstencil s = stencil[i]; | |||
if (s>0) { | |||
stencil[i] = (invmask & s) | (wrtmask & (s-1)); | |||
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); | |||
} | |||
} | |||
} | |||
@@ -313,7 +313,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
stencil[i] = (invmask & s) | (wrtmask & (stencil[i]+1)); | |||
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (stencil[i]+1))); | |||
} | |||
} | |||
} | |||
@@ -330,7 +330,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
stencil[i] = (invmask & s) | (wrtmask & (stencil[i]-1)); | |||
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (stencil[i]-1))); | |||
} | |||
} | |||
} | |||
@@ -348,7 +348,7 @@ static void apply_stencil_op_to_span( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil s = stencil[i]; | |||
stencil[i] = (invmask & s) | (wrtmask & ~s); | |||
stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & ~s)); | |||
} | |||
} | |||
} | |||
@@ -405,10 +405,10 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
allfail = 1; | |||
break; | |||
case GL_LESS: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r < s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -424,10 +424,10 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_LEQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r <= s) { | |||
/* pass */ | |||
fail[i] = 0; | |||
@@ -443,10 +443,10 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_GREATER: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r > s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -462,10 +462,10 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_GEQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r >= s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -481,10 +481,10 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_EQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r == s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -503,7 +503,7 @@ GLint gl_stencil_span( GLcontext *ctx, | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
s = stencil[i] & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); | |||
if (r != s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -611,7 +611,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
GLstencil wrtmask, invmask; | |||
wrtmask = ctx->Stencil.WriteMask; | |||
invmask = ~ctx->Stencil.WriteMask; | |||
invmask = (GLstencil) (~ctx->Stencil.WriteMask); | |||
ref = ctx->Stencil.Ref; | |||
@@ -632,7 +632,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = invmask & *sptr; | |||
*sptr = (GLstencil) (invmask & *sptr); | |||
} | |||
} | |||
} | |||
@@ -650,7 +650,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = (invmask & *sptr ) | (wrtmask & ref); | |||
*sptr = (GLstencil) ((invmask & *sptr ) | (wrtmask & ref)); | |||
} | |||
} | |||
} | |||
@@ -661,7 +661,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
if (*sptr < STENCIL_MAX) { | |||
*sptr = *sptr + 1; | |||
*sptr = (GLstencil) (*sptr + 1); | |||
} | |||
} | |||
} | |||
@@ -671,7 +671,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
if (*sptr < STENCIL_MAX) { | |||
*sptr = (invmask & *sptr) | (wrtmask & (*sptr+1)); | |||
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1))); | |||
} | |||
} | |||
} | |||
@@ -683,7 +683,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
if (*sptr>0) { | |||
*sptr = *sptr - 1; | |||
*sptr = (GLstencil) (*sptr - 1); | |||
} | |||
} | |||
} | |||
@@ -693,7 +693,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
if (*sptr>0) { | |||
*sptr = (invmask & *sptr) | (wrtmask & (*sptr-1)); | |||
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); | |||
} | |||
} | |||
} | |||
@@ -704,7 +704,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = *sptr + 1; | |||
*sptr = (GLstencil) (*sptr + 1); | |||
} | |||
} | |||
} | |||
@@ -712,7 +712,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = (invmask & *sptr) | (wrtmask & (*sptr+1)); | |||
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1))); | |||
} | |||
} | |||
} | |||
@@ -722,7 +722,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = *sptr - 1; | |||
*sptr = (GLstencil) (*sptr - 1); | |||
} | |||
} | |||
} | |||
@@ -730,7 +730,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = (invmask & *sptr) | (wrtmask & (*sptr-1)); | |||
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); | |||
} | |||
} | |||
} | |||
@@ -740,7 +740,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = ~*sptr; | |||
*sptr = (GLstencil) (~*sptr); | |||
} | |||
} | |||
} | |||
@@ -748,7 +748,7 @@ static void apply_stencil_op_to_pixels( GLcontext *ctx, | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); | |||
*sptr = (invmask & *sptr) | (wrtmask & ~*sptr); | |||
*sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & ~*sptr)); | |||
} | |||
} | |||
} | |||
@@ -803,11 +803,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
allfail = 1; | |||
break; | |||
case GL_LESS: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r < s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -823,11 +823,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_LEQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r <= s) { | |||
/* pass */ | |||
fail[i] = 0; | |||
@@ -843,11 +843,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_GREATER: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r > s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -863,11 +863,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_GEQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r >= s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -883,11 +883,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_EQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r == s) { | |||
/* passed */ | |||
fail[i] = 0; | |||
@@ -903,11 +903,11 @@ GLint gl_stencil_pixels( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_NOTEQUAL: | |||
r = ctx->Stencil.Ref & ctx->Stencil.ValueMask; | |||
r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); | |||
for (i=0;i<n;i++) { | |||
if (mask[i]) { | |||
GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); | |||
s = *sptr & ctx->Stencil.ValueMask; | |||
s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); | |||
if (r != s) { | |||
/* passed */ | |||
fail[i] = 0; |
@@ -1,4 +1,4 @@ | |||
/* $Id: teximage.c,v 1.9 1999/11/03 17:27:05 brianp Exp $ */ | |||
/* $Id: teximage.c,v 1.10 1999/11/05 06:43:11 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -619,9 +619,9 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, | |||
GLint srcRow = 7 - i % 8; | |||
for (j=0;j<width;j++) { | |||
GLint srcCol = j % 32; | |||
GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70; | |||
GLint texel = (message[srcRow][srcCol]=='X') ? 255 : 70; | |||
for (k=0;k<components;k++) { | |||
*imgPtr++ = texel; | |||
*imgPtr++ = (GLubyte) texel; | |||
} | |||
} | |||
} | |||
@@ -642,7 +642,7 @@ static GLboolean | |||
texture_error_check( GLcontext *ctx, GLenum target, | |||
GLint level, GLint internalFormat, | |||
GLenum format, GLenum type, | |||
GLint dimensions, | |||
GLuint dimensions, | |||
GLint width, GLint height, | |||
GLint depth, GLint border ) | |||
{ | |||
@@ -650,21 +650,21 @@ texture_error_check( GLcontext *ctx, GLenum target, | |||
GLint iformat; | |||
if (dimensions == 1) { | |||
isProxy = (target == GL_PROXY_TEXTURE_1D); | |||
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_1D); | |||
if (target != GL_TEXTURE_1D && !isProxy) { | |||
gl_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); | |||
return GL_TRUE; | |||
} | |||
} | |||
else if (dimensions == 2) { | |||
isProxy = (target == GL_PROXY_TEXTURE_2D); | |||
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D); | |||
if (target != GL_TEXTURE_2D && !isProxy) { | |||
gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); | |||
return GL_TRUE; | |||
} | |||
} | |||
else if (dimensions == 3) { | |||
isProxy = (target == GL_PROXY_TEXTURE_3D); | |||
isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_3D); | |||
if (target != GL_TEXTURE_3D && !isProxy) { | |||
gl_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); | |||
return GL_TRUE; | |||
@@ -946,7 +946,7 @@ static GLboolean | |||
copytexsubimage_error_check( GLcontext *ctx, GLint dimensions, | |||
GLenum target, GLint level, | |||
GLint xoffset, GLint yoffset, GLint zoffset, | |||
GLint x, GLint y, GLsizei width, GLsizei height ) | |||
GLsizei width, GLsizei height ) | |||
{ | |||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; | |||
struct gl_texture_image *teximage; | |||
@@ -1760,7 +1760,7 @@ void gl_CopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level, | |||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); | |||
if (!copytexsubimage_error_check(ctx, 1, target, level, | |||
xoffset, 0, 0, x, y, width, 1)) { | |||
xoffset, 0, 0, width, 1)) { | |||
struct gl_texture_unit *texUnit; | |||
struct gl_texture_image *teximage; | |||
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; | |||
@@ -1787,7 +1787,7 @@ void gl_CopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, | |||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); | |||
if (!copytexsubimage_error_check(ctx, 2, target, level, | |||
xoffset, yoffset, 0, x, y, width, height)) { | |||
xoffset, yoffset, 0, width, height)) { | |||
struct gl_texture_unit *texUnit; | |||
struct gl_texture_image *teximage; | |||
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; | |||
@@ -1815,7 +1815,7 @@ void gl_CopyTexSubImage3D( GLcontext *ctx, GLenum target, GLint level, | |||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); | |||
if (!copytexsubimage_error_check(ctx, 3, target, level, | |||
xoffset, yoffset, zoffset, x, y, width, height)) { | |||
xoffset, yoffset, zoffset, width, height)) { | |||
struct gl_texture_unit *texUnit; | |||
struct gl_texture_image *teximage; | |||
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
@@ -1,4 +1,4 @@ | |||
/* $Id: texobj.c,v 1.6 1999/10/13 18:42:50 brianp Exp $ */ | |||
/* $Id: texobj.c,v 1.7 1999/11/05 06:43:11 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -415,7 +415,7 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName ) | |||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; | |||
struct gl_texture_object *oldTexObj; | |||
struct gl_texture_object *newTexObj; | |||
GLint dim; | |||
GLuint dim; | |||
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) | |||
fprintf(stderr, "glBindTexture %s %d\n", | |||
@@ -423,7 +423,7 @@ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName ) | |||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture"); | |||
dim = target - GL_TEXTURE_1D; | |||
dim = (GLuint) (target - GL_TEXTURE_1D); | |||
if (dim < 0 || dim > 2) { | |||
gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" ); |
@@ -1,4 +1,4 @@ | |||
/* $Id: texstate.c,v 1.3 1999/10/08 09:27:11 keithw Exp $ */ | |||
/* $Id: texstate.c,v 1.4 1999/11/05 06:43:11 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -111,10 +111,10 @@ void gl_TexEnvfv( GLcontext *ctx, | |||
} | |||
} | |||
else if (pname==GL_TEXTURE_ENV_COLOR) { | |||
texUnit->EnvColor[0] = CLAMP( param[0], 0.0, 1.0 ); | |||
texUnit->EnvColor[1] = CLAMP( param[1], 0.0, 1.0 ); | |||
texUnit->EnvColor[2] = CLAMP( param[2], 0.0, 1.0 ); | |||
texUnit->EnvColor[3] = CLAMP( param[3], 0.0, 1.0 ); | |||
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 ); | |||
} | |||
else { | |||
gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); | |||
@@ -284,10 +284,10 @@ void gl_TexParameterfv( GLcontext *ctx, | |||
} | |||
break; | |||
case GL_TEXTURE_BORDER_COLOR: | |||
texObj->BorderColor[0] = CLAMP((GLint)(params[0]*255.0), 0, 255); | |||
texObj->BorderColor[1] = CLAMP((GLint)(params[1]*255.0), 0, 255); | |||
texObj->BorderColor[2] = CLAMP((GLint)(params[2]*255.0), 0, 255); | |||
texObj->BorderColor[3] = CLAMP((GLint)(params[3]*255.0), 0, 255); | |||
texObj->BorderColor[0] = (GLubyte) CLAMP((GLint)(params[0]*255.0), 0, 255); | |||
texObj->BorderColor[1] = (GLubyte) CLAMP((GLint)(params[1]*255.0), 0, 255); | |||
texObj->BorderColor[2] = (GLubyte) CLAMP((GLint)(params[2]*255.0), 0, 255); | |||
texObj->BorderColor[3] = (GLubyte) CLAMP((GLint)(params[3]*255.0), 0, 255); | |||
break; | |||
case GL_TEXTURE_MIN_LOD: | |||
texObj->MinLod = params[0]; | |||
@@ -315,7 +315,7 @@ void gl_TexParameterfv( GLcontext *ctx, | |||
break; | |||
case GL_TEXTURE_PRIORITY: | |||
/* (keithh@netcomuk.co.uk) */ | |||
texObj->Priority = CLAMP( params[0], 0.0, 1.0 ); | |||
texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); | |||
break; | |||
default: | |||
gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(pname)" ); | |||
@@ -505,10 +505,10 @@ void gl_GetTexParameterfv( GLcontext *ctx, | |||
*params = obj->MaxLod; | |||
break; | |||
case GL_TEXTURE_BASE_LEVEL: | |||
*params = obj->BaseLevel; | |||
*params = (GLfloat) obj->BaseLevel; | |||
break; | |||
case GL_TEXTURE_MAX_LEVEL: | |||
*params = obj->MaxLevel; | |||
*params = (GLfloat) obj->MaxLevel; | |||
break; | |||
default: | |||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" ); | |||
@@ -556,10 +556,10 @@ void gl_GetTexParameteriv( GLcontext *ctx, | |||
case GL_TEXTURE_BORDER_COLOR: | |||
{ | |||
GLfloat color[4]; | |||
color[0] = obj->BorderColor[0]/255.0; | |||
color[1] = obj->BorderColor[1]/255.0; | |||
color[2] = obj->BorderColor[2]/255.0; | |||
color[3] = obj->BorderColor[3]/255.0; | |||
color[0] = obj->BorderColor[0] / 255.0F; | |||
color[1] = obj->BorderColor[1] / 255.0F; | |||
color[2] = obj->BorderColor[2] / 255.0F; | |||
color[3] = obj->BorderColor[3] / 255.0F; | |||
params[0] = FLOAT_TO_INT( color[0] ); | |||
params[1] = FLOAT_TO_INT( color[1] ); | |||
params[2] = FLOAT_TO_INT( color[2] ); | |||
@@ -965,10 +965,16 @@ void gl_GetTexGeniv( GLcontext *ctx, | |||
params[0] = texUnit->GenModeS; | |||
} | |||
else if (pname==GL_OBJECT_PLANE) { | |||
COPY_4V( params, texUnit->ObjectPlaneS ); | |||
params[0] = (GLint) texUnit->ObjectPlaneS[0]; | |||
params[1] = (GLint) texUnit->ObjectPlaneS[1]; | |||
params[2] = (GLint) texUnit->ObjectPlaneS[2]; | |||
params[3] = (GLint) texUnit->ObjectPlaneS[3]; | |||
} | |||
else if (pname==GL_EYE_PLANE) { | |||
COPY_4V( params, texUnit->EyePlaneS ); | |||
params[0] = (GLint) texUnit->EyePlaneS[0]; | |||
params[1] = (GLint) texUnit->EyePlaneS[1]; | |||
params[2] = (GLint) texUnit->EyePlaneS[2]; | |||
params[3] = (GLint) texUnit->EyePlaneS[3]; | |||
} | |||
else { | |||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); | |||
@@ -977,13 +983,19 @@ void gl_GetTexGeniv( GLcontext *ctx, | |||
break; | |||
case GL_T: | |||
if (pname==GL_TEXTURE_GEN_MODE) { | |||
params[0] = texUnit->GenModeT; | |||
params[0] = (GLint) texUnit->GenModeT; | |||
} | |||
else if (pname==GL_OBJECT_PLANE) { | |||
COPY_4V( params, texUnit->ObjectPlaneT ); | |||
params[0] = (GLint) texUnit->ObjectPlaneT[0]; | |||
params[1] = (GLint) texUnit->ObjectPlaneT[1]; | |||
params[2] = (GLint) texUnit->ObjectPlaneT[2]; | |||
params[3] = (GLint) texUnit->ObjectPlaneT[3]; | |||
} | |||
else if (pname==GL_EYE_PLANE) { | |||
COPY_4V( params, texUnit->EyePlaneT ); | |||
params[0] = (GLint) texUnit->EyePlaneT[0]; | |||
params[1] = (GLint) texUnit->EyePlaneT[1]; | |||
params[2] = (GLint) texUnit->EyePlaneT[2]; | |||
params[3] = (GLint) texUnit->EyePlaneT[3]; | |||
} | |||
else { | |||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); | |||
@@ -992,13 +1004,19 @@ void gl_GetTexGeniv( GLcontext *ctx, | |||
break; | |||
case GL_R: | |||
if (pname==GL_TEXTURE_GEN_MODE) { | |||
params[0] = texUnit->GenModeR; | |||
params[0] = (GLint) texUnit->GenModeR; | |||
} | |||
else if (pname==GL_OBJECT_PLANE) { | |||
COPY_4V( params, texUnit->ObjectPlaneR ); | |||
params[0] = (GLint) texUnit->ObjectPlaneR[0]; | |||
params[1] = (GLint) texUnit->ObjectPlaneR[1]; | |||
params[2] = (GLint) texUnit->ObjectPlaneR[2]; | |||
params[3] = (GLint) texUnit->ObjectPlaneR[3]; | |||
} | |||
else if (pname==GL_EYE_PLANE) { | |||
COPY_4V( params, texUnit->EyePlaneR ); | |||
params[0] = (GLint) texUnit->EyePlaneR[0]; | |||
params[1] = (GLint) texUnit->EyePlaneR[1]; | |||
params[2] = (GLint) texUnit->EyePlaneR[2]; | |||
params[3] = (GLint) texUnit->EyePlaneR[3]; | |||
} | |||
else { | |||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); | |||
@@ -1007,13 +1025,19 @@ void gl_GetTexGeniv( GLcontext *ctx, | |||
break; | |||
case GL_Q: | |||
if (pname==GL_TEXTURE_GEN_MODE) { | |||
params[0] = texUnit->GenModeQ; | |||
params[0] = (GLint) texUnit->GenModeQ; | |||
} | |||
else if (pname==GL_OBJECT_PLANE) { | |||
COPY_4V( params, texUnit->ObjectPlaneQ ); | |||
params[0] = (GLint) texUnit->ObjectPlaneQ[0]; | |||
params[1] = (GLint) texUnit->ObjectPlaneQ[1]; | |||
params[2] = (GLint) texUnit->ObjectPlaneQ[2]; | |||
params[3] = (GLint) texUnit->ObjectPlaneQ[3]; | |||
} | |||
else if (pname==GL_EYE_PLANE) { | |||
COPY_4V( params, texUnit->EyePlaneQ ); | |||
params[0] = (GLint) texUnit->EyePlaneQ[0]; | |||
params[1] = (GLint) texUnit->EyePlaneQ[1]; | |||
params[2] = (GLint) texUnit->EyePlaneQ[2]; | |||
params[3] = (GLint) texUnit->EyePlaneQ[3]; | |||
} | |||
else { | |||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); |
@@ -1,4 +1,4 @@ | |||
/* $Id: varray.c,v 1.6 1999/11/04 19:42:28 keithw Exp $ */ | |||
/* $Id: varray.c,v 1.7 1999/11/05 06:43:11 brianp Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -505,7 +505,7 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count ) | |||
struct immediate *IM = VB->IM; | |||
struct gl_client_array *client_data; | |||
struct gl_pipeline *elt = &ctx->CVA.elt; | |||
GLuint relock; | |||
GLboolean relock; | |||
GLuint fallback, required; | |||
if (ctx->NewState) | |||
@@ -1226,7 +1226,7 @@ void GLAPIENTRY glDrawRangeElements(CTX_ARG GLenum mode, GLuint start, | |||
return; | |||
} | |||
if (!ctx->Array.LockCount && 2*count > 3*(end-start)) { | |||
if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) { | |||
glLockArraysEXT(CTX_PRM start, end ); | |||
glDrawElements(CTX_PRM mode, count, type, indices ); | |||
glUnlockArraysEXT(CTX_VPRM ); |