Zorro666 / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org/builds
MIT License
3 stars 1 forks source link

WIP: Pre-requisites to support basic Metal capture #76

Closed Zorro666 closed 2 years ago

Zorro666 commented 2 years ago

Description

Hooking and capture serialization for MTLCommandBuffer APIs enqueue and waitUntilCompleted (required to capture test programs with enqueue support). These chunks are added to the command buffer record in order that the chunks are only included in the capture when the command buffer is included. The replay support for these APIs treats them at the global scope and not replayed within the command buffer. The enqueue chunk might not be required or used by replay in the future (currently it is used to verify the order of command buffer reply matches what is expected).

Updated the MetalCmdBufferRecordingInfo struct to store the CA::MetalLayer & WrappedMTLTexture from the MTL::Drawable instead of the MTL::Drawable. This avoids validation asserts about accessing the texture of an MTL::Drawable after calling MTLCommandBuffer::presentDrawable.

Changed member data bool present to uint32_t flags to be able to efficiently store more than one flag. Added MetalCmdBufferStatus enum to store different status flags.

Changed the return of WrappedMTLCommandBuffer::GetCommandQueueReturn to be a WrappedMTLCommandQueue * instead of MTL::CommandQueue *. It makes sense and is more natural to return the m_CommandQueue without casting it. The previous API usage was for the Objective C bridge layer which worked with `MTL::CommandQueue *. This is not required now the Objective C and C++ wrapping/unwrapping has been simplified.

This PR represents the final Objective C change in the current Metal development branch 🥳

Zorro666 commented 2 years ago

https://github.com/baldurk/renderdoc/pull/2635