summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple/i915_state.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2007-09-14 04:08:58 -0400
committerZack Rusin <[email protected]>2007-09-18 06:31:22 -0400
commit9780327c5d95586a88fce94d7b47342355ead118 (patch)
tree9007ea135504d8fd90b49a391a43fa579b9374b5 /src/mesa/pipe/i915simple/i915_state.c
parentffacb1c12a77d71613e8171e31ffc348959881e4 (diff)
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.
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_state.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index f5ea721cc8e..478988fd4a9 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -37,17 +37,37 @@
/* None of this state is actually used for anything yet.
*/
-static void i915_set_blend_state( struct pipe_context *pipe,
+
+static const struct pipe_blend_state *
+i915_create_blend_state(struct pipe_context *pipe,
+ const struct pipe_blend_state *blend)
+{
+ /*struct i915_context *i915 = i915_context(pipe);*/
+
+ struct pipe_blend_state *new_blend = malloc(sizeof(struct pipe_blend_state));
+ memcpy(new_blend, blend, sizeof(struct pipe_blend_state));
+
+ return new_blend;
+}
+
+static void i915_bind_blend_state( struct pipe_context *pipe,
const struct pipe_blend_state *blend )
{
struct i915_context *i915 = i915_context(pipe);
- i915->blend = *blend;
+ i915->blend = blend;
i915->dirty |= I915_NEW_BLEND;
}
+static void i915_delete_blend_state( struct pipe_context *pipe,
+ const struct pipe_blend_state *blend )
+{
+ /*struct i915_context *i915 = i915_context(pipe);*/
+ free(blend);
+}
+
static void i915_set_blend_color( struct pipe_context *pipe,
const struct pipe_blend_color *blend_color )
{
@@ -289,9 +309,12 @@ static void i915_set_vertex_element( struct pipe_context *pipe,
void
i915_init_state_functions( struct i915_context *i915 )
{
+ i915->pipe.create_blend_state = i915_create_blend_state;
+ i915->pipe.bind_blend_state = i915_bind_blend_state;
+ i915->pipe.delete_blend_state = i915_delete_blend_state;
+
i915->pipe.set_alpha_test_state = i915_set_alpha_test_state;
i915->pipe.set_blend_color = i915_set_blend_color;
- i915->pipe.set_blend_state = i915_set_blend_state;
i915->pipe.set_clip_state = i915_set_clip_state;
i915->pipe.set_clear_color_state = i915_set_clear_color_state;
i915->pipe.set_constant_buffer = i915_set_constant_buffer;