diff options
author | Chia-I Wu <[email protected]> | 2013-04-29 08:25:27 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-05-01 17:34:49 +0800 |
commit | 252a21c2cccfda8c8e48e9be74a45744f07614eb (patch) | |
tree | 08ae9d504e504da525ef85a679190d3161117628 /src | |
parent | 440557db4e51fcf15343fef759cc36f1207dc81f (diff) |
ilo: expose register indices of OUTs in ilo_shader
pipe_stream_output_info tells us which of OUT[i] needs to be written out.
We need the info to map OUT[i] to VUE offset.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_shader.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/ilo_shader_fs.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/ilo_shader_gs.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/shader/ilo_shader_vs.c | 16 |
4 files changed, 30 insertions, 4 deletions
diff --git a/src/gallium/drivers/ilo/ilo_shader.h b/src/gallium/drivers/ilo/ilo_shader.h index accea7ad6be..66adabac35d 100644 --- a/src/gallium/drivers/ilo/ilo_shader.h +++ b/src/gallium/drivers/ilo/ilo_shader.h @@ -92,6 +92,7 @@ struct ilo_shader { } in; struct { + int register_indices[PIPE_MAX_SHADER_OUTPUTS]; int semantic_names[PIPE_MAX_SHADER_OUTPUTS]; int semantic_indices[PIPE_MAX_SHADER_OUTPUTS]; int count; diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c index 1766f6f224f..7a2724ca95c 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c @@ -1441,6 +1441,7 @@ fs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi) sh->out.count = tgsi->num_outputs; for (i = 0; i < tgsi->num_outputs; i++) { + sh->out.register_indices[i] = tgsi->outputs[i].index; sh->out.semantic_names[i] = tgsi->outputs[i].semantic_name; sh->out.semantic_indices[i] = tgsi->outputs[i].semantic_index; diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_gs.c b/src/gallium/drivers/ilo/shader/ilo_shader_gs.c index a07e39c3e8d..caa0b17b9c7 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_gs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_gs.c @@ -1094,21 +1094,31 @@ gs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, /* the first two VUEs are always PSIZE and POSITION */ num_outs = 2; + output_map[0] = psize_slot; + output_map[1] = pos_slot; + + sh->out.register_indices[0] = + (psize_slot >= 0) ? tgsi->outputs[psize_slot].index : -1; sh->out.semantic_names[0] = TGSI_SEMANTIC_PSIZE; sh->out.semantic_indices[0] = 0; + + sh->out.register_indices[1] = + (pos_slot >= 0) ? tgsi->outputs[pos_slot].index : -1; sh->out.semantic_names[1] = TGSI_SEMANTIC_POSITION; sh->out.semantic_indices[1] = 0; sh->out.has_pos = true; - output_map[0] = psize_slot; - output_map[1] = pos_slot; /* followed by optional clip distances */ if (output_clipdist) { + sh->out.register_indices[num_outs] = + (clipdist_slot[0] >= 0) ? tgsi->outputs[clipdist_slot[0]].index : -1; sh->out.semantic_names[num_outs] = TGSI_SEMANTIC_CLIPDIST; sh->out.semantic_indices[num_outs] = 0; output_map[num_outs++] = clipdist_slot[0]; + sh->out.register_indices[num_outs] = + (clipdist_slot[1] >= 0) ? tgsi->outputs[clipdist_slot[1]].index : -1; sh->out.semantic_names[num_outs] = TGSI_SEMANTIC_CLIPDIST; sh->out.semantic_indices[num_outs] = 1; output_map[num_outs++] = clipdist_slot[1]; @@ -1124,6 +1134,7 @@ gs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, if (slot < 0) continue; + sh->out.register_indices[num_outs] = tgsi->outputs[slot].index; sh->out.semantic_names[num_outs] = tgsi->outputs[slot].semantic_name; sh->out.semantic_indices[num_outs] = tgsi->outputs[slot].semantic_index; @@ -1140,6 +1151,7 @@ gs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, case TGSI_SEMANTIC_BCOLOR: break; default: + sh->out.register_indices[num_outs] = tgsi->outputs[i].index; sh->out.semantic_names[num_outs] = tgsi->outputs[i].semantic_name; sh->out.semantic_indices[num_outs] = tgsi->outputs[i].semantic_index; output_map[num_outs++] = i; diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c index ff4e4be01cc..4b1ba02687c 100644 --- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c +++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c @@ -1056,21 +1056,31 @@ vs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, /* the first two VUEs are always PSIZE and POSITION */ num_outs = 2; + output_map[0] = psize_slot; + output_map[1] = pos_slot; + + sh->out.register_indices[0] = + (psize_slot >= 0) ? tgsi->outputs[psize_slot].index : -1; sh->out.semantic_names[0] = TGSI_SEMANTIC_PSIZE; sh->out.semantic_indices[0] = 0; + + sh->out.register_indices[1] = + (pos_slot >= 0) ? tgsi->outputs[pos_slot].index : -1; sh->out.semantic_names[1] = TGSI_SEMANTIC_POSITION; sh->out.semantic_indices[1] = 0; sh->out.has_pos = true; - output_map[0] = psize_slot; - output_map[1] = pos_slot; /* followed by optional clip distances */ if (output_clipdist) { + sh->out.register_indices[num_outs] = + (clipdist_slot[0] >= 0) ? tgsi->outputs[clipdist_slot[0]].index : -1; sh->out.semantic_names[num_outs] = TGSI_SEMANTIC_CLIPDIST; sh->out.semantic_indices[num_outs] = 0; output_map[num_outs++] = clipdist_slot[0]; + sh->out.register_indices[num_outs] = + (clipdist_slot[1] >= 0) ? tgsi->outputs[clipdist_slot[1]].index : -1; sh->out.semantic_names[num_outs] = TGSI_SEMANTIC_CLIPDIST; sh->out.semantic_indices[num_outs] = 1; output_map[num_outs++] = clipdist_slot[1]; @@ -1086,6 +1096,7 @@ vs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, if (slot < 0) continue; + sh->out.register_indices[num_outs] = tgsi->outputs[slot].index; sh->out.semantic_names[num_outs] = tgsi->outputs[slot].semantic_name; sh->out.semantic_indices[num_outs] = tgsi->outputs[slot].semantic_index; @@ -1102,6 +1113,7 @@ vs_setup_shader_out(struct ilo_shader *sh, const struct toy_tgsi *tgsi, case TGSI_SEMANTIC_BCOLOR: break; default: + sh->out.register_indices[num_outs] = tgsi->outputs[i].index; sh->out.semantic_names[num_outs] = tgsi->outputs[i].semantic_name; sh->out.semantic_indices[num_outs] = tgsi->outputs[i].semantic_index; output_map[num_outs++] = i; |