Pass pLayerName correctly when enumerating device extensions

* We want to enumerate extensions from the right source, and also only add our
  own added extensions if pLayerName == NULL.
This commit is contained in:
baldurk
2019-01-15 13:40:22 +00:00
parent 2ba624adb8
commit 26d35d4214
3 changed files with 23 additions and 14 deletions
+20 -12
View File
@@ -1020,6 +1020,7 @@ void WrappedVulkan::FilterToSupportedExtensions(std::vector<VkExtensionPropertie
}
VkResult WrappedVulkan::FilterDeviceExtensionProperties(VkPhysicalDevice physDev,
const char *pLayerName,
uint32_t *pPropertyCount,
VkExtensionProperties *pProperties)
{
@@ -1027,13 +1028,14 @@ VkResult WrappedVulkan::FilterDeviceExtensionProperties(VkPhysicalDevice physDev
// first fetch the list of extensions ourselves
uint32_t numExts;
vkr = ObjDisp(physDev)->EnumerateDeviceExtensionProperties(Unwrap(physDev), NULL, &numExts, NULL);
vkr = ObjDisp(physDev)->EnumerateDeviceExtensionProperties(Unwrap(physDev), pLayerName, &numExts,
NULL);
if(vkr != VK_SUCCESS)
return vkr;
std::vector<VkExtensionProperties> exts(numExts);
vkr = ObjDisp(physDev)->EnumerateDeviceExtensionProperties(Unwrap(physDev), NULL, &numExts,
vkr = ObjDisp(physDev)->EnumerateDeviceExtensionProperties(Unwrap(physDev), pLayerName, &numExts,
&exts[0]);
if(vkr != VK_SUCCESS)
@@ -1048,11 +1050,14 @@ VkResult WrappedVulkan::FilterDeviceExtensionProperties(VkPhysicalDevice physDev
filtered.reserve(exts.size());
FilterToSupportedExtensions(exts, filtered);
// now we can add extensions that we provide ourselves (note this isn't sorted, but we
// don't have to sort the results, the sorting was just so we could filter optimally).
filtered.insert(
filtered.end(), &renderdocProvidedDeviceExtensions[0],
&renderdocProvidedDeviceExtensions[0] + ARRAY_COUNT(renderdocProvidedDeviceExtensions));
if(pLayerName == NULL)
{
// now we can add extensions that we provide ourselves (note this isn't sorted, but we
// don't have to sort the results, the sorting was just so we could filter optimally).
filtered.insert(
filtered.end(), &renderdocProvidedDeviceExtensions[0],
&renderdocProvidedDeviceExtensions[0] + ARRAY_COUNT(renderdocProvidedDeviceExtensions));
}
return FillPropertyCountAndList(&filtered[0], (uint32_t)filtered.size(), pPropertyCount,
pProperties);
@@ -1087,11 +1092,14 @@ VkResult WrappedVulkan::FilterInstanceExtensionProperties(
FilterToSupportedExtensions(exts, filtered);
// now we can add extensions that we provide ourselves (note this isn't sorted, but we
// don't have to sort the results, the sorting was just so we could filter optimally).
filtered.insert(
filtered.end(), &renderdocProvidedInstanceExtensions[0],
&renderdocProvidedInstanceExtensions[0] + ARRAY_COUNT(renderdocProvidedInstanceExtensions));
if(pLayerName == NULL)
{
// now we can add extensions that we provide ourselves (note this isn't sorted, but we
// don't have to sort the results, the sorting was just so we could filter optimally).
filtered.insert(
filtered.end(), &renderdocProvidedInstanceExtensions[0],
&renderdocProvidedInstanceExtensions[0] + ARRAY_COUNT(renderdocProvidedInstanceExtensions));
}
return FillPropertyCountAndList(&filtered[0], (uint32_t)filtered.size(), pPropertyCount,
pProperties);
+2 -1
View File
@@ -958,7 +958,8 @@ public:
static bool IsSupportedExtension(const char *extName);
static void FilterToSupportedExtensions(std::vector<VkExtensionProperties> &exts,
std::vector<VkExtensionProperties> &filtered);
VkResult FilterDeviceExtensionProperties(VkPhysicalDevice physDev, uint32_t *pPropertyCount,
VkResult FilterDeviceExtensionProperties(VkPhysicalDevice physDev, const char *pLayerName,
uint32_t *pPropertyCount,
VkExtensionProperties *pProperties);
static VkResult FilterInstanceExtensionProperties(
const VkEnumerateInstanceExtensionPropertiesChain *pChain, const char *pLayerName,
+1 -1
View File
@@ -240,7 +240,7 @@ VK_LAYER_RENDERDOC_CaptureEnumerateDeviceExtensionProperties(VkPhysicalDevice ph
// This is our chance to filter out any reported extensions that we don't support
if(physicalDevice != NULL && (pLayerName == NULL || strcmp(pLayerName, RENDERDOC_VULKAN_LAYER_NAME)))
return CoreDisp(physicalDevice)
->FilterDeviceExtensionProperties(physicalDevice, pPropertyCount, pProperties);
->FilterDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties);
return WrappedVulkan::GetProvidedDeviceExtensionProperties(pPropertyCount, pProperties);
}