From 8c8a7da43ee43a75ea39fe3f95f5d5ca9c0c83d7 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 8 Sep 2025 11:43:56 +0200 Subject: [PATCH] zink: use polygonModePointSize instead of open-coding VK_KHR_maintenance5 added a query for exactly this behavior, so we should query that instead of manually checking for the one driver where this is known to be a problem. Part-of: --- .../drivers/zink/VP_ZINK_requirements.json | 7 +++++++ src/gallium/drivers/zink/zink_screen.c | 18 ++---------------- src/gallium/drivers/zink/zink_state.c | 4 ++-- src/gallium/drivers/zink/zink_types.h | 1 - 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/zink/VP_ZINK_requirements.json b/src/gallium/drivers/zink/VP_ZINK_requirements.json index 3fb14f2950f..d22338bc1dc 100644 --- a/src/gallium/drivers/zink/VP_ZINK_requirements.json +++ b/src/gallium/drivers/zink/VP_ZINK_requirements.json @@ -409,6 +409,7 @@ "VK_EXT_provoking_vertex": 1, "VK_EXT_attachment_feedback_loop_layout": 1, "VK_EXT_attachment_feedback_loop_dynamic_state": 1, + "VK_KHR_maintenance5": 1, "VK_KHR_maintenance6": 1, "VK_KHR_maintenance7": 1, "VK_KHR_maintenance8": 1 @@ -451,6 +452,9 @@ "VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT": { "attachmentFeedbackLoopDynamicState": true }, + "VkPhysicalDeviceMaintenance5FeaturesKHR": { + "maintenance5": true + }, "VkPhysicalDeviceMaintenance6FeaturesKHR": { "maintenance6": true }, @@ -464,6 +468,9 @@ "properties": { "VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT": { "graphicsPipelineLibraryFastLinking": true + }, + "VkPhysicalDeviceMaintenance5PropertiesKHR": { + "polygonModePointSize": true } } }, diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index c920b12e334..8c1ff88fe68 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -2871,19 +2871,6 @@ init_driver_workarounds(struct zink_screen *screen) screen->info.feats.features.geometryShader) screen->driver_workarounds.no_linesmooth = true; - /* This is a workarround for the lack of - * gl_PointSize + glPolygonMode(..., GL_LINE), in the imagination - * proprietary driver. - */ - switch (zink_driverid(screen)) { - case VK_DRIVER_ID_IMAGINATION_PROPRIETARY: - screen->driver_workarounds.no_hw_gl_point = true; - break; - default: - screen->driver_workarounds.no_hw_gl_point = false; - break; - } - /* these drivers don't use VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT, so it can always be set */ switch (zink_driverid(screen)) { case VK_DRIVER_ID_MESA_RADV: @@ -3089,7 +3076,7 @@ init_optimal_keys(struct zink_screen *screen) !screen->driconf.inline_uniforms && !screen->driver_workarounds.no_linestipple && !screen->driver_workarounds.no_linesmooth && - !screen->driver_workarounds.no_hw_gl_point && + screen->info.maint5_props.polygonModePointSize && !screen->driver_compiler_workarounds.lower_robustImageAccess2 && !screen->driconf.emulate_point_smooth && !screen->driver_compiler_workarounds.needs_zs_shader_swizzle; @@ -3111,8 +3098,7 @@ init_optimal_keys(struct zink_screen *screen) CHECK_OR_PRINT(have_EXT_provoking_vertex); if (screen->driver_workarounds.no_linesmooth) fprintf(stderr, "driver does not support smooth lines\n"); - if (screen->driver_workarounds.no_hw_gl_point) - fprintf(stderr, "driver does not support hardware GL_POINT\n"); + CHECK_OR_PRINT(maint5_props.polygonModePointSize); CHECK_OR_PRINT(rb2_feats.robustImageAccess2); CHECK_OR_PRINT(feats.features.robustBufferAccess); CHECK_OR_PRINT(rb_image_feats.robustImageAccess); diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c index 6273c4fe1a6..2f2d6950ec2 100644 --- a/src/gallium/drivers/zink/zink_state.c +++ b/src/gallium/drivers/zink/zink_state.c @@ -614,7 +614,7 @@ zink_create_rasterizer_state(struct pipe_context *pctx, debug_printf("BUG: vulkan doesn't support different front and back fill modes\n"); if (rs_state->fill_front == PIPE_POLYGON_MODE_POINT && - screen->driver_workarounds.no_hw_gl_point) { + !screen->info.maint5_props.polygonModePointSize) { state->hw_state.polygon_mode = VK_POLYGON_MODE_FILL; state->cull_mode = VK_CULL_MODE_NONE; } else { @@ -734,7 +734,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso) if (fabs(ctx->rast_state->base.line_width - line_width) > FLT_EPSILON) ctx->line_width_changed = true; - bool lower_gl_point = screen->driver_workarounds.no_hw_gl_point; + bool lower_gl_point = !screen->info.maint5_props.polygonModePointSize; lower_gl_point &= ctx->rast_state->base.fill_front == PIPE_POLYGON_MODE_POINT; if (zink_get_gs_key(ctx)->lower_gl_point != lower_gl_point) zink_set_gs_key(ctx)->lower_gl_point = lower_gl_point; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index c76431fdf03..f5a0cfad144 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1515,7 +1515,6 @@ struct zink_screen { bool track_renderpasses; bool no_linestipple; bool no_linesmooth; - bool no_hw_gl_point; bool can_do_invalid_linear_modifier; bool inconsistent_interpolation; bool can_2d_view_sparse;