mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Apple added drawableID to MetalDrawableInfo
If MTL:Drawable is not found by pointer, fallback and search for it by drawableID (which should be unique and monotonically increasing). This fixes a problem preventing frame capture when launching RenderDoc UI from Xcode with "GPU Frame Capture" enabled.
This commit is contained in:
committed by
Baldur Karlsson
parent
e6fb67c1e1
commit
e36062b989
@@ -1034,6 +1034,7 @@ void WrappedMTLDevice::RegisterDrawableInfo(CA::MetalDrawable *caMtlDrawable)
|
||||
MetalDrawableInfo drawableInfo;
|
||||
drawableInfo.mtlLayer = caMtlDrawable->layer();
|
||||
drawableInfo.texture = GetWrapped(caMtlDrawable->texture());
|
||||
drawableInfo.drawableID = caMtlDrawable->drawableID();
|
||||
SCOPED_LOCK(m_CaptureDrawablesLock);
|
||||
RDCASSERTEQUAL(m_CaptureDrawableInfos.find(caMtlDrawable), m_CaptureDrawableInfos.end());
|
||||
m_CaptureDrawableInfos[caMtlDrawable] = drawableInfo;
|
||||
@@ -1052,6 +1053,17 @@ MetalDrawableInfo WrappedMTLDevice::UnregisterDrawableInfo(MTL::Drawable *mtlDra
|
||||
return drawableInfo;
|
||||
}
|
||||
}
|
||||
// Not found by pointer fall back and check by drawableID
|
||||
NS::UInteger drawableID = mtlDrawable->drawableID();
|
||||
for(auto it = m_CaptureDrawableInfos.begin(); it != m_CaptureDrawableInfos.end(); ++it)
|
||||
{
|
||||
drawableInfo = it->second;
|
||||
if(drawableInfo.drawableID == drawableID)
|
||||
{
|
||||
m_CaptureDrawableInfos.erase(it);
|
||||
return drawableInfo;
|
||||
}
|
||||
}
|
||||
drawableInfo.mtlLayer = NULL;
|
||||
drawableInfo.texture = NULL;
|
||||
return drawableInfo;
|
||||
|
||||
@@ -35,6 +35,7 @@ struct MetalDrawableInfo
|
||||
{
|
||||
CA::MetalLayer *mtlLayer;
|
||||
WrappedMTLTexture *texture;
|
||||
NS::UInteger drawableID;
|
||||
};
|
||||
|
||||
class MetalCapturer : public IFrameCapturer
|
||||
|
||||
Reference in New Issue
Block a user