summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta.c47
-rw-r--r--src/mesa/drivers/common/meta.h17
2 files changed, 36 insertions, 28 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 56ad8f809b..9638e9bc7c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -78,6 +78,9 @@ struct save_state
/** META_DEPTH_TEST */
struct gl_depthbuffer_attrib Depth;
+ /** META_FOG */
+ GLboolean Fog;
+
/** META_PIXELSTORE */
/* XXX / TO-DO */
@@ -128,7 +131,6 @@ struct save_state
/** Miscellaneous (always disabled) */
GLboolean Lighting;
- GLboolean Fog;
};
@@ -171,7 +173,6 @@ struct copypix_state
};
-
/**
* All per-context meta state.
*/
@@ -279,6 +280,12 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
_mesa_Disable(GL_DEPTH_TEST);
}
+ if (state & META_FOG) {
+ save->Fog = ctx->Fog.Enabled;
+ if (ctx->Fog.Enabled)
+ _mesa_set_enable(ctx, GL_FOG, GL_FALSE);
+ }
+
if (state & META_RASTERIZATION) {
save->FrontPolygonMode = ctx->Polygon.FrontMode;
save->BackPolygonMode = ctx->Polygon.BackMode;
@@ -335,16 +342,19 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
- _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
- _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ if (ctx->Texture.Unit[u].Enabled ||
+ ctx->Texture.Unit[u].TexGenEnabled) {
+ _mesa_ActiveTextureARB(GL_TEXTURE0 + u);
+ _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
+ _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
+ }
}
/* save current texture objects for unit[0] only */
@@ -357,10 +367,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
_mesa_ActiveTextureARB(GL_TEXTURE0);
_mesa_ClientActiveTextureARB(GL_TEXTURE0);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
}
if (state & META_TRANSFORM) {
@@ -418,10 +424,6 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
save->Lighting = ctx->Light.Enabled;
if (ctx->Light.Enabled)
_mesa_set_enable(ctx, GL_LIGHTING, GL_FALSE);
-
- save->Fog = ctx->Fog.Enabled;
- if (ctx->Fog.Enabled)
- _mesa_set_enable(ctx, GL_FOG, GL_FALSE);
}
}
@@ -460,6 +462,10 @@ _mesa_meta_end(GLcontext *ctx)
_mesa_DepthMask(save->Depth.Mask);
}
+ if (state & META_FOG) {
+ _mesa_set_enable(ctx, GL_FOG, save->Fog);
+ }
+
if (state & META_RASTERIZATION) {
_mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
_mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
@@ -895,6 +901,7 @@ _mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY,
if (type != GL_COLOR ||
ctx->_ImageTransferState ||
+ ctx->Fog.Enabled ||
width > ctx->Const.MaxTextureRectSize ||
height > ctx->Const.MaxTextureRectSize) {
/* XXX avoid this fallback */
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index b66d20c344..88cab8e388 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -36,14 +36,15 @@
#define META_BLEND 0x2 /**< includes logicop */
#define META_COLOR_MASK 0x4
#define META_DEPTH_TEST 0x8
-#define META_RASTERIZATION 0x10
-#define META_SCISSOR 0x20
-#define META_SHADER 0x40
-#define META_STENCIL_TEST 0x80
-#define META_TRANSFORM 0x100 /**< modelview, projection */
-#define META_TEXTURE 0x200
-#define META_VERTEX 0x400
-#define META_VIEWPORT 0x800
+#define META_FOG 0x10
+#define META_RASTERIZATION 0x20
+#define META_SCISSOR 0x40
+#define META_SHADER 0x80
+#define META_STENCIL_TEST 0x100
+#define META_TRANSFORM 0x200 /**< modelview, projection */
+#define META_TEXTURE 0x400
+#define META_VERTEX 0x800
+#define META_VIEWPORT 0x1000
#define META_ALL ~0x0
/*@}*/