aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Jesionowski <maciej.jesionowski@mobica.com>2016-11-23 10:44:34 +0100
committerTobin Ehlis <tobine@google.com>2016-11-23 16:04:24 -0700
commit73a548c8f80490526cf3c15e92f95918491e3e2e (patch)
tree6c8cfd39b0ef384b0b4c7f8bac242f715e2bdedd
parentc191c5de1fc1baad5d8ecf5cb3790d1fdc126c70 (diff)
downloadusermoji-73a548c8f80490526cf3c15e92f95918491e3e2e.tar.xz
layers: Handle partial failure in vkCreate*Pipelines
This applies to vkCreate*Pipelines creating multiple objects with a single call. Creation of *some* pipelines may fail and an error code will be returned. In this case invalid handles will be set to NULL, and the remaining handles must be managed properly.
-rw-r--r--layers/object_tracker.cpp8
-rw-r--r--layers/unique_objects.cpp20
2 files changed, 16 insertions, 12 deletions
diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp
index 172d81e0..1691f3eb 100644
--- a/layers/object_tracker.cpp
+++ b/layers/object_tracker.cpp
@@ -3589,8 +3589,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli
VkResult result = get_dispatch_table(ot_device_table_map, device)
->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
lock.lock();
- if (result == VK_SUCCESS) {
- for (uint32_t idx2 = 0; idx2 < createInfoCount; ++idx2) {
+ for (uint32_t idx2 = 0; idx2 < createInfoCount; ++idx2) {
+ if (pPipelines[idx2] != VK_NULL_HANDLE) {
CreateObject(device, pPipelines[idx2], VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, pAllocator);
}
}
@@ -3631,8 +3631,8 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin
VkResult result = get_dispatch_table(ot_device_table_map, device)
->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
lock.lock();
- if (result == VK_SUCCESS) {
- for (uint32_t idx1 = 0; idx1 < createInfoCount; ++idx1) {
+ for (uint32_t idx1 = 0; idx1 < createInfoCount; ++idx1) {
+ if (pPipelines[idx1] != VK_NULL_HANDLE) {
CreateObject(device, pPipelines[idx1], VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, pAllocator);
}
}
diff --git a/layers/unique_objects.cpp b/layers/unique_objects.cpp
index 0d81c809..3a0945a8 100644
--- a/layers/unique_objects.cpp
+++ b/layers/unique_objects.cpp
@@ -428,13 +428,15 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(VkDevice device, VkPipelin
VkResult result = my_device_data->device_dispatch_table->CreateComputePipelines(
device, pipelineCache, createInfoCount, (const VkComputePipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines);
delete[] local_pCreateInfos;
- if (VK_SUCCESS == result) {
+ {
uint64_t unique_id = 0;
std::lock_guard<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
- unique_id = global_unique_id++;
- my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
- pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
+ if (pPipelines[i] != VK_NULL_HANDLE) {
+ unique_id = global_unique_id++;
+ my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
+ pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
+ }
}
}
return result;
@@ -484,13 +486,15 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(VkDevice device, VkPipeli
VkResult result = my_device_data->device_dispatch_table->CreateGraphicsPipelines(
device, pipelineCache, createInfoCount, (const VkGraphicsPipelineCreateInfo *)local_pCreateInfos, pAllocator, pPipelines);
delete[] local_pCreateInfos;
- if (VK_SUCCESS == result) {
+ {
uint64_t unique_id = 0;
std::lock_guard<std::mutex> lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
- unique_id = global_unique_id++;
- my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
- pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
+ if (pPipelines[i] != VK_NULL_HANDLE) {
+ unique_id = global_unique_id++;
+ my_device_data->unique_id_mapping[unique_id] = reinterpret_cast<uint64_t &>(pPipelines[i]);
+ pPipelines[i] = reinterpret_cast<VkPipeline &>(unique_id);
+ }
}
}
return result;