-
Notifications
You must be signed in to change notification settings - Fork 270
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
WIP: Vulkan sampling support #256
Conversation
… Vulkan 1.2 and/or a handful of extensions are available.
…nfuse some compilers that think the end scope objects are function declarations
…ed to clear g_Remotery only after calling _rmt_UnbindVulkan or _rmt_UnbindD3D12 since both functions access g_Remotery
…h a dataSize of 0
…32k bytes, or 4k queries
…ns a timestamp in the mach_continuous_time() time domain instead of mach_absolute_time(), which I think is a bug
Matthew, this looks amazing. I've just ended my day so will go through all this first thing tomorrow morning. Thank you! |
…formation w.r.t. MoltenVK/Vulkan. I'm close to convincing myself that I should drop querying the CPU timestamp entirely from Vulkan and just query it myself (like the Linux fallback does).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks great. Not really much to critique, though I did go through each commit and try to use my very limited Vulkan knowledge to ensure all was OK.
…etInstanceProcAddr, not vkGetDeviceProcAddr
…Means the user doesn't have to do this themselves
What's left to pull this out of Draft? |
I think it might be worth discussing the API of Edit: Somehow this whole time I missed that Remotery already has an answer to this problem for CUDA - declaring all the required function pointers as It's probably also worth discussing whether it's worth relaxing the current Vulkan version / extension requirements. If you're fine with the current limitations then it could probably be merged in its current form and future changes could be taken to support older Vulkan implementations. |
…tery.h and README
By static linking, I presume you mean platforms like iOS? This issue here seems to imply you can link statically and use Also, do you have to pass the
I think it's not worth worrying about. If anybody needs extra functionality and you personally do not need it right now, it's worth waiting until somebody adds a PR for it. |
Yeah there are a handful of edge cases related to statically linking Vulkan that I haven't tested, though my understanding is that dynamic linking is almost always preferable (or even required) on most platforms.
In theory no, but I was trying to avoid having to re-implement something like the dynamic loader in Volk (see volkInitialize). Further, I think it's possible the user may have a "special" loader function that is not the one retrieved directly from the dynamic library, but I don't know how common that is in practice. I think it's overall a lot easier and less error prone for Remotery to be passed all the function pointers, but it does make initialization more complex for the user. |
That's pretty much what we do with OpenGL. However, in the absence of a wide array of platforms to test this on, currently, I'm more than happy to accept a PR that requires you to pass Vulkan function pointers as part of That said: Volk is MIT licensed, so I would also have no issues if the function pointer loading code was copied over for just the functions we need. Reference would have to be given in the code, of course. Another Edit: And while I'm here, the code as it stands is perfect for a PR anyway. It catches your use-case well and you have done the heavy lifting of the entire Vulkan port. If it doesn't meet another user's needs, we'll get a PR and anybody can work on updating it. |
I think I'll submit changes to have the user pass the function pointers. I realized when I was doing some final cleanup that many (all?) Vulkan implementations might expose function pointers for extensions that aren't enabled (or not even supported) by the implementation, and there's no way to check for extension enable state. That might be fine if we just expect the user to have enabled the right extensions ahead of time, but unfortunately there's no way to tell whether they're using an extension or promoted feature, e.g. an EXT extension promoted to KHR or any extension promoted to core functionality in a later Vulkan version. |
…em. Fix and update documentation
1. Return RMT_ERROR_NONE instead of NULL from rmt_BindVulkan if Vulkan is not enabled 2. Explicitly cast function pointers to void* in README since this is potentially required by some compilers 3. Use rmtMakeError in rmt_BindVulkan to describe what parameter/function pointer is missing
The new fn registration looks good, we can make smoother API changes later if required, but I doubt we'll need it. The only build failures are typical Github spurious fails that have nothing to do with the code. This is some great work; thanks for pushing it through! |
NOTE: This pull request includes a handful of fixes that aren't strictly related to Vulkan sampling which I'll list below. They could be pulled out into a separate change if required.
Remotery_Destructor
: Move clearing ofg_Remotery
to after graphics API-specific deletion/unbind calls, avoiding crashes because of unchecked access to g_Remotery.RMT_ARCH_64BIT
: Check__arm64__
as well.rmt_GetLastErrorMessage
declaration: Enclose insideextern "C"
block for C++ users.rmt_ScopedD3D12Sample
: Remove extra parens in end-of-scope object declaration which confuse some compilers that think it's a function declaration (most vexing parse).Remotery.js
deserialization ofUint64
andSint64
properties:Remotery.c
already converts these tormtF64
prior to sending them over the socket.pthread_setname_np
andpthread_getname_np
.This is a first-pass implementation of Vulkan sampling support for Remotery based on the D3D12 implementation. It currently expects a handful of things about the user's Vulkan environment that are likely more restrictive than necessary but make the implementation much simpler.
hostQueryReset
andtimelineSemaphore
features enabled, or have enabled the extensionsVK_EXT_host_query_reset
andVK_KHR_timeline_semaphore
. These features/extensions are pretty widely supported so it seems maybe reasonable to require that users enable them; without them the implementation gets reasonably more complex and less performant.VK_EXT_calibrated_timestamps
. It'd probably be pretty easy to make usage of this extension optional.vkGetInstanceProcAddr
feels very hacky, definitely open to suggestions here.TODO(valakor)
's in the code for potential future improvement points.I'm open to discussion/feedback about this implementation!