ALooper_pollAll was obsoleted since NDK 27 and resulted in
renderdoccmd_android.cpp:526:8: error: 'ALooper_pollAll' is
unavailable: obsoleted in Android 1 - ALooper_pollAll may ignore
wakes. Use ALooper_pollOnce instead. See The API documentation for
more information
Since we poll from within a loop, we can replace it by ALooper_pollOnce
directly. But to be on the safe side, do this only on NDK 27+.
Java 7 support was dropped since JDK 20. We should be able to target
Java 8 without compatibility concerns because we run the bytecode
through dex which desugars (or fails at build time which does not
happen). But to be on the safe side, print a warning.
* In a previous update in 2021 many copyright ranges were truncated
accidentally, and some files have been copy-pasted with wrong years. These
dates have been fixed based on git history and original copyright messages.
The renderdoccmd android build assumes all files in '${ANDROID_SDK_ROOT_PATH}/platforms' are valid 'android-<version>.jar' platform libraries. Unfortunately because MacOS litters its directories with metadata files called .DS_Store, that file actually wins this sorting logic and is incorrectly selected.
This fixes the lib search logic to only consider android libraries.
* We add a capture option that defines a soft limit we aim to keep under for
memory overhead during capture, excess initial states after that will be
stored temporarily on disk.
3rdParty source files and some renderdoc files which include 3rdparty header files
Disable "-Wshadow" for the whole of qrenderdoc render_python.cxx triggers the warning
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.
* Most of the main entry points that can fail with relevant reasons now has a
way of specifying a message to return with it. This message can be displayed
to the user to give more information or context about an error.
* When a port is specified (with the usual :12345 suffix on the hostname) we use
that for remote replay connections. We disable target control enumeration
since that requires a port _range_ and captured applications self-assign those
ports. Those can still be accessed via a normal unsuffixed remote specifier -
even if there is no remote server running on the default port.
* There's not a good accepted terminology for this kind of event, and for
historical reasons 'drawcall' has been the accepted term, even though
that can be quite confusing when a dispatch or a copy is a 'drawcall'.
* This is particularly highlighted by the event browser filters where
$draw() includes draws and dispatches, but $dispatch() only includes
dispatches, it's hard to intuitively understand why $draw() matches all
of these calls.
* As a result we've defined the term 'action' to cover these types of
events in the same way that we defined 'event' in the first place to
mean a single atomic API call.
This commit adds x86/x86_64 support for RenderdocCmd APKs for Android.
This is needed mostly to support Chromebook devices. Many of them are
based on x86_64 CPUs.
* cmake's built in platforms/Android.cmake for some reason sets
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to OFF which prevents any subsequent
find_program or find_package from locating any executables in the system PATH.
This can break finding java among other things.
* This prevents unnecessary conversions back and forth between rdcstr and const
char * when going through interfaces. In the OS specific layer this is rarely
an issue because most of the implementations don't convert to rdcstr, but it
is convenient to be able to pass in an rdcstr directly. The few cases where
there's an unecessary construction of an rdcstr is acceptable.
* A couple of places in the public API need to return a string from a global
function, so can't return an rdcstr due to C ABI, so they still return a const
char *.
* Similarly const char * is kept for logging, to avoid a dependency on rdcstr
and because that's one place where unnecessary conversions/constructions may
be impactful.