Commit Graph

22 Commits

Author SHA1 Message Date
baldurk 9f4f0e6aa1 Update copyright years to 2024 2024-02-12 11:04:52 +00:00
baldurk d47e79ae07 Update copyright years to 2023 2023-02-01 12:23:32 +00:00
Jake Turner 2d6290bab1 Basic Metal capture support
Captures can be manually triggered from renderdoccmd capture <application> using F12 or from the UI on the in-development Metal replay branch.
The captures can be loaded and replayed on the in-development Metal replay branch.

The command buffer tracking and serialization are done by GPU submission order which is not necessarily the same as CPU commit order. The command buffer tracking for GPU submission order is currently using an rdcarray, this might change in the future to use a linked list if the performance of appending and deleting from the rdcarray becomes a performance bottleneck.

Does not include support for the presented MTLDrawable ie.
* Thumbnail generation of the final presented image.
* Serializing the presented texture ID.

Does not include support for initial state data.
No MTLBuffer data contents are serialized.

There is a lot missing and a lot of TODOs. 
This is the basic structure for capturing which is then built upon. 

Includes:
* register the Metal device as a frame capturer ie. AddDeviceFrameCapturer
* logic for triggering captures at Present ie. AddActiveDriver, StartFrameCapture, EndFrameCapture.
* Stopped declaring MetalResourceManager as a friend of WrappedMTLDevice which meant making the initial state-related APIs public instead of private.
* IFrameCapturer interface APIs
* Command buffer tracking for including in the output capture CaptureCmdBufCommit and CaptureCmdBufEnqueue.
* Serialise_MTLCreateSystemDefaultDevice(SerialiserType &ser)
* A helper class MetalCapturer which is derived from IFrameCapturer and registered with the RenderDoc instance. This is because Wrapped Metal classes can't have virtual tables as a requirement for how the C++ and Objective C overlay is implemented.
* The frame capture chunk and API AddFrameCaptureRecordChunk
* MetalInitParams data and serialization.

Helper Methods and Members in MTLDevice
* WaitForGPU()
* MTL::CommandQueue *m_mtlCommandQueue which is used to implement WaitForGPU()
* CaptureClearSubmittedCmdBuffers() & CaptureCmdBufSubmit()
* RegisterMetalLayer() & UnregisterMetalLayer() used to track active Metal swapchains

Details on the memory lifetime for WrappedMTLCommandBuffer

retain the real resource in WrappedMTLCommandBuffer::commit()
release the real resource when no longer needed to be tracked: for background capture in during WrappedMTLDevice::CaptureCmdBufSubmit, for active capture in WrappedMTLDevice::EndFrameCapture.

During capture (Background or Active)
* AddRef() record when command buffer is enqueued (explicit or implicit)
* Delete() record at end of command buffer submit

During Active capture
* AddRef() record in command buffer submit
* Delete() submitted command buffers as part of finalizing the capture

Added TrackedCAMetalLayer & ObjCTrackedCAMetalLayer to track the lifetime of CA::MetalLayer.
The CA::MetalLayer is tracked in the hook for CAMetalLayer::nextDrawable(), with ObjCTrackedCAMetalLayer set as an association to the CAMetalLayer. Then ObjCTrackedCAMetalLayer::dealloc() triggers ending the tracking.
2022-07-18 12:41:44 +01:00
baldurk fcdea67879 Update copyright years to 2022 2022-02-17 17:38:32 +00:00
Jake Turner f3b6e38db4 Apple implementation of DisplayRendererPreview 2021-04-07 11:54:46 +01:00
baldurk 026da176bb Update copyright years to 2021 2021-01-13 13:56:10 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk e6627542cf Don't enumerate available GPUs when running in renderdoccmd 2019-11-26 17:38:25 +00:00
baldurk a965a3a703 Remove 'using std::string'
* This will make it easier to replace std::string with rdcstr in future
2019-05-17 16:32:56 +01:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk 1c05c5e5d1 Add option to renderdoccmd replay to specify a loop count 2018-10-02 16:23:40 +01:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk 96e39cb781 Add a preview window ability to remote servers. Always on for android
* On android in particular this shows some sense of what's happening on
  the device and gives user feedback that it's not completely dead.
2018-01-01 17:31:23 +00:00
baldurk 3ab7510c7f Avoid calling XOpenDisplay multiple times, fixes crashes on Intel Mesa
* See https://bugs.freedesktop.org/show_bug.cgi?id=99831
  https://bugs.freedesktop.org/show_bug.cgi?id=54971
* It's not clear if it's invalid to call XOpenDisplay more than once but
  at the very least it's only really used as convenience to avoid
  plumbing the display handle through.
2017-05-30 12:02:00 +01:00
baldurk 6930841705 Rename ReplayRenderer to ReplayController
* It's not a renderer, it's an interface to controlling the replay and
  any 'renderer' type work actually happens in ReplayOutput.
2017-04-18 14:57:47 +01:00
baldurk 487a1b7903 Start moving towards C++ only UI code. Assume C++ for the replay API
* The C# P/Invoke stuff doesn't directly use the header, and we are soon
  going to deprecate the C interface entirely.
2017-03-13 17:56:00 +00:00
baldurk 030cbfde9a Batch update copyright years everywhere 2017-01-06 12:13:31 +00:00
baldurk f8b3fd3e1e Update renderdoccmd for new remote server code, add daemonise for server 2016-08-19 17:26:08 +02:00
baldurk 99c0177cd9 Remove unused GetUsername() function 2016-07-12 19:39:41 +02:00
baldurk ced8a62af6 Add replay command (with optional remote replay) 2016-07-12 17:39:23 +02:00
baldurk eb9a545104 Move common functions declarations into header 2016-07-12 17:10:42 +02:00
baldurk c1f66de413 Add early OS X compiling support from @Zorro666 - still non-functional!
* Build with cmake -DENABLE_VULKAN=OFF -DENABLE_QRENDERDOC=OFF
2016-05-31 12:05:45 +02:00