From 9780327c5d95586a88fce94d7b47342355ead118 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 14 Sep 2007 04:08:58 -0400 Subject: First stab at immutable state objects (create/bind/delete) We want our state objects to be immutable, handled via the create/bind/delete calls instead of struct propagation. Only implementing the blend state to see how it would look like and work. --- src/mesa/pipe/failover/fo_context.h | 3 ++- src/mesa/pipe/failover/fo_state.c | 9 +++++---- src/mesa/pipe/failover/fo_state_emit.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/mesa/pipe/failover') diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h index 5666d4e830..b065aa832a 100644 --- a/src/mesa/pipe/failover/fo_context.h +++ b/src/mesa/pipe/failover/fo_context.h @@ -67,8 +67,9 @@ struct failover_context { /* The most recent drawing state as set by the driver: */ + const struct pipe_blend_state *blend; + struct pipe_alpha_test_state alpha_test; - struct pipe_blend_state blend; struct pipe_blend_color blend_color; struct pipe_clear_color_state clear_color; struct pipe_clip_state clip; diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c index 097acf7d57..2357d7ef5c 100644 --- a/src/mesa/pipe/failover/fo_state.c +++ b/src/mesa/pipe/failover/fo_state.c @@ -58,14 +58,14 @@ failover_set_alpha_test_state(struct pipe_context *pipe, static void -failover_set_blend_state( struct pipe_context *pipe, +failover_bind_blend_state( struct pipe_context *pipe, const struct pipe_blend_state *blend ) { struct failover_context *failover = failover_context(pipe); - failover->blend = *blend; + failover->blend = blend; failover->dirty |= FO_NEW_BLEND; - failover->hw->set_blend_state( failover->hw, blend ); + failover->hw->bind_blend_state( failover->hw, blend ); } @@ -266,9 +266,10 @@ failover_set_vertex_element(struct pipe_context *pipe, void failover_init_state_functions( struct failover_context *failover ) { + failover->pipe.bind_blend_state = failover_bind_blend_state; + failover->pipe.set_alpha_test_state = failover_set_alpha_test_state; failover->pipe.set_blend_color = failover_set_blend_color; - failover->pipe.set_blend_state = failover_set_blend_state; failover->pipe.set_clip_state = failover_set_clip_state; failover->pipe.set_clear_color_state = failover_set_clear_color_state; failover->pipe.set_depth_state = failover_set_depth_test_state; diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c index 52fcf5dbc9..77413d100b 100644 --- a/src/mesa/pipe/failover/fo_state_emit.c +++ b/src/mesa/pipe/failover/fo_state_emit.c @@ -59,7 +59,7 @@ failover_state_emit( struct failover_context *failover ) failover->sw->set_alpha_test_state( failover->sw, &failover->alpha_test ); if (failover->dirty & FO_NEW_BLEND) - failover->sw->set_blend_state( failover->sw, &failover->blend ); + failover->sw->bind_blend_state( failover->sw, failover->blend ); if (failover->dirty & FO_NEW_BLEND_COLOR) failover->sw->set_blend_color( failover->sw, &failover->blend_color ); -- cgit v1.2.3