Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

vkDestroyFence validation fails after vkDeviceWaitIdle call if no vkWaitForFences is called #2632

Open
PVRDevTech opened this issue May 3, 2018 · 0 comments
Assignees
Labels

Comments

@PVRDevTech
Copy link

PVRDevTech commented May 3, 2018

Short description- reproduction

Application appears to have no other errors. There are two sets of fences synchronising command buffers submissions and command buffer presentation. When cleaning up exiting the application:

  • Call vkDeviceWaitIdle. Do not explicitly wait for any fences
  • Destroy the objects (including the vkDestroyFence)

Result (Actual)

Standard validation fails with: VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT. VULKAN_LAYER_VALIDATION: Object: 0x1c (Type = 7) | Fence 0x1c is in use. The spec valid usage text states 'All queue submission commands that refer to fence must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VUID-vkDestroyFence-fence-01120)

Additional info (+Workaround)

If I call vkWaitForFences and vkResetFences after (or before) vkDeviceWaitIdle, and before vkDestroyFances, the validation error goes away.Additional info

I also tried just querying the fence status before destroying:

  • vkDeviceWaitIdle
  • vkGetFenceStatus
  • vkDestroyFence

This also fixes the issue (i.e. it does not throw the validation error), which makes me think that it is just that the layer code has the wrong idea about the fence status reasoning (i.e. not updated by vkDeviceWaitIdle that the fence must be signalled).

Expected (Correct) behaviour

Since vkDeviceWaitIdle has been called, it is expected that all commands have finished executing, hence all the fences are signalled, hence the validation error is incorrect as the fences must be signalled.

Rationale

I assume that vkDeviceWaitIdle should not have returned if the fences were not signalled, as then it would be implied that the corresponding commands are not executed.

Debugging Details

For SDK 1.1.73.0 The failure can become apparent seen around core_validation.cpp:3364: if ((*fence_node)->scope == kSyncScopeInternal && (*fence_node)->state == FENCE_INFLIGHT).

Since If I insert a vkWaitForFences the error goes away, it follows that the layer probably misses the fact that the fence must have been signalled as the device has completed all commands. I think that the vkDeviceWaitIdle command should mark the fences as complete itself, or something to that effect.

Thanks,
Gerry

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants