state->properties.depth_source = MALI_DEPTH_SOURCE_FIXED_FUNCTION;
state->properties.midgard.force_early_z = true;
} else {
- /* Reasons to disable early-Z from a shader perspective */
- bool late_z = fs->info.fs.can_discard || fs->info.writes_global ||
- fs->info.fs.writes_depth || fs->info.fs.writes_stencil ||
- ((enum mali_func) zsa->base.alpha_func != MALI_FUNC_ALWAYS);
+ state->properties.midgard.force_early_z =
+ fs->info.fs.can_early_z && !alpha_to_coverage &&
+ ((enum mali_func) zsa->base.alpha_func == MALI_FUNC_ALWAYS);
bool has_blend_shader = false;
else
state->properties.midgard.work_register_count = fs->info.work_reg_count;
- state->properties.midgard.force_early_z = !(late_z || alpha_to_coverage);
-
/* Workaround a hardware errata where early-z cannot be enabled
* when discarding even when the depth buffer is read-only, by
* lying to the hardware about the discard and setting the
info->fs.sidefx = s->info.writes_memory ||
s->info.fs.uses_discard ||
s->info.fs.uses_demote;
+
+ /* With suitable ZSA/blend, is early-z possible? */
+ info->fs.can_early_z =
+ !info->fs.sidefx &&
+ !info->fs.writes_depth &&
+ !info->fs.writes_stencil &&
+ !info->fs.writes_coverage;
+
info->fs.reads_frag_coord =
(s->info.inputs_read & (1 << VARYING_SLOT_POS)) ||
BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_FRAG_COORD);
bool reads_helper_invocation;
bool sample_shading;
bool early_fragment_tests;
+ bool can_early_z;
BITSET_WORD outputs_read;
BITSET_WORD outputs_written;
} fs;