radeonsi: use tgsi_shader_info to get a list of GS outputs
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
parent
101905d3f7
commit
02134cfaae
|
@ -2232,6 +2232,7 @@ static void si_llvm_emit_vertex(
|
||||||
struct si_shader_context *si_shader_ctx = si_shader_context(bld_base);
|
struct si_shader_context *si_shader_ctx = si_shader_context(bld_base);
|
||||||
struct lp_build_context *uint = &bld_base->uint_bld;
|
struct lp_build_context *uint = &bld_base->uint_bld;
|
||||||
struct si_shader *shader = si_shader_ctx->shader;
|
struct si_shader *shader = si_shader_ctx->shader;
|
||||||
|
struct tgsi_shader_info *info = &shader->selector->info;
|
||||||
struct gallivm_state *gallivm = bld_base->base.gallivm;
|
struct gallivm_state *gallivm = bld_base->base.gallivm;
|
||||||
LLVMTypeRef i32 = LLVMInt32TypeInContext(gallivm->context);
|
LLVMTypeRef i32 = LLVMInt32TypeInContext(gallivm->context);
|
||||||
LLVMValueRef soffset = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
|
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",
|
build_intrinsic(gallivm->builder, "llvm.AMDGPU.kill",
|
||||||
LLVMVoidTypeInContext(gallivm->context), &kill, 1, 0);
|
LLVMVoidTypeInContext(gallivm->context), &kill, 1, 0);
|
||||||
|
|
||||||
for (i = 0; i < shader->noutput; i++) {
|
for (i = 0; i < info->num_outputs; i++) {
|
||||||
LLVMValueRef *out_ptr =
|
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++) {
|
for (chan = 0; chan < 4; chan++) {
|
||||||
LLVMValueRef out_val = LLVMBuildLoad(gallivm->builder, out_ptr[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 lp_build_context *uint = &bld_base->uint_bld;
|
||||||
struct si_shader *shader = si_shader_ctx->shader;
|
struct si_shader *shader = si_shader_ctx->shader;
|
||||||
struct si_shader_output_values *outputs;
|
struct si_shader_output_values *outputs;
|
||||||
|
struct tgsi_shader_info *gsinfo = &gs->selector->info;
|
||||||
LLVMValueRef t_list_ptr, t_list;
|
LLVMValueRef t_list_ptr, t_list;
|
||||||
LLVMValueRef args[9];
|
LLVMValueRef args[9];
|
||||||
int i, r;
|
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;
|
si_shader_ctx->type = TGSI_PROCESSOR_VERTEX;
|
||||||
shader->is_gs_copy_shader = true;
|
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 */
|
args[8] = uint->zero; /* TFE */
|
||||||
|
|
||||||
/* Fetch vertex data from GSVS ring */
|
/* Fetch vertex data from GSVS ring */
|
||||||
for (i = 0; i < gs->noutput; ++i) {
|
for (i = 0; i < gsinfo->num_outputs; ++i) {
|
||||||
struct si_shader_output *out = gs->output + i;
|
|
||||||
unsigned chan;
|
unsigned chan;
|
||||||
|
|
||||||
shader->output[i] = *out;
|
outputs[i].name = gsinfo->output_semantic_name[i];
|
||||||
|
outputs[i].index = i;
|
||||||
outputs[i].name = out->name;
|
outputs[i].sid = gsinfo->output_semantic_index[i];
|
||||||
outputs[i].index = out->index;
|
|
||||||
outputs[i].sid = out->sid;
|
|
||||||
|
|
||||||
for (chan = 0; chan < 4; chan++) {
|
for (chan = 0; chan < 4; chan++) {
|
||||||
args[2] = lp_build_const_int32(gallivm,
|
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, "");
|
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);
|
radeon_llvm_finalize_module(&si_shader_ctx->radeon_bld);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
static void si_shader_gs(struct pipe_context *ctx, struct si_shader *shader)
|
||||||
{
|
{
|
||||||
struct si_context *sctx = (struct si_context *)ctx;
|
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 gs_max_vert_out = shader->selector->gs_max_out_vertices;
|
||||||
unsigned gsvs_itemsize = gs_vert_itemsize * gs_max_vert_out;
|
unsigned gsvs_itemsize = gs_vert_itemsize * gs_max_vert_out;
|
||||||
unsigned cut_mode;
|
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,
|
si_set_ring_buffer(ctx, PIPE_SHADER_GEOMETRY, SI_RING_GSVS,
|
||||||
sctx->gsvs_ring,
|
sctx->gsvs_ring,
|
||||||
sctx->gs_shader->gs_max_out_vertices *
|
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);
|
64, true, true, 4, 16);
|
||||||
|
|
||||||
if (!sctx->gs_on) {
|
if (!sctx->gs_on) {
|
||||||
|
|
Loading…
Reference in New Issue