radv,aco: remap PS inputs when declaring shader arguments
LLVM seems to require all inputs for PS. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>
This commit is contained in:
@@ -11257,37 +11257,8 @@ emit_streamout(isel_context* ctx, unsigned stream)
|
||||
Pseudo_instruction*
|
||||
add_startpgm(struct isel_context* ctx)
|
||||
{
|
||||
unsigned arg_count = ctx->args->ac.arg_count;
|
||||
if (ctx->stage == fragment_fs) {
|
||||
/* LLVM optimizes away unused FS inputs and computes spi_ps_input_addr
|
||||
* itself and then communicates the results back via the ELF binary.
|
||||
* Mirror what LLVM does by re-mapping the VGPR arguments here.
|
||||
*
|
||||
* TODO: If we made the FS input scanning code into a separate pass that
|
||||
* could run before argument setup, then this wouldn't be necessary
|
||||
* anymore.
|
||||
*/
|
||||
struct ac_shader_args* args = &ctx->args->ac;
|
||||
arg_count = 0;
|
||||
for (unsigned i = 0, vgpr_arg = 0, vgpr_reg = 0; i < args->arg_count; i++) {
|
||||
if (args->args[i].file != AC_ARG_VGPR) {
|
||||
arg_count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(ctx->program->config->spi_ps_input_addr & (1 << vgpr_arg))) {
|
||||
args->args[i].skip = true;
|
||||
} else {
|
||||
args->args[i].offset = vgpr_reg;
|
||||
vgpr_reg += args->args[i].size;
|
||||
arg_count++;
|
||||
}
|
||||
vgpr_arg++;
|
||||
}
|
||||
}
|
||||
|
||||
aco_ptr<Pseudo_instruction> startpgm{
|
||||
create_instruction<Pseudo_instruction>(aco_opcode::p_startpgm, Format::PSEUDO, 0, arg_count)};
|
||||
create_instruction<Pseudo_instruction>(aco_opcode::p_startpgm, Format::PSEUDO, 0, ctx->args->ac.arg_count)};
|
||||
for (unsigned i = 0, arg = 0; i < ctx->args->ac.arg_count; i++) {
|
||||
if (ctx->args->ac.args[i].skip)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user