From 2cf117ee39fb06d6752a0c4bba19a5cb8cee3ca9 Mon Sep 17 00:00:00 2001 From: SoroushIMG Date: Fri, 24 Feb 2023 10:04:39 +0000 Subject: [PATCH] zink: add depth/stencil needs shader swizzle workaround field Part-of: --- src/gallium/drivers/zink/zink_screen.c | 15 ++++++++++++++- src/gallium/drivers/zink/zink_types.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 043d822..cef4374 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -2514,6 +2514,18 @@ init_driver_workarounds(struct zink_screen *screen) screen->driver_workarounds.needs_sanitised_layer = false; break; } + /* these drivers will produce undefined results when using swizzle 1 with combined z/s textures + * TODO: use a future device property when available + */ + switch (screen->info.driver_props.driverID) { + case VK_DRIVER_ID_IMAGINATION_PROPRIETARY: + case VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA: + screen->driver_workarounds.needs_zs_shader_swizzle = true; + break; + default: + screen->driver_workarounds.needs_zs_shader_swizzle = false; + break; + } /* When robust contexts are advertised but robustImageAccess2 is not available */ screen->driver_workarounds.lower_robustImageAccess2 = @@ -3037,7 +3049,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config) !screen->driver_workarounds.no_linesmooth && !screen->driver_workarounds.no_hw_gl_point && !screen->driver_workarounds.lower_robustImageAccess2 && - !screen->driconf.emulate_point_smooth; + !screen->driconf.emulate_point_smooth && + !screen->driver_workarounds.needs_zs_shader_swizzle; 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 03ef3f4..d648d64 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1413,6 +1413,7 @@ struct zink_screen { bool no_linesmooth; bool no_hw_gl_point; bool lower_robustImageAccess2; + bool needs_zs_shader_swizzle; unsigned z16_unscaled_bias; unsigned z24_unscaled_bias; unsigned extra_swapchain_images; -- 2.7.4