diff options
Diffstat (limited to 'initgfx.cc')
-rw-r--r-- | initgfx.cc | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,12 +1,12 @@ # include <luma/main.hh> -# include <cstdint> -# include <string> # include <vulkan/vulkan.h> # include <wayland-client.h> # include <xcb/xcb.h> void luma::initgfx() { luma::dat.gfxisinit = true; - if constexpr(luma::usex == 0x1) { + // Determine if X should be used or if Wayland is da way. + luma::setdispsrvproto(); + if(luma::dat.dispsrvproto == luma::dispsrvproto_t::x) { luma::dbgmsg("Creating X connection... "); luma::dat.xconn = xcb_connect(nullptr,nullptr); luma::dat.xscrn = xcb_setup_roots_iterator(xcb_get_setup(luma::dat.xconn)).data; @@ -23,6 +23,7 @@ void luma::initgfx() { luma::dbgmsg("O.K.\n"); } } + // Set data required by Vulkan. luma::dat.vkappinf.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; luma::dat.vkappinf.pApplicationName = "Luma Standard Library"; luma::dat.vkappinf.pEngineName = "Luma Standard Library"; @@ -31,7 +32,7 @@ void luma::initgfx() { luma::dat.vkinstcrtinf.enabledLayerCount = 0x0; luma::dbgmsg("Creating Vulkan instance... "); luma::dat.vkreslt = vkCreateInstance(&luma::dat.vkinstcrtinf,nullptr,&luma::dat.vkinst); - if((luma::dat.vkreslt != VK_SUCCESS)) { + if(luma::dat.vkreslt != VK_SUCCESS) { luma::dbgmsg("Error\n"); } else { @@ -40,12 +41,12 @@ void luma::initgfx() { std::uint32_t extcount = 0x0; luma::dat.vkexts = std::vector<VkExtensionProperties>(extcount); ::vkEnumerateInstanceExtensionProperties(nullptr,&extcount,luma::dat.vkexts.data()); - luma::dbgmsg(std::basic_string<char> {std::to_string(extcount) + " Vulkan extensions supported.\n"s}.c_str()); + luma::dbgmsg(std::basic_string<char> {std::to_string(extcount) + " Vulkan extensions supported.\n"}.c_str()); luma::dbgmsg("The following Vulkan extensions are supported:\n"); for(auto const & ext : luma::dat.vkexts) { luma::dbgmsg(ext.extensionName); } std::uint32_t devcount = 0x0; ::vkEnumeratePhysicalDevices(luma::dat.vkinst,&devcount,luma::dat.vkphysdevs.data()); - luma::dbgmsg(std::basic_string<char> {std::to_string(devcount) + " Vulkan-compatible device(s) found.\n"s}.c_str()); + luma::dbgmsg(std::basic_string<char> {std::to_string(devcount) + " Vulkan-compatible device(s) found.\n"}.c_str()); } |