panfrost: Deduplicate shader properties

Between Midgard and Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
This commit is contained in:
Alyssa Rosenzweig 2020-11-04 11:17:43 -05:00
parent 4a2ecc72d3
commit cd66aa712d
1 changed files with 9 additions and 10 deletions

View File

@ -53,16 +53,10 @@ pan_prepare_midgard_props(struct panfrost_shader_state *state,
* conformant on gles3 */
state->properties.midgard.fp_mode = MALI_FP_MODE_GL_INF_NAN_SUPPRESSED;
if (stage == MESA_SHADER_FRAGMENT) {
/* Work register count, early-z, reads at draw-time */
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;
} else {
/* For fragment shaders, work register count, early-z, reads at draw-time */
if (stage != MESA_SHADER_FRAGMENT)
state->properties.midgard.work_register_count = state->work_reg_count;
}
}
static void
@ -86,7 +80,6 @@ pan_prepare_bifrost_props(struct panfrost_shader_state *state,
/* Early-Z set at draw-time */
state->properties.bifrost.zs_update_operation = MALI_PIXEL_KILL_STRONG_EARLY;
state->properties.uniform_buffer_count = state->ubo_count;
state->properties.shader_contains_barrier = state->helper_invocations;
state->properties.bifrost.shader_modifies_coverage = state->can_discard;
pan_prepare(&state->preload, PRELOAD);
@ -393,6 +386,12 @@ panfrost_shader_compile(struct panfrost_context *ctx,
else
pan_prepare_midgard_props(state, stage);
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;
if (stage != MESA_SHADER_FRAGMENT)
pan_upload_shader_descriptor(ctx, state);