Use new macros for serialising APIs with returns

Use DECLARE_FUNCTION_WITH_RETURN_SERIALISED & INSTANTIATE_FUNCTION_WITH_RETURN_SERIALISED for
MTLDevice::newDefaultLibrary
MTLDevice::newLibraryWithSource
This commit is contained in:
Jake Turner
2022-03-16 06:21:03 +00:00
committed by Baldur Karlsson
parent 0c8e41b201
commit b743580b79
2 changed files with 9 additions and 25 deletions
+6 -16
View File
@@ -140,7 +140,7 @@ WrappedMTLLibrary *WrappedMTLDevice::newDefaultLibrary()
template <typename SerialiserType>
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);
+3 -9
View File
@@ -38,16 +38,10 @@ public:
static WrappedMTLDevice *MTLCreateSystemDefaultDevice(MTL::Device *realMTLDevice);
DECLARE_FUNCTION_WITH_RETURN_SERIALISED(WrappedMTLCommandQueue *, newCommandQueue);
WrappedMTLLibrary *newDefaultLibrary();
template <typename SerialiserType>
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 <typename SerialiserType>
bool Serialise_newLibraryWithSource(SerialiserType &ser, WrappedMTLLibrary *library,
NS::String *source, MTL::CompileOptions *options);
CaptureState &GetStateRef() { return m_State; }
CaptureState GetState() { return m_State; }