* Version: 7.5
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
}
+/**
+ * This is called just prior to changing any texture object state.
+ * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
+ * state flag and then mark the texture object as 'incomplete' so that any
+ * per-texture derived state gets recomputed.
+ */
+static INLINE void
+flush(GLcontext *ctx, struct gl_texture_object *texObj)
+{
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->_Complete = GL_FALSE;
+}
+
+
/** Set an integer-valued texture parameter */
static void
set_tex_parameteri(GLcontext *ctx,
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
case GL_NEAREST_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR:
if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MinFilter = params[0];
return;
}
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MagFilter = params[0];
return;
default:
if (texObj->WrapS == params[0])
return;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->WrapS = params[0];
}
return;
if (texObj->WrapT == params[0])
return;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->WrapT = params[0];
}
return;
if (texObj->WrapR == params[0])
return;
if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->WrapR = params[0];
}
return;
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->BaseLevel = params[0];
return;
_mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MaxLevel = params[0];
return;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
if (texObj->GenerateMipmap != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
}
}
(params[0] == GL_NONE ||
params[0] == GL_COMPARE_R_TO_TEXTURE_ARB)) {
if (texObj->CompareMode != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->CompareMode = params[0];
}
}
switch (params[0]) {
case GL_LEQUAL:
case GL_GEQUAL:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
case GL_EQUAL:
case GL_ALWAYS:
case GL_NEVER:
if (ctx->Extensions.EXT_shadow_funcs) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->CompareFunc = params[0];
return;
}
params[0] == GL_INTENSITY ||
params[0] == GL_ALPHA)) {
if (texObj->DepthMode != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->DepthMode = params[0];
}
}
}
ASSERT(comp < 4);
if (swz >= 0) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->Swizzle[comp] = params[0];
set_swizzle_component(&texObj->_Swizzle, comp, swz);
return;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
if (ctx->Extensions.EXT_texture_swizzle) {
GLuint comp;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
for (comp = 0; comp < 4; comp++) {
const GLint swz = comp_to_swizzle(params[comp]);
if (swz >= 0) {
case GL_TEXTURE_MIN_LOD:
if (texObj->MinLod == params[0])
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MinLod = params[0];
return;
case GL_TEXTURE_MAX_LOD:
if (texObj->MaxLod == params[0])
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MaxLod = params[0];
return;
case GL_TEXTURE_PRIORITY:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
return;
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
/* clamp to max, that's what NVIDIA does */
texObj->MaxAnisotropy = MIN2(params[0],
ctx->Const.MaxTextureMaxAnisotropy);
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
if (ctx->Extensions.ARB_shadow_ambient) {
if (texObj->CompareFailValue != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
}
}
/* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
if (ctx->Extensions.EXT_texture_lod_bias) {
if (texObj->LodBias != params[0]) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->LodBias = params[0];
}
}
break;
case GL_TEXTURE_BORDER_COLOR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->BorderColor[RCOMP] = params[0];
texObj->BorderColor[GCOMP] = params[1];
texObj->BorderColor[BCOMP] = params[2];
set_tex_parameterf(ctx, texObj, pname, ¶m);
}
- texObj->_Complete = GL_FALSE;
-
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, ¶m);
}
set_tex_parameterf(ctx, texObj, pname, params);
}
- texObj->_Complete = GL_FALSE;
-
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
}
set_tex_parameteri(ctx, texObj, pname, ¶m);
}
- texObj->_Complete = GL_FALSE;
-
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
GLfloat fparam = (GLfloat) param;
ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
set_tex_parameteri(ctx, texObj, pname, params);
}
- texObj->_Complete = GL_FALSE;
-
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
GLfloat fparams[4];
fparams[0] = INT_TO_FLOAT(params[0]);