@@ -66,7 +66,7 @@ WrappedMTLDevice::WrappedMTLDevice(MTL::Device *realMTLDevice, ResourceId objId)
6666 }
6767
6868 RDCASSERT (m_Device == this );
69- GetResourceManager ()->AddCurrentResource (objId, this );
69+ GetResourceManager ()->AddResource (objId, this );
7070
7171 if (IsCaptureMode (m_State))
7272 {
@@ -184,8 +184,7 @@ bool WrappedMTLDevice::Serialise_newCommandQueue(SerialiserType &ser, WrappedMTL
184184 {
185185 MTL::CommandQueue *realMTLCommandQueue = Unwrap (this )->newCommandQueue ();
186186 WrappedMTLCommandQueue *wrappedMTLCommandQueue;
187- GetResourceManager ()->WrapResource (realMTLCommandQueue, wrappedMTLCommandQueue);
188- GetResourceManager ()->AddLiveResource (CommandQueue, wrappedMTLCommandQueue);
187+ GetResourceManager ()->WrapResource (CommandQueue, realMTLCommandQueue, wrappedMTLCommandQueue);
189188
190189 AddResource (CommandQueue, ResourceType::Queue, " Queue" );
191190 DerivedResource (this , CommandQueue);
@@ -198,7 +197,8 @@ WrappedMTLCommandQueue *WrappedMTLDevice::newCommandQueue()
198197 MTL::CommandQueue *realMTLCommandQueue;
199198 SERIALISE_TIME_CALL (realMTLCommandQueue = Unwrap (this )->newCommandQueue ());
200199 WrappedMTLCommandQueue *wrappedMTLCommandQueue;
201- ResourceId id = GetResourceManager ()->WrapResource (realMTLCommandQueue, wrappedMTLCommandQueue);
200+ ResourceId id =
201+ GetResourceManager ()->WrapResource (ResourceId (), realMTLCommandQueue, wrappedMTLCommandQueue);
202202 if (IsCaptureMode (m_State))
203203 {
204204 Chunk *chunk = NULL ;
@@ -256,8 +256,7 @@ bool WrappedMTLDevice::Serialise_newDefaultLibrary(SerialiserType &ser, WrappedM
256256 dispatch_release (dispatchData);
257257
258258 WrappedMTLLibrary *wrappedMTLLibrary;
259- GetResourceManager ()->WrapResource (realMTLLibrary, wrappedMTLLibrary);
260- GetResourceManager ()->AddLiveResource (Library, wrappedMTLLibrary);
259+ GetResourceManager ()->WrapResource (Library, realMTLLibrary, wrappedMTLLibrary);
261260 AddResource (Library, ResourceType::Pool, " Library" );
262261 DerivedResource (this , Library);
263262 }
@@ -270,7 +269,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newDefaultLibrary()
270269
271270 SERIALISE_TIME_CALL (realMTLLibrary = Unwrap (this )->newDefaultLibrary ());
272271 WrappedMTLLibrary *wrappedMTLLibrary;
273- ResourceId id = GetResourceManager ()->WrapResource (realMTLLibrary, wrappedMTLLibrary);
272+ ResourceId id = GetResourceManager ()->WrapResource (ResourceId (), realMTLLibrary, wrappedMTLLibrary);
274273 if (IsCaptureMode (m_State))
275274 {
276275 Chunk *chunk = NULL ;
@@ -309,8 +308,7 @@ bool WrappedMTLDevice::Serialise_newLibraryWithSource(SerialiserType &ser,
309308 NS::Error *compileErrors = NULL ;
310309 MTL::Library *realMTLLibrary = Unwrap (this )->newLibrary (source, options, &compileErrors);
311310 WrappedMTLLibrary *wrappedMTLLibrary;
312- GetResourceManager ()->WrapResource (realMTLLibrary, wrappedMTLLibrary);
313- GetResourceManager ()->AddLiveResource (Library, wrappedMTLLibrary);
311+ GetResourceManager ()->WrapResource (Library, realMTLLibrary, wrappedMTLLibrary);
314312 AddResource (Library, ResourceType::Pool, " Library" );
315313 DerivedResource (this , Library);
316314 }
@@ -324,7 +322,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newLibraryWithSource(NS::String *source,
324322 MTL::Library *realMTLLibrary;
325323 SERIALISE_TIME_CALL (realMTLLibrary = Unwrap (this )->newLibrary (source, options, error));
326324 WrappedMTLLibrary *wrappedMTLLibrary;
327- ResourceId id = GetResourceManager ()->WrapResource (realMTLLibrary, wrappedMTLLibrary);
325+ ResourceId id = GetResourceManager ()->WrapResource (ResourceId (), realMTLLibrary, wrappedMTLLibrary);
328326 if (IsCaptureMode (m_State))
329327 {
330328 Chunk *chunk = NULL ;
@@ -377,8 +375,7 @@ bool WrappedMTLDevice::Serialise_newBufferWithBytes(SerialiserType &ser, Wrapped
377375 realMTLBuffer = Unwrap (this )->newBuffer (initialData.data (), initialData.size (), options);
378376 }
379377 WrappedMTLBuffer *wrappedMTLBuffer;
380- GetResourceManager ()->WrapResource (realMTLBuffer, wrappedMTLBuffer);
381- GetResourceManager ()->AddLiveResource (Buffer, wrappedMTLBuffer);
378+ GetResourceManager ()->WrapResource (Buffer, realMTLBuffer, wrappedMTLBuffer);
382379
383380 AddResource (Buffer, ResourceType::Buffer, " Buffer" );
384381 DerivedResource (this , Buffer);
@@ -419,9 +416,8 @@ bool WrappedMTLDevice::Serialise_newRenderPipelineStateWithDescriptor(
419416 Unwrap (this )->newRenderPipelineState (mtlDescriptor, error);
420417 mtlDescriptor->release ();
421418 WrappedMTLRenderPipelineState *wrappedMTLRenderPipelineState;
422- liveID = GetResourceManager ()->WrapResource (realMTLRenderPipelineState,
419+ liveID = GetResourceManager ()->WrapResource (RenderPipelineState, realMTLRenderPipelineState,
423420 wrappedMTLRenderPipelineState);
424- GetResourceManager ()->AddLiveResource (RenderPipelineState, wrappedMTLRenderPipelineState);
425421 AddResource (RenderPipelineState, ResourceType::PipelineState, " Pipeline State" );
426422 DerivedResource (this , RenderPipelineState);
427423 }
@@ -438,8 +434,8 @@ WrappedMTLRenderPipelineState *WrappedMTLDevice::newRenderPipelineStateWithDescr
438434 realDescriptor->release ();
439435
440436 WrappedMTLRenderPipelineState *wrappedMTLRenderPipelineState;
441- ResourceId id =
442- GetResourceManager ()-> WrapResource (realMTLRenderPipelineState, wrappedMTLRenderPipelineState);
437+ ResourceId id = GetResourceManager ()-> WrapResource ( ResourceId (), realMTLRenderPipelineState,
438+ wrappedMTLRenderPipelineState);
443439 if (IsCaptureMode (m_State))
444440 {
445441 Chunk *chunk = NULL ;
@@ -492,8 +488,8 @@ bool WrappedMTLDevice::Serialise_newTextureWithDescriptor(SerialiserType &ser,
492488 MTL::Texture *realMTLTexture = Unwrap (this )->newTexture (mtlDescriptor);
493489 mtlDescriptor->release ();
494490 WrappedMTLTexture *wrappedMTLTexture;
495- ResourceId liveID = GetResourceManager ()-> WrapResource (realMTLTexture, wrappedMTLTexture);
496- GetResourceManager ()->AddLiveResource (Texture, wrappedMTLTexture);
491+ ResourceId liveID =
492+ GetResourceManager ()->WrapResource (Texture, realMTLTexture , wrappedMTLTexture);
497493
498494 AddResource (Texture, ResourceType::Texture, " Texture" );
499495 DerivedResource (this , Texture);
@@ -676,7 +672,7 @@ WrappedMTLTexture *WrappedMTLDevice::Common_NewTexture(RDMTL::TextureDescriptor
676672 realDescriptor, iosurface, plane));
677673 realDescriptor->release ();
678674 WrappedMTLTexture *wrappedMTLTexture;
679- ResourceId id = GetResourceManager ()->WrapResource (realMTLTexture, wrappedMTLTexture);
675+ ResourceId id = GetResourceManager ()->WrapResource (ResourceId (), realMTLTexture, wrappedMTLTexture);
680676 if (IsCaptureMode (m_State))
681677 {
682678 RDMTL::TextureDescriptor rdDescriptor (descriptor);
@@ -712,7 +708,7 @@ WrappedMTLBuffer *WrappedMTLDevice::Common_NewBuffer(bool withBytes, const void
712708 : Unwrap (this )->newBuffer (length, options));
713709
714710 WrappedMTLBuffer *wrappedMTLBuffer;
715- ResourceId id = GetResourceManager ()->WrapResource (realMTLBuffer, wrappedMTLBuffer);
711+ ResourceId id = GetResourceManager ()->WrapResource (ResourceId (), realMTLBuffer, wrappedMTLBuffer);
716712 if (IsCaptureMode (m_State))
717713 {
718714 Chunk *chunk = NULL ;
0 commit comments