2025-10-01 05:49:40 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @file Mw/Widget/Vulkan.h
|
|
|
|
|
* @brief Vulkan widget
|
|
|
|
|
* @warning This header is not documented yet
|
2025-10-01 05:49:40 +00:00
|
|
|
*/
|
2025-10-01 05:57:00 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ioixd maintains this file. nishi doesn't know vulkan at all
|
|
|
|
|
*/
|
|
|
|
|
|
2025-10-04 16:34:24 +00:00
|
|
|
#ifndef __MW_WIDGET_VULKAN_H__
|
|
|
|
|
#define __MW_WIDGET_VULKAN_H__
|
2025-10-01 05:39:02 +00:00
|
|
|
|
2026-04-16 22:58:16 -07:00
|
|
|
#if defined(MW_VULKAN) && !defined(_WIN32) && !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
|
2025-10-01 05:39:02 +00:00
|
|
|
#error Vulkan is unsupported on the requested platform.
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-17 00:20:29 +09:00
|
|
|
#if !defined(MW_VULKAN_NO_INCLUDE)
|
2025-10-01 05:39:02 +00:00
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
#include <vulkan/vulkan_core.h>
|
2026-04-17 00:20:29 +09:00
|
|
|
#endif
|
2025-10-01 05:39:02 +00:00
|
|
|
|
|
|
|
|
#include <Mw/MachDep.h>
|
|
|
|
|
#include <Mw/TypeDefs.h>
|
2025-10-20 21:55:30 +00:00
|
|
|
#include <Mw/Core.h>
|
2025-10-01 05:39:02 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-10-01 05:49:40 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Vulkan widget class
|
2025-10-01 05:49:40 +00:00
|
|
|
*/
|
2025-10-01 05:39:02 +00:00
|
|
|
MWDECL MwClass MwVulkanClass;
|
|
|
|
|
|
2025-10-01 22:15:14 +00:00
|
|
|
/*!
|
2026-04-19 17:53:10 -07:00
|
|
|
* @brief Configuration options that can be passed to setup parts of the Vulkan widget.
|
2025-10-01 22:15:14 +00:00
|
|
|
*/
|
2026-04-17 00:20:29 +09:00
|
|
|
typedef struct _MwVulkanConfig {
|
2025-10-01 22:15:14 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Vulkan API version (default: VK_API_VERSION_1_0)
|
2025-10-01 22:15:14 +00:00
|
|
|
*/
|
2026-04-17 00:20:29 +09:00
|
|
|
MwU32 api_version;
|
2025-10-01 22:15:14 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Vulkan version (default: VK_VERSION_1_0)
|
2025-10-01 22:15:14 +00:00
|
|
|
*/
|
2026-04-17 00:20:29 +09:00
|
|
|
MwU32 vk_version;
|
2025-10-01 22:15:14 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Whether or not to enable validation layers (default: false)
|
2025-10-01 22:15:14 +00:00
|
|
|
*/
|
2026-04-17 00:20:29 +09:00
|
|
|
int validation_layers;
|
2025-10-01 22:15:14 +00:00
|
|
|
} MwVulkanConfig;
|
|
|
|
|
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Field that can be gotten from Vulkan.
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
enum MwVULKANFIELD {
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's vkGetInstanceProcAddr function (PFN_vkGetInstanceProcAddr)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_GETINSTANCEPROCADDR = 0,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's instance (VkInstance)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_INSTANCE,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's surface (VkSurfaceKHR)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_SURFACE,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's physical device (VkPhysicalDevice)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_PHYSICALDEVICE,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's logical device (VkDevice)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_LOGICALDEVICE,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the index that the vulkan widget uses for the graphics queue (uint32_t *)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_GRAPHICSQUEUEINDEX,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the index that the vulkan widget uses for the present queue (uint32_t *)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_PRESENTQUEUEINDEX,
|
|
|
|
|
MwVULKANFIELD_GRAPHICSQUEUE,
|
2025-10-01 21:47:55 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief The address of the vulkan widget's graphics queue (VkQueue)
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:36:34 +09:00
|
|
|
MwVULKANFIELD_PRESENTQUEUE,
|
|
|
|
|
};
|
2025-10-01 21:47:55 +00:00
|
|
|
|
|
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Function for getting a field from within Vulkan.
|
2026-04-17 01:46:47 +09:00
|
|
|
* @note Consult the documentation for MwVULKANFIELD to know what type is expected for output.
|
2025-10-01 21:47:55 +00:00
|
|
|
*/
|
2026-04-17 01:46:47 +09:00
|
|
|
MwInline void* MwVulkanGetField(MwWidget handle, int field, int* err) {
|
2025-10-20 21:55:30 +00:00
|
|
|
void* field_out;
|
2026-04-17 01:46:47 +09:00
|
|
|
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, err);
|
2025-10-20 21:55:30 +00:00
|
|
|
return field_out;
|
2025-11-09 12:13:46 +00:00
|
|
|
}
|
2025-10-01 05:39:02 +00:00
|
|
|
|
2025-10-01 23:09:38 +00:00
|
|
|
/*!
|
2025-10-28 20:40:26 +00:00
|
|
|
* @brief Return whether Vulkan is installed on the target platform.
|
2025-10-01 23:09:38 +00:00
|
|
|
*/
|
2026-04-22 12:05:49 +09:00
|
|
|
MWDECL int MWAPI MwVulkanSupported(void);
|
2025-10-01 23:09:38 +00:00
|
|
|
|
2025-10-01 05:39:02 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|