zink: reject invalid sample-counts
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 28 Nov 2019 17:41:30 +0000 (18:41 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 29 Nov 2019 07:58:05 +0000 (08:58 +0100)
Vulkan only allows power-of-two sample counts. We already kinda checked
for this, but forgot to validate the result in the end. Let's check the
result and error properly.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/zink/zink_screen.c

index cff37b9b37bd68afc7ecc7de3c23def03aff9e13..fa92424a6a6b05a8b2f5625ceac93503ca58e300 100644 (file)
@@ -490,6 +490,8 @@ zink_is_format_supported(struct pipe_screen *pscreen,
 
    if (sample_count >= 1) {
       VkSampleCountFlagBits sample_mask = vk_sample_count_flags(sample_count);
+      if (!sample_mask)
+         return false;
       const struct util_format_description *desc = util_format_description(format);
       if (util_format_is_depth_or_stencil(format)) {
          if (util_format_has_depth(desc)) {