From: Erik Faye-Lund Date: Tue, 27 Sep 2022 10:53:03 +0000 (+0200) Subject: zink: setup driver-workaround for missing linestipple X-Git-Tag: upstream/23.3.3~16153 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f67e72e84f1ec9b703eaafdb29037661db84738;p=platform%2Fupstream%2Fmesa.git 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: --- diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 1f1936e..c9cec8d 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -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) { diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 68e27f1..5dd642a 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -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)); diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 3304ed4..842a868 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 115a88e..0f9c710 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -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;