diff options
author | Marek Olšák <[email protected]> | 2014-10-04 22:33:36 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-10-12 23:53:57 +0200 |
commit | ec0d16872b25055e5d06d4cf3d6ad0271e4bb27b (patch) | |
tree | 1468399186c20cf76c25fb0e8df1ade0502fcf99 /src/gallium/drivers | |
parent | 80677327404490e1bb4a37c065b4536940e74f73 (diff) |
radeonsi: use tgsi_shader_info in si_llvm_emit_vs_epilogue
That code was really ugly.
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 63b77be73e7..2a1217946c1 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1308,38 +1308,25 @@ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context * bld_base) { struct si_shader_context *si_shader_ctx = si_shader_context(bld_base); struct gallivm_state *gallivm = bld_base->base.gallivm; - struct tgsi_parse_context *parse = &si_shader_ctx->parse; + struct tgsi_shader_info *info = &si_shader_ctx->shader->selector->info; struct si_shader_output_values *outputs = NULL; - unsigned noutput = 0; - int i; - - while (!tgsi_parse_end_of_tokens(parse)) { - struct tgsi_full_declaration *d = - &parse->FullToken.FullDeclaration; - unsigned index; + int i,j; - tgsi_parse_token(parse); + outputs = MALLOC(info->num_outputs * sizeof(outputs[0])); - if (parse->FullToken.Token.Type != TGSI_TOKEN_TYPE_DECLARATION) - continue; + for (i = 0; i < info->num_outputs; i++) { + outputs[i].name = info->output_semantic_name[i]; + outputs[i].sid = info->output_semantic_index[i]; + outputs[i].index = i; - outputs = REALLOC(outputs, noutput * sizeof(outputs[0]), - (noutput + 1) * sizeof(outputs[0])); - for (index = d->Range.First; index <= d->Range.Last; index++) { - outputs[noutput].index = index; - outputs[noutput].name = d->Semantic.Name; - outputs[noutput].sid = d->Semantic.Index; - - for (i = 0; i < 4; i++) - outputs[noutput].values[i] = - LLVMBuildLoad(gallivm->builder, - si_shader_ctx->radeon_bld.soa.outputs[index][i], - ""); - } - noutput++; + for (j = 0; j < 4; j++) + outputs[i].values[j] = + LLVMBuildLoad(gallivm->builder, + si_shader_ctx->radeon_bld.soa.outputs[i][j], + ""); } - si_llvm_export_vs(bld_base, outputs, noutput); + si_llvm_export_vs(bld_base, outputs, info->num_outputs); FREE(outputs); } |