commit:     7db7d4664334929e601561afe237980895811877
Author:     Matthew Smith <matthew <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 21 07:26:52 2022 +0000
Commit:     Matthew Smith <matthew <AT> gentoo <DOT> org>
CommitDate: Mon Feb 21 07:26:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7db7d466

media-gfx/renderdoc: backport feature test patch

Signed-off-by: Matthew Smith <matthew <AT> gentoo.org>

 .../files/renderdoc-1.18-check-api-ver.patch       | 50 ++++++++++++++++++++++
 ...derdoc-1.18.ebuild => renderdoc-1.18-r1.ebuild} |  4 ++
 2 files changed, 54 insertions(+)

diff --git a/media-gfx/renderdoc/files/renderdoc-1.18-check-api-ver.patch 
b/media-gfx/renderdoc/files/renderdoc-1.18-check-api-ver.patch
new file mode 100644
index 000000000000..a6af5645d14b
--- /dev/null
+++ b/media-gfx/renderdoc/files/renderdoc-1.18-check-api-ver.patch
@@ -0,0 +1,50 @@
+From 3d49524da4a28ecc1ee1a9b3f9ec455fc0263c81 Mon Sep 17 00:00:00 2001
+From: baldurk <bald...@baldurk.org>
+Date: Mon, 31 Jan 2022 19:28:08 +0000
+Subject: [PATCH] Don't enable functionality not supported by the current
+ physical device
+
+---
+ .../driver/vulkan/wrappers/vk_device_funcs.cpp     | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp 
b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
+index 4d342e0123..a40c52d6ef 100644
+--- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
++++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
+@@ -3171,7 +3171,7 @@ bool 
WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
+         VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR,
+     };
+ 
+-    if(physProps.apiVersion >= VK_MAKE_VERSION(1, 2, 0))
++    if(RDCMIN(m_EnabledExtensions.vulkanVersion, physProps.apiVersion) >= 
VK_MAKE_VERSION(1, 2, 0))
+     {
+       VkPhysicalDeviceVulkan12Features avail12Features = {
+           VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
+@@ -3376,11 +3376,13 @@ bool 
WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
+ 
+     CheckDeviceExts();
+ 
++    uint32_t effectiveApiVersion = RDCMIN(m_EnabledExtensions.vulkanVersion, 
physProps.apiVersion);
++
+ #undef CheckExt
+-#define CheckExt(name, ver)                                                   
                   \
+-  if(!strcmp(createInfo.ppEnabledExtensionNames[i], "VK_" #name) || 
physProps.apiVersion >= ver) \
+-  {                                                                           
                   \
+-    m_EnabledExtensions.ext_##name = true;                                    
                   \
++#define CheckExt(name, ver)                                                   
                  \
++  if(!strcmp(createInfo.ppEnabledExtensionNames[i], "VK_" #name) || 
effectiveApiVersion >= ver) \
++  {                                                                           
                  \
++    m_EnabledExtensions.ext_##name = true;                                    
                  \
+   }
+ 
+     for(uint32_t i = 0; i < createInfo.enabledExtensionCount; i++)
+@@ -3391,7 +3393,7 @@ bool 
WrappedVulkan::Serialise_vkCreateDevice(SerialiserType &ser, VkPhysicalDevi
+     // for cases where a promoted extension isn't supported as the extension 
itself, manually
+     // disable them when the feature bit is false.
+ 
+-    if(physProps.apiVersion >= VK_MAKE_VERSION(1, 2, 0))
++    if(effectiveApiVersion >= VK_MAKE_VERSION(1, 2, 0))
+     {
+       
if(supportedExtensions.find(VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME) ==
+              supportedExtensions.end() &&

diff --git a/media-gfx/renderdoc/renderdoc-1.18.ebuild 
b/media-gfx/renderdoc/renderdoc-1.18-r1.ebuild
similarity index 96%
rename from media-gfx/renderdoc/renderdoc-1.18.ebuild
rename to media-gfx/renderdoc/renderdoc-1.18-r1.ebuild
index 38a71320c453..aca43a4ec9e9 100644
--- a/media-gfx/renderdoc/renderdoc-1.18.ebuild
+++ b/media-gfx/renderdoc/renderdoc-1.18-r1.ebuild
@@ -99,6 +99,10 @@ PATCHES=(
 
        "${FILESDIR}"/${PN}-1.18-system-glslang.patch
        "${FILESDIR}"/${PN}-1.18-system-compress.patch
+
+       # Check physical device API version and supported extensions.  Fixes
+       # segfault on some GPU/driver combinations.  Will be in release 1.19
+       "${FILESDIR}"/${PN}-1.18-check-api-ver.patch
 )
 
 DOCS=( util/LINUX_DIST_README )

Reply via email to