ilo: switch to ilo states for WM stage
authorChia-I Wu <olvaffe@gmail.com>
Wed, 29 May 2013 07:02:31 +0000 (15:02 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 7 Jun 2013 03:13:15 +0000 (11:13 +0800)
Define and use

 struct ilo_rasterizer_state;

in ilo_context.

src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
src/gallium/drivers/ilo/ilo_blit.c
src/gallium/drivers/ilo/ilo_context.h
src/gallium/drivers/ilo/ilo_gpe.h
src/gallium/drivers/ilo/ilo_shader.c
src/gallium/drivers/ilo/ilo_state.c

index e0ce20711dab3af85681b9d12d6cb22fb5971ef2..3e716006930618d405fb54dbd9bc909b50d96ef8 100644 (file)
@@ -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);
 
index f2ce48f30c605ec143b4ba705b0350aa10a1ef3b..00699e1ae33953a0142b3e67252a26de9611a920 100644 (file)
@@ -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,
index 899ccace9c37cd76e0a4ed160690c09394ea0313..8b8d5df3040a78acd175d457704667a3250d8535 100644 (file)
@@ -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,
index 6bd3e48ef9081b8c3a9786b9ee075353ece7559d..be7d94df1dcd1ef65b91e2e329d2b2cd60289ca1 100644 (file)
@@ -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];
index 9bf1114e9dc9c857d8d92baa2d2be9a39dffd61d..4288ed5c25e2ea2a06402b199fd54fef78600ba2 100644 (file)
@@ -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 */
index 67e1a80b7515268565a3692b10c0916ef53117a8..78366ba9c82e3c015928f743c8029c502c1a0e84 100644 (file)
@@ -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;
index dfee07f4825f00a4fd6b8d7e73684e0dc82af284..30d5056f05319af316f563cdf96173cbef8f21a2 100644 (file)
@@ -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;
 }