summaryrefslogtreecommitdiffstats
path: root/Primitives/interface
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-28 18:45:43 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-28 18:45:43 +0000
commit5e9b0dd7fb610e326739676aa0a0d9615a8e9c2d (patch)
tree76b4d1299cb573311918f0ac566a157e029e67bc /Primitives/interface
parentReworked IShaderD3D::GetHLSLResource method to be compatible wit C (diff)
downloadDiligentCore-5e9b0dd7fb610e326739676aa0a0d9615a8e9c2d.tar.gz
DiligentCore-5e9b0dd7fb610e326739676aa0a0d9615a8e9c2d.zip
Reworked C inteface method calls to use CALL_IFACE_METHOD macro
Diffstat (limited to 'Primitives/interface')
-rw-r--r--Primitives/interface/CommonDefinitions.h2
-rw-r--r--Primitives/interface/DataBlob.h6
-rw-r--r--Primitives/interface/FileStream.h10
-rw-r--r--Primitives/interface/MemoryAllocator.h4
-rw-r--r--Primitives/interface/Object.h6
5 files changed, 15 insertions, 13 deletions
diff --git a/Primitives/interface/CommonDefinitions.h b/Primitives/interface/CommonDefinitions.h
index 7c719267..bfd5102c 100644
--- a/Primitives/interface/CommonDefinitions.h
+++ b/Primitives/interface/CommonDefinitions.h
@@ -61,6 +61,8 @@
# define DEFAULT_VALUE(x)
+# define CALL_IFACE_METHOD(Iface, Method, This, ...) (This)->pVtbl->Iface.Method((I##Iface*)(This), ##__VA_ARGS__)
+
#else
# define DILIGENT_BEGIN_NAMESPACE(Name) \
diff --git a/Primitives/interface/DataBlob.h b/Primitives/interface/DataBlob.h
index 24d87544..52bcca10 100644
--- a/Primitives/interface/DataBlob.h
+++ b/Primitives/interface/DataBlob.h
@@ -80,9 +80,9 @@ typedef struct IDataBlob
// clang-format off
-# define IDataBlob_Resize(This, ...) (This)->pVtbl->DataBlob.Resize ((IDataBlob*)(This), __VA_ARGS__)
-# define IDataBlob_GetSize(This) (This)->pVtbl->DataBlob.GetSize ((IDataBlob*)(This))
-# define IDataBlob_GetDataPtr(This) (This)->pVtbl->DataBlob.GetDataPtr((IDataBlob*)(This))
+# define IDataBlob_Resize(This, ...) CALL_IFACE_METHOD(DataBlob, Resize, This, __VA_ARGS__)
+# define IDataBlob_GetSize(This) CALL_IFACE_METHOD(DataBlob, GetSize, This)
+# define IDataBlob_GetDataPtr(This) CALL_IFACE_METHOD(DataBlob, GetDataPtr, This)
// clang-format on
diff --git a/Primitives/interface/FileStream.h b/Primitives/interface/FileStream.h
index 1f3ccad3..4bef7123 100644
--- a/Primitives/interface/FileStream.h
+++ b/Primitives/interface/FileStream.h
@@ -88,11 +88,11 @@ typedef struct IFileStream
// clang-format off
-# define IFileStream_Read(This, ...) (This)->pVtbl->FileStream.Read ((IFileStream*)(This), __VA_ARGS__)
-# define IFileStream_ReadBlob(This, ...) (This)->pVtbl->FileStream.ReadBlob((IFileStream*)(This), __VA_ARGS__)
-# define IFileStream_Write(This, ...) (This)->pVtbl->FileStream.Write ((IFileStream*)(This), __VA_ARGS__)
-# define IFileStream_GetSize(This) (This)->pVtbl->FileStream.GetSize ((IFileStream*)(This))
-# define IFileStream_IsValid(This) (This)->pVtbl->FileStream.IsValid ((IFileStream*)(This))
+# define IFileStream_Read(This, ...) CALL_IFACE_METHOD(FileStream, Read, This, __VA_ARGS__)
+# define IFileStream_ReadBlob(This, ...) CALL_IFACE_METHOD(FileStream, ReadBlob, This, __VA_ARGS__)
+# define IFileStream_Write(This, ...) CALL_IFACE_METHOD(FileStream, Write, This, __VA_ARGS__)
+# define IFileStream_GetSize(This) CALL_IFACE_METHOD(FileStream, GetSize, This)
+# define IFileStream_IsValid(This) CALL_IFACE_METHOD(FileStream, IsValid, This)
// clang-format on
diff --git a/Primitives/interface/MemoryAllocator.h b/Primitives/interface/MemoryAllocator.h
index 5fdf3b32..ebd7d907 100644
--- a/Primitives/interface/MemoryAllocator.h
+++ b/Primitives/interface/MemoryAllocator.h
@@ -73,8 +73,8 @@ typedef struct IMemoryAllocator
// clang-format off
-# define IMemoryAllocator_Allocate(This, ...) (This)->pVtbl->MemoryAllocator.Allocate((IMemoryAllocator*)(This), __VA_ARGS__)
-# define IMemoryAllocator_Free(This, ...) (This)->pVtbl->MemoryAllocator.Free ((IMemoryAllocator*)(This), __VA_ARGS__)
+# define IMemoryAllocator_Allocate(This, ...) CALL_IFACE_METHOD(MemoryAllocator, Allocate, This, __VA_ARGS__)
+# define IMemoryAllocator_Free(This, ...) CALL_IFACE_METHOD(MemoryAllocator, Free, This, __VA_ARGS__)
#endif
diff --git a/Primitives/interface/Object.h b/Primitives/interface/Object.h
index d328eb64..66b68d02 100644
--- a/Primitives/interface/Object.h
+++ b/Primitives/interface/Object.h
@@ -107,9 +107,9 @@ typedef struct IObject
// clang-format off
-# define IObject_QueryInterface(This, ...) (This)->pVtbl->Object.QueryInterface((struct IObject*)(This), __VA_ARGS__)
-# define IObject_AddRef(This) (This)->pVtbl->Object.AddRef ((struct IObject*)(This))
-# define IObject_Release(This) (This)->pVtbl->Object.Release ((struct IObject*)(This))
+# define IObject_QueryInterface(This, ...) CALL_IFACE_METHOD(Object, QueryInterface, This, __VA_ARGS__)
+# define IObject_AddRef(This) CALL_IFACE_METHOD(Object, AddRef, This)
+# define IObject_Release(This) CALL_IFACE_METHOD(Object, Release, This)
// clang-format on