Skip to content

Commit a713b4f

Browse files
ok so I found out that renderdoc hates External memory
1 parent 215df72 commit a713b4f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

include/nbl/video/SPhysicalDeviceLimits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ struct SPhysicalDeviceLimits
332332

333333
/* VK_EXT_external_memory_host */
334334
/* ExternalMemoryHostPropertiesEXT */
335-
uint32_t minImportedHostPointerAlignment = 0x1u<<16u;
335+
uint32_t minImportedHostPointerAlignment = 0x1u<<31u;
336336

337337
/* ShaderAtomicFloatFeaturesEXT *//* VK_EXT_shader_atomic_float */
338338
// [REQUIRE] Nabla Core Profile

src/nbl/video/CVulkanPhysicalDevice.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
257257
return availableFeatureSet.find(name)!=availableFeatureSet.end();
258258
};
259259
//! Required by Nabla Core Profile
260-
if (!isExtensionSupported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME))
260+
if (!rdoc && !isExtensionSupported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME))
261261
return nullptr;
262262
if (!isExtensionSupported(VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME))
263263
return nullptr;
@@ -294,7 +294,6 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
294294
addToPNextChain(&vulkan13Properties);
295295
//! Required by Nabla Core Profile
296296
VkPhysicalDeviceExternalMemoryHostPropertiesEXT externalMemoryHostProperties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT };
297-
addToPNextChain(&externalMemoryHostProperties);
298297
VkPhysicalDeviceRobustness2PropertiesEXT robustness2Properties = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT };
299298
addToPNextChain(&robustness2Properties);
300299
//! Extensions (ordered by spec extension number)
@@ -314,6 +313,9 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
314313
#endif
315314
VkPhysicalDeviceShaderSMBuiltinsPropertiesNV shaderSMBuiltinsPropertiesNV = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV };
316315
VkPhysicalDeviceShaderCoreProperties2AMD shaderCoreProperties2AMD = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD };
316+
//! Because Renderdoc is special and instead of ignoring extensions it whitelists them
317+
if (isExtensionSupported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME))
318+
addToPNextChain(&externalMemoryHostProperties);
317319
//! This is only written for convenience to avoid getting validation errors otherwise vulkan will just skip any strutctures it doesn't recognize
318320
if (isExtensionSupported(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME))
319321
addToPNextChain(&conservativeRasterizationProperties);
@@ -504,7 +506,8 @@ std::unique_ptr<CVulkanPhysicalDevice> CVulkanPhysicalDevice::create(core::smart
504506

505507

506508
//! Nabla Core Extensions
507-
properties.limits.minImportedHostPointerAlignment = externalMemoryHostProperties.minImportedHostPointerAlignment;
509+
if (isExtensionSupported(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME)) // renderdoc special
510+
properties.limits.minImportedHostPointerAlignment = externalMemoryHostProperties.minImportedHostPointerAlignment;
508511

509512
// there's no ShaderAtomicFloatPropertiesEXT
510513

@@ -1395,7 +1398,7 @@ core::smart_refctd_ptr<ILogicalDevice> CVulkanPhysicalDevice::createLogicalDevic
13951398
extensionsToEnable.insert(VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME); // All Requirements Exist in Vulkan 1.1 (including instance extensions)
13961399
#endif
13971400
enableExtensionIfAvailable(VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME);
1398-
extensionsToEnable.insert(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME);
1401+
enableExtensionIfAvailable(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME);
13991402
extensionsToEnable.insert(VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME);
14001403

14011404
//! required but has overhead so conditional

0 commit comments

Comments
 (0)