diff options
author | Danny Holman <dholman@gymli.org> | 2025-03-21 01:07:49 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2025-03-21 01:07:49 -0500 |
commit | 6c0bd285dd3dcd1c183abea15122ea5af0657757 (patch) | |
tree | 979bb717c4a80db82778533711cc6608debf1618 | |
parent | de73efecc8c996be4b2e695ac85a6dc0423e0f92 (diff) |
render: vulkan: replace depreciated version macro
Replace the depreciated versioning macros with a simple function call
that converts a version string to a uint32_t.
Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r-- | render/vulkan/context.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/render/vulkan/context.c b/render/vulkan/context.c index 5d78dd4..22003bf 100644 --- a/render/vulkan/context.c +++ b/render/vulkan/context.c @@ -89,6 +89,27 @@ int _init_vkdebugger(vkcontext_t *context) { return 0; } +uint32_t _vertoi(const char *version) { + uint32_t major = 0; + uint32_t minor = 0; + uint32_t patch = 0; + char *version_copy = strdup(version); + char *token = strtok(version_copy, "."); + if (token != NULL) + major = (uint32_t)atoi(token); + + token = strtok(NULL, "."); + if (token != NULL) + minor = (uint32_t)atoi(token); + + token = strtok(NULL, "."); + if (token != NULL) + patch = (uint32_t)atoi(token); + + free(version_copy); + return (major << 22) | (minor << 12) | patch; +} + vkcontext_t* create_vkcontext(vklayer_container_t *vklayers, ext_container_t *ext) { vkcontext_t *ret = rune_calloc(0, sizeof(vkcontext_t)); ret->surface = rune_alloc(sizeof(vksurface_t)); @@ -98,14 +119,10 @@ vkcontext_t* create_vkcontext(vklayer_container_t *vklayers, ext_container_t *ex app_info.pNext = NULL; app_info.apiVersion = VK_API_VERSION_1_2; app_info.pApplicationName = rune_get_app_name(); - int *app_ver = rune_get_app_ver(); - app_info.applicationVersion = VK_MAKE_VERSION(app_ver[0], - app_ver[1], - app_ver[2]); + const char *app_ver = rune_get_app_ver(); + app_info.applicationVersion = _vertoi(app_ver); app_info.pEngineName = "RuneEngine"; - app_info.engineVersion = VK_MAKE_VERSION(RUNE_VER_MAJOR, - RUNE_VER_MINOR, - RUNE_VER_PATCH); + app_info.engineVersion = _vertoi(RUNE_VER); VkInstanceCreateInfo cinfo; cinfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; |