add direct to display wsi swapchain option

direct to display swapchain needs to be enabled at compile time with option -DUSE_D2D_WSI=ON

currently tested under linux
This commit is contained in:
Shi Yan 2016-11-04 13:32:58 -07:00
parent 6f75370240
commit 9b5127f894
25 changed files with 262 additions and 45 deletions

View file

@ -12,6 +12,8 @@ include_directories(external/gli)
include_directories(external/assimp) include_directories(external/assimp)
include_directories(base) include_directories(base)
OPTION(USE_D2D_WSI "Build the project using debugging code" OFF)
IF(WIN32) IF(WIN32)
find_library(VULKAN_LIB NAMES vulkan-1 vulkan PATHS ${CMAKE_SOURCE_DIR}/libs/vulkan) find_library(VULKAN_LIB NAMES vulkan-1 vulkan PATHS ${CMAKE_SOURCE_DIR}/libs/vulkan)
find_library(ASSIMP_LIBRARIES NAMES assimp libassimp.dll.a PATHS ${CMAKE_SOURCE_DIR}/libs/assimp) find_library(ASSIMP_LIBRARIES NAMES assimp libassimp.dll.a PATHS ${CMAKE_SOURCE_DIR}/libs/assimp)
@ -19,9 +21,14 @@ IF(WIN32)
ELSE(WIN32) ELSE(WIN32)
find_library(VULKAN_LIB NAMES libvulkan.so PATHS ${CMAKE_SOURCE_DIR}/libs/vulkan) find_library(VULKAN_LIB NAMES libvulkan.so PATHS ${CMAKE_SOURCE_DIR}/libs/vulkan)
find_package(ASSIMP REQUIRED) find_package(ASSIMP REQUIRED)
find_package(XCB REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
IF(USE_D2D_WSI)
MESSAGE("Using direct to display extension...")
add_definitions(-D_DIRECT2DISPLAY)
ELSE(USE_D2D_WSI)
find_package(XCB REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_XCB_KHR") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_XCB_KHR")
ENDIF(USE_D2D_WSI)
# Todo : android? # Todo : android?
ENDIF(WIN32) ENDIF(WIN32)

View file

@ -25,6 +25,8 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation)
enabledExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME); enabledExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
enabledExtensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); enabledExtensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
#elif defined(_DIRECT2DISPLAY)
enabledExtensions.push_back(VK_KHR_DISPLAY_EXTENSION_NAME);
#elif defined(__linux__) #elif defined(__linux__)
enabledExtensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME); enabledExtensions.push_back(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
#endif #endif
@ -509,6 +511,43 @@ void VulkanExampleBase::renderLoop()
} }
} }
} }
#elif defined(_DIRECT2DISPLAY)
while (!quit)
{
auto tStart = std::chrono::high_resolution_clock::now();
if (viewUpdated)
{
viewUpdated = false;
viewChanged();
}
render();
frameCounter++;
auto tEnd = std::chrono::high_resolution_clock::now();
auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count();
frameTimer = tDiff / 1000.0f;
camera.update(frameTimer);
if (camera.moving())
{
viewUpdated = true;
}
// Convert to clamped timer value
if (!paused)
{
timer += timerSpeed * frameTimer;
if (timer > 1.0)
{
timer -= 1.0f;
}
}
fpsTimer += (float)tDiff;
if (fpsTimer > 1000.0f)
{
lastFPS = frameCounter;
updateTextOverlay();
fpsTimer = 0.0f;
frameCounter = 0;
}
}
#elif defined(__linux__) #elif defined(__linux__)
xcb_flush(connection); xcb_flush(connection);
while (!quit) while (!quit)
@ -654,6 +693,8 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation, PFN_GetEnabledFeatur
// Vulkan library is loaded dynamically on Android // Vulkan library is loaded dynamically on Android
bool libLoaded = loadVulkanLibrary(); bool libLoaded = loadVulkanLibrary();
assert(libLoaded); assert(libLoaded);
#elif defined(_DIRECT2DISPLAY)
#elif defined(__linux__) #elif defined(__linux__)
initxcbConnection(); initxcbConnection();
#endif #endif
@ -733,7 +774,9 @@ VulkanExampleBase::~VulkanExampleBase()
vkDestroyInstance(instance, nullptr); vkDestroyInstance(instance, nullptr);
#if defined(__linux) #if defined(_DIRECT2DISPLAY)
#elif defined(__linux)
#if defined(__ANDROID__) #if defined(__ANDROID__)
// todo : android cleanup (if required) // todo : android cleanup (if required)
#else #else
@ -1212,6 +1255,7 @@ void VulkanExampleBase::handleAppCommand(android_app * app, int32_t cmd)
break; break;
} }
} }
#elif defined(_DIRECT2DISPLAY)
#elif defined(__linux__) #elif defined(__linux__)
// Set up a window using XCB and request event types // Set up a window using XCB and request event types
xcb_window_t VulkanExampleBase::setupWindow() xcb_window_t VulkanExampleBase::setupWindow()
@ -1652,6 +1696,8 @@ void VulkanExampleBase::initSwapchain()
swapChain.initSurface(windowInstance, window); swapChain.initSurface(windowInstance, window);
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
swapChain.initSurface(androidApp->window); swapChain.initSurface(androidApp->window);
#elif defined(_DIRECT2DISPLAY)
swapChain.initSurface(width, height);
#elif defined(__linux__) #elif defined(__linux__)
swapChain.initSurface(connection, window); swapChain.initSurface(connection, window);
#endif #endif

View file

@ -392,6 +392,23 @@ void android_main(android_app* state) \
vulkanExample->renderLoop(); \ vulkanExample->renderLoop(); \
delete(vulkanExample); \ delete(vulkanExample); \
} }
#elif defined(_DIRECT2DISPLAY)
// Linux entry point with direct to display wsi
// todo: extract command line arguments
#define VULKAN_EXAMPLE_MAIN() \
VulkanExample *vulkanExample; \
static void handleEvent() \
{ \
} \
int main(const int argc, const char *argv[]) \
{ \
vulkanExample = new VulkanExample(); \
vulkanExample->initSwapchain(); \
vulkanExample->prepare(); \
vulkanExample->renderLoop(); \
delete(vulkanExample); \
return 0; \
}
#elif defined(__linux__) #elif defined(__linux__)
// Linux entry point // Linux entry point
// todo: extract command line arguments // todo: extract command line arguments

View file

@ -107,7 +107,11 @@ public:
#ifdef __ANDROID__ #ifdef __ANDROID__
ANativeWindow* window ANativeWindow* window
#else #else
xcb_connection_t* connection, xcb_window_t window #ifdef _DIRECT2DISPLAY
uint32_t width, uint32_t height
#else
xcb_connection_t* connection, xcb_window_t window
#endif
#endif #endif
#endif #endif
) )
@ -127,6 +131,9 @@ public:
surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
surfaceCreateInfo.window = window; surfaceCreateInfo.window = window;
err = vkCreateAndroidSurfaceKHR(instance, &surfaceCreateInfo, NULL, &surface); err = vkCreateAndroidSurfaceKHR(instance, &surfaceCreateInfo, NULL, &surface);
#else
#if defined(_DIRECT2DISPLAY)
createDirect2DisplaySurface(width, height);
#else #else
VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {}; VkXcbSurfaceCreateInfoKHR surfaceCreateInfo = {};
surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
@ -134,6 +141,7 @@ public:
surfaceCreateInfo.window = window; surfaceCreateInfo.window = window;
err = vkCreateXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface); err = vkCreateXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &surface);
#endif #endif
#endif
#endif #endif
// Get available queue family properties // Get available queue family properties
@ -480,4 +488,143 @@ public:
swapChain = VK_NULL_HANDLE; swapChain = VK_NULL_HANDLE;
} }
/**
* Create direct to display surface
*/
void createDirect2DisplaySurface(uint32_t width, uint32_t height)
{
uint32_t displayPropertyCount;
// Get display property
vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &displayPropertyCount, NULL);
VkDisplayPropertiesKHR* pDisplayProperties = new VkDisplayPropertiesKHR[displayPropertyCount];
vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &displayPropertyCount, pDisplayProperties);
// Get plane property
uint32_t planePropertyCount;
vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &planePropertyCount, NULL);
VkDisplayPlanePropertiesKHR* pPlaneProperties = new VkDisplayPlanePropertiesKHR[planePropertyCount];
vkGetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, &planePropertyCount, pPlaneProperties);
VkDisplayKHR display = VK_NULL_HANDLE;
VkDisplayModeKHR displayMode;
VkDisplayModePropertiesKHR* pModeProperties;
bool foundMode = false;
for(uint32_t i = 0; i < displayPropertyCount;++i)
{
display = pDisplayProperties[i].display;
uint32_t modeCount;
vkGetDisplayModePropertiesKHR(physicalDevice, display, &modeCount, NULL);
pModeProperties = new VkDisplayModePropertiesKHR[modeCount];
vkGetDisplayModePropertiesKHR(physicalDevice, display, &modeCount, pModeProperties);
for (uint32_t j = 0; j < modeCount; ++j)
{
const VkDisplayModePropertiesKHR* mode = &pModeProperties[j];
if (mode->parameters.visibleRegion.width == width && mode->parameters.visibleRegion.height == height)
{
displayMode = mode->displayMode;
foundMode = true;
break;
}
}
if (foundMode)
{
break;
}
delete [] pModeProperties;
}
if(!foundMode)
{
vkTools::exitFatal("Can't find a display and a display mode!", "Fatal error");
return;
}
// Search for a best plane we can use
uint32_t bestPlaneIndex = UINT32_MAX;
VkDisplayKHR* pDisplays = NULL;
for(uint32_t i = 0; i < planePropertyCount; i++)
{
uint32_t planeIndex=i;
uint32_t displayCount;
vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, &displayCount, NULL);
if (pDisplays)
{
delete [] pDisplays;
}
pDisplays = new VkDisplayKHR[displayCount];
vkGetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, &displayCount, pDisplays);
// Find a display that matches the current plane
bestPlaneIndex = UINT32_MAX;
for(uint32_t j = 0; j < displayCount; j++)
{
if(display == pDisplays[j])
{
bestPlaneIndex = i;
break;
}
}
if(bestPlaneIndex != UINT32_MAX)
{
break;
}
}
if(bestPlaneIndex == UINT32_MAX)
{
vkTools::exitFatal("Can't find a plane for displaying!", "Fatal error");
return;
}
VkDisplayPlaneCapabilitiesKHR planeCap;
vkGetDisplayPlaneCapabilitiesKHR(physicalDevice, displayMode, bestPlaneIndex, &planeCap);
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
if (planeCap.supportedAlpha & VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR)
{
alphaMode = VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR;
}
else if (planeCap.supportedAlpha & VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR)
{
alphaMode = VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR;
}
else
{
alphaMode = VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR;
}
VkDisplaySurfaceCreateInfoKHR surfaceInfo =
{
.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR,
.pNext = NULL,
.flags = 0,
.displayMode = displayMode,
.planeIndex = bestPlaneIndex,
.planeStackIndex = pPlaneProperties[bestPlaneIndex].currentStackIndex,
.transform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
.globalAlpha = 1.0,
.alphaMode = alphaMode,
.imageExtent =
{
width,
height,
}
};
VkResult result = vkCreateDisplayPlaneSurfaceKHR(instance, &surfaceInfo, NULL, &surface);
if(result !=VK_SUCCESS)
{
vkTools::exitFatal("Failed to create surface!", "Fatal error");
}
delete[] pDisplays;
delete[] pModeProperties;
delete[] pDisplayProperties;
delete[] pPlaneProperties;
}
}; };

View file

@ -1172,7 +1172,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -1208,7 +1208,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -603,7 +603,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -639,7 +639,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -751,7 +751,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -787,7 +787,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -383,7 +383,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -419,7 +419,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -506,7 +506,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -542,7 +542,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -608,7 +608,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -644,7 +644,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -642,7 +642,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -678,7 +678,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -657,7 +657,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -693,7 +693,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -623,7 +623,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -659,7 +659,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -799,7 +799,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -835,7 +835,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -482,7 +482,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -518,7 +518,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -489,7 +489,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -525,7 +525,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -888,7 +888,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -924,7 +924,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -1101,7 +1101,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -1137,7 +1137,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -500,7 +500,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -536,7 +536,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -990,7 +990,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -1026,7 +1026,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -609,7 +609,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -645,7 +645,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -1238,7 +1238,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -1274,7 +1274,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -703,7 +703,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -739,7 +739,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -788,7 +788,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != NULL) if (vulkanExample != NULL)
@ -824,7 +824,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)

View file

@ -1028,7 +1028,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return (DefWindowProc(hWnd, uMsg, wParam, lParam)); return (DefWindowProc(hWnd, uMsg, wParam, lParam));
} }
#elif defined(__linux__) && !defined(__ANDROID__) #elif defined(__linux__) && !defined(__ANDROID__) && !defined(_DIRECT2DISPLAY)
static void handleEvent(const xcb_generic_event_t *event) static void handleEvent(const xcb_generic_event_t *event)
{ {
if (vulkanExample != nullptr) if (vulkanExample != nullptr)
@ -1064,7 +1064,7 @@ int main(const int argc, const char *argv[])
state->onAppCmd = VulkanExample::handleAppCommand; state->onAppCmd = VulkanExample::handleAppCommand;
state->onInputEvent = VulkanExample::handleAppInput; state->onInputEvent = VulkanExample::handleAppInput;
vulkanExample->androidApp = state; vulkanExample->androidApp = state;
#elif defined(__linux__) #elif defined(__linux__) && !defined(_DIRECT2DISPLAY)
vulkanExample->setupWindow(); vulkanExample->setupWindow();
#endif #endif
#if !defined(__ANDROID__) #if !defined(__ANDROID__)