Mesa (main): zink: do not warn about rare features until used
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 18:31:13 UTC 2021
Module: Mesa
Branch: main
Commit: 64c558ab8302cfc7f21c6283cb88b9c214d893e9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=64c558ab8302cfc7f21c6283cb88b9c214d893e9
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Fri Aug 27 10:05:52 2021 +0200
zink: do not warn about rare features until used
We currently cause the following scary warning to be printed on
start-up for *every* application regardless if that feature is being
used or not when run on top of ANV:
> WARNING: Some incorrect rendering might occur because the selected
> Vulkan device (Intel(R) UHD Graphics 620 (KBL GT2)) doesn't support
> base Zink requirements: line_rast_feats.stippledRectangularLines
> line_rast_feats.stippledSmoothLines
There's no need to scare the users about this, as most applications
don't care about these combinational features. So let's instead emit a
warning when these features are attempted (but failed) to be used
instead.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12587>
---
src/gallium/drivers/zink/zink_screen.c | 16 +---------------
src/gallium/drivers/zink/zink_state.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index a4327178f18..3df9edf6517 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1711,13 +1711,7 @@ check_base_requirements(struct zink_screen *screen)
screen->info.have_EXT_scalar_block_layout) ||
!screen->info.have_KHR_maintenance1 ||
!screen->info.have_EXT_custom_border_color ||
- !screen->info.have_EXT_line_rasterization ||
- !screen->info.line_rast_feats.rectangularLines ||
- !screen->info.line_rast_feats.bresenhamLines ||
- !screen->info.line_rast_feats.smoothLines ||
- !screen->info.line_rast_feats.stippledRectangularLines ||
- !screen->info.line_rast_feats.stippledBresenhamLines ||
- !screen->info.line_rast_feats.stippledSmoothLines) {
+ !screen->info.have_EXT_line_rasterization) {
fprintf(stderr, "WARNING: Some incorrect rendering "
"might occur because the selected Vulkan device (%s) doesn't support "
"base Zink requirements: ", screen->info.props.deviceName);
@@ -1735,14 +1729,6 @@ check_base_requirements(struct zink_screen *screen)
CHECK_OR_PRINT(have_KHR_maintenance1);
CHECK_OR_PRINT(have_EXT_custom_border_color);
CHECK_OR_PRINT(have_EXT_line_rasterization);
- if (screen->info.have_EXT_line_rasterization) {
- CHECK_OR_PRINT(line_rast_feats.rectangularLines);
- CHECK_OR_PRINT(line_rast_feats.bresenhamLines);
- CHECK_OR_PRINT(line_rast_feats.smoothLines);
- CHECK_OR_PRINT(line_rast_feats.stippledRectangularLines);
- CHECK_OR_PRINT(line_rast_feats.stippledBresenhamLines);
- CHECK_OR_PRINT(line_rast_feats.stippledSmoothLines);
- }
fprintf(stderr, "\n");
}
}
diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c
index e6d90644937..8815a042f0b 100644
--- a/src/gallium/drivers/zink/zink_state.c
+++ b/src/gallium/drivers/zink/zink_state.c
@@ -455,6 +455,18 @@ line_width(float width, float granularity, const float range[2])
return CLAMP(width, range[0], range[1]);
}
+#define warn_line_feature(feat) \
+ do { \
+ static bool warned = false; \
+ if (!warned) { \
+ fprintf(stderr, "WARNING: Incorrect rendering will happen, " \
+ "because the Vulkan device doesn't support " \
+ "the %s feature of " \
+ "VK_EXT_line_rasterization\n", feat); \
+ warned = true; \
+ } \
+ } while (0)
+
static void *
zink_create_rasterizer_state(struct pipe_context *pctx,
const struct pipe_rasterizer_state *rs_state)
@@ -498,13 +510,19 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
if (line_feats->stippledSmoothLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
+ else
+ warn_line_feature("stippledSmoothLines");
} else if (line_feats->stippledRectangularLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
+ else
+ warn_line_feature("stippledRectangularLines");
} else if (line_feats->stippledBresenhamLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
else {
+ warn_line_feature("stippledBresenhamLines");
+
/* no suitable mode that supports line stippling */
state->base.line_stipple_factor = 0;
state->base.line_stipple_pattern = UINT16_MAX;
@@ -517,12 +535,18 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
if (line_feats->smoothLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
+ else
+ warn_line_feature("smoothLines");
} else if (line_feats->rectangularLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
+ else
+ warn_line_feature("rectangularLines");
} else if (line_feats->bresenhamLines)
state->hw_state.line_mode =
VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
+ else
+ warn_line_feature("bresenhamLines");
}
state->base.line_stipple_factor = 0;
state->base.line_stipple_pattern = UINT16_MAX;
More information about the mesa-commit
mailing list