}
-static void
+static void *
+failover_create_blend_state( struct pipe_context *pipe,
+ const struct pipe_blend_state *blend )
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_blend_state(pipe, blend);
+ state->hw_state = failover->hw->create_blend_state(pipe, blend);
+
+ return state;
+}
+
+static void
failover_bind_blend_state( struct pipe_context *pipe,
- const struct pipe_blend_state *blend )
+ void *blend )
{
struct failover_context *failover = failover_context(pipe);
- failover->blend = blend;
+ failover->blend = (struct fo_state *)blend;
failover->dirty |= FO_NEW_BLEND;
failover->hw->bind_blend_state( failover->hw, blend );
}
+static void
+failover_delete_blend_state( struct pipe_context *pipe,
+ void *blend )
+{
+ struct fo_state *state = (struct fo_state*)blend;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_blend_state(pipe, state->sw_state);
+ failover->hw->delete_blend_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
+}
static void
failover_set_blend_color( struct pipe_context *pipe,
}
static void
-failover_set_depth_test_state(struct pipe_context *pipe,
- const struct pipe_depth_state *depth)
+failover_bind_depth_stencil_state(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_state *depth_stencil)
{
struct failover_context *failover = failover_context(pipe);
- failover->depth_test = *depth;
- failover->dirty |= FO_NEW_DEPTH_TEST;
- failover->hw->set_depth_state( failover->hw, depth );
+ failover->depth_stencil = depth_stencil;
+ failover->dirty |= FO_NEW_DEPTH_STENCIL;
+ failover->hw->bind_depth_stencil_state( failover->hw, depth_stencil );
}
static void
failover->hw->set_framebuffer_state( failover->hw, framebuffer );
}
+
+static void *
+failover_create_fs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_fs_state(pipe, templ);
+ state->hw_state = failover->hw->create_fs_state(pipe, templ);
+
+ return state;
+}
+
static void
-failover_set_fs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *fs)
+failover_bind_fs_state(struct pipe_context *pipe,
+ void *fs)
{
struct failover_context *failover = failover_context(pipe);
- failover->fragment_shader = *fs;
+ failover->fragment_shader = (struct fo_state *)fs;
failover->dirty |= FO_NEW_FRAGMENT_SHADER;
- failover->hw->set_fs_state( failover->hw, fs );
+ failover->hw->bind_fs_state(failover->hw, (struct pipe_shader_state *)fs);
+}
+
+static void
+failover_delete_fs_state(struct pipe_context *pipe,
+ void *fs)
+{
+ struct fo_state *state = (struct fo_state*)fs;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_fs_state(pipe, state->sw_state);
+ failover->hw->delete_fs_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
+}
+
+static void *
+failover_create_vs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_vs_state(pipe, templ);
+ state->hw_state = failover->hw->create_vs_state(pipe, templ);
+
+ return state;
}
static void
-failover_set_vs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *vs)
+failover_bind_vs_state(struct pipe_context *pipe,
+ void *vs)
{
struct failover_context *failover = failover_context(pipe);
- failover->vertex_shader = *vs;
+ failover->vertex_shader = (struct fo_state*)vs;
failover->dirty |= FO_NEW_VERTEX_SHADER;
- failover->hw->set_vs_state( failover->hw, vs );
+ failover->hw->bind_vs_state(failover->hw, vs);
}
+static void
+failover_delete_vs_state(struct pipe_context *pipe,
+ void *vs)
+{
+ struct fo_state *state = (struct fo_state*)vs;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_vs_state(pipe, state->sw_state);
+ failover->hw->delete_vs_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
+}
static void
failover_set_polygon_stipple( struct pipe_context *pipe,
failover->hw->set_polygon_stipple( failover->hw, stipple );
}
+static void *
+failover_create_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *templ)
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+ state->sw_state = failover->sw->create_rasterizer_state(pipe, templ);
+ state->hw_state = failover->hw->create_rasterizer_state(pipe, templ);
-static void
-failover_set_setup_state( struct pipe_context *pipe,
- const struct pipe_setup_state *setup )
+ return state;
+}
+
+static void
+failover_bind_rasterizer_state(struct pipe_context *pipe,
+ void *raster)
+{
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->rasterizer = (struct fo_state *)raster;
+ failover->dirty |= FO_NEW_RASTERIZER;
+ failover->hw->bind_rasterizer_state( failover->hw, raster );
+}
+
+static void
+failover_delete_rasterizer_state(struct pipe_context *pipe,
+ void *raster)
{
+ struct fo_state *state = (struct fo_state*)raster;
struct failover_context *failover = failover_context(pipe);
- failover->setup = *setup;
- failover->dirty |= FO_NEW_SETUP;
- failover->hw->set_setup_state( failover->hw, setup );
+ failover->sw->delete_rasterizer_state(pipe, state->sw_state);
+ failover->hw->delete_rasterizer_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
}
}
static void
-failover_set_stencil_state(struct pipe_context *pipe,
- const struct pipe_stencil_state *stencil)
-{
- struct failover_context *failover = failover_context(pipe);
-
- failover->stencil = *stencil;
- failover->dirty |= FO_NEW_STENCIL;
- failover->hw->set_stencil_state( failover->hw, stencil );
-}
-
-
-static void
-failover_set_sampler_state(struct pipe_context *pipe,
+failover_bind_sampler_state(struct pipe_context *pipe,
unsigned unit,
const struct pipe_sampler_state *sampler)
{
struct failover_context *failover = failover_context(pipe);
- failover->sampler[unit] = *sampler;
+ failover->sampler[unit] = sampler;
failover->dirty |= FO_NEW_SAMPLER;
failover->dirty_sampler |= (1<<unit);
- failover->hw->set_sampler_state( failover->hw, unit, sampler );
+ failover->hw->bind_sampler_state( failover->hw, unit, sampler );
}
void
failover_init_state_functions( struct failover_context *failover )
{
+ failover->pipe.create_blend_state = failover_create_blend_state;
failover->pipe.bind_blend_state = failover_bind_blend_state;
+ failover->pipe.delete_blend_state = failover_delete_blend_state;
+ failover->pipe.bind_sampler_state = failover_bind_sampler_state;
+ failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state;
+ failover->pipe.create_rasterizer_state = failover_create_rasterizer_state;
+ failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
+ failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state;
+ failover->pipe.create_fs_state = failover_create_fs_state;
+ failover->pipe.bind_fs_state = failover_bind_fs_state;
+ failover->pipe.delete_fs_state = failover_delete_fs_state;
+ failover->pipe.create_vs_state = failover_create_vs_state;
+ failover->pipe.bind_vs_state = failover_bind_vs_state;
+ failover->pipe.delete_vs_state = failover_delete_vs_state;
failover->pipe.set_alpha_test_state = failover_set_alpha_test_state;
failover->pipe.set_blend_color = failover_set_blend_color;
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;
failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
- failover->pipe.set_fs_state = failover_set_fs_state;
- failover->pipe.set_vs_state = failover_set_vs_state;
failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
- failover->pipe.set_sampler_state = failover_set_sampler_state;
failover->pipe.set_scissor_state = failover_set_scissor_state;
- failover->pipe.set_setup_state = failover_set_setup_state;
- failover->pipe.set_stencil_state = failover_set_stencil_state;
failover->pipe.set_texture_state = failover_set_texture_state;
failover->pipe.set_viewport_state = failover_set_viewport_state;
failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;