Skip to content

Commit 4284118

Browse files
Deal with deferredHostOperations for RTPSO properly.
We need to consider the NOT_DEFERRED / DEFERRED error codes. For paranoid build we cannot use host operations since createInfoCount might be larger than 1, and we never want to defer work in paranoid mode anyway.
1 parent c03ec90 commit 4284118

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

layer/dispatch.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesNormal(Device *la
10101010

10111011
// If pipeline compile fails due to pipeline cache control we get a null handle for pipeline, so we need to
10121012
// treat it as a failure.
1013-
if (res != VK_SUCCESS || !shouldRecord)
1013+
if ((res != VK_SUCCESS && res != VK_OPERATION_DEFERRED_KHR && res != VK_OPERATION_NOT_DEFERRED_KHR) || !shouldRecord)
10141014
return res;
10151015

10161016
for (uint32_t i = 0; i < createInfoCount; i++)
@@ -1023,7 +1023,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesNormal(Device *la
10231023
}
10241024
}
10251025

1026-
return VK_SUCCESS;
1026+
return res;
10271027
}
10281028

10291029
static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesParanoid(Device *layer,
@@ -1062,9 +1062,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesParanoid(Device *
10621062

10631063
// Have to create all pipelines here, in case the application makes use of basePipelineIndex.
10641064
// Write arguments in TLS in-case we crash here.
1065+
// Never defer operations when we're recording in paranoid mode,
1066+
// since we need to observe the compilation on this thread.
10651067
Instance::braceForRayTracingPipelineCrash(&layer->getRecorder(), &info);
1066-
// FIXME: Can we meaningfully deal with deferredOperation here?
1067-
auto res = layer->getTable()->CreateRayTracingPipelinesKHR(device, deferredOperation, pipelineCache, 1, &info,
1068+
auto res = layer->getTable()->CreateRayTracingPipelinesKHR(device, VK_NULL_HANDLE, pipelineCache, 1, &info,
10681069
pAllocator, &pPipelines[i]);
10691070
Instance::completedPipelineCompilation();
10701071

@@ -1076,7 +1077,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesParanoid(Device *
10761077
LOGW_LEVEL("Failed to record compute pipeline, usually caused by unsupported pNext.\n");
10771078
}
10781079

1079-
if (res == VK_PIPELINE_COMPILE_REQUIRED_EXT)
1080+
if (res == VK_PIPELINE_COMPILE_REQUIRED)
10801081
final_res = res;
10811082

10821083
if (res < 0)
@@ -1092,6 +1093,9 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateRayTracingPipelinesParanoid(Device *
10921093
}
10931094
}
10941095

1096+
if (final_res == VK_SUCCESS && deferredOperation)
1097+
final_res = VK_OPERATION_NOT_DEFERRED_KHR;
1098+
10951099
return final_res;
10961100
}
10971101

0 commit comments

Comments
 (0)