From 5201c46a219a8225d28206c1015b93e168ba1f84 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Fri, 17 Apr 2026 00:20:29 +0900 Subject: [PATCH] update vulkan/opengl --- include/Mw/Widget/Vulkan.h | 14 ++++---- milsko.xml | 69 +++++++++++++++++++++++++++++++------- src/widget/opengl.c | 5 ++- src/widget/vulkan.c | 29 ++++++++++++---- 4 files changed, 92 insertions(+), 25 deletions(-) diff --git a/include/Mw/Widget/Vulkan.h b/include/Mw/Widget/Vulkan.h index 3297d22..217f0e5 100644 --- a/include/Mw/Widget/Vulkan.h +++ b/include/Mw/Widget/Vulkan.h @@ -15,8 +15,10 @@ #error Vulkan is unsupported on the requested platform. #endif +#if !defined(MW_VULKAN_NO_INCLUDE) #include #include +#endif #include #include @@ -46,19 +48,19 @@ MWDECL void MwVulkanEnableLayer(const char* ext_name); /*! * @brief Configuration options that can be passed to setup Vulkan before a widget is created. */ -typedef struct MwVulkanConfig_T { +typedef struct _MwVulkanConfig { /*! * @brief Vulkan API version (default: VK_API_VERSION_1_0) */ - uint32_t api_version; + MwU32 api_version; /*! * @brief Vulkan version (default: VK_VERSION_1_0) */ - uint32_t vk_version; + MwU32 vk_version; /*! * @brief Whether or not to enable validation layers (default: false) */ - VkBool32 validation_layers; + int validation_layers; } MwVulkanConfig; /*! @@ -71,7 +73,7 @@ MWDECL void MwVulkanConfigure(MwVulkanConfig cfg); /*! * @brief Field that can be gotten from Vulkan. */ -typedef enum MwVulkanField_T { +typedef enum _MwVulkanField { /*! * @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr) */ @@ -120,7 +122,7 @@ MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, int* out) /*! * @brief Return whether Vulkan is installed on the target platform. */ -MWDECL VkBool32 MwVulkanSupported(void); +MWDECL int MwVulkanSupported(void); #ifdef __cplusplus } diff --git a/milsko.xml b/milsko.xml index d42f7e9..2e522bd 100644 --- a/milsko.xml +++ b/milsko.xml @@ -67,10 +67,6 @@ - @@ -88,6 +84,9 @@ + + + @@ -150,9 +149,20 @@ - 0 + 0 + + 0 + + + + + + + + + 0x0fffffff @@ -409,14 +419,14 @@ - + - - + + @@ -502,6 +512,8 @@ + + @@ -721,15 +733,48 @@ - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/widget/opengl.c b/src/widget/opengl.c index e8b222c..252d7ad 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -2,9 +2,12 @@ #include -#ifdef MW_OPENGL +#ifndef MW_OPENGL +#define MW_OPENGL_NO_INCLUDE +#endif #include +#ifdef MW_OPENGL #ifdef USE_GDI typedef HGLRC(WINAPI* MWwglCreateContext)(HDC); typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC); diff --git a/src/widget/vulkan.c b/src/widget/vulkan.c index 394c9e5..e871646 100644 --- a/src/widget/vulkan.c +++ b/src/widget/vulkan.c @@ -4,9 +4,12 @@ * ioixd maintains this file. nishi doesn't know vulkan at all */ -#ifdef MW_VULKAN +#ifndef MW_VULKAN +#define MW_VULKAN_NO_INCLUDE +#endif #include +#ifdef MW_VULKAN #ifdef USE_GDI #define VK_USE_PLATFORM_WIN32_KHR 1 #endif @@ -498,7 +501,7 @@ void MwVulkanEnableLayer(const char* name) { arrput(enabledLayers, name); } -VkBool32 MwVulkanSupported(void) { +int MwVulkanSupported(void) { if(vulkan_supported == VULKAN_SUPPORTED_UNKNOWN) { void* lib = vulkan_lib_load(); if(lib == NULL) { @@ -509,9 +512,9 @@ VkBool32 MwVulkanSupported(void) { } } if(vulkan_supported == VULKAN_SUPPORTED_YES) { - return VK_TRUE; + return 1; } else { - return VK_FALSE; + return 0; } }; @@ -582,7 +585,21 @@ MwClassRec MwVulkanClassRec = { NULL}; MwClass MwVulkanClass = &MwVulkanClassRec; #else -MWDECL MwClass MwVulkanClass; - MwClass MwVulkanClass = NULL; + +void MwVulkanEnableExtension(const char* ext_name) { + (void)ext_name; +} + +void MwVulkanEnableLayer(const char* ext_name) { + (void)ext_name; +} + +void MwVulkanConfigure(MwVulkanConfig cfg) { + (void)cfg; +} + +int MwVulkanSupported(void) { + return 0; +} #endif