Skip to content

Commit d3dd8fb

Browse files
authored
Slightly better surface creation logic for Vulkan. (#3447)
1 parent a76903d commit d3dd8fb

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/renderer_vk.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7043,7 +7043,7 @@ VK_DESTROY
70437043
VkResult SwapChainVK::createSurface()
70447044
{
70457045
BGFX_PROFILER_SCOPE("SwapChainVK::createSurface", kColorFrame);
7046-
VkResult result = VK_ERROR_INITIALIZATION_FAILED;
7046+
VkResult result = VK_ERROR_EXTENSION_NOT_PRESENT;
70477047

70487048
const VkInstance instance = s_renderVK->m_instance;
70497049
const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
@@ -7077,20 +7077,22 @@ VK_DESTROY
70777077
}
70787078
#elif BX_PLATFORM_LINUX
70797079
{
7080-
if (g_platformData.type == bgfx::NativeWindowHandleType::Wayland
7081-
&& s_extension[Extension::KHR_wayland_surface].m_supported
7082-
&& NULL != vkCreateWaylandSurfaceKHR
7083-
)
7080+
if (g_platformData.type == bgfx::NativeWindowHandleType::Wayland)
70847081
{
7085-
BX_TRACE("Attempting Wayland surface creation.");
7086-
VkWaylandSurfaceCreateInfoKHR sci;
7087-
sci.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
7088-
sci.pNext = NULL;
7089-
sci.flags = 0;
7090-
sci.display = (wl_display*)g_platformData.ndt;
7091-
sci.surface = (wl_surface*)m_nwh;
7092-
result = vkCreateWaylandSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
7093-
BX_WARN(VK_SUCCESS == result, "vkCreateWaylandSurfaceKHR failed %d: %s.", result, getName(result) );
7082+
if (s_extension[Extension::KHR_wayland_surface].m_supported
7083+
&& NULL != vkCreateWaylandSurfaceKHR
7084+
)
7085+
{
7086+
BX_TRACE("Attempting Wayland surface creation.");
7087+
VkWaylandSurfaceCreateInfoKHR sci;
7088+
sci.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
7089+
sci.pNext = NULL;
7090+
sci.flags = 0;
7091+
sci.display = (wl_display*)g_platformData.ndt;
7092+
sci.surface = (wl_surface*)m_nwh;
7093+
result = vkCreateWaylandSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
7094+
BX_WARN(VK_SUCCESS == result, "vkCreateWaylandSurfaceKHR failed %d: %s.", result, getName(result) );
7095+
}
70947096
}
70957097
else
70967098
{

0 commit comments

Comments
 (0)