summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-26 19:25:35 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-26 19:25:35 +0000
commite6b4b11fdfc356134ee532ff4c54aec80533e822 (patch)
tree2a8ebe238417743c8a832947912408be375e4ea7 /Graphics/GraphicsEngine
parentFixed resource mapping c interface; added API test. (diff)
downloadDiligentCore-e6b4b11fdfc356134ee532ff4c54aec80533e822.tar.gz
DiligentCore-e6b4b11fdfc356134ee532ff4c54aec80533e822.zip
Fixed Render device, query, PSO and fence C interfaces; added render device C interface test.
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/interface/Fence.h29
-rw-r--r--Graphics/GraphicsEngine/interface/PipelineState.h42
-rw-r--r--Graphics/GraphicsEngine/interface/Query.h29
-rw-r--r--Graphics/GraphicsEngine/interface/RenderDevice.h83
4 files changed, 118 insertions, 65 deletions
diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h
index bb08045e..a9f9eab8 100644
--- a/Graphics/GraphicsEngine/interface/Fence.h
+++ b/Graphics/GraphicsEngine/interface/Fence.h
@@ -74,23 +74,36 @@ public:
struct IFence;
+// clang-format off
+
+struct IFenceMethods
+{
+ Uint64 (*GetCompletedValue)(struct IFence*);
+ void (*Reset) (struct IFence*, Uint64 Value);
+};
+
+// clang-format on
+
struct IFenceVtbl
{
- Uint64 (*GetCompletedValue)();
- void (*Reset)(Uint64 Value);
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IFenceMethods Fence;
};
struct IFence
{
- struct IObjectVtbl* pObjectVtbl;
- struct IDeviceObjectVtbl* pDeviceObjectVtbl;
- struct IFenceVtbl* pFenceVtbl;
+ struct IFenceVtbl* pVtbl;
};
-# define IFence_GetDesc(This) (const struct FenceDesc*)(This)->pDeviceObjectVtbl->GetDesc(This)
+// clang-format off
+
+# define IFence_GetDesc(This) (const struct FenceDesc*)IDeviceObject_GetDesc(This)
-# define IFence_GetCompletedValue(This) (This)->pFenceVtbl->GetCompletedValue(This)
-# define IFence_Reset(This, ...) (This)->pFenceVtbl->Reset(This, __VA_ARGS__)
+# define IFence_GetCompletedValue(This) (This)->pVtbl->Fence.GetCompletedValue((struct IFenceVtbl*)(This))
+# define IFence_Reset(This, ...) (This)->pVtbl->Fence.Reset ((struct IFenceVtbl*)(This), __VA_ARGS__)
+
+// clang-format on
#endif
diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h
index dee9e9e7..94599b3b 100644
--- a/Graphics/GraphicsEngine/interface/PipelineState.h
+++ b/Graphics/GraphicsEngine/interface/PipelineState.h
@@ -329,34 +329,42 @@ public:
struct IPipelineState;
-struct IPipelineStateVtbl
+struct IPipelineStateMethods
{
- void (*BindStaticResources)(Uint32 ShaderFlags, class IResourceMapping* pResourceMapping, Uint32 Flags);
- Uint32 (*GetStaticVariableCount)(SHADER_TYPE ShaderType);
- class IShaderResourceVariable* (*GetStaticVariableByName)(SHADER_TYPE ShaderType, const Char* Name);
- class IShaderResourceVariable* (*GetStaticVariableByIndex)(SHADER_TYPE ShaderType, Uint32 Index);
- void (*CreateShaderResourceBinding)(class IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources);
- bool (*IsCompatibleWith)(const class IPipelineState* pPSO);
+ void (*BindStaticResources) (struct IPipelineState*, Uint32 ShaderFlags, class IResourceMapping* pResourceMapping, Uint32 Flags);
+ Uint32 (*GetStaticVariableCount) (struct IPipelineState*, SHADER_TYPE ShaderType);
+ class IShaderResourceVariable* (*GetStaticVariableByName) (struct IPipelineState*, SHADER_TYPE ShaderType, const Char* Name);
+ class IShaderResourceVariable* (*GetStaticVariableByIndex) (struct IPipelineState*, SHADER_TYPE ShaderType, Uint32 Index);
+ void (*CreateShaderResourceBinding)(struct IPipelineState*, class IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources);
+ bool (*IsCompatibleWith) (struct IPipelineState*, const class IPipelineState* pPSO);
};
// clang-format on
+struct IPipelineStateVtbl
+{
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IPipelineStateMethods PipelineState;
+};
+
struct IPipelineState
{
- struct IObjectVtbl* pObjectVtbl;
- struct IDeviceObjectVtbl* pDeviceObjectVtbl;
- struct IPipelineState* pPipelineStateVtbl;
+ struct IPipelineStateVtbl* pVtbl;
};
-# define IPipelineState_GetDesc(This) (const struct PipelineStateDesc*)(This)->pDeviceObjectVtbl->GetDesc(This)
+// clang-format off
+
+# define IPipelineState_GetDesc(This) (const struct PipelineStateDesc*)IDeviceObject_GetDesc(This)
-# define IPipelineState_BindStaticResources(This, ...) (This)->pPipelineStateVtbl->BindStaticResources(This, __VA_ARGS__)
-# define IPipelineState_GetStaticVariableCount(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableCount(This, __VA_ARGS__)
-# define IPipelineState_GetStaticVariableByName(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByName(This, __VA_ARGS__)
-# define IPipelineState_GetStaticVariableByIndex(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByIndex(This, __VA_ARGS__)
-# define IPipelineState_CreateShaderResourceBinding(This, ...) (This)->pPipelineStateVtbl->CreateShaderResourceBinding(This, __VA_ARGS__)
-# define IPipelineState_IsCompatibleWith(This, ...) (This)->pPipelineStateVtbl->IsCompatibleWith(This, __VA_ARGS__)
+# define IPipelineState_BindStaticResources(This, ...) (This)->pPipelineStateVtbl->BindStaticResources ((struct IPipelineState*)(This), __VA_ARGS__)
+# define IPipelineState_GetStaticVariableCount(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableCount ((struct IPipelineState*)(This), __VA_ARGS__)
+# define IPipelineState_GetStaticVariableByName(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByName ((struct IPipelineState*)(This), __VA_ARGS__)
+# define IPipelineState_GetStaticVariableByIndex(This, ...) (This)->pPipelineStateVtbl->GetStaticVariableByIndex ((struct IPipelineState*)(This), __VA_ARGS__)
+# define IPipelineState_CreateShaderResourceBinding(This, ...) (This)->pPipelineStateVtbl->CreateShaderResourceBinding((struct IPipelineState*)(This), __VA_ARGS__)
+# define IPipelineState_IsCompatibleWith(This, ...) (This)->pPipelineStateVtbl->IsCompatibleWith ((struct IPipelineState*)(This), __VA_ARGS__)
+// clang-format on
#endif
diff --git a/Graphics/GraphicsEngine/interface/Query.h b/Graphics/GraphicsEngine/interface/Query.h
index b44b6142..b87b109d 100644
--- a/Graphics/GraphicsEngine/interface/Query.h
+++ b/Graphics/GraphicsEngine/interface/Query.h
@@ -211,23 +211,36 @@ public:
struct IQuery;
+// clang-format off
+
+struct IQueryMethods
+{
+ bool (*GetData) (struct IQuery*, void* pData, Uint32 DataSize, bool AutoInvalidate);
+ void (*Invalidate)(struct IQuery*);
+};
+
+// clang-format on
+
struct IQueryVtbl
{
- bool (*GetData)(void* pData, Uint32 DataSize, bool AutoInvalidate);
- void (*Invalidate)();
+ struct IObjectMethods Object;
+ struct IDeviceObjectMethods DeviceObject;
+ struct IQueryMethods Query;
};
struct IQuery
{
- struct IObjectVtbl* pObjectVtbl;
- struct IDeviceObjectVtbl* pDeviceObjectVtbl;
- struct IQuery* pQueryVtbl;
+ struct IQueryVtbl* pVtbl;
};
-# define IQuery_GetDesc(This) (const struct QueryDesc*)(This)->pDeviceObjectVtbl->GetDesc(This)
+// clang-format off
+
+# define IQuery_GetDesc(This) (const struct QueryDesc*)IDeviceObject_GetDesc(This)
-# define IQuery_GetData(This, ...) (This)->pQueryVtbl->GetData(This, __VA_ARGS__)
-# define IQuery_Invalidate(This) (This)->pQueryVtbl->Invalidate(This)
+# define IQuery_GetData(This, ...) (This)->pVtbl->Query.GetData ((struct IQuery*)(This), __VA_ARGS__)
+# define IQuery_Invalidate(This) (This)->pVtbl->Query.Invalidate((struct IQuery*)(This))
+
+// clang-format on
#endif
diff --git a/Graphics/GraphicsEngine/interface/RenderDevice.h b/Graphics/GraphicsEngine/interface/RenderDevice.h
index 97256d08..82414dc5 100644
--- a/Graphics/GraphicsEngine/interface/RenderDevice.h
+++ b/Graphics/GraphicsEngine/interface/RenderDevice.h
@@ -227,55 +227,74 @@ public:
struct IRenderDevice;
-struct IRenderDeviceVtbl
+struct IRenderDeviceMethods
{
- void (*CreateBuffer)(const struct BufferDesc* BuffDesc,
+ void (*CreateBuffer)(struct IRenderDevice*,
+ const struct BufferDesc* BuffDesc,
const struct BufferData* pBuffData,
class IBuffer** ppBuffer);
- void (*CreateShader)(const struct ShaderCreateInfo* ShaderCI,
+ void (*CreateShader)(struct IRenderDevice*,
+ const struct ShaderCreateInfo* ShaderCI,
class IShader** ppShader);
- void (*CreateTexture)(const struct TextureDesc* TexDesc,
+ void (*CreateTexture)(struct IRenderDevice*,
+ const struct TextureDesc* TexDesc,
const struct TextureData* pData,
class ITexture** ppTexture);
- void (*CreateSampler)(const struct SamplerDesc* SamDesc,
+ void (*CreateSampler)(struct IRenderDevice*,
+ const struct SamplerDesc* SamDesc,
class ISampler** ppSampler);
- void (*CreateResourceMapping)(const struct ResourceMappingDesc* MappingDesc,
+ void (*CreateResourceMapping)(struct IRenderDevice*,
+ const struct ResourceMappingDesc* MappingDesc,
class IResourceMapping** ppMapping);
- void (*CreatePipelineState)(const struct PipelineStateDesc* PipelineDesc,
+ void (*CreatePipelineState)(struct IRenderDevice*,
+ const struct PipelineStateDesc* PipelineDesc,
class IPipelineState** ppPipelineState);
- void (*CreateFence)(const struct FenceDesc* Desc,
+ void (*CreateFence)(struct IRenderDevice*,
+ const struct FenceDesc* Desc,
class IFence** ppFence);
- void (*CreateQuery)(const struct QueryDesc* Desc,
+ void (*CreateQuery)(struct IRenderDevice*,
+ const struct QueryDesc* Desc,
class IQuery** ppQuery);
- const struct DeviceCaps* (*GetDeviceCaps)();
- const struct TextureFormatInfo* (*GetTextureFormatInfo)(TEXTURE_FORMAT TexFormat);
- const struct TextureFormatInfoExt* (*GetTextureFormatInfoExt)(TEXTURE_FORMAT TexFormat);
- void (*ReleaseStaleResources)(bool ForceRelease);
- void (*IdleGPU)();
- class IEngineFactory* (*GetEngineFactory)();
+ const struct DeviceCaps* (*GetDeviceCaps)(struct IRenderDevice*);
+ const struct TextureFormatInfo* (*GetTextureFormatInfo)(struct IRenderDevice*,
+ TEXTURE_FORMAT TexFormat);
+ const struct TextureFormatInfoExt* (*GetTextureFormatInfoExt)(struct IRenderDevice*,
+ TEXTURE_FORMAT TexFormat);
+ void (*ReleaseStaleResources)(struct IRenderDevice*,
+ bool ForceRelease);
+ void (*IdleGPU)(struct IRenderDevice*);
+ class IEngineFactory* (*GetEngineFactory)(struct IRenderDevice*);
+};
+
+struct IRenderDeviceVtbl
+{
+ struct IObjectMethods Object;
+ struct IRenderDeviceMethods RenderDevice;
};
struct IRenderDevice
{
- struct IObjectVtbl* pObjectVtbl;
- struct IDeviceObjectVtbl* pDeviceObjectVtbl;
- struct IRenderDevice* pRenderDeviceVtbl;
+ struct IRenderDeviceVtbl* pVtbl;
};
-# define IRenderDevice_CreateBuffer(This, ...) (This)->pRenderDeviceVtbl->CreateBuffer(This, __VA_ARGS__)
-# define IRenderDevice_CreateShader(This, ...) (This)->pRenderDeviceVtbl->CreateShader(This, __VA_ARGS__)
-# define IRenderDevice_CreateTexture(This, ...) (This)->pRenderDeviceVtbl->CreateTexture(This, __VA_ARGS__)
-# define IRenderDevice_CreateSampler(This, ...) (This)->pRenderDeviceVtbl->CreateSampler(This, __VA_ARGS__)
-# define IRenderDevice_CreateResourceMapping(This, ...) (This)->pRenderDeviceVtbl->CreateResourceMapping(This, __VA_ARGS__)
-# define IRenderDevice_CreatePipelineState(This, ...) (This)->pRenderDeviceVtbl->CreatePipelineState(This, __VA_ARGS__)
-# define IRenderDevice_CreateFence(This, ...) (This)->pRenderDeviceVtbl->CreateFence(This, __VA_ARGS__)
-# define IRenderDevice_CreateQuery(This, ...) (This)->pRenderDeviceVtbl->CreateQuery(This, __VA_ARGS__)
-# define IRenderDevice_GetDeviceCaps(This) (This)->pRenderDeviceVtbl->GetDeviceCaps(This)
-# define IRenderDevice_GetTextureFormatInfo(This, ...) (This)->pRenderDeviceVtbl->GetTextureFormatInfo(This, __VA_ARGS__)
-# define IRenderDevice_GetTextureFormatInfoExt(This, ...) (This)->pRenderDeviceVtbl->GetTextureFormatInfoExt(This, __VA_ARGS__)
-# define IRenderDevice_ReleaseStaleResources(This, ...) (This)->pRenderDeviceVtbl->ReleaseStaleResources(This, __VA_ARGS__)
-# define IRenderDevice_IdleGPU(This) (This)->pRenderDeviceVtbl->IdleGPU(This)
-# define IRenderDevice_GetEngineFactory(This) (This)->pRenderDeviceVtbl->GetEngineFactory(This)
+// clang-format off
+
+# define IRenderDevice_CreateBuffer(This, ...) (This)->pVtbl->RenderDevice.CreateBuffer ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateShader(This, ...) (This)->pVtbl->RenderDevice.CreateShader ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateTexture(This, ...) (This)->pVtbl->RenderDevice.CreateTexture ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateSampler(This, ...) (This)->pVtbl->RenderDevice.CreateSampler ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateResourceMapping(This, ...) (This)->pVtbl->RenderDevice.CreateResourceMapping ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreatePipelineState(This, ...) (This)->pVtbl->RenderDevice.CreatePipelineState ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateFence(This, ...) (This)->pVtbl->RenderDevice.CreateFence ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_CreateQuery(This, ...) (This)->pVtbl->RenderDevice.CreateQuery ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_GetDeviceCaps(This) (This)->pVtbl->RenderDevice.GetDeviceCaps ((struct IRenderDevice*)(This))
+# define IRenderDevice_GetTextureFormatInfo(This, ...) (This)->pVtbl->RenderDevice.GetTextureFormatInfo ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_GetTextureFormatInfoExt(This, ...) (This)->pVtbl->RenderDevice.GetTextureFormatInfoExt((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_ReleaseStaleResources(This, ...) (This)->pVtbl->RenderDevice.ReleaseStaleResources ((struct IRenderDevice*)(This), __VA_ARGS__)
+# define IRenderDevice_IdleGPU(This) (This)->pVtbl->RenderDevice.IdleGPU ((struct IRenderDevice*)(This))
+# define IRenderDevice_GetEngineFactory(This) (This)->pVtbl->RenderDevice.GetEngineFactory ((struct IRenderDevice*)(This))
+
+// clang-format on
#endif