Mesa (master): r600g: fix polygon mode

Dave Airlie airlied at kemper.freedesktop.org
Fri Sep 24 09:00:05 UTC 2010


Module: Mesa
Branch: master
Commit: 11cd1612a1f0f7225ccb22c1197074c57b46aa26
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=11cd1612a1f0f7225ccb22c1197074c57b46aa26

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Sep 24 18:57:33 2010 +1000

r600g: fix polygon mode

this fixes glean'pointSprite test.

---

 src/gallium/drivers/r600/r600_hw_states.c     |    9 ++++++++-
 src/gallium/drivers/r600/r600_state_inlines.h |   12 ++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c
index 892666b..b4d73a0 100644
--- a/src/gallium/drivers/r600/r600_hw_states.c
+++ b/src/gallium/drivers/r600/r600_hw_states.c
@@ -201,6 +201,7 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta
 	unsigned offset_db_fmt_cntl = 0;
 	unsigned point_size;
 	unsigned prov_vtx = 1;
+	unsigned polygon_dual_mode;
 
 	if (rctx->clip)
 		clip = &rctx->clip->state.clip;
@@ -263,6 +264,9 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta
 			S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp) |
 			S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
 	}
+	polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
+			     state->fill_back != PIPE_POLYGON_MODE_FILL);
+
 	rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] =
 		S_028814_PROVOKING_VTX_LAST(prov_vtx) |
 		S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
@@ -270,7 +274,10 @@ static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rsta
 		S_028814_FACE(!state->front_ccw) |
 		S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
 		S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
-		S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri);
+		S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) |
+		S_028814_POLY_MODE(polygon_dual_mode) |
+		S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
+		S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back));
 	rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] =
 			S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
 			S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h
index 3be5248..a9e7619 100644
--- a/src/gallium/drivers/r600/r600_state_inlines.h
+++ b/src/gallium/drivers/r600/r600_state_inlines.h
@@ -123,6 +123,18 @@ static INLINE uint32_t r600_translate_stencil_op(int s_op)
 	return 0;
 }
 
+static INLINE uint32_t r600_translate_fill(uint32_t func)
+{
+	switch(func) {
+	case PIPE_POLYGON_MODE_FILL:
+		return 2;
+	case PIPE_POLYGON_MODE_LINE:
+		return 1;
+	case PIPE_POLYGON_MODE_POINT:
+		return 0;
+	}
+}
+
 /* translates straight */
 static INLINE uint32_t r600_translate_ds_func(int func)
 {




More information about the mesa-commit mailing list