summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-02-26 14:47:22 +0100
committerMarek Olšák <[email protected]>2012-03-05 14:22:20 +0100
commit597fd6dc8c424a35f8442d5fd9de708013a69830 (patch)
tree6d0169f98af7369f19b3609b99cf37e027ccb89c /src
parent734792e83fdc526623d8fe0a60479648c936bd53 (diff)
r600g: fix and improve rasterizer discard for r600-r700
For polygons, we have been using face culling with success, but that doesn't work for points and lines. Setting the point size and line width to 0 fixes it. Also improve it even more by setting SCREEN_SCISSOR to a zero area. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c1
-rw-r--r--src/gallium/drivers/r600/r600_state.c20
2 files changed, 15 insertions, 6 deletions
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 1dc23fdcca5..40e776107f6 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -374,6 +374,7 @@ static const struct r600_reg r600_context_reg_list[] = {
{R_028010_DB_DEPTH_INFO, REG_FLAG_NEED_BO, 0},
{R_028D24_DB_HTILE_SURFACE, 0, 0},
{R_028D34_DB_PREFETCH_LIMIT, 0, 0},
+ {R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0},
{R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0},
{R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0},
{R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0},
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 38b48a29b7d..a13c9944d44 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -818,10 +818,15 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, NULL, 0);
/* point size 12.4 fixed point */
- tmp = (unsigned)(state->point_size * 8.0);
+ /* For rasterizer discard, disable point rendering by forcing the point size to be 0. */
+ tmp = state->rasterizer_discard ? 0 : r600_pack_float_12p4(state->point_size/2);
r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), NULL, 0);
- if (state->point_size_per_vertex) {
+ if (state->rasterizer_discard) {
+ /* For rasterizer discard, disable point rendering by forcing the point size to be 0. */
+ psize_min = 0;
+ psize_max = 0;
+ } else if (state->point_size_per_vertex) {
psize_min = util_get_min_point_size(state);
psize_max = 8192;
} else {
@@ -835,7 +840,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
S_028A04_MAX_SIZE(r600_pack_float_12p4(psize_max/2)),
NULL, 0);
- tmp = (unsigned)state->line_width * 8;
+ /* For rasterizer discard, disable line rendering by forcing the line width to be 0. */
+ tmp = state->rasterizer_discard ? 0 : r600_pack_float_12p4(state->line_width/2);
r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, S_028A08_WIDTH(tmp), NULL, 0);
if (rctx->chip_class >= R700) {
@@ -872,6 +878,10 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)),
NULL, 0);
+
+ r600_pipe_state_add_reg(rstate, R_028034_PA_SC_SCREEN_SCISSOR_BR,
+ state->rasterizer_discard ? 0 : (S_028034_BR_X(8192) | S_028034_BR_Y(8192)),
+ NULL, 0);
return rstate;
}
@@ -2056,9 +2066,7 @@ void r600_init_atom_start_cs(struct r600_context *rctx)
r600_store_context_reg(cb, R_028C48_PA_SC_AA_MASK, 0xFFFFFFFF);
- r600_store_context_reg_seq(cb, R_028030_PA_SC_SCREEN_SCISSOR_TL, 2);
- r600_store_value(cb, 0); /* R_028030_PA_SC_SCREEN_SCISSOR_TL */
- r600_store_value(cb, S_028034_BR_X(8192) | S_028034_BR_Y(8192)); /* R_028034_PA_SC_SCREEN_SCISSOR_BR */
+ r600_store_context_reg(cb, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0);
r600_store_context_reg_seq(cb, R_028240_PA_SC_GENERIC_SCISSOR_TL, 2);
r600_store_value(cb, 0); /* R_028240_PA_SC_GENERIC_SCISSOR_TL */