summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2009-12-23 09:59:30 +0100
committerCorbin Simpson <[email protected]>2010-01-06 12:49:14 -0800
commita6d91a141f9bb80444d11922998c348fb3cc7d98 (patch)
tree53697d8027bc03ce7ae690231f1aa3a7d497825f /src/gallium
parent8e559e05a8887df6477eb5ee26c4f4461b79b303 (diff)
util/blitter: allow NULL CSOs to be saved
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 1f794d39a17..cef3b69e46d 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -48,6 +48,8 @@
#include "util/u_simple_shaders.h"
#include "util/u_texture.h"
+#define INVALID_PTR ((void*)~0)
+
struct blitter_context_priv
{
struct blitter_context blitter;
@@ -110,6 +112,11 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
ctx->pipe = pipe;
/* init state objects for them to be considered invalid */
+ ctx->blitter.saved_blend_state = INVALID_PTR;
+ ctx->blitter.saved_dsa_state = INVALID_PTR;
+ ctx->blitter.saved_rs_state = INVALID_PTR;
+ ctx->blitter.saved_fs = INVALID_PTR;
+ ctx->blitter.saved_vs = INVALID_PTR;
ctx->blitter.saved_fb_state.nr_cbufs = ~0;
ctx->blitter.saved_num_textures = ~0;
ctx->blitter.saved_num_sampler_states = ~0;
@@ -234,11 +241,11 @@ void util_blitter_destroy(struct blitter_context *blitter)
static void blitter_check_saved_CSOs(struct blitter_context_priv *ctx)
{
/* make sure these CSOs have been saved */
- assert(ctx->blitter.saved_blend_state &&
- ctx->blitter.saved_dsa_state &&
- ctx->blitter.saved_rs_state &&
- ctx->blitter.saved_fs &&
- ctx->blitter.saved_vs);
+ assert(ctx->blitter.saved_blend_state != INVALID_PTR &&
+ ctx->blitter.saved_dsa_state != INVALID_PTR &&
+ ctx->blitter.saved_rs_state != INVALID_PTR &&
+ ctx->blitter.saved_fs != INVALID_PTR &&
+ ctx->blitter.saved_vs != INVALID_PTR);
}
static void blitter_restore_CSOs(struct blitter_context_priv *ctx)
@@ -252,11 +259,11 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx)
pipe->bind_fs_state(pipe, ctx->blitter.saved_fs);
pipe->bind_vs_state(pipe, ctx->blitter.saved_vs);
- ctx->blitter.saved_blend_state = 0;
- ctx->blitter.saved_dsa_state = 0;
- ctx->blitter.saved_rs_state = 0;
- ctx->blitter.saved_fs = 0;
- ctx->blitter.saved_vs = 0;
+ ctx->blitter.saved_blend_state = INVALID_PTR;
+ ctx->blitter.saved_dsa_state = INVALID_PTR;
+ ctx->blitter.saved_rs_state = INVALID_PTR;
+ ctx->blitter.saved_fs = INVALID_PTR;
+ ctx->blitter.saved_vs = INVALID_PTR;
/* restore the state objects which are required to be saved before copy/fill
*/