[Mesa-dev] [PATCH 11/16] radeonsi: use tgsi_shader_info to get a list of GS outputs
Marek Olšák
maraeo at gmail.com
Sat Oct 4 15:42:14 PDT 2014
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 22 ++++++++++------------
src/gallium/drivers/radeonsi/si_state_draw.c | 4 ++--
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 5ab9e55..a4073a7 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2232,6 +2232,7 @@ static void si_llvm_emit_vertex(
struct si_shader_context *si_shader_ctx = si_shader_context(bld_base);
struct lp_build_context *uint = &bld_base->uint_bld;
struct si_shader *shader = si_shader_ctx->shader;
+ struct tgsi_shader_info *info = &shader->selector->info;
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMTypeRef i32 = LLVMInt32TypeInContext(gallivm->context);
LLVMValueRef soffset = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
@@ -2282,9 +2283,9 @@ static void si_llvm_emit_vertex(
build_intrinsic(gallivm->builder, "llvm.AMDGPU.kill",
LLVMVoidTypeInContext(gallivm->context), &kill, 1, 0);
- for (i = 0; i < shader->noutput; i++) {
+ for (i = 0; i < info->num_outputs; i++) {
LLVMValueRef *out_ptr =
- si_shader_ctx->radeon_bld.soa.outputs[shader->output[i].index];
+ si_shader_ctx->radeon_bld.soa.outputs[i];
for (chan = 0; chan < 4; chan++) {
LLVMValueRef out_val = LLVMBuildLoad(gallivm->builder, out_ptr[chan], "");
@@ -2693,11 +2694,12 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
struct lp_build_context *uint = &bld_base->uint_bld;
struct si_shader *shader = si_shader_ctx->shader;
struct si_shader_output_values *outputs;
+ struct tgsi_shader_info *gsinfo = &gs->selector->info;
LLVMValueRef t_list_ptr, t_list;
LLVMValueRef args[9];
int i, r;
- outputs = MALLOC(gs->noutput * sizeof(outputs[0]));
+ outputs = MALLOC(gsinfo->num_outputs * sizeof(outputs[0]));
si_shader_ctx->type = TGSI_PROCESSOR_VERTEX;
shader->is_gs_copy_shader = true;
@@ -2727,15 +2729,12 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
args[8] = uint->zero; /* TFE */
/* Fetch vertex data from GSVS ring */
- for (i = 0; i < gs->noutput; ++i) {
- struct si_shader_output *out = gs->output + i;
+ for (i = 0; i < gsinfo->num_outputs; ++i) {
unsigned chan;
- shader->output[i] = *out;
-
- outputs[i].name = out->name;
- outputs[i].index = out->index;
- outputs[i].sid = out->sid;
+ outputs[i].name = gsinfo->output_semantic_name[i];
+ outputs[i].index = i;
+ outputs[i].sid = gsinfo->output_semantic_index[i];
for (chan = 0; chan < 4; chan++) {
args[2] = lp_build_const_int32(gallivm,
@@ -2752,9 +2751,8 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
base->elem_type, "");
}
}
- shader->noutput = gs->noutput;
- si_llvm_export_vs(bld_base, outputs, gs->noutput);
+ si_llvm_export_vs(bld_base, outputs, gsinfo->num_outputs);
radeon_llvm_finalize_module(&si_shader_ctx->radeon_bld);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 5f9e89f..5460af9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -80,7 +80,7 @@ static void si_shader_es(struct pipe_context *ctx, struct si_shader *shader)
static void si_shader_gs(struct pipe_context *ctx, struct si_shader *shader)
{
struct si_context *sctx = (struct si_context *)ctx;
- unsigned gs_vert_itemsize = shader->noutput * (16 >> 2);
+ unsigned gs_vert_itemsize = shader->selector->info.num_outputs * (16 >> 2);
unsigned gs_max_vert_out = shader->selector->gs_max_out_vertices;
unsigned gsvs_itemsize = gs_vert_itemsize * gs_max_vert_out;
unsigned cut_mode;
@@ -633,7 +633,7 @@ static void si_update_derived_state(struct si_context *sctx)
si_set_ring_buffer(ctx, PIPE_SHADER_GEOMETRY, SI_RING_GSVS,
sctx->gsvs_ring,
sctx->gs_shader->gs_max_out_vertices *
- sctx->gs_shader->current->noutput * 16,
+ sctx->gs_shader->info.num_outputs * 16,
64, true, true, 4, 16);
if (!sctx->gs_on) {
--
1.9.1
More information about the mesa-dev
mailing list