[Mesa-dev] [PATCH 3/5] mesa: Handle clip control in meta operations.
Mathias.Froehlich at gmx.net
Mathias.Froehlich at gmx.net
Wed Oct 22 10:13:30 PDT 2014
From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
Restore clip control to the default state if MESA_META_VIEWPORT
or MESA_META_DEPTH_TEST is requested.
Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
---
src/mesa/drivers/common/meta.c | 13 +++++++++++++
src/mesa/drivers/common/meta.h | 4 ++++
2 files changed, 17 insertions(+)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7a8e627..119f327 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -494,6 +494,13 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_set_enable(ctx, GL_DITHER, GL_TRUE);
}
+ if (state & MESA_META_CLIP_CONTROL) {
+ save->ClipControl = ctx->ClipControl;
+ if (ctx->ClipControl.Origin != GL_LOWER_LEFT ||
+ ctx->ClipControl.Depth != GL_NEGATIVE_ONE_TO_ONE)
+ _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
+ }
+
if (state & MESA_META_COLOR_MASK) {
memcpy(save->ColorMask, ctx->Color.ColorMask,
sizeof(ctx->Color.ColorMask));
@@ -856,6 +863,12 @@ _mesa_meta_end(struct gl_context *ctx)
if (state & MESA_META_DITHER)
_mesa_set_enable(ctx, GL_DITHER, save->DitherFlag);
+ if (state & MESA_META_CLIP_CONTROL) {
+ if (ctx->ClipControl.Origin != save->ClipControl.Origin ||
+ ctx->ClipControl.Depth != save->ClipControl.Depth)
+ _mesa_ClipControl(save->ClipControl.Origin, save->ClipControl.Depth);
+ }
+
if (state & MESA_META_COLOR_MASK) {
GLuint i;
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 2c9517b..08514ad 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -60,6 +60,7 @@
#define MESA_META_OCCLUSION_QUERY 0x400000
#define MESA_META_DRAW_BUFFERS 0x800000
#define MESA_META_DITHER 0x1000000
+#define MESA_META_CLIP_CONTROL (MESA_META_VIEWPORT|MESA_META_DEPTH_TEST)
/**\}*/
/**
@@ -88,6 +89,9 @@ struct save_state
/** MESA_META_DITHER */
GLboolean DitherFlag;
+ /** MESA_META_CLIP_CONTROL */
+ struct gl_clip_control ClipControl;
+
/** MESA_META_COLOR_MASK */
GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
--
1.9.3
More information about the mesa-dev
mailing list