radeonsi: add nir support for es epilogue
v2: make use of existing si_tgsi_emit_epilogue() Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
204f547852
commit
73918b3172
|
@ -3183,9 +3183,11 @@ static void si_llvm_emit_ls_epilogue(struct ac_shader_abi *abi,
|
||||||
si_set_ls_return_value_for_tcs(ctx);
|
si_set_ls_return_value_for_tcs(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base)
|
static void si_llvm_emit_es_epilogue(struct ac_shader_abi *abi,
|
||||||
|
unsigned max_outputs,
|
||||||
|
LLVMValueRef *addrs)
|
||||||
{
|
{
|
||||||
struct si_shader_context *ctx = si_shader_context(bld_base);
|
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
|
||||||
struct si_shader *es = ctx->shader;
|
struct si_shader *es = ctx->shader;
|
||||||
struct tgsi_shader_info *info = &es->selector->info;
|
struct tgsi_shader_info *info = &es->selector->info;
|
||||||
LLVMValueRef soffset = LLVMGetParam(ctx->main_fn,
|
LLVMValueRef soffset = LLVMGetParam(ctx->main_fn,
|
||||||
|
@ -3206,7 +3208,6 @@ static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < info->num_outputs; i++) {
|
for (i = 0; i < info->num_outputs; i++) {
|
||||||
LLVMValueRef *out_ptr = ctx->outputs[i];
|
|
||||||
int param;
|
int param;
|
||||||
|
|
||||||
if (info->output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX ||
|
if (info->output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX ||
|
||||||
|
@ -3217,7 +3218,7 @@ static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base)
|
||||||
info->output_semantic_index[i]);
|
info->output_semantic_index[i]);
|
||||||
|
|
||||||
for (chan = 0; chan < 4; chan++) {
|
for (chan = 0; chan < 4; chan++) {
|
||||||
LLVMValueRef out_val = LLVMBuildLoad(ctx->ac.builder, out_ptr[chan], "");
|
LLVMValueRef out_val = LLVMBuildLoad(ctx->ac.builder, addrs[4 * i + chan], "");
|
||||||
out_val = ac_to_integer(&ctx->ac, out_val);
|
out_val = ac_to_integer(&ctx->ac, out_val);
|
||||||
|
|
||||||
/* GFX9 has the ESGS ring in LDS. */
|
/* GFX9 has the ESGS ring in LDS. */
|
||||||
|
@ -4428,7 +4429,6 @@ static void create_function(struct si_shader_context *ctx)
|
||||||
declare_vs_specific_input_sgprs(ctx, &fninfo);
|
declare_vs_specific_input_sgprs(ctx, &fninfo);
|
||||||
|
|
||||||
if (shader->key.as_es) {
|
if (shader->key.as_es) {
|
||||||
assert(!shader->selector->nir);
|
|
||||||
ctx->param_es2gs_offset = add_arg(&fninfo, ARG_SGPR, ctx->i32);
|
ctx->param_es2gs_offset = add_arg(&fninfo, ARG_SGPR, ctx->i32);
|
||||||
} else if (shader->key.as_ls) {
|
} else if (shader->key.as_ls) {
|
||||||
/* no extra parameters */
|
/* no extra parameters */
|
||||||
|
@ -5733,15 +5733,13 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
|
||||||
switch (ctx->type) {
|
switch (ctx->type) {
|
||||||
case PIPE_SHADER_VERTEX:
|
case PIPE_SHADER_VERTEX:
|
||||||
ctx->load_input = declare_input_vs;
|
ctx->load_input = declare_input_vs;
|
||||||
if (shader->key.as_ls) {
|
if (shader->key.as_ls)
|
||||||
ctx->abi.emit_outputs = si_llvm_emit_ls_epilogue;
|
ctx->abi.emit_outputs = si_llvm_emit_ls_epilogue;
|
||||||
bld_base->emit_epilogue = si_tgsi_emit_epilogue;
|
else if (shader->key.as_es)
|
||||||
} else if (shader->key.as_es)
|
ctx->abi.emit_outputs = si_llvm_emit_es_epilogue;
|
||||||
bld_base->emit_epilogue = si_llvm_emit_es_epilogue;
|
else
|
||||||
else {
|
|
||||||
ctx->abi.emit_outputs = si_llvm_emit_vs_epilogue;
|
ctx->abi.emit_outputs = si_llvm_emit_vs_epilogue;
|
||||||
bld_base->emit_epilogue = si_tgsi_emit_epilogue;
|
bld_base->emit_epilogue = si_tgsi_emit_epilogue;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PIPE_SHADER_TESS_CTRL:
|
case PIPE_SHADER_TESS_CTRL:
|
||||||
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tcs;
|
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tcs;
|
||||||
|
@ -5752,11 +5750,10 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
|
||||||
case PIPE_SHADER_TESS_EVAL:
|
case PIPE_SHADER_TESS_EVAL:
|
||||||
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tes;
|
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tes;
|
||||||
if (shader->key.as_es)
|
if (shader->key.as_es)
|
||||||
bld_base->emit_epilogue = si_llvm_emit_es_epilogue;
|
ctx->abi.emit_outputs = si_llvm_emit_es_epilogue;
|
||||||
else {
|
else
|
||||||
ctx->abi.emit_outputs = si_llvm_emit_vs_epilogue;
|
ctx->abi.emit_outputs = si_llvm_emit_vs_epilogue;
|
||||||
bld_base->emit_epilogue = si_tgsi_emit_epilogue;
|
bld_base->emit_epilogue = si_tgsi_emit_epilogue;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PIPE_SHADER_GEOMETRY:
|
case PIPE_SHADER_GEOMETRY:
|
||||||
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs;
|
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs;
|
||||||
|
|
Loading…
Reference in New Issue