summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-26 05:07:00 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-26 05:07:00 +0000
commit03a44b881fb5a61aef30a180563bb872d20c03d9 (patch)
treeaf9d83bd6d9ddecc38f65d53d6c61d1b32cc1863 /Graphics/GraphicsEngine
parentFixed issue with RenderDeviceMtlImpl (diff)
downloadDiligentCore-03a44b881fb5a61aef30a180563bb872d20c03d9.tar.gz
DiligentCore-03a44b881fb5a61aef30a180563bb872d20c03d9.zip
Updated shader resource variable C interface; added test
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/interface/ShaderResourceVariable.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
index e7daa80d..6c682ab1 100644
--- a/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
+++ b/Graphics/GraphicsEngine/interface/ShaderResourceVariable.h
@@ -149,30 +149,41 @@ public:
struct IShaderResourceVariable;
// clang-format off
-struct IShaderResourceVariableVtbl
+struct IShaderResourceVariableMethods
{
- void (*Set)(class IDeviceObject* pObject);
- void (*SetArray)(class IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements);
- SHADER_RESOURCE_VARIABLE_TYPE(*GetType)();
- struct ShaderResourceDesc (*GetResourceDesc)();
- Uint32 (*GetIndex)();
- bool (*IsBound)(Uint32 ArrayIndex);
+ void (*Set) (struct IShaderResourceVariable*, class IDeviceObject* pObject);
+ void (*SetArray) (struct IShaderResourceVariable*, class IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements);
+ SHADER_RESOURCE_VARIABLE_TYPE (*GetType) (struct IShaderResourceVariable*);
+ struct ShaderResourceDesc (*GetResourceDesc)(struct IShaderResourceVariable*);
+ Uint32 (*GetIndex) (struct IShaderResourceVariable*);
+ bool (*IsBound) (struct IShaderResourceVariable*, Uint32 ArrayIndex);
};
// clang-format on
+struct IShaderResourceVariableVtbl
+{
+ struct IObjectMethods Object;
+ struct IShaderResourceVariableMethods ShaderResourceVariable;
+};
struct IShaderResourceVariable
{
- struct IObjectVtbl* pObjectVtbl;
- struct IShaderResourceVariable* pShaderResourceVariableVtbl;
+ struct IShaderResourceVariableVtbl* pVtbl;
};
-# define IShaderResourceVariable_Set(This, ...) (This)->pShaderResourceVariableVtbl->Set(This, __VA_ARGS__)
-# define IShaderResourceVariable_SetArray(This, ...) (This)->pShaderResourceVariableVtbl->SetArray(This, __VA_ARGS__)
-# define IShaderResourceVariable_GetType(This) (This)->pShaderResourceVariableVtbl->GetType(This)
-# define IShaderResourceVariable_GetResourceDesc(This) (This)->pShaderResourceVariableVtbl->GetResourceDesc(This)
-# define IShaderResourceVariable_GetIndex(This) (This)->pShaderResourceVariableVtbl->GetIndex(This)
-# define IShaderResourceVariable_IsBound(This, ...) (This)->pShaderResourceVariableVtbl->IsBound(This, __VA_ARGS__)
+// clang-format off
+
+# define IShaderResourceVariable_Set(This, ...) (This)->pVtbl->ShaderResourceVariable.Set ((struct IShaderResourceVariable*)(This), __VA_ARGS__)
+# define IShaderResourceVariable_SetArray(This, ...) (This)->pVtbl->ShaderResourceVariable.SetArray ((struct IShaderResourceVariable*)(This), __VA_ARGS__)
+# define IShaderResourceVariable_GetType(This) (This)->pVtbl->ShaderResourceVariable.GetType ((struct IShaderResourceVariable*)(This))
+
+// TODO: returning structure from a function produces different signatures in C and C++
+//# define IShaderResourceVariable_GetResourceDesc(This) (This)->pVtbl->ShaderResourceVariable.GetResourceDesc((struct IShaderResourceVariable*)(This))
+
+# define IShaderResourceVariable_GetIndex(This) (This)->pVtbl->ShaderResourceVariable.GetIndex ((struct IShaderResourceVariable*)(This))
+# define IShaderResourceVariable_IsBound(This, ...) (This)->pVtbl->ShaderResourceVariable.IsBound ((struct IShaderResourceVariable*)(This), __VA_ARGS__)
+
+// clang-format on
#endif