From 21360476249122b8f5f016a80c78818f7ef93084 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 22 Sep 2022 17:01:42 -0400 Subject: [PATCH] zink: rework ZINK_PIPELINE_LIBRARY_FORCE into ZINK_DEBUG flag Reviewed-by: Dave Airlie Part-of: --- docs/drivers/zink.rst | 2 ++ src/gallium/drivers/zink/zink_program_state.hpp | 2 +- src/gallium/drivers/zink/zink_screen.c | 12 ++++++------ src/gallium/drivers/zink/zink_types.h | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/drivers/zink.rst b/docs/drivers/zink.rst index b36e87e897b..bdf1684b6ab 100644 --- a/docs/drivers/zink.rst +++ b/docs/drivers/zink.rst @@ -273,6 +273,8 @@ variable: Use a maximum of 4 descriptor sets ``noreorder`` Do not reorder or optimize GL command streams +``gpl`` + Force using Graphics Pipeline Library for all shaders Vulkan Validation Layers ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 9fceac05600..52054128774 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -239,7 +239,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx, struct set_entry *he = NULL; /* TODO: this will eventually be pre-populated by async shader compile */ //struct set_entry *he = _mesa_set_search(&prog->libs[idx], &ctx->gfx_pipeline_state.gkey); - if (!he && screen->driver_workarounds.force_pipeline_library) { + if (!he && (zink_debug & ZINK_DEBUG_GPL)) { create_pipeline_lib(screen, prog, &ctx->gfx_pipeline_state, mode); he = _mesa_set_search(&prog->libs[idx], &ctx->gfx_pipeline_state.gkey); assert(he); diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index e9517baa1ee..a5fffc8feff 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -77,6 +77,7 @@ zink_debug_options[] = { { "sync", ZINK_DEBUG_SYNC, "Force synchronization before draws/dispatches" }, { "compact", ZINK_DEBUG_COMPACT, "Use only 4 descriptor sets" }, { "noreorder", ZINK_DEBUG_NOREORDER, "Do not reorder command streams" }, + { "gpl", ZINK_DEBUG_GPL, "Force using Graphics Pipeline Library for all shaders" }, DEBUG_NAMED_VALUE_END }; @@ -2220,7 +2221,6 @@ static void init_driver_workarounds(struct zink_screen *screen) { /* enable implicit sync for all non-mesa drivers */ - screen->driver_workarounds.force_pipeline_library = debug_get_bool_option("ZINK_PIPELINE_LIBRARY_FORCE", false); screen->driver_workarounds.implicit_sync = true; switch (screen->info.driver_props.driverID) { case VK_DRIVER_ID_MESA_RADV: @@ -2238,14 +2238,14 @@ init_driver_workarounds(struct zink_screen *screen) if (screen->info.have_EXT_graphics_pipeline_library) screen->info.have_EXT_graphics_pipeline_library = screen->info.have_EXT_extended_dynamic_state && screen->info.have_EXT_extended_dynamic_state2 && - (screen->driver_workarounds.force_pipeline_library || + ((zink_debug & ZINK_DEBUG_GPL) || screen->info.dynamic_state2_feats.extendedDynamicState2PatchControlPoints) && screen->info.have_KHR_dynamic_rendering && screen->info.have_EXT_non_seamless_cube_map && (screen->info.gpl_props.graphicsPipelineLibraryFastLinking || screen->is_cpu || - screen->driver_workarounds.force_pipeline_library); - if (!screen->driver_workarounds.force_pipeline_library) + (zink_debug & ZINK_DEBUG_GPL)); + if (!(zink_debug & ZINK_DEBUG_GPL)) screen->info.have_EXT_graphics_pipeline_library = false; screen->driver_workarounds.broken_l4a4 = screen->info.driver_props.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY; screen->driver_workarounds.depth_clip_control_missing = !screen->info.have_EXT_depth_clip_control; @@ -2555,10 +2555,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config) goto fail; } - if (!screen->driver_workarounds.force_pipeline_library) + if (!(zink_debug & ZINK_DEBUG_GPL)) screen->optimal_keys = !screen->need_decompose_attrs && screen->info.have_EXT_non_seamless_cube_map && !screen->driconf.inline_uniforms; if (screen->optimal_keys) - screen->driver_workarounds.force_pipeline_library = false; + screen->info.have_EXT_graphics_pipeline_library = false; return screen; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 567a970f7d4..bc4561eded4 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -180,6 +180,7 @@ enum zink_debug { ZINK_DEBUG_SYNC = (1<<4), ZINK_DEBUG_COMPACT = (1<<5), ZINK_DEBUG_NOREORDER = (1<<6), + ZINK_DEBUG_GPL = (1<<7), }; @@ -1168,7 +1169,6 @@ struct zink_screen { bool depth_clip_control_missing; bool implicit_sync; bool always_feedback_loop; - bool force_pipeline_library; unsigned z16_unscaled_bias; unsigned z24_unscaled_bias; } driver_workarounds;