zink: always set VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT sometimes

some drivers (mostly desktop) are known to ignore this pipeline flag,
thus it can be set unconditionally in pipeline state to deduplicate
pipeline variants without affecting performance

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18787>
This commit is contained in:
Mike Blumenkrantz 2022-09-22 13:27:14 -04:00 committed by Marge Bot
parent 97c7eaf17f
commit 645f2da3fa
3 changed files with 19 additions and 2 deletions

View file

@ -1786,7 +1786,8 @@ unbind_samplerview(struct zink_context *ctx, gl_shader_stage stage, unsigned slo
} }
ctx->feedback_loops &= ~BITFIELD_BIT(idx); ctx->feedback_loops &= ~BITFIELD_BIT(idx);
} }
if (feedback_loops && !ctx->feedback_loops) { if (!zink_screen(ctx->base.screen)->driver_workarounds.always_feedback_loop &&
feedback_loops && !ctx->feedback_loops) {
/* unset feedback loop bits */ /* unset feedback loop bits */
if (ctx->gfx_pipeline_state.feedback_loop) if (ctx->gfx_pipeline_state.feedback_loop)
ctx->gfx_pipeline_state.dirty = true; ctx->gfx_pipeline_state.dirty = true;
@ -2825,7 +2826,8 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, unsigned
ctx->rp_layout_changed = true; ctx->rp_layout_changed = true;
} }
ctx->feedback_loops &= ~BITFIELD_BIT(idx); ctx->feedback_loops &= ~BITFIELD_BIT(idx);
if (feedback_loops && !ctx->feedback_loops) { if (!zink_screen(ctx->base.screen)->driver_workarounds.always_feedback_loop &&
feedback_loops && !ctx->feedback_loops) {
/* unset feedback loop bits */ /* unset feedback loop bits */
if (ctx->gfx_pipeline_state.feedback_loop) if (ctx->gfx_pipeline_state.feedback_loop)
ctx->gfx_pipeline_state.dirty = true; ctx->gfx_pipeline_state.dirty = true;

View file

@ -2267,6 +2267,20 @@ init_driver_workarounds(struct zink_screen *screen)
screen->driver_workarounds.z16_unscaled_bias = 1<<15; screen->driver_workarounds.z16_unscaled_bias = 1<<15;
else else
screen->driver_workarounds.z16_unscaled_bias = 1<<16; screen->driver_workarounds.z16_unscaled_bias = 1<<16;
/* these drivers don't use VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT, so it can always be set */
switch (screen->info.driver_props.driverID) {
case VK_DRIVER_ID_MESA_RADV:
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
case VK_DRIVER_ID_MESA_LLVMPIPE:
case VK_DRIVER_ID_MESA_VENUS:
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
case VK_DRIVER_ID_IMAGINATION_PROPRIETARY:
screen->driver_workarounds.always_feedback_loop = screen->info.have_EXT_attachment_feedback_loop_layout;
break;
default:
break;
}
} }
static struct zink_screen * static struct zink_screen *

View file

@ -1167,6 +1167,7 @@ struct zink_screen {
bool broken_l4a4; bool broken_l4a4;
bool depth_clip_control_missing; bool depth_clip_control_missing;
bool implicit_sync; bool implicit_sync;
bool always_feedback_loop;
bool force_pipeline_library; bool force_pipeline_library;
unsigned z16_unscaled_bias; unsigned z16_unscaled_bias;
unsigned z24_unscaled_bias; unsigned z24_unscaled_bias;