diff options
author | Xiang, Haihao <[email protected]> | 2010-12-10 09:31:19 +0800 |
---|---|---|
committer | Xiang, Haihao <[email protected]> | 2010-12-10 13:25:17 +0800 |
commit | d1196bbc191c4f1b355d432dcb2eeff9790fda34 (patch) | |
tree | 58b160fbc6f4db5b2ebda9fd272c74bccc7f1b9e | |
parent | 3a3b1bd722786ab0b1386a3a505cadfa89798232 (diff) |
meta: allow nested meta operations
_mesa_meta_CopyPixels results in nested meta operations on Sandybridge.
Previoulsy the second meta operation overrides all states saved by the
first meta function.
-rw-r--r-- | src/mesa/drivers/common/meta.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 95accc1813d..cbc0512b580 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -266,13 +266,14 @@ struct gen_mipmap_state GLuint FBO; }; - +#define MAX_META_OPS_DEPTH 2 /** * All per-context meta state. */ struct gl_meta_state { - struct save_state Save; /**< state saved during meta-ops */ + struct save_state Save[MAX_META_OPS_DEPTH]; /**< state saved during meta-ops */ + int current_save_state; struct temp_texture TempTex; @@ -324,8 +325,13 @@ _mesa_meta_free(struct gl_context *ctx) static void _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) { - struct save_state *save = &ctx->Meta->Save; + struct save_state *save; + + /* hope MAX_META_OPS_DEPTH is large enough */ + assert(current_save_state < MAX_META_OPS_DEPTH); + save = &ctx->Meta->Save[ctx->Meta->current_save_state++]; + memset(save, 0, sizeof(*save)); save->SavedState = state; if (state & META_ALPHA_TEST) { @@ -575,7 +581,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) static void _mesa_meta_end(struct gl_context *ctx) { - struct save_state *save = &ctx->Meta->Save; + struct save_state *save = &ctx->Meta->Save[--ctx->Meta->current_save_state]; const GLbitfield state = save->SavedState; if (state & META_ALPHA_TEST) { |