summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-05-29 15:02:31 +0800
committerChia-I Wu <[email protected]>2013-06-07 11:13:15 +0800
commit29b938d9f43a4bc355ee05cad2c9796ea7ee93dd (patch)
treeabcc679677f64e5a73fcae857661cc9c574d352e
parent130364ad1d5010e9320aaa312309f83746d751d3 (diff)
ilo: switch to ilo states for WM stage
Define and use struct ilo_rasterizer_state; in ilo_context.
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c18
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c10
-rw-r--r--src/gallium/drivers/ilo/ilo_blit.c4
-rw-r--r--src/gallium/drivers/ilo/ilo_context.h7
-rw-r--r--src/gallium/drivers/ilo/ilo_gpe.h4
-rw-r--r--src/gallium/drivers/ilo/ilo_shader.c10
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c6
7 files changed, 33 insertions, 26 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
index e0ce20711da..3e716006930 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
@@ -615,7 +615,7 @@ gen6_pipeline_clip(struct ilo_3d_pipeline *p,
y1 <= 0.0f && y2 >= (float) ilo->framebuffer.height);
p->gen6_3DSTATE_CLIP(p->dev,
- ilo->rasterizer,
+ &ilo->rasterizer->state,
(ilo->fs && ilo->fs->shader->in.has_linear_interp),
enable_guardband, 1, p->cp);
}
@@ -634,7 +634,7 @@ gen6_pipeline_sf(struct ilo_3d_pipeline *p,
(ilo->vs)? ilo->vs->shader : NULL;
p->gen6_3DSTATE_SF(p->dev,
- ilo->rasterizer, fs, last_sh, p->cp);
+ &ilo->rasterizer->state, fs, last_sh, p->cp);
}
}
@@ -682,7 +682,7 @@ gen6_pipeline_wm(struct ilo_3d_pipeline *p,
gen6_wa_pipe_control_wm_max_threads_stall(p);
p->gen6_3DSTATE_WM(p->dev, fs, num_samplers,
- ilo->rasterizer, dual_blend, cc_may_kill, p->cp);
+ &ilo->rasterizer->state, dual_blend, cc_may_kill, p->cp);
}
}
@@ -708,7 +708,7 @@ gen6_pipeline_wm_multisample(struct ilo_3d_pipeline *p,
}
p->gen6_3DSTATE_MULTISAMPLE(p->dev, num_samples, packed_sample_pos,
- ilo->rasterizer->half_pixel_center, p->cp);
+ ilo->rasterizer->state.half_pixel_center, p->cp);
p->gen6_3DSTATE_SAMPLE_MASK(p->dev,
(num_samples > 1) ? ilo->sample_mask : 0x1, p->cp);
@@ -742,7 +742,7 @@ gen6_pipeline_wm_raster(struct ilo_3d_pipeline *p,
{
/* 3DSTATE_POLY_STIPPLE_PATTERN and 3DSTATE_POLY_STIPPLE_OFFSET */
if ((DIRTY(RASTERIZER) || DIRTY(POLY_STIPPLE)) &&
- ilo->rasterizer->poly_stipple_enable) {
+ ilo->rasterizer->state.poly_stipple_enable) {
if (p->dev->gen == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
@@ -753,17 +753,17 @@ gen6_pipeline_wm_raster(struct ilo_3d_pipeline *p,
}
/* 3DSTATE_LINE_STIPPLE */
- if (DIRTY(RASTERIZER) && ilo->rasterizer->line_stipple_enable) {
+ if (DIRTY(RASTERIZER) && ilo->rasterizer->state.line_stipple_enable) {
if (p->dev->gen == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
p->gen6_3DSTATE_LINE_STIPPLE(p->dev,
- ilo->rasterizer->line_stipple_pattern,
- ilo->rasterizer->line_stipple_factor + 1, p->cp);
+ ilo->rasterizer->state.line_stipple_pattern,
+ ilo->rasterizer->state.line_stipple_factor + 1, p->cp);
}
/* 3DSTATE_AA_LINE_PARAMETERS */
- if (DIRTY(RASTERIZER) && ilo->rasterizer->line_smooth) {
+ if (DIRTY(RASTERIZER) && ilo->rasterizer->state.line_smooth) {
if (p->dev->gen == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
index f2ce48f30c6..00699e1ae33 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
@@ -424,7 +424,7 @@ gen7_pipeline_sol(struct ilo_3d_pipeline *p,
const unsigned buffer_mask = (1 << ilo->so.count) - 1;
p->gen7_3DSTATE_STREAMOUT(p->dev, buffer_mask, sh->out.count,
- ilo->rasterizer->rasterizer_discard, p->cp);
+ ilo->rasterizer->state.rasterizer_discard, p->cp);
}
}
@@ -441,7 +441,7 @@ gen7_pipeline_sf(struct ilo_3d_pipeline *p,
(ilo->vs)? ilo->vs->shader : NULL;
p->gen7_3DSTATE_SBE(p->dev,
- ilo->rasterizer, fs, last_sh, p->cp);
+ &ilo->rasterizer->state, fs, last_sh, p->cp);
}
/* 3DSTATE_SF */
@@ -449,7 +449,7 @@ gen7_pipeline_sf(struct ilo_3d_pipeline *p,
gen7_wa_pipe_control_cs_stall(p, true, true);
p->gen7_3DSTATE_SF(p->dev,
- ilo->rasterizer, ilo->framebuffer.zsbuf, p->cp);
+ &ilo->rasterizer->state, ilo->framebuffer.zsbuf, p->cp);
}
}
@@ -472,7 +472,7 @@ gen7_pipeline_wm(struct ilo_3d_pipeline *p,
gen7_wa_pipe_control_wm_max_threads_stall(p);
p->gen7_3DSTATE_WM(p->dev,
- fs, ilo->rasterizer, cc_may_kill, p->cp);
+ fs, &ilo->rasterizer->state, cc_may_kill, p->cp);
}
/* 3DSTATE_BINDING_TABLE_POINTERS_PS */
@@ -582,7 +582,7 @@ gen7_pipeline_wm_multisample(struct ilo_3d_pipeline *p,
&p->packed_sample_position_1x;
p->gen6_3DSTATE_MULTISAMPLE(p->dev, num_samples, packed_sample_pos,
- ilo->rasterizer->half_pixel_center, p->cp);
+ ilo->rasterizer->state.half_pixel_center, p->cp);
p->gen7_3DSTATE_SAMPLE_MASK(p->dev,
(num_samples > 1) ? ilo->sample_mask : 0x1,
diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c
index 899ccace9c3..8b8d5df3040 100644
--- a/src/gallium/drivers/ilo/ilo_blit.c
+++ b/src/gallium/drivers/ilo/ilo_blit.c
@@ -560,13 +560,13 @@ ilo_blitter_begin(struct ilo_context *ilo, enum ilo_blitter_op op)
switch (op) {
case ILO_BLITTER_CLEAR:
- util_blitter_save_rasterizer(ilo->blitter, ilo->rasterizer);
+ util_blitter_save_rasterizer(ilo->blitter, (void *) ilo->rasterizer);
break;
case ILO_BLITTER_CLEAR_SURFACE:
util_blitter_save_framebuffer(ilo->blitter, &ilo->framebuffer);
break;
case ILO_BLITTER_BLIT:
- util_blitter_save_rasterizer(ilo->blitter, ilo->rasterizer);
+ util_blitter_save_rasterizer(ilo->blitter, (void *) ilo->rasterizer);
util_blitter_save_framebuffer(ilo->blitter, &ilo->framebuffer);
util_blitter_save_fragment_sampler_states(ilo->blitter,
diff --git a/src/gallium/drivers/ilo/ilo_context.h b/src/gallium/drivers/ilo/ilo_context.h
index 6bd3e48ef90..be7d94df1dc 100644
--- a/src/gallium/drivers/ilo/ilo_context.h
+++ b/src/gallium/drivers/ilo/ilo_context.h
@@ -66,8 +66,11 @@ struct ilo_context {
struct ilo_viewport_state viewport;
struct ilo_scissor_state scissor;
+ const struct ilo_rasterizer_state *rasterizer;
+ struct pipe_poly_stipple poly_stipple;
+ unsigned sample_mask;
+
struct pipe_blend_state *blend;
- struct pipe_rasterizer_state *rasterizer;
struct pipe_depth_stencil_alpha_state *depth_stencil_alpha;
struct ilo_shader_state *fs;
struct ilo_shader_state *vs;
@@ -75,9 +78,7 @@ struct ilo_context {
struct pipe_blend_color blend_color;
struct pipe_stencil_ref stencil_ref;
- unsigned sample_mask;
struct pipe_framebuffer_state framebuffer;
- struct pipe_poly_stipple poly_stipple;
struct {
struct pipe_sampler_state *samplers[ILO_MAX_SAMPLERS];
diff --git a/src/gallium/drivers/ilo/ilo_gpe.h b/src/gallium/drivers/ilo/ilo_gpe.h
index 9bf1114e9dc..4288ed5c25e 100644
--- a/src/gallium/drivers/ilo/ilo_gpe.h
+++ b/src/gallium/drivers/ilo/ilo_gpe.h
@@ -84,4 +84,8 @@ struct ilo_scissor_state {
struct pipe_scissor_state states[ILO_MAX_VIEWPORTS];
};
+struct ilo_rasterizer_state {
+ struct pipe_rasterizer_state state;
+};
+
#endif /* ILO_GPE_H */
diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c
index 67e1a80b751..78366ba9c82 100644
--- a/src/gallium/drivers/ilo/ilo_shader.c
+++ b/src/gallium/drivers/ilo/ilo_shader.c
@@ -44,12 +44,14 @@ ilo_shader_variant_init(struct ilo_shader_variant *variant,
switch (info->type) {
case PIPE_SHADER_VERTEX:
- variant->u.vs.rasterizer_discard = ilo->rasterizer->rasterizer_discard;
+ variant->u.vs.rasterizer_discard =
+ ilo->rasterizer->state.rasterizer_discard;
variant->u.vs.num_ucps =
- util_last_bit(ilo->rasterizer->clip_plane_enable);
+ util_last_bit(ilo->rasterizer->state.clip_plane_enable);
break;
case PIPE_SHADER_GEOMETRY:
- variant->u.gs.rasterizer_discard = ilo->rasterizer->rasterizer_discard;
+ variant->u.gs.rasterizer_discard =
+ ilo->rasterizer->state.rasterizer_discard;
variant->u.gs.num_inputs = ilo->vs->shader->out.count;
for (i = 0; i < ilo->vs->shader->out.count; i++) {
variant->u.gs.semantic_names[i] =
@@ -60,7 +62,7 @@ ilo_shader_variant_init(struct ilo_shader_variant *variant,
break;
case PIPE_SHADER_FRAGMENT:
variant->u.fs.flatshade =
- (info->has_color_interp && ilo->rasterizer->flatshade);
+ (info->has_color_interp && ilo->rasterizer->state.flatshade);
variant->u.fs.fb_height = (info->has_pos) ?
ilo->framebuffer.height : 1;
variant->u.fs.num_cbufs = ilo->framebuffer.nr_cbufs;
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index dfee07f4825..30d5056f053 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -300,12 +300,12 @@ static void *
ilo_create_rasterizer_state(struct pipe_context *pipe,
const struct pipe_rasterizer_state *state)
{
- struct pipe_rasterizer_state *rast;
+ struct ilo_rasterizer_state *rast;
- rast = MALLOC_STRUCT(pipe_rasterizer_state);
+ rast = MALLOC_STRUCT(ilo_rasterizer_state);
assert(rast);
- *rast = *state;
+ rast->state = *state;
return rast;
}