From: Iván Briano Date: Wed, 20 May 2020 19:38:46 +0000 (-0700) Subject: anv: implement VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=23633f6c694cde75e9347d7a18e79c08413bc022;p=mesa.git 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 Part-of: --- diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 4d4898ec4af..9ddb2ebabeb 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -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(); diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index cfb9fedb201..a66e566bb99 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -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]); - - /* Bail out on the first error as it is not obvious what error should be - * report upon 2 different failures. */ - if (result != VK_SUCCESS) + VkResult res = genX(graphics_pipeline_create)(_device, + pipeline_cache, + &pCreateInfos[i], + pAllocator, &pPipelines[i]); + + 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]); + + 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; - /* 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 (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT) break; }