Jackalope
Jackalope

Reputation: 93

Vulkan validation layers VkCmdWaitEvents srcStageMask error meaning

Event is signaled by another cmd buffer on the same queue with VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT stage mask.

Event is not signaled via vkSetEvent on the host.

Event is waited by vkCmdWaitEvents with src stage mask VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT and dst stage mask VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT.

Is this correct stage masks for depth attachment writting and reading as color attachment after?

Validation layers callback message:

Submitting cmdbuffer with call to VkCmdWaitEvents using srcStageMask 0x200 which must be the 
bitwise OR of the stageMask parameters used in calls to vkCmdSetEvent and 
VK_PIPELINE_STAGE_HOST_BIT if used with vkSetEvent but instead is 0x0. The Vulkan spec 
states: srcStageMask must be a valid combination of VkPipelineStageFlagBits values 
(https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-
vkCmdWaitEvents-srcStageMask-parameter)

It actually says, that "submitted value is 0x200, but is 0x0". Is this a bug? Where from 0x0 value come from, how it can be 0x200 and 0x0 at the same time?


Some code

Signal after depth buffer renderpass:

cmd.cmd_event_set_signaled(cmd_data.event<EventId::SHADOW_MAP>(),
                           vkw::StageFlag::LATE_FRAGMENT_TESTS);

Wait before primary render pass in another cmd:

vkw::StageMaskChange stage_masks;
stage_masks.src = vkw::StageFlag::LATE_FRAGMENT_TESTS;
stage_masks.dst = vkw::StageFlag::FRAGMENT_SHADER;
auto &shadow_map_event = cmd_data.event<EventId::SHADOW_MAP>();
cmd.cmd_event_wait(shadow_map_event, stage_masks);
cmd.cmd_event_set_unsignaled(shadow_map_event, stage_masks.dst);

Wrapper code. There is some C++ type conversions magic, but values are passing to vkCmd functions correctly.

void cmd_event_set_signaled(Event e, StageMask stage_mask) {
    vkCmdSetEvent(*this, e, stage_mask);
}
void cmd_event_set_unsignaled(Event e, StageMask stage_mask) {
    vkCmdResetEvent(*this, e, stage_mask);
}
void cmd_event_wait(Events es, StageMaskChange smc) {
    vkCmdWaitEvents(*this, es.count32(), &es.begin()->p_vk, smc.src, smc.dst,
                    0, {}, 0, {}, 0, {});
}

Upvotes: 1

Views: 276

Answers (2)

Jackalope
Jackalope

Reputation: 93

The problem is not present in the VulkanSDK 1.2.131.2, so vulkan-loader-1.1.125 is a bit outdated.

Upvotes: 0

krOoze
krOoze

Reputation: 13246

In the message, one references the pipeline stage used in vkCmdWaitEvents, the other references the stage passed to vkCmdSetEvent.

Upvotes: 0

Related Questions