Module: Mesa
Branch: master
Commit: 2de07d1ad224646e84aefa349ccfe772a7e04cf2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2de07d1ad224646e84aefa349ccfe772a7e04cf2

Author: Erik Faye-Lund <[email protected]>
Date:   Tue Mar 30 17:58:31 2021 +0200

zink: check base-requirements

This one is a bit of a tough nut to deal with gracefully. Zink has a set
of base-requirements that we always require. There's no Gallium caps to
report these missing features, so we're essentially left with two options:

1. Fail to create the screen.
2. Ignore the missing fetures.

Solution 1 will lead to difficulties bringing up a new Vulkan driver on
Zink, and solution 2 will lead to mis-rendering.

Since Zink is mostly an opt-in driver to use when there's no OpenGL driver
available, we should probably do 2 for now. It seems better to have some
mis-rendering than no rendering at all.

But let's at least check, and print a warning. That way people get to
know what's up.

Reviewed-By: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9925>

---

 src/gallium/drivers/zink/zink_screen.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_screen.c 
b/src/gallium/drivers/zink/zink_screen.c
index db0a4ac05e4..6cc8d6226cf 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1368,6 +1368,22 @@ pre_hash_descriptor_states(struct zink_screen *screen)
    screen->null_descriptor_hashes.buffer_view = _mesa_hash_data(&null_binfo, 
sizeof(VkBufferViewCreateInfo));
 }
 
+static void
+check_base_requements(struct zink_screen *screen)
+{
+   if (!screen->info.feats.features.logicOp ||
+       !screen->info.feats.features.fillModeNonSolid ||
+       !screen->info.feats.features.wideLines ||
+       !screen->info.feats.features.largePoints ||
+       !screen->info.feats.features.alphaToOne ||
+       !screen->info.feats.features.shaderClipDistance ||
+       !screen->info.have_KHR_maintenance1) {
+      fprintf(stderr, "WARNING: The Vulkan device doesn't support "
+              "the base Zink requirements, some incorrect rendering "
+              "might occur\n");
+   }
+}
+
 static struct zink_screen *
 zink_internal_create_screen(const struct pipe_screen_config *config)
 {
@@ -1421,6 +1437,8 @@ zink_internal_create_screen(const struct 
pipe_screen_config *config)
    if (!load_device_extensions(screen))
       goto fail;
 
+   check_base_requements(screen);
+
    screen->base.get_name = zink_get_name;
    screen->base.get_vendor = zink_get_vendor;
    screen->base.get_device_vendor = zink_get_device_vendor;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to