Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing is recorded when (Vulkan) application never presents frames #3255

Closed
haasn opened this issue Feb 19, 2024 · 5 comments
Closed

Nothing is recorded when (Vulkan) application never presents frames #3255

haasn opened this issue Feb 19, 2024 · 5 comments

Comments

@haasn
Copy link

haasn commented Feb 19, 2024

Description

I am trying to debug my vulkan test suite by making a renderdoc capture, but since this test suite does not render any frames, renderdoc does not record anything.

Steps to reproduce

  1. Create a headless vulkan application that does not present frames, but still runs rendering commands, transfers textures, or otherwise.
  2. Try to renderdoccmd capture it

An example is the https://code.videolan.org/videolan/libplacebo test suite.

Environment

Additional notes

I am aware of the renderdoc frame capture API, but this is too involved for my use case - I simply want to record the entire stream of commands in such a way that I can view it in e.g. qrenderdoc, without having to spend half an hour writing boilerplate code for loading the renderdoc DLL, initializing it, and wrapping a start/stop call around my entire application. Never mind that committing such debug code to git master would be very poor form, and thus this effort would have to be duplicated by all devs.

I expect renderdoc to be capable of recording the API calls from headless vulkan applications out of the box, without extensive modification of the application.

@baldurk
Copy link
Owner

baldurk commented Feb 19, 2024

Using the in-application API for this is the intended solution for programs where present boundaries do not provide a delineation of frames, and I do not intend to ever support a 'capture everything' mode.

Please also note that renderdoccmd is an internal program and not user facing and is not directly supported, you should launch your program from qrenderdoc.

@baldurk baldurk closed this as completed Feb 19, 2024
@haasn
Copy link
Author

haasn commented Feb 19, 2024

I do not intend to ever support a 'capture everything' mode.

Is there a specific reason for this? Would you accept a PR adding this functionality?

Edit: Also, what about, for example, a simple vulkan layer that merely hooks vkCreateInstance / vkDestroyInstance and places the appropriate renderdoc API call around each? I will try and write something like this for my own use, so I don't have to continuously re-invent the wheel just to use renderdoc in various projects.

@baldurk
Copy link
Owner

baldurk commented Feb 19, 2024

It is not how RenderDoc is intended to function as it's a frame-capture based debugger that is built around capturing the a given subset of work. I don't want to take on the support burden or encourage that kind of workflow of capturing an unbounded amount of work. If someone wants to they can use the in-application API to start and stop captures at arbitrary points, but I suspect it is unlikely to scale unless their program is quite small.

I would not accept any PR that tries to add that functionality, no.

Writing a layer like that I suspect you will run into challenges with layer ordering, and I'm not sure exactly when it will be valid to call the in-application API as it is only intended to be called by applications outside of those functions and not part way through their evaluation. If you wanted to try then you could of course, but you'd be on your own to fix any problems you encounter. In my experience integrating the in-application API has not been an issue for projects before, e.g. the vulkan CTS has the exact kind of integration needed for what you're describing.

@dorian-apanel-intel
Copy link

@haasn
For small simple tests, you might want to try this change:

diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
index 9514d3aeb..b3cc40dbc 100644
--- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
+++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp
@@ -4490,6 +4490,12 @@ void WrappedVulkan::vkDestroyDevice(VkDevice device, const VkAllocationCallbacks
     m_MemoryFreeThread = 0;
   }
 
+  // Save capture if active
+  if(IsActiveCapturing(m_State))
+  {
+    RenderDoc::Inst().EndFrameCapture(DeviceOwnedWindow(LayerDisp(m_Instance), NULL));
+  }
+
   // flush out any pending commands/semaphores
   SubmitCmds();
   SubmitSemaphores();

And just start test from Renderdoc with queueCapture frame 0.
Assuming your test does not call vkQueuePresent and calls vkDestroyDevice it will write everything to a capture.

@baldurk
Copy link
Owner

baldurk commented Mar 14, 2024

Please do not comment on old issues that have been closed.

If you are encountering a bug or are requesting a feature please open a new issue. You can reference this issue if you wish, but opening a new issue prevents any confusion of accidentally linking two unrelated issues and means that each issue can be handled in a clean process.

Repository owner locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants