33#include "VulkanDefines.h"
34#include <NDEVR/RWLock.h>
35#include <NDEVR/String.h>
36#include <NDEVR/DynamicPointer.h>
37#include <NDEVR/Buffer.h>
38#include <NDEVR/Time.h>
39#include <NDEVR/UUID.h>
40#include <NDEVR/ApplicationOptions.h>
41#include <vulkan/vulkan.h>
43#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
44#if !defined(DEFINE_NON_DISPATCHABLE_HANDLE)
45 #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
46 #define DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
48 #define DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
53VK_DEFINE_HANDLE(VkInstance)
54VK_DEFINE_HANDLE(VkPhysicalDevice)
55VK_DEFINE_HANDLE(VkDevice)
56VK_DEFINE_HANDLE(VkQueue)
57VK_DEFINE_HANDLE(VkCommandBuffer)
59DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT);
61DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR);
62DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool);
63DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView);
64struct VkApplicationInfo;
67 struct SwapChainSupportDetails;
76 extern VkResult
vkExecute(VkResult result,
const char* error_message);
88 VulkanInstance(VulkanInstance&& instance)
noexcept;
89 static void setupModule(
Module& module);
90 static Module VulkanBackupModule();
92 virtual ~VulkanInstance();
99 const String& surfaceType()
const;
101 VkInstance vkInstance()
const { lib_assert(
m_vk_instance,
"Instance not yet created, but access is attempted");
return m_vk_instance; }
104 bool supportsKHRSwapchain()
const;
105 bool supportsTriangleFan()
const;
109 virtual uint04 deviceSuitableScore(VkPhysicalDevice device);
110 bool isSoftwareRendered()
const;
112 virtual VkResult createVkInstance(
const VkInstanceCreateInfo& create_info);
113 virtual VkInstanceCreateInfo createInfo();
114 virtual VkApplicationInfo applicationInfo(
const String& app_name);
115 virtual uint04 setupExtensions(
const char**& extensions);
116 virtual uint04 setupLayers(
const char**& layers);
117 void initializeAll();
119 static String HardwareRenderedVulkanLib();
120 static String SoftwareRenderedVulkanLib();
121 String vulkanLibUsed()
const;
123 bool checkLayerSupport(
const String& layer);
124 bool checkExtensionSupport(
const String& layer);
125 bool checkValidationSupport();
126 virtual void setAvailablePhysicalDevices();
127 virtual void setupInstance();
128 virtual void setAvailableExtensionInfo();
129 virtual void setAvailableLayerInfo();
130 virtual void setupDebug();
The equivelent of std::vector but with a bit more control.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
The core String class for the NDEVR API.
Represents a timestamp with utilities for manipulation and conversion.
Buffer< String > m_extensions
Enabled instance extensions.
bool m_supports_validation
Whether validation layers are available.
bool m_is_init
Whether the instance has been initialized.
Buffer< VkPhysicalDevice, BufferAllocator< VkPhysicalDevice, 64, true > > m_available_physical_devices
Physical devices found at init.
Buffer< VkExtensionProperties, BufferAllocator< VkExtensionProperties, 64, true > > m_available_extension_info
Available Vulkan extensions.
bool m_supports_tri_fan
Whether the driver supports triangle fan topology.
VkInstance m_vk_instance
The native Vulkan instance handle.
VkDebugReportCallbackEXT m_debug_callback
Debug report callback handle.
Time m_creation_time
The time this instance was created.
static Buffer< VulkanInstance * > s_instances
Global list of all active Vulkan instances.
bool m_is_software_rendered
Whether using software-rendered Vulkan.
Buffer< VkLayerProperties, BufferAllocator< VkLayerProperties, 64, true > > m_available_layer_info
Available Vulkan layers.
Buffer< String > m_validation_layers
Enabled validation layers.
String m_surface_type
The type of surface this instance uses.
LogPtr m_log
Log for instance messages.
Contains core information about a Viewport.
The primary namespace for the NDEVR SDK.
VkResult vkExecute(VkResult result, const char *error_message)
Executes a Vulkan command and handles the results, throwing an exception if necessary.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Base class for extensions, typically added as external DLL's that can modify or enhance the behavior ...