summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.h5
-rw-r--r--src/mesa/pipe/failover/fo_context.h2
-rw-r--r--src/mesa/pipe/failover/fo_state.c35
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c3
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c18
-rw-r--r--src/mesa/pipe/p_context.h11
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h8
-rw-r--r--src/mesa/pipe/softpipe/sp_state_rasterizer.c18
8 files changed, 61 insertions, 39 deletions
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h
index 7ac5908922..cd4b64eec4 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.h
+++ b/src/mesa/pipe/cso_cache/cso_cache.h
@@ -53,6 +53,11 @@ struct cso_blend {
void *data;
};
+struct cso_rasterizer {
+ struct pipe_rasterizer_state state;
+ void *data;
+};
+
enum cso_cache_type {
CSO_BLEND,
CSO_SAMPLER,
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index ea7fb109b3..a649899010 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -73,7 +73,7 @@ struct failover_context {
const struct fo_state *blend;
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
- const struct pipe_rasterizer_state *rasterizer;
+ const struct fo_state *rasterizer;
const struct pipe_shader_state *fragment_shader;
const struct pipe_shader_state *vertex_shader;
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index ba110a6e4f..25725625e0 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -183,17 +183,42 @@ 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);
+
+ return state;
+}
static void
-failover_bind_rasterizer_state( struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup )
+failover_bind_rasterizer_state(struct pipe_context *pipe,
+ void *raster)
{
struct failover_context *failover = failover_context(pipe);
- failover->rasterizer = setup;
+ failover->rasterizer = (struct fo_state *)raster;
failover->dirty |= FO_NEW_RASTERIZER;
- failover->hw->bind_rasterizer_state( failover->hw, setup );
+ 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->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);
}
@@ -284,7 +309,9 @@ failover_init_state_functions( struct failover_context *failover )
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.bind_fs_state = failover_bind_fs_state;
failover->pipe.bind_vs_state = failover_bind_vs_state;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index 72697c01a9..f2b0b1edc0 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -87,7 +87,8 @@ failover_state_emit( struct failover_context *failover )
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );
if (failover->dirty & FO_NEW_RASTERIZER)
- failover->sw->bind_rasterizer_state( failover->sw, failover->rasterizer );
+ failover->sw->bind_rasterizer_state( failover->sw,
+ failover->rasterizer->sw_state );
if (failover->dirty & FO_NEW_SCISSOR)
failover->sw->set_scissor_state( failover->sw, &failover->scissor );
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 4a4d26be65..66aa9a0274 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -371,23 +371,19 @@ static void i915_set_viewport_state( struct pipe_context *pipe,
}
-static const struct pipe_rasterizer_state *
+static void *
i915_create_rasterizer_state(struct pipe_context *pipe,
const struct pipe_rasterizer_state *setup)
{
- struct pipe_rasterizer_state *raster =
- malloc(sizeof(struct pipe_rasterizer_state));
- memcpy(raster, setup, sizeof(struct pipe_rasterizer_state));
-
- return raster;
+ return 0;
}
static void i915_bind_rasterizer_state( struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup )
+ void *setup )
{
struct i915_context *i915 = i915_context(pipe);
- i915->rasterizer = setup;
+ i915->rasterizer = (struct pipe_rasterizer_state *)setup;
/* pass-through to draw module */
draw_set_rasterizer_state(i915->draw, setup);
@@ -395,10 +391,10 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe,
i915->dirty |= I915_NEW_RASTERIZER;
}
-static void i915_delete_rasterizer_state( struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup )
+static void i915_delete_rasterizer_state(struct pipe_context *pipe,
+ void *setup)
{
- free((struct pipe_rasterizer_state*)setup);
+ /* do nothing */
}
static void i915_set_vertex_buffer( struct pipe_context *pipe,
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index adca6612d5..1c0ab794f0 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -99,13 +99,10 @@ struct pipe_context {
void (*delete_sampler_state)(struct pipe_context *,
const struct pipe_sampler_state *);
- const struct pipe_rasterizer_state *(*create_rasterizer_state)(
- struct pipe_context *,
- const struct pipe_rasterizer_state *);
- void (*bind_rasterizer_state)(struct pipe_context *,
- const struct pipe_rasterizer_state *);
- void (*delete_rasterizer_state)(struct pipe_context *,
- const struct pipe_rasterizer_state *);
+ void *(*create_rasterizer_state)(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+ void (*bind_rasterizer_state)(struct pipe_context *, void *);
+ void (*delete_rasterizer_state)(struct pipe_context *, void *);
const struct pipe_depth_stencil_state * (*create_depth_stencil_state)(
struct pipe_context *,
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 8e7776a6c7..a20ae1d4a2 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -58,13 +58,13 @@ void softpipe_bind_depth_stencil_state(struct pipe_context *,
void softpipe_delete_depth_stencil_state(struct pipe_context *,
const struct pipe_depth_stencil_state *);
-const struct pipe_rasterizer_state *
+void *
softpipe_create_rasterizer_state(struct pipe_context *,
- const struct pipe_rasterizer_state *);
-void softpipe_bind_rasterizer_state(struct pipe_context *,
const struct pipe_rasterizer_state *);
+void softpipe_bind_rasterizer_state(struct pipe_context *,
+ void *);
void softpipe_delete_rasterizer_state(struct pipe_context *,
- const struct pipe_rasterizer_state *);
+ void *);
void softpipe_set_framebuffer_state( struct pipe_context *,
const struct pipe_framebuffer_state * );
diff --git a/src/mesa/pipe/softpipe/sp_state_rasterizer.c b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
index d832adb91b..d7845cef82 100644
--- a/src/mesa/pipe/softpipe/sp_state_rasterizer.c
+++ b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
@@ -32,34 +32,30 @@
-const struct pipe_rasterizer_state *
+void *
softpipe_create_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup)
+ const struct pipe_rasterizer_state *setup)
{
- struct pipe_rasterizer_state *raster =
- malloc(sizeof(struct pipe_rasterizer_state));
- memcpy(raster, setup, sizeof(struct pipe_rasterizer_state));
-
- return raster;
+ return 0;
}
void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *setup)
+ void *setup)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
/* pass-through to draw module */
draw_set_rasterizer_state(softpipe->draw, setup);
- softpipe->rasterizer = setup;
+ softpipe->rasterizer = (struct pipe_rasterizer_state *)setup;
softpipe->dirty |= SP_NEW_RASTERIZER;
}
void softpipe_delete_rasterizer_state(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *rasterizer)
+ void *rasterizer)
{
- free((struct pipe_rasterizer_state*)rasterizer);
+ /* do nothing */
}