add headless surface extension
parent
efd42bdef7
commit
8a36a4d721
|
@ -48,28 +48,39 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation)
|
|||
appInfo.pEngineName = name.c_str();
|
||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||
|
||||
std::vector<const char*> instanceExtensions = { VK_KHR_SURFACE_EXTENSION_NAME };
|
||||
std::vector<const char*> instanceExtensions = { };
|
||||
|
||||
// Enable surface extensions depending on os
|
||||
if (settings.headless)
|
||||
{
|
||||
instanceExtensions.push_back("VK_EXT_headless_surface");
|
||||
}
|
||||
else
|
||||
{
|
||||
instanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
// Enable surface extensions depending on os
|
||||
#if defined(_WIN32)
|
||||
instanceExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
instanceExtensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
|
||||
#elif defined(_DIRECT2DISPLAY)
|
||||
instanceExtensions.push_back(VK_KHR_DISPLAY_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_DISPLAY_EXTENSION_NAME);
|
||||
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
instanceExtensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
||||
instanceExtensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
|
||||
#elif defined(VK_USE_PLATFORM_MACOS_MVK)
|
||||
instanceExtensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_MVK_MACOS_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
#if defined(VK_USE_PLATFORM_MACOS_MVK) && (VK_HEADER_VERSION >= 216)
|
||||
instanceExtensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
instanceExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
VkInstanceCreateInfo instanceCreateInfo = {};
|
||||
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instanceCreateInfo.pNext = NULL;
|
||||
|
@ -94,6 +105,8 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation)
|
|||
instanceCreateInfo.ppEnabledLayerNames = validationLayerNames.data();
|
||||
}
|
||||
return vkCreateInstance(&instanceCreateInfo, nullptr, &instance);
|
||||
|
||||
|
||||
}
|
||||
void VulkanExampleBase::prepare()
|
||||
{
|
||||
|
|
|
@ -117,6 +117,12 @@ public:
|
|||
bool fullscreen = false;
|
||||
bool vsync = false;
|
||||
bool multiSampling = true;
|
||||
bool rotateModel = true;
|
||||
bool enableSaveToImageSequeue = false;
|
||||
bool headless = false;
|
||||
uint32_t outputFrameCount = 50;
|
||||
bool takeScreenShot = false;
|
||||
|
||||
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT;
|
||||
} settings;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ function(buildHomework HOMEWORK_NAME)
|
|||
"render/glTFModel.h"
|
||||
"render/glTFModel.cpp"
|
||||
|
||||
)
|
||||
"render/renderFoundation.h" "render/renderFoundation.cpp")
|
||||
target_link_libraries(${HOMEWORK_NAME} base ${Vulkan_LIBRARY} ${WINLIBS})
|
||||
else(WIN32)
|
||||
add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
|
||||
|
|
|
@ -216,18 +216,7 @@ public:
|
|||
VkDescriptorSet tonemappingDescriptorSet = VK_NULL_HANDLE;
|
||||
};
|
||||
|
||||
struct Settings {
|
||||
bool validation = true;
|
||||
bool fullscreen = false;
|
||||
bool vsync = false;
|
||||
bool multiSampling = true;
|
||||
bool rotateModel = true;
|
||||
bool enableSaveToImageSequeue = false;
|
||||
uint32_t outputFrameCount = 50;
|
||||
bool takeScreenShot = false;
|
||||
|
||||
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT;
|
||||
} settings;
|
||||
|
||||
struct DescriptorSetLayouts {
|
||||
VkDescriptorSetLayout scene;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#pragma once
|
Loading…
Reference in New Issue