@@ -4350,6 +4350,14 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
4350
4350
imCreateInfo.extent .height = RDCMAX (1U , imCreateInfo.extent .height >> mip);
4351
4351
imCreateInfo.extent .depth = RDCMAX (1U , imCreateInfo.extent .depth >> mip);
4352
4352
4353
+ // convert a 3D texture into a 2D array, so we can render to the slices without needing
4354
+ // KHR_maintenance1
4355
+ if (imCreateInfo.extent .depth > 1 )
4356
+ {
4357
+ imCreateInfo.arrayLayers = imCreateInfo.extent .depth ;
4358
+ imCreateInfo.extent .depth = 1 ;
4359
+ }
4360
+
4353
4361
// create render texture similar to readback texture
4354
4362
vt->CreateImage (Unwrap (dev), &imCreateInfo, NULL , &tmpImage);
4355
4363
@@ -4425,7 +4433,7 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
4425
4433
};
4426
4434
vt->CreateRenderPass (Unwrap (dev), &rpinfo, NULL , &tmpRP);
4427
4435
4428
- numFBs = ( imCreateInfo.imageType == VK_IMAGE_TYPE_3D ? (imCreateInfo. extent . depth >> mip) : 1 ) ;
4436
+ numFBs = imCreateInfo.arrayLayers ;
4429
4437
tmpFB = new VkFramebuffer[numFBs];
4430
4438
tmpView = new VkImageView[numFBs];
4431
4439
@@ -4437,6 +4445,12 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
4437
4445
// if 3d texture, render each slice separately, otherwise render once
4438
4446
for (uint32_t i = 0 ; i < numFBs; i++)
4439
4447
{
4448
+ if (numFBs > 1 && (i % GetDebugManager ()->m_TexDisplayUBO .GetRingCount ()) == 0 )
4449
+ {
4450
+ m_pDriver->SubmitCmds ();
4451
+ m_pDriver->FlushQ ();
4452
+ }
4453
+
4440
4454
TextureDisplay texDisplay;
4441
4455
4442
4456
texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true ;
@@ -4445,10 +4459,9 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
4445
4459
texDisplay.overlay = DebugOverlay::NoOverlay;
4446
4460
texDisplay.FlipY = false ;
4447
4461
texDisplay.mip = mip;
4448
- texDisplay.sampleIdx =
4449
- imCreateInfo.imageType == VK_IMAGE_TYPE_3D ? 0 : (params.resolve ? ~0U : arrayIdx);
4462
+ texDisplay.sampleIdx = imInfo.type == VK_IMAGE_TYPE_3D ? 0 : (params.resolve ? ~0U : arrayIdx);
4450
4463
texDisplay.CustomShader = ResourceId ();
4451
- texDisplay.sliceFace = imCreateInfo. imageType == VK_IMAGE_TYPE_3D ? i : arrayIdx;
4464
+ texDisplay.sliceFace = imInfo. type == VK_IMAGE_TYPE_3D ? i : arrayIdx;
4452
4465
texDisplay.rangemin = params.blackPoint ;
4453
4466
texDisplay.rangemax = params.whitePoint ;
4454
4467
texDisplay.scale = 1 .0f ;
@@ -4870,6 +4883,18 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
4870
4883
vt->CmdCopyImageToBuffer (Unwrap (cmd), srcImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
4871
4884
readbackBuf, 2 , copyregion);
4872
4885
}
4886
+ else if (imInfo.type == VK_IMAGE_TYPE_3D && params.remap )
4887
+ {
4888
+ // copy in each slice from the 2D array we created to render out the 3D texture
4889
+ for (uint32_t i = 0 ; i < imCreateInfo.arrayLayers ; i++)
4890
+ {
4891
+ copyregion[0 ].imageSubresource .baseArrayLayer = i;
4892
+ copyregion[0 ].bufferOffset =
4893
+ i * GetByteSize (imInfo.extent .width , imInfo.extent .height , 1 , imCreateInfo.format , mip);
4894
+ vt->CmdCopyImageToBuffer (Unwrap (cmd), srcImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
4895
+ readbackBuf, 1 , copyregion);
4896
+ }
4897
+ }
4873
4898
else
4874
4899
{
4875
4900
// copy from desired subresource in srcImage to buffer
0 commit comments