summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/failover
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/failover')
-rw-r--r--src/mesa/pipe/failover/fo_context.h4
-rw-r--r--src/mesa/pipe/failover/fo_state.c75
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c6
3 files changed, 73 insertions, 12 deletions
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index a649899010..a81bfe82dd 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -74,8 +74,8 @@ struct failover_context {
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct fo_state *rasterizer;
- const struct pipe_shader_state *fragment_shader;
- const struct pipe_shader_state *vertex_shader;
+ const struct fo_state *fragment_shader;
+ const struct fo_state *vertex_shader;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index 25725625e0..db3aea7756 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -150,26 +150,81 @@ failover_set_framebuffer_state(struct pipe_context *pipe,
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_bind_fs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *fs)
+ 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->bind_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_bind_vs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *vs)
+ 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->bind_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
@@ -312,8 +367,12 @@ failover_init_state_functions( struct failover_context *failover )
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.bind_fs_state = failover_bind_fs_state;
- failover->pipe.bind_vs_state = failover_bind_vs_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;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index f2b0b1edc0..ec896fd020 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -78,10 +78,12 @@ failover_state_emit( struct failover_context *failover )
failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer );
if (failover->dirty & FO_NEW_FRAGMENT_SHADER)
- failover->sw->bind_fs_state( failover->sw, failover->fragment_shader );
+ failover->sw->bind_fs_state( failover->sw,
+ failover->fragment_shader->sw_state );
if (failover->dirty & FO_NEW_VERTEX_SHADER)
- failover->sw->bind_vs_state( failover->sw, failover->vertex_shader );
+ failover->sw->bind_vs_state( failover->sw,
+ failover->vertex_shader->sw_state );
if (failover->dirty & FO_NEW_STIPPLE)
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );