[Mesa-dev] [PATCH v3] anv: fix multiple creation with internal failure
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Fri Dec 23 16:41:35 UTC 2016
The specification section 9.4 says :
When an application attempts to create many pipelines in a single
command, it is possible that some subset may fail creation. In that
case, the corresponding entries in the pPipelines output array will
be filled with VK_NULL_HANDLE values. If any pipeline fails
creation (for example, due to out of memory errors), the
vkCreate*Pipelines commands will return an error code. The
implementation will attempt to create all pipelines, and only
return VK_NULL_HANDLE values for those that actually failed.
Fixes :
dEQP-VK.api.object_management.alloc_callback_fail_multiple.graphics_pipeline
v2: C is hard let's go shopping (Lionel)
v3: Remove unnecessary condition in for loops (Lionel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
src/intel/vulkan/genX_pipeline.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 845d0204d8..ee02672cc7 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1476,15 +1476,13 @@ VkResult genX(CreateGraphicsPipelines)(
&pCreateInfos[i],
pAllocator, &pPipelines[i]);
if (result != VK_SUCCESS) {
- for (unsigned j = 0; j < i; j++) {
- anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
- }
-
- return result;
+ for (; i < count; i++)
+ pPipelines[i] = VK_NULL_HANDLE;
+ break;
}
}
- return VK_SUCCESS;
+ return result;
}
VkResult genX(CreateComputePipelines)(
@@ -1505,13 +1503,11 @@ VkResult genX(CreateComputePipelines)(
&pCreateInfos[i],
pAllocator, &pPipelines[i]);
if (result != VK_SUCCESS) {
- for (unsigned j = 0; j < i; j++) {
- anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
- }
-
- return result;
+ for (; i < count; i++)
+ pPipelines[i] = VK_NULL_HANDLE;
+ break;
}
}
- return VK_SUCCESS;
+ return result;
}
--
2.11.0
More information about the mesa-dev
mailing list