mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
adding headless mode
This commit is contained in:
@@ -125,10 +125,12 @@ namespace mlx
|
|||||||
vkGetPhysicalDeviceProperties(m_physical_device, &props);
|
vkGetPhysicalDeviceProperties(m_physical_device, &props);
|
||||||
DebugLog("Vulkan: physical device picked '%'", props.deviceName);
|
DebugLog("Vulkan: physical device picked '%'", props.deviceName);
|
||||||
|
|
||||||
const char* device_extensions[] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
|
std::vector<const char*> device_extensions;
|
||||||
|
if(!is_headless)
|
||||||
|
device_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||||
VkPhysicalDeviceFeatures features{};
|
VkPhysicalDeviceFeatures features{};
|
||||||
vkGetPhysicalDeviceFeatures(m_physical_device, &features);
|
vkGetPhysicalDeviceFeatures(m_physical_device, &features);
|
||||||
m_device = kvfCreateDevice(m_physical_device, device_extensions, sizeof(device_extensions) / sizeof(device_extensions[0]), &features);
|
m_device = kvfCreateDevice(m_physical_device, device_extensions.data(), device_extensions.size(), &features);
|
||||||
DebugLog("Vulkan: logical device created");
|
DebugLog("Vulkan: logical device created");
|
||||||
|
|
||||||
loader->LoadDevice(m_device);
|
loader->LoadDevice(m_device);
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ namespace mlx
|
|||||||
{
|
{
|
||||||
static inline PFN_vkVoidFunction vkGetInstanceProcAddrStub(Handle context, const char* name)
|
static inline PFN_vkVoidFunction vkGetInstanceProcAddrStub(Handle context, const char* name)
|
||||||
{
|
{
|
||||||
|
bool is_headless = std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||||
|
if(is_headless && std::string_view(name).find("KHR") != std::string_view::npos)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
PFN_vkVoidFunction function = RenderCore::Get().vkGetInstanceProcAddr(static_cast<VkInstance>(context), name);
|
PFN_vkVoidFunction function = RenderCore::Get().vkGetInstanceProcAddr(static_cast<VkInstance>(context), name);
|
||||||
if(!function)
|
if(!function)
|
||||||
FatalError("Vulkan Loader: could not load '%'", name);
|
FatalError("Vulkan Loader: could not load '%'", name);
|
||||||
@@ -37,6 +41,10 @@ namespace mlx
|
|||||||
|
|
||||||
static inline PFN_vkVoidFunction vkGetDeviceProcAddrStub(Handle context, const char* name)
|
static inline PFN_vkVoidFunction vkGetDeviceProcAddrStub(Handle context, const char* name)
|
||||||
{
|
{
|
||||||
|
bool is_headless = std::getenv("MLX_HEADLESS_MODE") != nullptr;
|
||||||
|
if(is_headless && std::string_view(name).find("KHR") != std::string_view::npos)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
PFN_vkVoidFunction function = RenderCore::Get().vkGetDeviceProcAddr(static_cast<VkDevice>(context), name);
|
PFN_vkVoidFunction function = RenderCore::Get().vkGetDeviceProcAddr(static_cast<VkDevice>(context), name);
|
||||||
if(!function)
|
if(!function)
|
||||||
FatalError("Vulkan Loader: could not load '%'", name);
|
FatalError("Vulkan Loader: could not load '%'", name);
|
||||||
|
|||||||
Reference in New Issue
Block a user