summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/evergreen_state.c
diff options
context:
space:
mode:
authorVadim Girlin <[email protected]>2011-11-04 21:24:03 +0400
committerAlex Deucher <[email protected]>2011-11-04 16:23:24 -0400
commit9804cf3118ae7249098af2a9c78b36f4fb576ee4 (patch)
treed7ccba7d7cafe243a783b6013ca1663e6de179a9 /src/gallium/drivers/r600/evergreen_state.c
parentc15f8569fddac5f8aee77863922fd5bb992cfe8a (diff)
r600g: move SPI setup to PS setup
SPI semantic indices for PS/VS are now static, so we don't need to update spi config for every shaders combination. We can move the functionality of r600_spi_update to r600(evergreen)_pipe_shader_ps. Flatshade state is now controlled by the global FLAT_SHADE_ENA flag instead of updating FLAT_SHADE for all inputs. Sprite coord still requires the update of spi setup when sprite_coord_enable is first changed from zero (enabled), and then only when it's changed to other non-zero value (enabled for other input). Change to zero (disabling) and back to the same value is handled via global SPRITE_COORD_ENA. New field "sprite_coord_enable" added to "struct r600_pipe_shader" to track current state for the pixel shader. It's checked in the r600_update_derived_state. Signed-off-by: Vadim Girlin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/evergreen_state.c')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 904267da1bd..c0b057cc334 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -908,7 +908,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(1);
+ tmp = S_0286D4_FLAT_SHADE_ENA(state->flatshade);
if (state->sprite_coord_enable) {
tmp |= S_0286D4_PNT_SPRITE_ENA(1) |
S_0286D4_PNT_SPRITE_OVRD_X(2) |
@@ -2246,7 +2246,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
int pos_index = -1, face_index = -1;
int ninterp = 0;
boolean have_linear = FALSE, have_centroid = FALSE, have_perspective = FALSE;
- unsigned spi_baryc_cntl;
+ unsigned spi_baryc_cntl, sid, tmp, idx = 0;
rstate->nregs = 0;
@@ -2267,7 +2267,31 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
if (rshader->input[i].centroid)
have_centroid = TRUE;
}
+
+ sid = rshader->input[i].spi_sid;
+
+ if (sid) {
+
+ tmp = S_028644_SEMANTIC(sid);
+
+ if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+ tmp |= S_028644_FLAT_SHADE(1);
+ }
+
+ if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
+ rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
+ tmp |= S_028644_PT_SPRITE_TEX(1);
+ }
+
+ r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + idx * 4,
+ tmp, 0xFFFFFFFF, NULL, 0);
+
+ idx++;
+ }
}
+
for (i = 0; i < rshader->noutput; i++) {
if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1);
@@ -2368,6 +2392,8 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader
r600_pipe_state_add_reg(rstate,
R_03A200_SQ_LOOP_CONST_0, 0x01000FFF,
0xFFFFFFFF, NULL, 0);
+
+ shader->sprite_coord_enable = rctx->sprite_coord_enable;
}
void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader)