Skip to content

Commit ffc985a

Browse files
jasmine-hansenbaldurk
authored andcommitted
Fix render overlay dynamic state for VK_EXT_shader_object
Mirrors the pipeline modifications with dynamic state for Highlight Draw, Depth, Stencil, Backface Cull, and Viewport Scissor
1 parent add78f9 commit ffc985a

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

renderdoc/driver/vulkan/vk_overlay.cpp

+53-1
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,8 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
10801080
state.depthBoundsTestEnable = VK_FALSE;
10811081
state.cullMode = VK_CULL_MODE_NONE;
10821082

1083+
state.sampleMask = {~0U};
1084+
10831085
// disable all discard rectangles
10841086
RemoveNextStruct(&pipeCreateInfo,
10851087
VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT);
@@ -1178,6 +1180,12 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
11781180
}
11791181
}
11801182

1183+
state.logicOpEnable = false;
1184+
for(uint32_t i = 0; i < state.colorBlendEnable.size(); i++)
1185+
state.colorBlendEnable[i] = false;
1186+
for(uint32_t i = 0; i < state.colorWriteMask.size(); i++)
1187+
state.colorWriteMask[i] = 0xf;
1188+
11811189
// set scissors to max for drawcall
11821190
if(overlay == DebugOverlay::Drawcall && pipeCreateInfo.pViewportState)
11831191
{
@@ -1488,10 +1496,18 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
14881496
state.depthBoundsTestEnable = VK_FALSE;
14891497
state.cullMode = VK_CULL_MODE_NONE;
14901498

1499+
state.sampleMask = {~0U};
1500+
14911501
// enable dynamic depth clamp
14921502
if(m_pDriver->GetDeviceEnabledFeatures().depthClamp)
14931503
state.depthClampEnable = true;
14941504

1505+
state.logicOpEnable = false;
1506+
for(uint32_t i = 0; i < state.colorBlendEnable.size(); i++)
1507+
state.colorBlendEnable[i] = false;
1508+
for(uint32_t i = 0; i < state.colorWriteMask.size(); i++)
1509+
state.colorWriteMask[i] = 0xf;
1510+
14951511
// modify state
14961512
state.SetRenderPass(GetResID(m_Overlay.NoDepthRP));
14971513
state.subpass = 0;
@@ -1817,10 +1833,18 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
18171833
state.depthBoundsTestEnable = VK_FALSE;
18181834
state.cullMode = VK_CULL_MODE_NONE;
18191835

1836+
state.sampleMask = {~0U};
1837+
18201838
// enable dynamic depth clamp
18211839
if(m_pDriver->GetDeviceEnabledFeatures().depthClamp)
18221840
state.depthClampEnable = true;
18231841

1842+
state.logicOpEnable = false;
1843+
for(uint32_t i = 0; i < state.colorBlendEnable.size(); i++)
1844+
state.colorBlendEnable[i] = false;
1845+
for(uint32_t i = 0; i < state.colorWriteMask.size(); i++)
1846+
state.colorWriteMask[i] = 0xf;
1847+
18241848
// modify state
18251849
state.SetRenderPass(GetResID(m_Overlay.NoDepthRP));
18261850
state.subpass = 0;
@@ -1953,7 +1977,9 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
19531977
if(useDepthWriteStencilPass)
19541978
{
19551979
useDepthWriteStencilPass = false;
1956-
const VulkanCreationInfo::ShaderEntry &ps = pipeInfo.shaders[4];
1980+
const VulkanCreationInfo::ShaderEntry &ps =
1981+
state.graphics.shaderObject ? createinfo.m_ShaderObject[state.shaderObjects[4]].shad
1982+
: pipeInfo.shaders[4];
19571983
if(ps.module != ResourceId())
19581984
{
19591985
ShaderReflection *reflection = ps.refl;
@@ -2473,10 +2499,32 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
24732499
state.depthBoundsTestEnable = VK_FALSE;
24742500
state.cullMode = VK_CULL_MODE_NONE;
24752501

2502+
state.sampleMask = {~0U};
2503+
24762504
// enable dynamic depth clamp
24772505
if(m_pDriver->GetDeviceEnabledFeatures().depthClamp)
24782506
state.depthClampEnable = true;
24792507

2508+
state.logicOpEnable = false;
2509+
for(uint32_t i = 0; i < state.colorBlendEnable.size(); i++)
2510+
state.colorBlendEnable[i] = false;
2511+
for(uint32_t i = 0; i < state.colorWriteMask.size(); i++)
2512+
state.colorWriteMask[i] = 0xf;
2513+
2514+
if(depthRP != VK_NULL_HANDLE)
2515+
{
2516+
if(overlay == DebugOverlay::Depth)
2517+
{
2518+
state.depthTestEnable = origDepthTest;
2519+
}
2520+
else
2521+
{
2522+
state.front.passOp = state.front.failOp = state.front.depthFailOp = VK_STENCIL_OP_KEEP;
2523+
state.back.passOp = state.back.failOp = state.back.depthFailOp = VK_STENCIL_OP_KEEP;
2524+
state.stencilTestEnable = origStencilTest;
2525+
}
2526+
}
2527+
24802528
if(state.graphics.shaderObject)
24812529
{
24822530
state.graphics.pipeline = ResourceId();
@@ -2487,6 +2535,10 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
24872535

24882536
if(useDepthWriteStencilPass)
24892537
{
2538+
// disable colour write
2539+
for(uint32_t i = 0; i < state.colorWriteMask.size(); i++)
2540+
state.colorWriteMask[i] = 0x0;
2541+
24902542
// override stencil dynamic state
24912543
state.front.compare = 0xff;
24922544
state.front.write = 0xff;

0 commit comments

Comments
 (0)