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.
This commit is contained in:
Dave Airlie 2010-09-24 14:58:15 +10:00
parent e74d26d82a
commit 59276b8541
4 changed files with 19 additions and 2 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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 ||

View file

@ -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);