anv: implement VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT
v2: * Set pPipeline to NULL in the corresponding graphics/compute_create_pipeline function. * Keep current ANV behavior of bailing on the first real error. v3: * Don't return early if the pipeline succeeded. v:4(5?): * Simplify return conditions. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5136>
This commit is contained in:
parent
13f44596d7
commit
23633f6c69
|
@ -1417,6 +1417,9 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
|
|||
}
|
||||
}
|
||||
|
||||
if (info->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT)
|
||||
return VK_PIPELINE_COMPILE_REQUIRED_EXT;
|
||||
|
||||
void *pipeline_ctx = ralloc_context(NULL);
|
||||
|
||||
for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
|
||||
|
@ -1679,6 +1682,10 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline,
|
|||
&cache_hit);
|
||||
}
|
||||
|
||||
if (bin == NULL &&
|
||||
(info->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT))
|
||||
return VK_PIPELINE_COMPILE_REQUIRED_EXT;
|
||||
|
||||
void *mem_ctx = ralloc_context(NULL);
|
||||
if (bin == NULL) {
|
||||
int64_t stage_start = os_time_get_nano();
|
||||
|
|
|
@ -2172,6 +2172,8 @@ genX(graphics_pipeline_create)(
|
|||
pCreateInfo, pAllocator);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free2(&device->vk.alloc, pAllocator, pipeline);
|
||||
if (result == VK_PIPELINE_COMPILE_REQUIRED_EXT)
|
||||
*pPipeline = VK_NULL_HANDLE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2306,6 +2308,8 @@ compute_pipeline_create(
|
|||
if (result != VK_SUCCESS) {
|
||||
anv_pipeline_finish(&pipeline->base, device, pAllocator);
|
||||
vk_free2(&device->vk.alloc, pAllocator, pipeline);
|
||||
if (result == VK_PIPELINE_COMPILE_REQUIRED_EXT)
|
||||
*pPipeline = VK_NULL_HANDLE;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2429,14 +2433,22 @@ VkResult genX(CreateGraphicsPipelines)(
|
|||
|
||||
unsigned i;
|
||||
for (i = 0; i < count; i++) {
|
||||
result = genX(graphics_pipeline_create)(_device,
|
||||
pipeline_cache,
|
||||
&pCreateInfos[i],
|
||||
pAllocator, &pPipelines[i]);
|
||||
VkResult res = genX(graphics_pipeline_create)(_device,
|
||||
pipeline_cache,
|
||||
&pCreateInfos[i],
|
||||
pAllocator, &pPipelines[i]);
|
||||
|
||||
/* Bail out on the first error as it is not obvious what error should be
|
||||
* report upon 2 different failures. */
|
||||
if (result != VK_SUCCESS)
|
||||
if (res == VK_SUCCESS)
|
||||
continue;
|
||||
|
||||
/* Bail out on the first error != VK_PIPELINE_COMPILE_REQUIRED_EX as it
|
||||
* is not obvious what error should be report upon 2 different failures.
|
||||
* */
|
||||
result = res;
|
||||
if (res != VK_PIPELINE_COMPILE_REQUIRED_EXT)
|
||||
break;
|
||||
|
||||
if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2460,13 +2472,21 @@ VkResult genX(CreateComputePipelines)(
|
|||
|
||||
unsigned i;
|
||||
for (i = 0; i < count; i++) {
|
||||
result = compute_pipeline_create(_device, pipeline_cache,
|
||||
&pCreateInfos[i],
|
||||
pAllocator, &pPipelines[i]);
|
||||
VkResult res = compute_pipeline_create(_device, pipeline_cache,
|
||||
&pCreateInfos[i],
|
||||
pAllocator, &pPipelines[i]);
|
||||
|
||||
/* Bail out on the first error as it is not obvious what error should be
|
||||
* report upon 2 different failures. */
|
||||
if (result != VK_SUCCESS)
|
||||
if (res == VK_SUCCESS)
|
||||
continue;
|
||||
|
||||
/* Bail out on the first error != VK_PIPELINE_COMPILE_REQUIRED_EX as it
|
||||
* is not obvious what error should be report upon 2 different failures.
|
||||
* */
|
||||
result = res;
|
||||
if (res != VK_PIPELINE_COMPILE_REQUIRED_EXT)
|
||||
break;
|
||||
|
||||
if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue