panfrost: Set barriers flag for compute shaders

Pipe in the info from NIR. Fix incorrect handling of helper invocations,
which also use the barrier flag.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6312>
This commit is contained in:
Alyssa Rosenzweig 2020-08-13 18:41:11 -04:00 committed by Marge Bot
parent 9f934e922d
commit 2f44a76ab4
2 changed files with 12 additions and 7 deletions

View file

@ -347,6 +347,8 @@ panfrost_shader_compile(struct panfrost_context *ctx,
s->info.writes_memory ||
s->info.fs.uses_discard ||
s->info.fs.uses_demote;
state->can_discard = s->info.fs.uses_discard;
break;
case MESA_SHADER_COMPUTE:
attribute_count = util_bitcount(s->info.images_used);
@ -356,10 +358,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
unreachable("Unknown shader state");
}
state->can_discard = s->info.fs.uses_discard;
state->helper_invocations = s->info.fs.needs_quad_helper_invocations;
state->stack_size = program->tls_size;
state->reads_frag_coord = (s->info.inputs_read & (1 << VARYING_SLOT_POS)) ||
BITSET_TEST(s->info.system_values_read, SYSTEM_VALUE_FRAG_COORD);
state->reads_point_coord = s->info.inputs_read & (1 << VARYING_SLOT_PNTC);
@ -411,8 +410,17 @@ panfrost_shader_compile(struct panfrost_context *ctx,
else
pan_prepare_midgard_props(state, program, stage);
state->properties.shader_contains_barrier =
s->info.uses_memory_barrier |
s->info.uses_control_barrier;
/* Ordering gaurantees are the same */
if (stage == MESA_SHADER_FRAGMENT) {
state->properties.shader_contains_barrier |=
s->info.fs.needs_quad_helper_invocations;
}
state->properties.stencil_from_shader = state->writes_stencil;
state->properties.shader_contains_barrier = state->helper_invocations;
state->properties.depth_source = state->writes_depth ?
MALI_DEPTH_SOURCE_SHADER :
MALI_DEPTH_SOURCE_FIXED_FUNCTION;

View file

@ -245,9 +245,6 @@ struct panfrost_shader_state {
struct panfrost_ubo_push push;
/* Should we enable helper invocations */
bool helper_invocations;
/* GPU-executable memory */
struct panfrost_bo *bo;