From 8925a2099aa056a917ff31495c5b07d3cd267311 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Tue, 10 Feb 2026 14:15:22 +0100 Subject: vulkan work --- src/graphics.cc | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/graphics.cc') diff --git a/src/graphics.cc b/src/graphics.cc index d0a257a..dc81041 100644 --- a/src/graphics.cc +++ b/src/graphics.cc @@ -1 +1,37 @@ -#include "graphics.h" \ No newline at end of file +#include "graphics.h" + +#include + +#include "utils.h" + +#define WAYC_APP_NAME "" +#define WAYC_APP_VERSION 0 + +enum graphics_error_e wayc_graphics_init(struct graphics_s* graphics) { + wayc_notnull(graphics); + memset(graphics, 0, sizeof(*graphics)); + + VkApplicationInfo appinfo = {}; + appinfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appinfo.pApplicationName = WAYC_APP_NAME; + appinfo.applicationVersion = WAYC_APP_VERSION; + appinfo.pEngineName = WAYC_APP_NAME; + appinfo.engineVersion = WAYC_APP_VERSION; + + VkInstanceCreateInfo createinfo = {}; + createinfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + createinfo.pApplicationInfo = &appinfo; + + VkResult result = vkCreateInstance(&createinfo, nullptr, &graphics->instance); + if (result != VK_SUCCESS) return GRAPHICS_ERROR_INSTANCE; + + graphics->instance = VK_NULL_HANDLE; + return GRAPHICS_ERROR_NONE; +} + +void wayc_graphics_deinit(struct graphics_s* graphics) { + wayc_notnull(graphics); + + if (graphics->instance == nullptr) return; + vkDestroyInstance(graphics->instance, nullptr); +} -- cgit v1.2.3