summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/fbobject.c2
-rw-r--r--src/mesa/main/mtypes.h8
-rw-r--r--src/mesa/main/pixel.c2
-rw-r--r--src/mesa/main/state.c66
-rw-r--r--src/mesa/main/texenvprogram.c39
-rw-r--r--src/mesa/main/texenvprogram.h2
-rw-r--r--src/mesa/main/teximage.c22
-rw-r--r--src/mesa/main/texparam.c88
9 files changed, 123 insertions, 114 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a315091a20..39c7fa037e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1305,10 +1305,10 @@ _mesa_free_context_data( GLcontext *ctx )
}
/* unreference WinSysDraw/Read buffers */
- _mesa_unreference_framebuffer(&ctx->WinSysDrawBuffer);
- _mesa_unreference_framebuffer(&ctx->WinSysReadBuffer);
- _mesa_unreference_framebuffer(&ctx->DrawBuffer);
- _mesa_unreference_framebuffer(&ctx->ReadBuffer);
+ _mesa_reference_framebuffer(&ctx->WinSysDrawBuffer, NULL);
+ _mesa_reference_framebuffer(&ctx->WinSysReadBuffer, NULL);
+ _mesa_reference_framebuffer(&ctx->DrawBuffer, NULL);
+ _mesa_reference_framebuffer(&ctx->ReadBuffer, NULL);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ae823262a2..c3cdc11037 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1268,7 +1268,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
/* But the object will not be freed until it's no longer
* bound in any context.
*/
- _mesa_unreference_framebuffer(&fb);
+ _mesa_reference_framebuffer(&fb, NULL);
}
}
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 67f7d46309..be982afe39 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2846,6 +2846,10 @@ struct gl_matrix_stack
/*@}*/
+/**
+ * Composite state flags
+ */
+/*@{*/
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
_NEW_TEXTURE | \
_NEW_POINT | \
@@ -2855,7 +2859,9 @@ struct gl_matrix_stack
#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \
_NEW_TEXTURE)
-#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX)
+#define _MESA_NEW_TRANSFER_STATE (_NEW_PIXEL | \
+ _NEW_COLOR_MATRIX)
+/*@}*/
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 8d24a201f0..52781e048e 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -828,7 +828,7 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
/* References ColorMatrix.type (derived above).
*/
- if (new_state & _IMAGE_NEW_TRANSFER_STATE)
+ if (new_state & _MESA_NEW_TRANSFER_STATE)
update_image_transfer_state(ctx);
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 718cd99847..0a39279bff 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -173,13 +173,16 @@ update_arrays( GLcontext *ctx )
}
+/**
+ * Update the following fields:
+ * ctx->VertexProgram._Enabled
+ * ctx->FragmentProgram._Enabled
+ * ctx->ATIFragmentShader._Enabled
+ * This needs to be done before texture state validation.
+ */
static void
-update_program(GLcontext *ctx)
+update_program_enables(GLcontext *ctx)
{
- const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
- const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
- const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
-
/* These _Enabled flags indicate if the program is enabled AND valid. */
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
&& ctx->VertexProgram.Current->Base.Instructions;
@@ -187,6 +190,25 @@ update_program(GLcontext *ctx)
&& ctx->FragmentProgram.Current->Base.Instructions;
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
&& ctx->ATIFragmentShader.Current->Instructions[0];
+}
+
+
+/**
+ * Update vertex/fragment program state. In particular, update these fields:
+ * ctx->VertexProgram._Current
+ * ctx->VertexProgram._TnlProgram,
+ * These point to the highest priority enabled vertex/fragment program or are
+ * NULL if fixed-function processing is to be done.
+ *
+ * This function needs to be called after texture state validation in case
+ * we're generating a fragment program from fixed-function texture state.
+ */
+static void
+update_program(GLcontext *ctx)
+{
+ const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
+ const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
+ const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
/*
* Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
@@ -432,6 +454,24 @@ _mesa_update_state_locked( GLcontext *ctx )
if (MESA_VERBOSE & VERBOSE_STATE)
_mesa_print_state("_mesa_update_state", new_state);
+ /* Determine which state flags effect vertex/fragment program state */
+ if (ctx->FragmentProgram._MaintainTexEnvProgram) {
+ prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
+ }
+ if (ctx->VertexProgram._MaintainTnlProgram) {
+ prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
+ _NEW_TRANSFORM | _NEW_POINT |
+ _NEW_FOG | _NEW_LIGHT |
+ _MESA_NEW_NEED_EYE_COORDS);
+ }
+
+ /*
+ * Now update derived state info
+ */
+
+ if (new_state & prog_flags)
+ update_program_enables( ctx );
+
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
_mesa_update_modelview_project( ctx, new_state );
@@ -454,7 +494,7 @@ _mesa_update_state_locked( GLcontext *ctx )
_mesa_update_stencil( ctx );
#if FEATURE_pixel_transfer
- if (new_state & _IMAGE_NEW_TRANSFER_STATE)
+ if (new_state & _MESA_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
#endif
@@ -491,23 +531,9 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _MESA_NEW_NEED_EYE_COORDS)
_mesa_update_tnl_spaces( ctx, new_state );
- if (ctx->FragmentProgram._MaintainTexEnvProgram) {
- prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE_MATRIX | _NEW_LIGHT |
- _NEW_RENDERMODE |
- _NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR);
- }
- if (ctx->VertexProgram._MaintainTnlProgram) {
- prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX |
- _NEW_RENDERMODE |
- _NEW_TRANSFORM | _NEW_POINT |
- _NEW_FOG | _NEW_LIGHT |
- _MESA_NEW_NEED_EYE_COORDS);
- }
if (new_state & prog_flags)
update_program( ctx );
-
-
/*
* Give the driver a chance to act upon the new_state flags.
* The driver might plug in different span functions, for example.
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 10edfc8fb8..af51a206a5 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1405,42 +1405,3 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx)
return prog;
}
-
-
-
-/**
- * If _MaintainTexEnvProgram is set we'll generate a fragment program that
- * implements the current texture env/combine mode.
- * This function generates that program and puts it into effect.
- *
- * XXX: remove this function. currently only called by some drivers,
- * not by mesa core. We now handle this properly from inside mesa.
- */
-void
-_mesa_UpdateTexEnvProgram( GLcontext *ctx )
-{
- const struct gl_fragment_program *prev = ctx->FragmentProgram._Current;
-
- ASSERT(ctx->FragmentProgram._MaintainTexEnvProgram);
-
- /* If a conventional fragment program/shader isn't in effect... */
- if (!ctx->FragmentProgram._Enabled &&
- (!ctx->Shader.CurrentProgram ||
- !ctx->Shader.CurrentProgram->FragmentProgram) )
- {
- struct gl_fragment_program *newProg;
-
- newProg = _mesa_get_fixed_func_fragment_program(ctx);
-
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, newProg);
- _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, newProg);
- }
-
- /* Tell the driver about the change. Could define a new target for
- * this?
- */
- if (ctx->FragmentProgram._Current != prev && ctx->Driver.BindProgram) {
- ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
- (struct gl_program *) ctx->FragmentProgram._Current);
- }
-}
diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h
index a7aa60cf37..0a162d2e7a 100644
--- a/src/mesa/main/texenvprogram.h
+++ b/src/mesa/main/texenvprogram.h
@@ -32,6 +32,4 @@
extern struct gl_fragment_program *
_mesa_get_fixed_func_fragment_program(GLcontext *ctx);
-extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx );
-
#endif
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index fdc72ed843..8fd69c4f6a 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2431,7 +2431,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
return; /* error was recorded */
}
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
@@ -2537,7 +2537,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
return; /* error was recorded */
}
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
@@ -2638,7 +2638,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
return; /* error was recorded */
}
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
@@ -2731,7 +2731,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -2791,7 +2791,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -2851,7 +2851,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset,
@@ -2907,7 +2907,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -2972,7 +2972,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
#if FEATURE_convolve
@@ -3040,7 +3040,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 1, target, level))
@@ -3095,7 +3095,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 2, target, level))
@@ -3150,7 +3150,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
+ if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
if (copytexsubimage_error_check1(ctx, 3, target, level))
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 8df22fe9e2..865aae8627 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -3,7 +3,7 @@
* 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"),
@@ -165,6 +165,20 @@ set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz)
}
+/**
+ * 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,
@@ -178,7 +192,7 @@ 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:
@@ -186,7 +200,7 @@ set_tex_parameteri(GLcontext *ctx,
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;
}
@@ -202,7 +216,7 @@ set_tex_parameteri(GLcontext *ctx,
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->MagFilter = params[0];
return;
default:
@@ -214,7 +228,7 @@ set_tex_parameteri(GLcontext *ctx,
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;
@@ -223,7 +237,7 @@ set_tex_parameteri(GLcontext *ctx,
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;
@@ -232,7 +246,7 @@ set_tex_parameteri(GLcontext *ctx,
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;
@@ -245,7 +259,7 @@ set_tex_parameteri(GLcontext *ctx,
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ flush(ctx, texObj);
texObj->BaseLevel = params[0];
return;
@@ -256,14 +270,16 @@ set_tex_parameteri(GLcontext *ctx,
_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) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
+ if (texObj->GenerateMipmap != params[0]) {
+ flush(ctx, texObj);
+ texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
+ }
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -275,8 +291,10 @@ set_tex_parameteri(GLcontext *ctx,
if (ctx->Extensions.ARB_shadow &&
(params[0] == GL_NONE ||
params[0] == GL_COMPARE_R_TO_TEXTURE_ARB)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareMode = params[0];
+ if (texObj->CompareMode != params[0]) {
+ flush(ctx, texObj);
+ texObj->CompareMode = params[0];
+ }
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -286,10 +304,12 @@ set_tex_parameteri(GLcontext *ctx,
case GL_TEXTURE_COMPARE_FUNC_ARB:
if (ctx->Extensions.ARB_shadow) {
+ if (texObj->CompareFunc == params[0])
+ return;
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:
@@ -299,7 +319,7 @@ set_tex_parameteri(GLcontext *ctx,
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;
}
@@ -319,8 +339,10 @@ set_tex_parameteri(GLcontext *ctx,
(params[0] == GL_LUMINANCE ||
params[0] == GL_INTENSITY ||
params[0] == GL_ALPHA)) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->DepthMode = params[0];
+ if (texObj->DepthMode != params[0]) {
+ flush(ctx, texObj);
+ texObj->DepthMode = params[0];
+ }
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -351,7 +373,7 @@ set_tex_parameteri(GLcontext *ctx,
}
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;
@@ -363,7 +385,7 @@ set_tex_parameteri(GLcontext *ctx,
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) {
@@ -397,29 +419,31 @@ set_tex_parameterf(GLcontext *ctx,
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;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
+ if (texObj->MaxAnisotropy == params[0])
+ return;
if (params[0] < 1.0) {
_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);
@@ -432,8 +456,10 @@ set_tex_parameterf(GLcontext *ctx,
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
if (ctx->Extensions.ARB_shadow_ambient) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
+ if (texObj->CompareFailValue != params[0]) {
+ flush(ctx, texObj);
+ texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
+ }
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -445,14 +471,14 @@ set_tex_parameterf(GLcontext *ctx,
/* 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];
@@ -503,8 +529,6 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
set_tex_parameterf(ctx, texObj, pname, &param);
}
- texObj->_Complete = GL_FALSE;
-
if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
}
@@ -560,8 +584,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
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);
}
@@ -597,8 +619,6 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
set_tex_parameteri(ctx, texObj, pname, &param);
}
- 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);
@@ -646,8 +666,6 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
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]);