diff options
author | Vadim Girlin <[email protected]> | 2012-01-24 23:32:50 +0400 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2012-01-28 16:20:37 +0000 |
commit | 1a9d2b764295f561aa9c24f504bd8cf3f95e7f54 (patch) | |
tree | a33690fc647ff1b83985bdbc64e2447e8db9eb58 | |
parent | eaf360e5bffc5630789367020252cd12fe586177 (diff) |
r600g: fix linear and flat interpolation
Signed-off-by: Vadim Girlin <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 21 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 5 |
4 files changed, 27 insertions, 17 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3bec748661a..a988fabe3c1 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -909,7 +909,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_RASTERIZER; if (state->flatshade_first) prov_vtx = 0; - tmp = S_0286D4_FLAT_SHADE_ENA(state->flatshade); + tmp = S_0286D4_FLAT_SHADE_ENA(1); if (state->sprite_coord_enable) { tmp |= S_0286D4_PNT_SPRITE_ENA(1) | S_0286D4_PNT_SPRITE_OVRD_X(2) | @@ -985,9 +985,11 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, S_028810_PS_UCP_MODE(3) | S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | - S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip), - S_028810_PS_UCP_MODE(3) | S_028810_ZCLIP_NEAR_DISABLE(1) | - S_028810_ZCLIP_FAR_DISABLE(1), NULL, 0); + S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip) | + S_028810_DX_LINEAR_ATTR_CLIP_ENA(1), + ~(C_028810_PS_UCP_MODE & C_028810_ZCLIP_NEAR_DISABLE & + C_028810_ZCLIP_FAR_DISABLE & + C_028810_DX_LINEAR_ATTR_CLIP_ENA), NULL, 0); return rstate; } @@ -2307,8 +2309,9 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader tmp = S_028644_SEMANTIC(sid); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION || - rshader->input[i].interpolate == TGSI_INTERPOLATE_COLOR || - rshader->input[i].interpolate == TGSI_INTERPOLATE_CONSTANT) { + rshader->input[i].interpolate == TGSI_INTERPOLATE_CONSTANT || + (rshader->input[i].interpolate == TGSI_INTERPOLATE_COLOR && + rctx->rasterizer && rctx->rasterizer->flatshade)) { tmp |= S_028644_FLAT_SHADE(1); } @@ -2427,6 +2430,8 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader 0xFFFFFFFF, NULL, 0); shader->sprite_coord_enable = rctx->sprite_coord_enable; + if (rctx->rasterizer) + shader->flatshade = rctx->rasterizer->flatshade; } void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 9de8e7efaca..47c6ad0335a 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -146,6 +146,7 @@ struct r600_pipe_shader { struct r600_vertex_element vertex_elements; struct tgsi_token *tokens; unsigned sprite_coord_enable; + unsigned flatshade; struct pipe_stream_output_info so; }; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index e093e5003a9..8e5342c8114 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -967,7 +967,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, rstate->id = R600_PIPE_STATE_RASTERIZER; if (state->flatshade_first) prov_vtx = 0; - tmp = S_0286D4_FLAT_SHADE_ENA(state->flatshade); + tmp = S_0286D4_FLAT_SHADE_ENA(1); if (state->sprite_coord_enable) { tmp |= S_0286D4_PNT_SPRITE_ENA(1) | S_0286D4_PNT_SPRITE_OVRD_X(2) | @@ -1035,9 +1035,11 @@ static void *r600_create_rs_state(struct pipe_context *ctx, r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL, S_028810_PS_UCP_MODE(3) | S_028810_ZCLIP_NEAR_DISABLE(!state->depth_clip) | - S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip), - S_028810_PS_UCP_MODE(3) | S_028810_ZCLIP_NEAR_DISABLE(1) | - S_028810_ZCLIP_FAR_DISABLE(1), NULL, 0); + S_028810_ZCLIP_FAR_DISABLE(!state->depth_clip) | + S_028810_DX_LINEAR_ATTR_CLIP_ENA(1), + ~(C_028810_PS_UCP_MODE & C_028810_ZCLIP_NEAR_DISABLE & + C_028810_ZCLIP_FAR_DISABLE & + C_028810_DX_LINEAR_ATTR_CLIP_ENA), NULL, 0); return rstate; } @@ -2096,11 +2098,10 @@ void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shad tmp = S_028644_SEMANTIC(sid); - if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) { - tmp |= S_028644_FLAT_SHADE(1); - } - if (rshader->input[i].interpolate == TGSI_INTERPOLATE_COLOR || - rshader->input[i].interpolate == TGSI_INTERPOLATE_CONSTANT) + if (rshader->input[i].name == TGSI_SEMANTIC_POSITION || + rshader->input[i].interpolate == TGSI_INTERPOLATE_CONSTANT || + (rshader->input[i].interpolate == TGSI_INTERPOLATE_COLOR && + rctx->rasterizer && rctx->rasterizer->flatshade)) tmp |= S_028644_FLAT_SHADE(1); if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC && @@ -2203,6 +2204,8 @@ void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shad 0xFFFFFFFF, NULL, 0); shader->sprite_coord_enable = rctx->sprite_coord_enable; + if (rctx->rasterizer) + shader->flatshade = rctx->rasterizer->flatshade; } void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader) diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 80b28d9e7ca..333e10cc5e9 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -595,8 +595,9 @@ static void r600_update_derived_state(struct r600_pipe_context *rctx) r600_update_alpha_ref(rctx); } - if (rctx->ps_shader && rctx->sprite_coord_enable && - (rctx->ps_shader->sprite_coord_enable != rctx->sprite_coord_enable)) { + if (rctx->ps_shader && ((rctx->sprite_coord_enable && + (rctx->ps_shader->sprite_coord_enable != rctx->sprite_coord_enable)) || + (rctx->rasterizer && rctx->rasterizer->flatshade != rctx->ps_shader->flatshade))) { if (rctx->chip_class >= EVERGREEN) evergreen_pipe_shader_ps(ctx, rctx->ps_shader); |