Commit 709472c9 by Mohan Maiya Committed by Commit Bot

Vulkan: Fix variable scope bug during vkCreateInstance

While enabling best practices layer the struct that gets added to the pNext chain is a stack variable and goes out of scope beyond the if-check. Move the struct variables out of local scope to prevent access violation errors during vkCreateInstance. Bug: b/156661359 Change-Id: Ifa470ff1e51d454782695adcf40b4db2aa1608a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2335747Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 11207393
...@@ -721,15 +721,16 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -721,15 +721,16 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
instanceInfo.enabledLayerCount = static_cast<uint32_t>(enabledInstanceLayerNames.size()); instanceInfo.enabledLayerCount = static_cast<uint32_t>(enabledInstanceLayerNames.size());
instanceInfo.ppEnabledLayerNames = enabledInstanceLayerNames.data(); instanceInfo.ppEnabledLayerNames = enabledInstanceLayerNames.data();
VkValidationFeatureEnableEXT enabledFeatures[] = {
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT};
VkValidationFeaturesEXT validationFeatures = {};
validationFeatures.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
validationFeatures.enabledValidationFeatureCount = 1;
validationFeatures.pEnabledValidationFeatures = enabledFeatures;
if (mEnableValidationLayers) if (mEnableValidationLayers)
{ {
// Enable best practices output which includes perfdoc layer // Enable best practices output which includes perfdoc layer
VkValidationFeatureEnableEXT enabledFeatures[] = {
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT};
VkValidationFeaturesEXT validationFeatures = {};
validationFeatures.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
validationFeatures.enabledValidationFeatureCount = 1;
validationFeatures.pEnabledValidationFeatures = enabledFeatures;
vk::AddToPNextChain(&instanceInfo, &validationFeatures); vk::AddToPNextChain(&instanceInfo, &validationFeatures);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment