From b743580b7911932b5693b09e885852e4bff0b5bd Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 16 Mar 2022 06:21:03 +0000 Subject: [PATCH] Use new macros for serialising APIs with returns Use DECLARE_FUNCTION_WITH_RETURN_SERIALISED & INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED for MTLDevice::newDefaultLibrary MTLDevice::newLibraryWithSource --- renderdoc/driver/metal/metal_device.cpp | 22 ++++++---------------- renderdoc/driver/metal/metal_device.h | 12 +++--------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/renderdoc/driver/metal/metal_device.cpp b/renderdoc/driver/metal/metal_device.cpp index 91c6e3b4f..dae1b0c1a 100644 --- a/renderdoc/driver/metal/metal_device.cpp +++ b/renderdoc/driver/metal/metal_device.cpp @@ -140,7 +140,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newDefaultLibrary() template bool WrappedMTLDevice::Serialise_newLibraryWithSource(SerialiserType &ser, WrappedMTLLibrary *library, NS::String *source, - MTL::CompileOptions *options) + MTL::CompileOptions *options, NS::Error **error) { SERIALISE_ELEMENT_LOCAL(Library, GetResID(library)).TypedAs("MTLLibrary"_lit); SERIALISE_ELEMENT(source); @@ -169,7 +169,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newLibraryWithSource(NS::String *source, { CACHE_THREAD_SERIALISER(); SCOPED_SERIALISE_CHUNK(MetalChunk::MTLDevice_newLibraryWithSource); - Serialise_newLibraryWithSource(ser, wrappedMTLLibrary, source, options); + Serialise_newLibraryWithSource(ser, wrappedMTLLibrary, source, options, error); chunk = scope.Get(); } MetalResourceRecord *record = GetResourceManager()->AddResourceRecord(wrappedMTLLibrary); @@ -186,17 +186,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newLibraryWithSource(NS::String *source, INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLDevice, WrappedMTLCommandQueue *, newCommandQueue); - -template bool WrappedMTLDevice::Serialise_newDefaultLibrary(ReadSerialiser &ser, - WrappedMTLLibrary *library); -template bool WrappedMTLDevice::Serialise_newDefaultLibrary(WriteSerialiser &ser, - WrappedMTLLibrary *library); - -template bool WrappedMTLDevice::Serialise_newLibraryWithSource(ReadSerialiser &ser, - WrappedMTLLibrary *library, - NS::String *source, - MTL::CompileOptions *options); -template bool WrappedMTLDevice::Serialise_newLibraryWithSource(WriteSerialiser &ser, - WrappedMTLLibrary *library, - NS::String *source, - MTL::CompileOptions *options); +INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLDevice, WrappedMTLLibrary *, newDefaultLibrary); +INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLDevice, WrappedMTLLibrary *, + newLibraryWithSource, NS::String *source, + MTL::CompileOptions *options, NS::Error **error); diff --git a/renderdoc/driver/metal/metal_device.h b/renderdoc/driver/metal/metal_device.h index 38897b1e8..49819f4f7 100644 --- a/renderdoc/driver/metal/metal_device.h +++ b/renderdoc/driver/metal/metal_device.h @@ -38,16 +38,10 @@ public: static WrappedMTLDevice *MTLCreateSystemDefaultDevice(MTL::Device *realMTLDevice); DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLCommandQueue *, newCommandQueue); - - WrappedMTLLibrary *newDefaultLibrary(); - template - bool Serialise_newDefaultLibrary(SerialiserType &ser, WrappedMTLLibrary *library); - - WrappedMTLLibrary *newLibraryWithSource(NS::String *source, MTL::CompileOptions *options, + DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLLibrary *, newDefaultLibrary); + DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLLibrary *, newLibraryWithSource, + NS::String *source, MTL::CompileOptions *options, NS::Error **error); - template - bool Serialise_newLibraryWithSource(SerialiserType &ser, WrappedMTLLibrary *library, - NS::String *source, MTL::CompileOptions *options); CaptureState &GetStateRef() { return m_State; } CaptureState GetState() { return m_State; }