commit:     60bf2b4609439e1b3d96059102a57d2e7163ea9b
Author:     Niklas Haas <gentoo <AT> haasn <DOT> xyz>
AuthorDate: Wed Jun 17 01:41:43 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Jun 18 09:13:19 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60bf2b46

media-libs/libplacebo: backport vulkan-headers compatibility patch

This patch is needed to compile older versions of libplacebo against
versions of vulkan-headers newer than 1.2.140. It doesn't break anything
retroactively, and doesn't change behaviour, nor installed headers, so
we don't need to bump the revision number.

Closes: https://bugs.gentoo.org/728248
Signed-off-by: Niklas Haas <gentoo <AT> haasn.xyz>
Closes: https://github.com/gentoo/gentoo/pull/16243
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...43.0-vulkan-headers-1.2.140-compatibility.patch | 59 ++++++++++++++++++++++
 media-libs/libplacebo/libplacebo-2.43.0.ebuild     |  4 ++
 2 files changed, 63 insertions(+)

diff --git 
a/media-libs/libplacebo/files/libplacebo-2.43.0-vulkan-headers-1.2.140-compatibility.patch
 
b/media-libs/libplacebo/files/libplacebo-2.43.0-vulkan-headers-1.2.140-compatibility.patch
new file mode 100644
index 00000000000..8fa64744fd0
--- /dev/null
+++ 
b/media-libs/libplacebo/files/libplacebo-2.43.0-vulkan-headers-1.2.140-compatibility.patch
@@ -0,0 +1,59 @@
+From 45e19e7bbbbfceb197d8826c775e16ef536a4565 Mon Sep 17 00:00:00 2001
+From: Niklas Haas <g...@haasn.xyz>
+Date: Tue, 5 May 2020 00:13:49 +0200
+Subject: [PATCH] vulkan: get rid of deprecated enum members
+
+Maybe we should just get rid of the switch coverage check altogether. I
+wish we could somehow differentiate between enums defined in our code
+and enums defined externally.
+
+Fixes #71.
+---
+ src/vulkan/context.c   | 4 +++-
+ src/vulkan/swapchain.c | 7 +------
+ 2 files changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/src/vulkan/context.c b/src/vulkan/context.c
+index 10928a9..14a57cf 100644
+--- a/src/vulkan/context.c
++++ b/src/vulkan/context.c
+@@ -685,7 +685,6 @@ VkPhysicalDevice pl_vulkan_choose_device(struct pl_context 
*ctx,
+         [VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU]    = {"virtual",    3},
+         [VK_PHYSICAL_DEVICE_TYPE_CPU]            = {"software",   2},
+         [VK_PHYSICAL_DEVICE_TYPE_OTHER]          = {"other",      1},
+-        [VK_PHYSICAL_DEVICE_TYPE_END_RANGE+1]    = {0},
+     };
+ 
+     int best = 0;
+@@ -693,6 +692,9 @@ VkPhysicalDevice pl_vulkan_choose_device(struct pl_context 
*ctx,
+         VkPhysicalDeviceProperties props = {0};
+         GetPhysicalDeviceProperties(devices[i], &props);
+         VkPhysicalDeviceType t = props.deviceType;
++        if (t > PL_ARRAY_SIZE(types))
++            continue;
++
+         PL_INFO(vk, "    GPU %d: %s (%s)", i, props.deviceName, 
types[t].name);
+ 
+         if (params->surface) {
+diff --git a/src/vulkan/swapchain.c b/src/vulkan/swapchain.c
+index bf6fd54..6bf40dd 100644
+--- a/src/vulkan/swapchain.c
++++ b/src/vulkan/swapchain.c
+@@ -138,13 +138,8 @@ static bool vk_map_color_space(VkColorSpaceKHR space, 
struct pl_color_space *out
+         return false;
+ #endif
+ 
+-    // Included to satisfy the switch coverage check
+-    case VK_COLOR_SPACE_RANGE_SIZE_KHR:
+-    case VK_COLOR_SPACE_MAX_ENUM_KHR:
+-        break;
++    default: return false;
+     }
+-
+-    return false;
+ }
+ 
+ static bool pick_surf_format(const struct pl_gpu *gpu, const struct vk_ctx 
*vk,
+-- 
+2.27.0
+

diff --git a/media-libs/libplacebo/libplacebo-2.43.0.ebuild 
b/media-libs/libplacebo/libplacebo-2.43.0.ebuild
index b0088dafa64..3306d2602b4 100644
--- a/media-libs/libplacebo/libplacebo-2.43.0.ebuild
+++ b/media-libs/libplacebo/libplacebo-2.43.0.ebuild
@@ -32,6 +32,10 @@ BDEPEND="virtual/pkgconfig"
 
 RESTRICT="!test? ( test )"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-vulkan-headers-1.2.140-compatibility.patch
+)
+
 multilib_src_configure() {
        local emesonargs=(
                $(meson_feature glslang)

Reply via email to