diff options
author | Dave Airlie <[email protected]> | 2010-09-24 14:58:15 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-09-24 14:59:19 +1000 |
commit | 59276b8541049a2d07d32fbb139fb14e21e387fc (patch) | |
tree | 26c9ac7a609d6073f68070dbaede7389c580a711 /src/gallium/drivers/r600 | |
parent | e74d26d82ab6e4b21c6220d8f599f69ab2acf01e (diff) |
r600g: fixup VP->FP output->input routing.
We need to map the TGSI semantics to each other using the hw semantic ids.
this fixes glsl-kwin-blur and glsl-routing.
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/eg_hw_states.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_states.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 16 |
4 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c index 77ac444fe2e..47c15b8dcc8 100644 --- a/src/gallium/drivers/r600/eg_hw_states.c +++ b/src/gallium/drivers/r600/eg_hw_states.c @@ -934,7 +934,7 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)); tmp |= S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h index c15e64329d8..aec0dab338c 100644 --- a/src/gallium/drivers/r600/r600_context.h +++ b/src/gallium/drivers/r600/r600_context.h @@ -279,6 +279,7 @@ extern int r600_pipe_shader_create(struct pipe_context *ctx, const struct tgsi_token *tokens); extern int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_context_state *rstate); +extern int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id); #define R600_ERR(fmt, args...) \ fprintf(stderr, "EE %s/%s:%d - "fmt, __FILE__, __func__, __LINE__, ##args) diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c index 1e9c5ffbfc7..9cbf12008b7 100644 --- a/src/gallium/drivers/r600/r600_hw_states.c +++ b/src/gallium/drivers/r600/r600_hw_states.c @@ -1007,7 +1007,7 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state * radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS); for (i = 0; i < rshader->ninput; i++) { - tmp = S_028644_SEMANTIC(i) | S_028644_SEL_CENTROID(1); + tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)) | S_028644_SEL_CENTROID(1); if (rshader->input[i].name == TGSI_SEMANTIC_POSITION) have_pos = TRUE; if (rshader->input[i].name == TGSI_SEMANTIC_COLOR || diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index e18c6ce6052..3274f3be71a 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -64,6 +64,22 @@ struct r600_shader_tgsi_instruction { static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[]; static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx); +/* called from hw states files to find VS->FS mapping */ +int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id) +{ + int i; + struct r600_shader *vs = &rctx->vs_shader->shader; + struct r600_shader_io *input = &rshader->input[id]; + + for (i = 0; i < vs->noutput; i++) { + if (input->name == vs->output[i].name && + input->sid == vs->output[i].sid) { + return i - 1; + } + } + return 0; +} + static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader) { struct r600_context *rctx = r600_context(ctx); |