update vulkan/opengl
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
b82e13cb2e
commit
5201c46a21
4 changed files with 92 additions and 25 deletions
|
|
@ -15,8 +15,10 @@
|
||||||
#error Vulkan is unsupported on the requested platform.
|
#error Vulkan is unsupported on the requested platform.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MW_VULKAN_NO_INCLUDE)
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Mw/MachDep.h>
|
#include <Mw/MachDep.h>
|
||||||
#include <Mw/TypeDefs.h>
|
#include <Mw/TypeDefs.h>
|
||||||
|
|
@ -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.
|
* @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)
|
* @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)
|
* @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)
|
* @brief Whether or not to enable validation layers (default: false)
|
||||||
*/
|
*/
|
||||||
VkBool32 validation_layers;
|
int validation_layers;
|
||||||
} MwVulkanConfig;
|
} MwVulkanConfig;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -71,7 +73,7 @@ MWDECL void MwVulkanConfigure(MwVulkanConfig cfg);
|
||||||
/*!
|
/*!
|
||||||
* @brief Field that can be gotten from Vulkan.
|
* @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)
|
* @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.
|
* @brief Return whether Vulkan is installed on the target platform.
|
||||||
*/
|
*/
|
||||||
MWDECL VkBool32 MwVulkanSupported(void);
|
MWDECL int MwVulkanSupported(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
69
milsko.xml
69
milsko.xml
|
|
@ -67,10 +67,6 @@
|
||||||
<integer name="hasBorder" />
|
<integer name="hasBorder" />
|
||||||
<integer name="inverted" />
|
<integer name="inverted" />
|
||||||
<integer name="modernLook" common="yes" />
|
<integer name="modernLook" common="yes" />
|
||||||
<integer
|
|
||||||
name="waitMS"
|
|
||||||
common="yes"
|
|
||||||
/> <!-- This is a special property, only applies to toplevel widget -->
|
|
||||||
<integer name="hideInput" />
|
<integer name="hideInput" />
|
||||||
<integer name="singleClickSelectable" />
|
<integer name="singleClickSelectable" />
|
||||||
<integer name="flat" />
|
<integer name="flat" />
|
||||||
|
|
@ -88,6 +84,9 @@
|
||||||
<integer name="darkTheme" common="yes" />
|
<integer name="darkTheme" common="yes" />
|
||||||
<integer name="useMonospace" common="yes" />
|
<integer name="useMonospace" common="yes" />
|
||||||
|
|
||||||
|
<!-- waitMS is a special property, only applies to toplevel widget -->
|
||||||
|
<integer name="waitMS" common="yes" />
|
||||||
|
|
||||||
<string name="title" />
|
<string name="title" />
|
||||||
<string name="text" />
|
<string name="text" />
|
||||||
<string name="background" common="yes" />
|
<string name="background" common="yes" />
|
||||||
|
|
@ -150,9 +149,20 @@
|
||||||
<integer name="MwMB_ICONCLOCK" />
|
<integer name="MwMB_ICONCLOCK" />
|
||||||
</enumeration>
|
</enumeration>
|
||||||
<enumeration name="MwClipboardType">
|
<enumeration name="MwClipboardType">
|
||||||
<integer name="MwClipboardMain">0</integer>
|
<integer name="MwClipboardMain">0</integer>
|
||||||
<integer name="MwClipboardPrimary" />
|
<integer name="MwClipboardPrimary" />
|
||||||
</enumeration>
|
</enumeration>
|
||||||
|
<enumeration name="MwVulkanField">
|
||||||
|
<integer name="MwVulkanField_GetInstanceProcAddr">0</integer>
|
||||||
|
<integer name="MwVulkanField_Instance" />
|
||||||
|
<integer name="MwVulkanField_Surface" />
|
||||||
|
<integer name="MwVulkanField_PhysicalDevice" />
|
||||||
|
<integer name="MwVulkanField_LogicalDevice" />
|
||||||
|
<integer name="MwVulkanField_GraphicsQueueIndex" />
|
||||||
|
<integer name="MwVulkanField_PresentQueueIndex" />
|
||||||
|
<integer name="MwVulkanField_GraphicsQueue" />
|
||||||
|
<integer name="MwVulkanField_PresentQueue" />
|
||||||
|
</enumeration>
|
||||||
</enumerations>
|
</enumerations>
|
||||||
<constants>
|
<constants>
|
||||||
<integer name="MwDEFAULT">0x0fffffff</integer>
|
<integer name="MwDEFAULT">0x0fffffff</integer>
|
||||||
|
|
@ -409,14 +419,14 @@
|
||||||
<function name="MwGetClipboard">
|
<function name="MwGetClipboard">
|
||||||
<arguments>
|
<arguments>
|
||||||
<widget name="handle" />
|
<widget name="handle" />
|
||||||
<enum defname="MwClipboardType" pointer="no" name="clipboard_type" />
|
<enumeration defname="MwClipboardType" name="clipboard_type" />
|
||||||
</arguments>
|
</arguments>
|
||||||
</function>
|
</function>
|
||||||
<function name="MwSetClipboard">
|
<function name="MwSetClipboard">
|
||||||
<arguments>
|
<arguments>
|
||||||
<widget name="handle" />
|
<widget name="handle" />
|
||||||
<string name="text" />
|
<string name="text" />
|
||||||
<enum defname="MwClipboardType" pointer="no" name="clipboard_type" />
|
<enumeration defname="MwClipboardType" name="clipboard_type" />
|
||||||
</arguments>
|
</arguments>
|
||||||
</function>
|
</function>
|
||||||
</functions>
|
</functions>
|
||||||
|
|
@ -502,6 +512,8 @@
|
||||||
</functions>
|
</functions>
|
||||||
</header>
|
</header>
|
||||||
</headers>
|
</headers>
|
||||||
|
|
||||||
|
<!-- Widget functions are prefixed with mw<widget name> -->
|
||||||
<widgets>
|
<widgets>
|
||||||
<widget name="Box">
|
<widget name="Box">
|
||||||
<properties>
|
<properties>
|
||||||
|
|
@ -721,15 +733,48 @@
|
||||||
</properties>
|
</properties>
|
||||||
<functions>
|
<functions>
|
||||||
<function name="Add">
|
<function name="Add">
|
||||||
<pointer name="parent" />
|
<arguments>
|
||||||
<pixmap name="pixmap" />
|
<pointer name="parent" />
|
||||||
<string name="item" />
|
<pixmap name="pixmap" />
|
||||||
|
<string name="item" />
|
||||||
|
</arguments>
|
||||||
</function>
|
</function>
|
||||||
<function name="Delete">
|
<function name="Delete">
|
||||||
<pointer name="item" />
|
<arguments>
|
||||||
|
<pointer name="item" />
|
||||||
|
</arguments>
|
||||||
</function>
|
</function>
|
||||||
<function name="Reset" />
|
<function name="Reset" />
|
||||||
</functions>
|
</functions>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<!-- They are not alphabetically sorted for reasons -->
|
||||||
|
<widget name="OpenGL">
|
||||||
|
<functions>
|
||||||
|
<function name="MakeCurrent" />
|
||||||
|
<function name="GetProcAddress">
|
||||||
|
<return>
|
||||||
|
<pointer />
|
||||||
|
</return>
|
||||||
|
<arguments>
|
||||||
|
<string name="name" />
|
||||||
|
</arguments>
|
||||||
|
</function>
|
||||||
|
<function name="SwapBuffer" />
|
||||||
|
</functions>
|
||||||
|
</widget>
|
||||||
|
<widget name="Vulkan">
|
||||||
|
<functions>
|
||||||
|
<function name="GetField">
|
||||||
|
<return>
|
||||||
|
<pointer />
|
||||||
|
</return>
|
||||||
|
<arguments>
|
||||||
|
<enumeration defname="MwVulkanField" name="field">
|
||||||
|
<integer pointer="yes" name="out">
|
||||||
|
</arguments>
|
||||||
|
</function>
|
||||||
|
</functions>
|
||||||
|
</widget>
|
||||||
</widgets>
|
</widgets>
|
||||||
</milsko>
|
</milsko>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
#ifdef MW_OPENGL
|
#ifndef MW_OPENGL
|
||||||
|
#define MW_OPENGL_NO_INCLUDE
|
||||||
|
#endif
|
||||||
#include <Mw/Widget/OpenGL.h>
|
#include <Mw/Widget/OpenGL.h>
|
||||||
|
|
||||||
|
#ifdef MW_OPENGL
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
typedef HGLRC(WINAPI* MWwglCreateContext)(HDC);
|
typedef HGLRC(WINAPI* MWwglCreateContext)(HDC);
|
||||||
typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC);
|
typedef BOOL(WINAPI* MWwglMakeCurrent)(HDC, HGLRC);
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,12 @@
|
||||||
* ioixd maintains this file. nishi doesn't know vulkan at all
|
* ioixd maintains this file. nishi doesn't know vulkan at all
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef MW_VULKAN
|
#ifndef MW_VULKAN
|
||||||
|
#define MW_VULKAN_NO_INCLUDE
|
||||||
|
#endif
|
||||||
#include <Mw/Widget/Vulkan.h>
|
#include <Mw/Widget/Vulkan.h>
|
||||||
|
|
||||||
|
#ifdef MW_VULKAN
|
||||||
#ifdef USE_GDI
|
#ifdef USE_GDI
|
||||||
#define VK_USE_PLATFORM_WIN32_KHR 1
|
#define VK_USE_PLATFORM_WIN32_KHR 1
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -498,7 +501,7 @@ void MwVulkanEnableLayer(const char* name) {
|
||||||
arrput(enabledLayers, name);
|
arrput(enabledLayers, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBool32 MwVulkanSupported(void) {
|
int MwVulkanSupported(void) {
|
||||||
if(vulkan_supported == VULKAN_SUPPORTED_UNKNOWN) {
|
if(vulkan_supported == VULKAN_SUPPORTED_UNKNOWN) {
|
||||||
void* lib = vulkan_lib_load();
|
void* lib = vulkan_lib_load();
|
||||||
if(lib == NULL) {
|
if(lib == NULL) {
|
||||||
|
|
@ -509,9 +512,9 @@ VkBool32 MwVulkanSupported(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(vulkan_supported == VULKAN_SUPPORTED_YES) {
|
if(vulkan_supported == VULKAN_SUPPORTED_YES) {
|
||||||
return VK_TRUE;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return VK_FALSE;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -582,7 +585,21 @@ MwClassRec MwVulkanClassRec = {
|
||||||
NULL};
|
NULL};
|
||||||
MwClass MwVulkanClass = &MwVulkanClassRec;
|
MwClass MwVulkanClass = &MwVulkanClassRec;
|
||||||
#else
|
#else
|
||||||
MWDECL MwClass MwVulkanClass;
|
|
||||||
|
|
||||||
MwClass MwVulkanClass = NULL;
|
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
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue