r300g: implement pipe_rasterizer_state::clip_halfz
authorMarek Olšák <marek.olsak@amd.com>
Wed, 22 Oct 2014 08:59:49 +0000 (10:59 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Oct 2014 19:04:56 +0000 (21:04 +0200)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c

index 92a35d51448be4d8830ebaa5cb2e7239a6971175..4d2b1531ad709d5c19939d4acf1e488b0fc83057 100644 (file)
@@ -580,6 +580,7 @@ struct r300_context {
     /* Whether two-sided color selection is enabled (AKA light_twoside). */
     boolean two_sided_color;
     boolean flatshade;
+    boolean clip_halfz;
     /* Whether fast color clear is enabled. */
     boolean cbzb_clear;
     /* Whether fragment shader needs to be validated. */
index b201334cb959253554fe6f840d9a9be9d663dde2..b632963d187139b1ed0068efebd166defa690980 100644 (file)
@@ -1136,6 +1136,7 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
             R300_PVS_NUM_CNTLRS(pvs_num_controllers) |
             R300_PVS_NUM_FPUS(r300screen->caps.num_vert_fpus) |
             R300_PVS_VF_MAX_VTX_NUM(12) |
+            (r300->clip_halfz ? R300_DX_CLIP_SPACE_DEF : 0) |
             (r300screen->caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0));
 
     /* Emit flow control instructions.  Even if there are no fc instructions,
index fd67e35b25817227e1349d089a155bd8f5d96e68..cfcc19d1c68d2e1136e8ca78d2a8c9609804f6d9 100644 (file)
@@ -1390,6 +1390,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     boolean last_two_sided_color = r300->two_sided_color;
     boolean last_msaa_enable = r300->msaa_enable;
     boolean last_flatshade = r300->flatshade;
+    boolean last_clip_halfz = r300->clip_halfz;
 
     if (r300->draw && rs) {
         draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
@@ -1401,12 +1402,14 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
         r300->two_sided_color = rs->rs.light_twoside;
         r300->msaa_enable = rs->rs.multisample;
         r300->flatshade = rs->rs.flatshade;
+        r300->clip_halfz = rs->rs.clip_halfz;
     } else {
         r300->polygon_offset_enabled = FALSE;
         r300->sprite_coord_enable = 0;
         r300->two_sided_color = FALSE;
         r300->msaa_enable = FALSE;
         r300->flatshade = FALSE;
+        r300->clip_halfz = FALSE;
     }
 
     UPDATE_STATE(state, r300->rs_state);
@@ -1428,6 +1431,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
             r300->fs_status = FRAGMENT_SHADER_MAYBE_DIRTY;
         }
     }
+
+    if (last_clip_halfz != r300->clip_halfz) {
+        r300_mark_atom_dirty(r300, &r300->vs_state);
+    }
 }
 
 /* Free rasterizer state. */