summaryrefslogtreecommitdiffstats
path: root/Tests/IncludeTest
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-28 17:22:17 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-28 17:22:17 +0000
commitff5cbaa7be4411abf6fc6d77f8520bcb40a72bf6 (patch)
tree54828822dd8addfb0ae681bb14152dcb70e40346 /Tests/IncludeTest
parentImplemented C interface for Vulkan backend (diff)
downloadDiligentCore-ff5cbaa7be4411abf6fc6d77f8520bcb40a72bf6.tar.gz
DiligentCore-ff5cbaa7be4411abf6fc6d77f8520bcb40a72bf6.zip
Added Vulkan C API tests
Diffstat (limited to 'Tests/IncludeTest')
-rw-r--r--Tests/IncludeTest/CMakeLists.txt3
-rw-r--r--Tests/IncludeTest/GraphicsEngineOpenGL/EngineFactoryOpenGLH_test.cpp7
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/BufferViewVkH_test.c6
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/BufferVkH_test.c9
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/CommandQueueVkH_test.c24
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/DeviceContextVkH_test.c11
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c32
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.cpp7
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/PipelineStateVkH_test.c8
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/RenderDeviceVkH_test.c23
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/SamplerVkH_test.c6
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/SwapChainVkH_test.c8
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/TextureViewVkH_test.c6
-rw-r--r--Tests/IncludeTest/GraphicsEngineVk/TextureVkH_test.c11
14 files changed, 137 insertions, 24 deletions
diff --git a/Tests/IncludeTest/CMakeLists.txt b/Tests/IncludeTest/CMakeLists.txt
index ee330698..ca8f1376 100644
--- a/Tests/IncludeTest/CMakeLists.txt
+++ b/Tests/IncludeTest/CMakeLists.txt
@@ -39,6 +39,9 @@ if(MSVC)
set_target_properties(DiligentCore-IncludeTest PROPERTIES
STATIC_LIBRARY_FLAGS "/IGNORE:4221"
)
+
+ # Treat warnings as errors to catch c compilation issues
+ target_compile_options(DiligentCore-IncludeTest PRIVATE "/WX")
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE})
diff --git a/Tests/IncludeTest/GraphicsEngineOpenGL/EngineFactoryOpenGLH_test.cpp b/Tests/IncludeTest/GraphicsEngineOpenGL/EngineFactoryOpenGLH_test.cpp
index c94e103f..4528a838 100644
--- a/Tests/IncludeTest/GraphicsEngineOpenGL/EngineFactoryOpenGLH_test.cpp
+++ b/Tests/IncludeTest/GraphicsEngineOpenGL/EngineFactoryOpenGLH_test.cpp
@@ -25,13 +25,6 @@
* of the possibility of such damages.
*/
-#if PLATFORM_WIN32 || PLATFORM_UNIVERSAL_WINDOWS
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-# include <Windows.h>
-#endif
-
#ifndef ENGINE_DLL
# define ENGINE_DLL 1
#endif
diff --git a/Tests/IncludeTest/GraphicsEngineVk/BufferViewVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/BufferViewVkH_test.c
index 1057b9ca..89abee67 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/BufferViewVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/BufferViewVkH_test.c
@@ -27,3 +27,9 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/BufferViewVk.h"
+
+void TestBufferViewVk_CInterface(IBufferViewVk* pView)
+{
+ VkBufferView vkView = IBufferViewVk_GetVkBufferView(pView);
+ (void)vkView;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/BufferVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/BufferVkH_test.c
index f93a3f6d..c63a98dc 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/BufferVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/BufferVkH_test.c
@@ -27,3 +27,12 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/BufferVk.h"
+
+void TestBufferVk_CInterface(IBufferVk* pView)
+{
+ VkBuffer vkView = IBufferVk_GetVkBuffer(pView);
+ (void)vkView;
+ IBufferVk_SetAccessFlags(pView, VK_ACCESS_HOST_READ_BIT);
+ VkAccessFlags vkAccessFlag = IBufferVk_GetAccessFlags(pView);
+ (void)vkAccessFlag;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/CommandQueueVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/CommandQueueVkH_test.c
index c3952ad6..f19ce217 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/CommandQueueVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/CommandQueueVkH_test.c
@@ -27,3 +27,27 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/CommandQueueVk.h"
+
+void TestCommandQueueVk_CInterface(ICommandQueueVk* pQueue)
+{
+ Uint64 FenceVal = ICommandQueueVk_GetNextFenceValue(pQueue);
+ (void)FenceVal;
+
+ FenceVal = ICommandQueueVk_SubmitCmdBuffer(pQueue, (VkCommandBuffer)NULL);
+
+ FenceVal = ICommandQueueVk_Submit(pQueue, (VkSubmitInfo*)NULL);
+
+ ICommandQueueVk_Present(pQueue, (VkPresentInfoKHR*)NULL);
+
+ VkQueue vkQueue = ICommandQueueVk_GetVkQueue(pQueue);
+ (void)vkQueue;
+
+ uint32_t fam = ICommandQueueVk_GetQueueFamilyIndex(pQueue);
+ (void)fam;
+
+ FenceVal = ICommandQueueVk_GetCompletedFenceValue(pQueue);
+
+ ICommandQueueVk_WaitForIdle(pQueue);
+
+ ICommandQueueVk_SignalFence(pQueue, (VkFence)NULL);
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/DeviceContextVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/DeviceContextVkH_test.c
index 61c0e3c3..ddde6f7e 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/DeviceContextVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/DeviceContextVkH_test.c
@@ -27,3 +27,14 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/DeviceContextVk.h"
+
+void TestDeviceContextVk_CInterface(IDeviceContextVk* pCtx)
+{
+ IDeviceContextVk_TransitionImageLayout(pCtx, (ITexture*)NULL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
+ IDeviceContextVk_BufferMemoryBarrier(pCtx, (IBuffer*)NULL, VK_ACCESS_HOST_READ_BIT);
+
+ ICommandQueueVk* pVkCmdQueue = IDeviceContextVk_LockCommandQueue(pCtx);
+ (void)pVkCmdQueue;
+
+ IDeviceContextVk_UnlockCommandQueue(pCtx);
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c
index f83256b9..fa7c9c0b 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.c
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * In no event and under no legal theory, whether in tort (including negligence),
+ * In no event and under no legal theory, whether in tort (including neVkigence),
* contract, or otherwise, unless required by applicable law (such as deliberate
- * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * and grossly neVkigent acts) or agreed to in writing, shall any Contributor be
* liable for any damages, including any direct, indirect, special, incidental,
* or consequential damages of any character arising as a result of this License or
* out of the use or inability to use the software (including but not limited to damages
@@ -25,15 +25,29 @@
* of the possibility of such damages.
*/
-#if PLATFORM_WIN32
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-# include <Windows.h>
-#endif
-
#ifndef ENGINE_DLL
# define ENGINE_DLL 1
#endif
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/EngineFactoryVk.h"
+
+
+void TestEngineFactoryVk_CInterface()
+{
+#if EXPLICITLY_LOAD_ENGINE_VK_DLL
+ GetEngineFactoryVkType GetEngineFactoryVk = LoadGraphicsEngineVk();
+ IEngineFactoryVk* pFactory = GetEngineFactoryVk();
+#else
+ IEngineFactoryVk* pFactory = Diligent_GetEngineFactoryVk();
+#endif
+
+ struct EngineVkCreateInfo EngineCI = {0};
+ IRenderDevice* pDevice = NULL;
+ IDeviceContext* pCtx = NULL;
+ IEngineFactoryVk_CreateDeviceAndContextsVk(pFactory, &EngineCI, &pDevice, &pCtx);
+
+ struct SwapChainDesc SCDesc = {0};
+ void* pNativeWndHandle = NULL;
+ ISwapChain* pSwapChain = NULL;
+ IEngineFactoryVk_CreateSwapChainVk(pFactory, pDevice, pCtx, &SCDesc, pNativeWndHandle, &pSwapChain);
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.cpp b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.cpp
index f83256b9..120b1181 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.cpp
+++ b/Tests/IncludeTest/GraphicsEngineVk/EngineFactoryVkH_test.cpp
@@ -25,13 +25,6 @@
* of the possibility of such damages.
*/
-#if PLATFORM_WIN32
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-# include <Windows.h>
-#endif
-
#ifndef ENGINE_DLL
# define ENGINE_DLL 1
#endif
diff --git a/Tests/IncludeTest/GraphicsEngineVk/PipelineStateVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/PipelineStateVkH_test.c
index f54ee46a..5ba5bd48 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/PipelineStateVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/PipelineStateVkH_test.c
@@ -27,3 +27,11 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/PipelineStateVk.h"
+
+void TestPipelineStateVk_CInterface(IPipelineStateVk* pPSO)
+{
+ VkRenderPass vkPass = IPipelineStateVk_GetVkRenderPass(pPSO);
+ VkPipeline vkPipeline = IPipelineStateVk_GetVkPipeline(pPSO);
+ (void)vkPass;
+ (void)vkPipeline;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/RenderDeviceVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/RenderDeviceVkH_test.c
index f421b717..d41c9a04 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/RenderDeviceVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/RenderDeviceVkH_test.c
@@ -27,3 +27,26 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/RenderDeviceVk.h"
+
+void TestRenderDeviceVkCInterface(IRenderDeviceVk* pDevice)
+{
+ VkDevice vkDevice = IRenderDeviceVk_GetVkDevice(pDevice);
+ (void)vkDevice;
+
+ VkPhysicalDevice vkPhysDevice = IRenderDeviceVk_GetVkPhysicalDevice(pDevice);
+ (void)vkPhysDevice;
+
+ VkInstance vkInst = IRenderDeviceVk_GetVkInstance(pDevice);
+ (void)vkInst;
+
+ Uint64 Fence = IRenderDeviceVk_GetNextFenceValue(pDevice, (Uint32)0);
+ (void)Fence;
+
+ Fence = IRenderDeviceVk_GetCompletedFenceValue(pDevice, (Uint32)0);
+
+ bool IsSignaled = IRenderDeviceVk_IsFenceSignaled(pDevice, (Uint32)0, (Uint64)0);
+ (void)IsSignaled;
+
+ IRenderDeviceVk_CreateTextureFromVulkanImage(pDevice, (VkImage)NULL, (TextureDesc*)NULL, RESOURCE_STATE_SHADER_RESOURCE, (ITexture**)NULL);
+ IRenderDeviceVk_CreateBufferFromVulkanResource(pDevice, (VkBuffer)NULL, (BufferDesc*)NULL, RESOURCE_STATE_CONSTANT_BUFFER, (IBuffer**)NULL);
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/SamplerVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/SamplerVkH_test.c
index 890fcb7e..25ad83d8 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/SamplerVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/SamplerVkH_test.c
@@ -27,3 +27,9 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/SamplerVk.h"
+
+void TestSamplerVk_CInterface(ISamplerVk* pSampler)
+{
+ VkSampler Handle = ISamplerVk_GetVkSampler(pSampler);
+ (void)Handle;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/SwapChainVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/SwapChainVkH_test.c
index 3f066e05..06397e69 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/SwapChainVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/SwapChainVkH_test.c
@@ -25,4 +25,10 @@
* of the possibility of such damages.
*/
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
-#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h" \ No newline at end of file
+#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/SwapChainVk.h"
+
+void TestSwapChainVk_CInterface(ISwapChainVk* pSwapChain)
+{
+ VkSwapchainKHR sc = ISwapChainVk_GetVkSwapChain(pSwapChain);
+ (void)sc;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/TextureViewVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/TextureViewVkH_test.c
index 92ea677b..183f6b7e 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/TextureViewVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/TextureViewVkH_test.c
@@ -27,3 +27,9 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/TextureViewVk.h"
+
+void TestTextureViewVk_CInterface(ITextureViewVk* pView)
+{
+ VkImageView vkView = ITextureViewVk_GetVulkanImageView(pView);
+ (void)vkView;
+}
diff --git a/Tests/IncludeTest/GraphicsEngineVk/TextureVkH_test.c b/Tests/IncludeTest/GraphicsEngineVk/TextureVkH_test.c
index 51d06227..1c4239ed 100644
--- a/Tests/IncludeTest/GraphicsEngineVk/TextureVkH_test.c
+++ b/Tests/IncludeTest/GraphicsEngineVk/TextureVkH_test.c
@@ -27,3 +27,14 @@
#include "DiligentCore/ThirdParty/vulkan/vulkan.h"
#include "DiligentCore/Graphics/GraphicsEngineVulkan/interface/TextureVk.h"
+
+void TestTextureVk_CInterface(ITextureVk* pTexture)
+{
+ VkImage vkImg = ITextureVk_GetVkImage(pTexture);
+ (void)vkImg;
+
+ ITextureVk_SetLayout(pTexture, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
+
+ VkImageLayout vkLayout = ITextureVk_GetLayout(pTexture);
+ (void)vkLayout;
+}