zink: setup driver-workaround for missing linestipple

This is not ideal, but at least it should work. In the long run, we
might want to store a bit per mode we're missing, so we can do this
conditionally. But that's quite a bit more complicated, so let's go with
this for now.

The line-stippling logic needs non-optimal shader-keys. So let's drop
some perf on the floor here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19117>
This commit is contained in:
Erik Faye-Lund 2022-09-27 12:53:03 +02:00 committed by Marge Bot
parent 4f01973034
commit 9f67e72e84
4 changed files with 19 additions and 3 deletions

View file

@ -670,7 +670,7 @@ zink_draw(struct pipe_context *pctx,
VKCTX(CmdSetCullModeEXT)(batch->state->cmdbuf, ctx->gfx_pipeline_state.dyn_state1.cull_mode);
}
if ((BATCH_CHANGED || rast_state_changed) &&
(DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3 || (screen->info.have_EXT_line_rasterization && rast_state->base.line_stipple_enable)))
(DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3 || (!screen->driver_workarounds.no_linestipple && rast_state->base.line_stipple_enable)))
VKCTX(CmdSetLineStippleEXT)(batch->state->cmdbuf, rast_state->base.line_stipple_factor, rast_state->base.line_stipple_pattern);
if ((BATCH_CHANGED || rast_state_changed) && DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3) {

View file

@ -677,7 +677,7 @@ zink_create_gfx_pipeline_library(struct zink_screen *screen, struct zink_gfx_pro
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT;
if (screen->info.dynamic_state3_feats.extendedDynamicState3LineStippleEnable)
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT;
if (screen->info.have_EXT_line_rasterization)
if (!screen->driver_workarounds.no_linestipple)
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_LINE_STIPPLE_EXT;
assert(state_count < ARRAY_SIZE(dynamicStateEnables));

View file

@ -2337,6 +2337,18 @@ init_driver_workarounds(struct zink_screen *screen)
/* performance */
screen->info.border_color_feats.customBorderColorWithoutFormat = VK_FALSE;
}
if ((!screen->info.have_EXT_line_rasterization ||
!screen->info.line_rast_feats.stippledBresenhamLines) &&
screen->info.feats.features.geometryShader &&
screen->info.feats.features.sampleRateShading) {
/* we're using stippledBresenhamLines as a proxy for all of these, to
* avoid accidentally changing behavior on VK-drivers where we don't
* want to add emulation.
*/
screen->driver_workarounds.no_linestipple = true;
}
if (screen->info.driver_props.driverID == VK_DRIVER_ID_AMD_OPEN_SOURCE ||
screen->info.driver_props.driverID == VK_DRIVER_ID_AMD_PROPRIETARY ||
screen->info.driver_props.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY ||
@ -2702,7 +2714,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
goto fail;
}
screen->optimal_keys = !screen->need_decompose_attrs && screen->info.have_EXT_non_seamless_cube_map && !screen->driconf.inline_uniforms;
screen->optimal_keys = !screen->need_decompose_attrs &&
screen->info.have_EXT_non_seamless_cube_map &&
!screen->driconf.inline_uniforms &&
!screen->driver_workarounds.no_linestipple;
if (!screen->optimal_keys)
screen->info.have_EXT_graphics_pipeline_library = false;

View file

@ -1279,6 +1279,7 @@ struct zink_screen {
bool always_feedback_loop_zs;
bool needs_sanitised_layer;
bool track_renderpasses;
bool no_linestipple;
unsigned z16_unscaled_bias;
unsigned z24_unscaled_bias;
} driver_workarounds;