29
29
30
30
RDOC_EXTERN_CONFIG (bool , Replay_Debug_SingleThreadedCompilation);
31
31
32
- static RDResult DeferredPipelineCompile (VkDevice device,
32
+ static RDResult DeferredPipelineCompile (VkDevice device, const VkPipelineCache &pipelineCache,
33
33
const VkGraphicsPipelineCreateInfo &createInfo,
34
34
WrappedVkPipeline *wrappedPipe)
35
35
{
@@ -38,7 +38,7 @@ static RDResult DeferredPipelineCompile(VkDevice device,
38
38
UnwrapStructAndChain (CaptureState::LoadingReplaying, mem, &createInfo);
39
39
40
40
VkPipeline realPipe;
41
- VkResult ret = ObjDisp (device)->CreateGraphicsPipelines (Unwrap (device), VK_NULL_HANDLE , 1 ,
41
+ VkResult ret = ObjDisp (device)->CreateGraphicsPipelines (Unwrap (device), Unwrap (pipelineCache) , 1 ,
42
42
unwrapped, NULL , &realPipe);
43
43
44
44
FreeAlignedBuffer ((byte *)unwrapped);
@@ -54,7 +54,7 @@ static RDResult DeferredPipelineCompile(VkDevice device,
54
54
return ResultCode::Succeeded;
55
55
}
56
56
57
- static RDResult DeferredPipelineCompile (VkDevice device,
57
+ static RDResult DeferredPipelineCompile (VkDevice device, const VkPipelineCache &pipelineCache,
58
58
const VkComputePipelineCreateInfo &createInfo,
59
59
WrappedVkPipeline *wrappedPipe)
60
60
{
@@ -63,7 +63,7 @@ static RDResult DeferredPipelineCompile(VkDevice device,
63
63
UnwrapStructAndChain (CaptureState::LoadingReplaying, mem, &createInfo);
64
64
65
65
VkPipeline realPipe;
66
- VkResult ret = ObjDisp (device)->CreateComputePipelines (Unwrap (device), VK_NULL_HANDLE , 1 ,
66
+ VkResult ret = ObjDisp (device)->CreateComputePipelines (Unwrap (device), Unwrap (pipelineCache) , 1 ,
67
67
unwrapped, NULL , &realPipe);
68
68
69
69
FreeAlignedBuffer ((byte *)unwrapped);
@@ -79,7 +79,7 @@ static RDResult DeferredPipelineCompile(VkDevice device,
79
79
return ResultCode::Succeeded;
80
80
}
81
81
82
- static RDResult DeferredPipelineCompile (VkDevice device,
82
+ static RDResult DeferredPipelineCompile (VkDevice device, const VkPipelineCache &pipelineCache,
83
83
const VkRayTracingPipelineCreateInfoKHR &createInfo,
84
84
const bytebuf &replayHandles,
85
85
uint32_t captureReplayHandleSize,
@@ -98,7 +98,7 @@ static RDResult DeferredPipelineCompile(VkDevice device,
98
98
99
99
VkPipeline realPipe;
100
100
VkResult ret = ObjDisp (device)->CreateRayTracingPipelinesKHR (
101
- Unwrap (device), VK_NULL_HANDLE, VK_NULL_HANDLE , 1 , unwrapped, NULL , &realPipe);
101
+ Unwrap (device), VK_NULL_HANDLE, Unwrap (pipelineCache) , 1 , unwrapped, NULL , &realPipe);
102
102
103
103
FreeAlignedBuffer ((byte *)unwrapped);
104
104
@@ -660,18 +660,7 @@ VkResult WrappedVulkan::vkCreatePipelineCache(VkDevice device,
660
660
const VkAllocationCallbacks *,
661
661
VkPipelineCache *pPipelineCache)
662
662
{
663
- // pretend the user didn't provide any cache data
664
-
665
663
VkPipelineCacheCreateInfo createInfo = *pCreateInfo;
666
- createInfo.initialDataSize = 0 ;
667
- createInfo.pInitialData = NULL ;
668
-
669
- if (pCreateInfo->initialDataSize > 0 )
670
- {
671
- RDCWARN (
672
- " Application provided pipeline cache data! This is invalid, as RenderDoc reports "
673
- " incompatibility with previous caches" );
674
- }
675
664
676
665
VkResult ret;
677
666
SERIALISE_TIME_CALL (ret = ObjDisp (device)->CreatePipelineCache (Unwrap (device), &createInfo, NULL ,
@@ -726,10 +715,6 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
726
715
VkPipeline pipe = VK_NULL_HANDLE;
727
716
728
717
VkRenderPass origRP = CreateInfo.renderPass ;
729
- VkPipelineCache origCache = pipelineCache;
730
-
731
- // don't use pipeline caches on replay
732
- pipelineCache = VK_NULL_HANDLE;
733
718
734
719
// if we have pipeline executable properties, capture the data
735
720
if (GetExtensions (NULL ).ext_KHR_pipeline_executable_properties )
@@ -852,8 +837,8 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
852
837
}
853
838
854
839
DerivedResource (device, Pipeline);
855
- if (origCache != VK_NULL_HANDLE)
856
- DerivedResource (origCache , Pipeline);
840
+ if (pipelineCache != VK_NULL_HANDLE)
841
+ DerivedResource (pipelineCache , Pipeline);
857
842
if (OrigCreateInfo.flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT)
858
843
{
859
844
if (OrigCreateInfo.basePipelineHandle != VK_NULL_HANDLE)
@@ -887,8 +872,8 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
887
872
{
888
873
for (rdcpair<VkGraphicsPipelineCreateInfo, VkPipeline> &deferredPipe : pipelinesToCompile)
889
874
{
890
- RDResult res =
891
- DeferredPipelineCompile (device, deferredPipe. first , GetWrapped (deferredPipe.second ));
875
+ RDResult res = DeferredPipelineCompile (device, pipelineCache, deferredPipe. first ,
876
+ GetWrapped (deferredPipe.second ));
892
877
893
878
if (res != ResultCode::Succeeded)
894
879
{
@@ -908,10 +893,11 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
908
893
{
909
894
WrappedVkPipeline *wrappedPipe = GetWrapped (deferredPipe.second );
910
895
wrappedPipe->deferredJob = Threading::JobSystem::AddJob (
911
- [wrappedVulkan = this , device, createInfo = deferredPipe.first , wrappedPipe]() {
896
+ [wrappedVulkan = this , device, pipelineCache, createInfo = deferredPipe.first ,
897
+ wrappedPipe]() {
912
898
PerformanceTimer timer;
913
899
wrappedVulkan->CheckDeferredResult (
914
- DeferredPipelineCompile (device, createInfo, wrappedPipe));
900
+ DeferredPipelineCompile (device, pipelineCache, createInfo, wrappedPipe));
915
901
wrappedVulkan->AddDeferredTime (timer.GetMilliseconds ());
916
902
},
917
903
parents);
@@ -1074,11 +1060,6 @@ bool WrappedVulkan::Serialise_vkCreateComputePipelines(SerialiserType &ser, VkDe
1074
1060
{
1075
1061
VkPipeline pipe = VK_NULL_HANDLE;
1076
1062
1077
- VkPipelineCache origCache = pipelineCache;
1078
-
1079
- // don't use pipeline caches on replay
1080
- pipelineCache = VK_NULL_HANDLE;
1081
-
1082
1063
// if we have pipeline executable properties, capture the data
1083
1064
if (GetExtensions (NULL ).ext_KHR_pipeline_executable_properties )
1084
1065
{
@@ -1152,7 +1133,7 @@ bool WrappedVulkan::Serialise_vkCreateComputePipelines(SerialiserType &ser, VkDe
1152
1133
1153
1134
if (Replay_Debug_SingleThreadedCompilation ())
1154
1135
{
1155
- RDResult res = DeferredPipelineCompile (device, OrigCreateInfo, GetWrapped (pipe ));
1136
+ RDResult res = DeferredPipelineCompile (device, pipelineCache, OrigCreateInfo, GetWrapped (pipe ));
1156
1137
Deserialise (OrigCreateInfo);
1157
1138
1158
1139
if (res != ResultCode::Succeeded)
@@ -1164,20 +1145,20 @@ bool WrappedVulkan::Serialise_vkCreateComputePipelines(SerialiserType &ser, VkDe
1164
1145
else
1165
1146
{
1166
1147
WrappedVkPipeline *wrappedPipe = GetWrapped (pipe );
1167
- wrappedPipe->deferredJob =
1168
- Threading::JobSystem::AddJob ( [wrappedVulkan = this , device, OrigCreateInfo, wrappedPipe]() {
1148
+ wrappedPipe->deferredJob = Threading::JobSystem::AddJob (
1149
+ [wrappedVulkan = this , device, pipelineCache , OrigCreateInfo, wrappedPipe]() {
1169
1150
PerformanceTimer timer;
1170
1151
wrappedVulkan->CheckDeferredResult (
1171
- DeferredPipelineCompile (device, OrigCreateInfo, wrappedPipe));
1152
+ DeferredPipelineCompile (device, pipelineCache, OrigCreateInfo, wrappedPipe));
1172
1153
wrappedVulkan->AddDeferredTime (timer.GetMilliseconds ());
1173
1154
1174
1155
Deserialise (OrigCreateInfo);
1175
1156
});
1176
1157
}
1177
1158
1178
1159
DerivedResource (device, Pipeline);
1179
- if (origCache != VK_NULL_HANDLE)
1180
- DerivedResource (origCache , Pipeline);
1160
+ if (pipelineCache != VK_NULL_HANDLE)
1161
+ DerivedResource (pipelineCache , Pipeline);
1181
1162
if (OrigCreateInfo.flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT)
1182
1163
{
1183
1164
if (OrigCreateInfo.basePipelineHandle != VK_NULL_HANDLE)
@@ -1360,11 +1341,6 @@ bool WrappedVulkan::Serialise_vkCreateRayTracingPipelinesKHR(
1360
1341
1361
1342
VkPipeline pipe = VK_NULL_HANDLE;
1362
1343
1363
- VkPipelineCache origCache = pipelineCache;
1364
-
1365
- // don't use pipeline caches on replay
1366
- pipelineCache = VK_NULL_HANDLE;
1367
-
1368
1344
// don't fail when a compile is required because we don't currently replay caches so this will
1369
1345
// always happen. This still allows application to use this flag at runtime where it will be
1370
1346
// valid
@@ -1390,8 +1366,8 @@ bool WrappedVulkan::Serialise_vkCreateRayTracingPipelinesKHR(
1390
1366
pipeInfo.Init (GetResourceManager (), m_CreationInfo, live, &OrigCreateInfo);
1391
1367
1392
1368
DerivedResource (device, Pipeline);
1393
- if (origCache != VK_NULL_HANDLE)
1394
- DerivedResource (origCache , Pipeline);
1369
+ if (pipelineCache != VK_NULL_HANDLE)
1370
+ DerivedResource (pipelineCache , Pipeline);
1395
1371
if (OrigCreateInfo.flags & VK_PIPELINE_CREATE_DERIVATIVE_BIT)
1396
1372
{
1397
1373
if (OrigCreateInfo.basePipelineHandle != VK_NULL_HANDLE)
@@ -1418,8 +1394,9 @@ bool WrappedVulkan::Serialise_vkCreateRayTracingPipelinesKHR(
1418
1394
1419
1395
if (Replay_Debug_SingleThreadedCompilation ())
1420
1396
{
1421
- RDResult res = DeferredPipelineCompile (device, OrigCreateInfo, *OrigReplayHandles,
1422
- captureReplayHandleSize, GetWrapped (pipe ));
1397
+ RDResult res =
1398
+ DeferredPipelineCompile (device, pipelineCache, OrigCreateInfo, *OrigReplayHandles,
1399
+ captureReplayHandleSize, GetWrapped (pipe ));
1423
1400
if (res == ResultCode::APIHardwareUnsupported)
1424
1401
res.message = rdcstr (res.message ) + " \n " + GetPhysDeviceCompatString (false , false );
1425
1402
Deserialise (OrigCreateInfo);
@@ -1435,11 +1412,12 @@ bool WrappedVulkan::Serialise_vkCreateRayTracingPipelinesKHR(
1435
1412
{
1436
1413
WrappedVkPipeline *wrappedPipe = GetWrapped (pipe );
1437
1414
wrappedPipe->deferredJob = Threading::JobSystem::AddJob (
1438
- [wrappedVulkan = this , device, OrigCreateInfo, OrigReplayHandles, captureReplayHandleSize ,
1439
- wrappedPipe]() {
1415
+ [wrappedVulkan = this , device, pipelineCache, OrigCreateInfo, OrigReplayHandles ,
1416
+ captureReplayHandleSize, wrappedPipe]() {
1440
1417
PerformanceTimer timer;
1441
- RDResult res = DeferredPipelineCompile (device, OrigCreateInfo, *OrigReplayHandles,
1442
- captureReplayHandleSize, wrappedPipe);
1418
+ RDResult res =
1419
+ DeferredPipelineCompile (device, pipelineCache, OrigCreateInfo, *OrigReplayHandles,
1420
+ captureReplayHandleSize, wrappedPipe);
1443
1421
wrappedVulkan->AddDeferredTime (timer.GetMilliseconds ());
1444
1422
if (res == ResultCode::APIHardwareUnsupported)
1445
1423
res.message = rdcstr (res.message ) + " \n " +
0 commit comments