/* On Bifrost it's a sysval, on Midgard it's a varying */
state->reads_frag_coord = s->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD);
+ state->writes_global = s->info.writes_memory;
+
switch (stage) {
case MESA_SHADER_VERTEX:
state->attribute_count = util_bitcount64(s->info.inputs_read);
/* TODO: This is not conformant on ES3 */
meta->midgard1.flags_hi = MALI_SUPPRESS_INF_NAN;
- meta->midgard1.flags_lo = MALI_WRITES_GLOBAL | 0x20;
+ meta->midgard1.flags_lo = 0x20;
meta->midgard1.uniform_buffer_count = panfrost_ubo_count(ctx, st);
+
+ SET_BIT(meta->midgard1.flags_hi, MALI_WRITES_GLOBAL, ss->writes_global);
}
}
/* TODO */
} else {
/* Depending on whether it's legal to in the given shader, we try to
- * enable early-z testing (or forward-pixel kill?) */
+ * enable early-z testing. TODO: respect e-z force */
SET_BIT(fragmeta->midgard1.flags_lo, MALI_EARLY_Z,
- !fs->can_discard && !fs->writes_depth);
+ !fs->can_discard && !fs->writes_depth && !fs->writes_global);
/* Add the writes Z/S flags if needed. */
SET_BIT(fragmeta->midgard1.flags_lo, MALI_WRITES_Z, fs->writes_depth);