mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 07:23:35 +00:00
adding Vulkan device creation, adding unit tests, adding few API function declarations
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
#include <Pulse.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_ANY, PULSE_SHADER_FORMAT_SPIRV_BIT, PULSE_NO_DEBUG);
|
||||
if(backend == PULSE_NULL_HANDLE)
|
||||
{
|
||||
fprintf(stderr, "Error while loading Pulse: %s", PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
return 1;
|
||||
}
|
||||
PulseUnloadBackend(backend);
|
||||
puts("Successfully loaded Pulse !");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
target("LoadingPulse")
|
||||
add_deps("pulse_gpu")
|
||||
if is_plat("linux") then
|
||||
set_extension(".x86_64")
|
||||
end
|
||||
add_files("main.c")
|
||||
target_end()
|
||||
11
Tests/Vulkan/DeviceSetup.c
git.filemode.normal_file
11
Tests/Vulkan/DeviceSetup.c
git.filemode.normal_file
@@ -0,0 +1,11 @@
|
||||
#include <unity/unity.h>
|
||||
#include <Pulse.h>
|
||||
|
||||
extern PulseBackend backend;
|
||||
|
||||
void TestDeviceSetup()
|
||||
{
|
||||
PulseDevice device = PulseCreateDevice(backend, NULL, 0);
|
||||
TEST_ASSERT_NOT_EQUAL_MESSAGE(device, PULSE_NULL_HANDLE, PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
PulseDestroyDevice(device);
|
||||
}
|
||||
41
Tests/Vulkan/main.c
git.filemode.normal_file
41
Tests/Vulkan/main.c
git.filemode.normal_file
@@ -0,0 +1,41 @@
|
||||
#include <unity/unity.h>
|
||||
#include <Pulse.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
PulseBackend backend;
|
||||
|
||||
extern void TestDeviceSetup();
|
||||
|
||||
bool SetupPulse()
|
||||
{
|
||||
backend = PulseLoadBackend(PULSE_BACKEND_VULKAN, PULSE_SHADER_FORMAT_SPIRV_BIT, PULSE_NO_DEBUG);
|
||||
if(backend == PULSE_NULL_HANDLE)
|
||||
{
|
||||
fprintf(stderr, "Fatal Error: could not load Pulse using Vulkan due to %s", PulseVerbaliseErrorType(PulseGetLastErrorType()));
|
||||
return false;
|
||||
}
|
||||
puts("Pulse loaded using Vulkan");
|
||||
return true;
|
||||
}
|
||||
|
||||
int RunUnitTests()
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(TestDeviceSetup);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
void UnloadPulse()
|
||||
{
|
||||
PulseUnloadBackend(backend);
|
||||
puts("Pulse unloaded");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
SetupPulse();
|
||||
int result = RunUnitTests();
|
||||
UnloadPulse();
|
||||
return result;
|
||||
}
|
||||
16
Tests/Vulkan/xmake.lua
git.filemode.normal_file
16
Tests/Vulkan/xmake.lua
git.filemode.normal_file
@@ -0,0 +1,16 @@
|
||||
option("vulkan-tests", { description = "Build Vulkan tests", default = false })
|
||||
|
||||
if has_config("vulkan-tests") then
|
||||
set_group("VulkanTests")
|
||||
add_requires("unity_test")
|
||||
|
||||
target("VulkanUnitTests")
|
||||
set_kind("binary")
|
||||
add_deps("pulse_gpu")
|
||||
add_files("**.c")
|
||||
add_packages("unity_test")
|
||||
if is_plat("linux") then
|
||||
set_extension(".x86_64")
|
||||
end
|
||||
target_end()
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
option("tests", { description = "Build tests", default = false })
|
||||
|
||||
if has_config("tests") then
|
||||
set_group("Tests")
|
||||
includes("*/xmake.lua")
|
||||
end
|
||||
Reference in New Issue
Block a user