aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers/common')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index c5c59ebee..e62267394 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -65,6 +65,7 @@
#include "main/teximage.h"
#include "main/texparam.h"
#include "main/texstate.h"
+#include "main/transformfeedback.h"
#include "main/uniforms.h"
#include "main/varray.h"
#include "main/viewport.h"
@@ -180,6 +181,8 @@ struct save_state
/** Miscellaneous (always disabled) */
GLboolean Lighting;
+ GLboolean RasterDiscard;
+ GLboolean TransformFeedbackNeedsResume;
};
/**
@@ -422,6 +425,15 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
memset(save, 0, sizeof(*save));
save->SavedState = state;
+ /* Pausing transform feedback needs to be done early, or else we won't be
+ * able to change other state.
+ */
+ save->TransformFeedbackNeedsResume =
+ ctx->TransformFeedback.CurrentObject->Active &&
+ !ctx->TransformFeedback.CurrentObject->Paused;
+ if (save->TransformFeedbackNeedsResume)
+ _mesa_PauseTransformFeedback();
+
if (state & MESA_META_ALPHA_TEST) {
save->AlphaEnabled = ctx->Color.AlphaEnabled;
save->AlphaFunc = ctx->Color.AlphaFunc;
@@ -702,6 +714,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
save->Lighting = ctx->Light.Enabled;
if (ctx->Light.Enabled)
_mesa_set_enable(ctx, GL_LIGHTING, GL_FALSE);
+ save->RasterDiscard = ctx->RasterDiscard;
+ if (ctx->RasterDiscard)
+ _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE);
}
}
@@ -981,6 +996,11 @@ _mesa_meta_end(struct gl_context *ctx)
if (save->Lighting) {
_mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
}
+ if (save->RasterDiscard) {
+ _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_TRUE);
+ }
+ if (save->TransformFeedbackNeedsResume)
+ _mesa_ResumeTransformFeedback();
}