freedreno/ir3: don't DCE ij_pix if used for pre-fs-texture-fetch
When we enable pre-dispatch texture fetch, we could have a scenario where the barycentric i/j coord sysval is not used in the shader, but only used for the varying fetch for the pre-dispatch texture fetch. In this case we need to take care not to DCE this sysval. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
parent
af817a44c1
commit
11e467c378
|
@ -1062,13 +1062,13 @@ void ir3_print(struct ir3 *ir);
|
|||
void ir3_print_instr(struct ir3_instruction *instr);
|
||||
|
||||
/* depth calculation: */
|
||||
struct ir3_shader_variant;
|
||||
int ir3_delayslots(struct ir3_instruction *assigner,
|
||||
struct ir3_instruction *consumer, unsigned n);
|
||||
void ir3_insert_by_depth(struct ir3_instruction *instr, struct list_head *list);
|
||||
void ir3_depth(struct ir3 *ir);
|
||||
void ir3_depth(struct ir3 *ir, struct ir3_shader_variant *so);
|
||||
|
||||
/* copy-propagate: */
|
||||
struct ir3_shader_variant;
|
||||
void ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so);
|
||||
|
||||
/* group neighbors and insert mov's to resolve conflicts: */
|
||||
|
|
|
@ -3142,7 +3142,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
|
|||
ir3_print(ir);
|
||||
}
|
||||
|
||||
ir3_depth(ir);
|
||||
ir3_depth(ir, so);
|
||||
|
||||
if (ir3_shader_debug & IR3_DBG_OPTMSGS) {
|
||||
printf("AFTER DEPTH:\n");
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "util/u_math.h"
|
||||
|
||||
#include "ir3.h"
|
||||
#include "ir3_shader.h"
|
||||
|
||||
/*
|
||||
* Instruction Depth:
|
||||
|
@ -209,7 +210,7 @@ remove_unused_by_block(struct ir3_block *block)
|
|||
}
|
||||
|
||||
static bool
|
||||
compute_depth_and_remove_unused(struct ir3 *ir)
|
||||
compute_depth_and_remove_unused(struct ir3 *ir, struct ir3_shader_variant *so)
|
||||
{
|
||||
unsigned i;
|
||||
bool progress = false;
|
||||
|
@ -221,6 +222,13 @@ compute_depth_and_remove_unused(struct ir3 *ir)
|
|||
*/
|
||||
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
|
||||
list_for_each_entry (struct ir3_instruction, instr, &block->instr_list, node) {
|
||||
/* special case, if pre-fs texture fetch used, we cannot
|
||||
* eliminate the barycentric i/j input
|
||||
*/
|
||||
if (so->num_sampler_prefetch &&
|
||||
(instr->opc == OPC_META_INPUT) &&
|
||||
(instr->input.sysval == SYSTEM_VALUE_BARYCENTRIC_PIXEL))
|
||||
continue;
|
||||
instr->flags |= IR3_INSTR_UNUSED;
|
||||
}
|
||||
}
|
||||
|
@ -263,10 +271,10 @@ compute_depth_and_remove_unused(struct ir3 *ir)
|
|||
}
|
||||
|
||||
void
|
||||
ir3_depth(struct ir3 *ir)
|
||||
ir3_depth(struct ir3 *ir, struct ir3_shader_variant *so)
|
||||
{
|
||||
bool progress;
|
||||
do {
|
||||
progress = compute_depth_and_remove_unused(ir);
|
||||
progress = compute_depth_and_remove_unused(ir, so);
|
||||
} while (progress);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue