Add more internal markers for debugging vulkan pixel history

This commit is contained in:
baldurk
2020-07-16 20:45:19 +01:00
parent 4d6d949f42
commit 93ac1654a9
3 changed files with 40 additions and 0 deletions
+19
View File
@@ -159,6 +159,25 @@ void VkMarkerRegion::End(VkQueue q)
ObjDisp(q)->QueueEndDebugUtilsLabelEXT(Unwrap(q));
}
template <>
void NameVulkanObject(VkImage obj, const rdcstr &name)
{
if(!VkMarkerRegion::vk)
return;
VkDevice dev = VkMarkerRegion::vk->GetDev();
if(!ObjDisp(dev)->SetDebugUtilsObjectNameEXT)
return;
VkDebugUtilsObjectNameInfoEXT info = {};
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
info.objectType = VK_OBJECT_TYPE_IMAGE;
info.objectHandle = NON_DISP_TO_UINT64(Unwrap(obj));
info.pObjectName = name.c_str();
ObjDisp(dev)->SetDebugUtilsObjectNameEXT(Unwrap(dev), &info);
}
void GPUBuffer::Create(WrappedVulkan *driver, VkDevice dev, VkDeviceSize size, uint32_t ringSize,
uint32_t flags)
{
+3
View File
@@ -178,6 +178,9 @@ struct VkMarkerRegion
static WrappedVulkan *vk;
};
template <typename T>
void NameVulkanObject(T obj, const rdcstr &name);
struct GPUBuffer
{
enum CreateFlags
@@ -1948,6 +1948,7 @@ private:
PipelineCreationFlags_DisableDepthTest | PipelineCreationFlags_DisableDepthBoundsTest |
PipelineCreationFlags_DisableStencilTest | PipelineCreationFlags_FixedColorShader;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test culling on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_Culling);
}
@@ -1966,6 +1967,7 @@ private:
// tests happen later in the pipeline, it does not matter.
for(uint32_t i = 0; i < pipestate.views.size(); i++)
IntersectScissors(prevScissors[i], pipestate.scissors[i]);
VkMarkerRegion::Set(StringFormat::Fmt("Test scissor on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_Scissor);
}
@@ -1979,6 +1981,7 @@ private:
PipelineCreationFlags_DisableDepthBoundsTest | PipelineCreationFlags_DisableStencilTest |
PipelineCreationFlags_DisableDepthTest | PipelineCreationFlags_FixedColorShader;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test sample mask on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_SampleMask);
}
@@ -1989,6 +1992,7 @@ private:
PipelineCreationFlags_DisableDepthTest |
PipelineCreationFlags_FixedColorShader;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test depth bounds on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_DepthBounds);
}
@@ -2001,6 +2005,7 @@ private:
uint32_t pipeFlags =
PipelineCreationFlags_DisableDepthTest | PipelineCreationFlags_FixedColorShader;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test stencil on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_StencilTesting);
}
@@ -2016,6 +2021,7 @@ private:
PipelineCreationFlags_DisableStencilTest | PipelineCreationFlags_FixedColorShader;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test depth on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_DepthTesting);
}
@@ -2029,6 +2035,7 @@ private:
PipelineCreationFlags_DisableStencilTest |
PipelineCreationFlags_DisableDepthTest;
VkPipeline pipe = CreatePipeline(basePipeline, pipeFlags, replacementShaders, outputIndex);
VkMarkerRegion::Set(StringFormat::Fmt("Test shader discard on %u", eid), cmd);
ReplayDraw(cmd, pipe, eid, TestEnabled_FragmentDiscard);
}
}
@@ -2250,6 +2257,9 @@ struct VulkanPixelHistoryPerFragmentCallback : VulkanPixelHistoryCallback
bool depthEnabled = prevState.depthTestEnable != VK_FALSE;
VkMarkerRegion::Set(StringFormat::Fmt("Event %u has %u fragments", eid, numFragmentsInEvent),
cmd);
// Get primitive ID and shader output value for each fragment.
for(uint32_t f = 0; f < numFragmentsInEvent; f++)
{
@@ -2261,6 +2271,9 @@ struct VulkanPixelHistoryPerFragmentCallback : VulkanPixelHistoryCallback
continue;
}
VkMarkerRegion region(cmd, StringFormat::Fmt("Getting %s for %u",
i == 0 ? "primitive ID" : "shader output", eid));
VkImageMemoryBarrier barrier = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
NULL,
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
@@ -2352,6 +2365,8 @@ struct VulkanPixelHistoryPerFragmentCallback : VulkanPixelHistoryCallback
// value.
for(uint32_t f = 0; f < numFragmentsInEvent - 1; f++)
{
VkMarkerRegion region(cmd, StringFormat::Fmt("Getting postmod for fragment %u in %u", f, eid));
// Get post-modification value, use the original framebuffer attachment.
state.graphics.pipeline = GetResID(pipes.postModPipe);
state.BeginRenderPassAndApplyState(m_pDriver, cmd, VulkanRenderState::BindGraphics);
@@ -2830,6 +2845,9 @@ bool VulkanDebugManager::PixelHistorySetupResources(PixelHistoryResources &resou
vkr = m_pDriver->vkBindImageMemory(m_Device, dsImage, gpuMem, offset);
RDCASSERTEQUAL(vkr, VK_SUCCESS);
NameVulkanObject(colorImage, "Pixel History color image");
NameVulkanObject(dsImage, "Pixel History depth image");
VkImageViewCreateInfo viewInfo = {VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO};
viewInfo.image = colorImage;
viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;