| 1 | #cxx . . $ `<file>/nv_vulkan_wrapper.cpp`/include <vulkan.h> |
| 2 | #include <dlfcn.h> |
| 3 | |
| 4 | #include <GL/glx.h> |
| 5 | |
| 6 | #include <string> |
| 7 | #include <memory> |
| 8 | #include <iostream> |
| 9 | #include <functional> |
| 10 | |
| 11 | extern "C" VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! VkResult VKAPI_CALLcxx . . $ `<external>/12100432684025345130/vk_platform.h:57:13`! vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion); |
| 12 | |
| 13 | |
| 14 | #ifndef NV_DRIVER_PATH |
| 15 | #define NV_DRIVER_PATHcxx . . $ `nv_vulkan_wrapper.cpp:15:9`! "/usr/lib/x86_64-linux-gnu/nvidia/libGL.so.1:libGLX_nvidia.so.0" |
| 16 | #endif |
| 17 | #ifndef NV_BUMBLEBEE_DISPLAY |
| 18 | #define NV_BUMBLEBEE_DISPLAYcxx . . $ `nv_vulkan_wrapper.cpp:18:9`! ":8" |
| 19 | #endif |
| 20 | |
| 21 | typedef void* dlsym_fncxx . . $ dlsym_fn#(void *, const char*); |
| 22 | |
| 23 | #define GLX_CONTEXT_MAJOR_VERSION_ARBcxx . . $ `nv_vulkan_wrapper.cpp:23:9`! 0x2091 |
| 24 | #define GLX_CONTEXT_MINOR_VERSION_ARBcxx . . $ `nv_vulkan_wrapper.cpp:24:9`! 0x2092 |
| 25 | typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROCcxx . . $ GLXCREATECONTEXTATTRIBSARBPROC#)(Displaycxx . . $ Display#*, GLXFBConfig, GLXContext, Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`!, const int*); |
| 26 | |
| 27 | typedef void *(*getproccxx . . $ getproc# )(const char* name); |
| 28 | |
| 29 | class BBGLXContextcxx . . $ BBGLXContext# { |
| 30 | public: |
| 31 | Displaycxx . . $ Display# *dpycxx . . $ BBGLXContext#dpy.; |
| 32 | Windowcxx . . $ Window# wincxx . . $ BBGLXContext#win.; |
| 33 | GLXContext ctxcxx . . $ BBGLXContext#ctx.; |
| 34 | public: |
| 35 | BBGLXContextcxx . . $ BBGLXContext#BBGLXContext(ced63f7c635d850d).() = default; |
| 36 | BBGLXContextcxx . . $ BBGLXContext#BBGLXContext(8a9373e84bc8e5a8).(const BBGLXContextcxx . . $ BBGLXContext# ©) = delete; |
| 37 | BBGLXContextcxx . . $ BBGLXContext#BBGLXContext(85c52e162fed56f9).(const char* display){ |
| 38 | dpycxx . . $ BBGLXContext#dpy. = XOpenDisplay(display); |
| 39 | if(!dpycxx . . $ BBGLXContext#dpy.){ |
| 40 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Can't open bumblebee display.\n"; |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | int nelements; |
| 45 | GLXFBConfig *fbc = glXChooseFBConfig(dpycxx . . $ BBGLXContext#dpy., DefaultScreencxx . . $ `<external>/7073035915403465041/Xlib.h:89:9`!(dpy), 0, &nelements); |
| 46 | static int attributeList[] = { GLX_RGBAcxx . . $ `<external>/4496914429062116541/glx.h:60:9`!, GLX_DOUBLEBUFFERcxx . . $ `<external>/4496914429062116541/glx.h:61:9`!, GLX_RED_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:64:9`!, 1, GLX_GREEN_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:65:9`!, 1, GLX_BLUE_SIZEcxx . . $ `<external>/4496914429062116541/glx.h:66:9`!, 1, Nonecxx . . $ `<external>/1208737181511191802/X.h:115:9`! }; |
| 47 | XVisualInfocxx . . $ XVisualInfo# *vi = glXChooseVisual(dpycxx . . $ BBGLXContext#dpy., DefaultScreencxx . . $ `<external>/7073035915403465041/Xlib.h:89:9`!(dpy),attributeList); |
| 48 | |
| 49 | XSetWindowAttributescxx . . $ XSetWindowAttributes# swa; |
| 50 | swa.colormapcxx . . $ $anonymous_type_17d7f07cf933eea7_7#colormap. = XCreateColormap(dpycxx . . $ BBGLXContext#dpy., RootWindowcxx . . $ `<external>/7073035915403465041/Xlib.h:88:9`!(dpy, vi->screen), vi->visualcxx . . $ $anonymous_type_c787e362e16f063b_7#visual., AllocNonecxx . . $ `<external>/1208737181511191802/X.h:616:9`!); |
| 51 | swa.border_pixelcxx . . $ $anonymous_type_17d7f07cf933eea7_7#border_pixel. = 0; |
| 52 | swa.event_maskcxx . . $ $anonymous_type_17d7f07cf933eea7_7#event_mask. = StructureNotifyMaskcxx . . $ `<external>/1208737181511191802/X.h:168:9`!; |
| 53 | wincxx . . $ BBGLXContext#win. = XCreateWindow(dpycxx . . $ BBGLXContext#dpy., RootWindowcxx . . $ `<external>/7073035915403465041/Xlib.h:88:9`!(dpy, vi->screen), 0, 0, 100, 100, 0, vi->depthcxx . . $ $anonymous_type_c787e362e16f063b_7#depth., InputOutputcxx . . $ `<external>/1208737181511191802/X.h:387:9`!, vi->visualcxx . . $ $anonymous_type_c787e362e16f063b_7#visual., CWBorderPixelcxx . . $ `<external>/1208737181511191802/X.h:395:9`!|CWColormapcxx . . $ `<external>/1208737181511191802/X.h:405:9`!|CWEventMaskcxx . . $ `<external>/1208737181511191802/X.h:403:9`!, &swa); |
| 54 | XFree(vi); |
| 55 | |
| 56 | GLXCREATECONTEXTATTRIBSARBPROCcxx . . $ GLXCREATECONTEXTATTRIBSARBPROC# pfn_glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROCcxx . . $ GLXCREATECONTEXTATTRIBSARBPROC#) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); |
| 57 | |
| 58 | int attribs[] = { |
| 59 | GLX_CONTEXT_MAJOR_VERSION_ARBcxx . . $ `nv_vulkan_wrapper.cpp:23:9`!, 3, |
| 60 | GLX_CONTEXT_MINOR_VERSION_ARBcxx . . $ `nv_vulkan_wrapper.cpp:24:9`!, 0, |
| 61 | 0}; |
| 62 | ctxcxx . . $ BBGLXContext#ctx. = pfn_glXCreateContextAttribsARB(dpycxx . . $ BBGLXContext#dpy., *fbc, 0, true, attribs); |
| 63 | XFree(fbc); |
| 64 | } |
| 65 | ~cxx . . $ BBGLXContext#`~BBGLXContext`(ced63f7c635d850d).BBGLXContextcxx . . $ BBGLXContext#() { |
| 66 | if(dpycxx . . $ BBGLXContext#dpy. != nullptr) { |
| 67 | glXDestroyContext(dpycxx . . $ BBGLXContext#dpy., ctxcxx . . $ BBGLXContext#ctx.); |
| 68 | XDestroyWindow(dpycxx . . $ BBGLXContext#dpy., wincxx . . $ BBGLXContext#win.); |
| 69 | XCloseDisplay(dpycxx . . $ BBGLXContext#dpy.); |
| 70 | } |
| 71 | } |
| 72 | BBGLXContextcxx . . $ BBGLXContext#& operatorcxx . . $ BBGLXContext#`operator=`(cdd3499b3743034d).=(BBGLXContextcxx . . $ BBGLXContext#&& other) noexcept { |
| 73 | dpycxx . . $ BBGLXContext#dpy. = other.dpycxx . . $ BBGLXContext#dpy.; |
| 74 | wincxx . . $ BBGLXContext#win. = other.wincxx . . $ BBGLXContext#win.; |
| 75 | ctxcxx . . $ BBGLXContext#ctx. = other.ctxcxx . . $ BBGLXContext#ctx.; |
| 76 | other.dpycxx . . $ BBGLXContext#dpy. = nullptr; |
| 77 | return *this; |
| 78 | } |
| 79 | bool isValidcxx . . $ BBGLXContext#isValid(c9857a73d68e59ba).(){ |
| 80 | return dpycxx . . $ BBGLXContext#dpy. != nullptr; |
| 81 | } |
| 82 | static void deletercxx . . $ BBGLXContext#deleter(11b0e290e57a7e53).(int *){ |
| 83 | } |
| 84 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<void, stdcxx . . $ std/::functioncxx . . $ std/function#<void(void*)>> makeCurrentcxx . . $ BBGLXContext#makeCurrent(4d1d2b7d0a0eba1c).(){ |
| 85 | glXMakeCurrent (dpycxx . . $ BBGLXContext#dpy., wincxx . . $ BBGLXContext#win., ctxcxx . . $ BBGLXContext#ctx.); |
| 86 | return stdcxx . . $ std/unique_ptr#unique_ptr(301a195fca954409).::unique_ptrcxx . . $ std/unique_ptr#<void, stdcxx . . $ std/::functioncxx . . $ std/function#<void(void*)>>(this, [cxx . . $ std/function#function(bdc3712e480e4d04).this](void *p){ |
| 87 | glXMakeCurrent (dpycxx . . $ BBGLXContext#dpy., 0, 0); |
| 88 | }); |
| 89 | } |
| 90 | }; |
| 91 | class VulkanIcdcxx . . $ VulkanIcd# { |
| 92 | protected: |
| 93 | VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! PFN_vkVoidFunction (*instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr.) (VkInstance instance, |
| 94 | const char* pName) = nullptr; |
| 95 | VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! PFN_vkVoidFunction (*phyProcAddrcxx . . $ VulkanIcd#phyProcAddr.) (VkInstance instance, |
| 96 | const char* pName) = nullptr; |
| 97 | VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! VkResult VKAPI_CALLcxx . . $ `<external>/12100432684025345130/vk_platform.h:57:13`! (*negotiateVersioncxx . . $ VulkanIcd#negotiateVersion.)(uint32_t* pSupportedVersion) = nullptr; |
| 98 | public: |
| 99 | VulkanIcdcxx . . $ VulkanIcd#VulkanIcd(ced63f7c635d850d).() = default; |
| 100 | virtual ~cxx . . $ VulkanIcd#`~VulkanIcd`(ced63f7c635d850d).VulkanIcdcxx . . $ VulkanIcd#() = default; |
| 101 | virtual PFN_vkVoidFunction vk_icdGetInstanceProcAddrcxx . . $ VulkanIcd#vk_icdGetInstanceProcAddr(548f0cd88e4f79b1).( |
| 102 | VkInstance instance, |
| 103 | const char* pName){ |
| 104 | return instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr.(instance, pName); |
| 105 | } |
| 106 | virtual PFN_vkVoidFunction vk_icdGetPhysicalDeviceProcAddrcxx . . $ VulkanIcd#vk_icdGetPhysicalDeviceProcAddr(548f0cd88e4f79b1).(VkInstance instance, |
| 107 | const char* pName) { |
| 108 | return phyProcAddrcxx . . $ VulkanIcd#phyProcAddr.(instance, pName); |
| 109 | } |
| 110 | virtual VkResult vk_icdNegotiateLoaderICDInterfaceVersioncxx . . $ VulkanIcd#vk_icdNegotiateLoaderICDInterfaceVersion(550863150dfdd8b9).(uint32_t* pSupportedVersion) { |
| 111 | return negotiateVersioncxx . . $ VulkanIcd#negotiateVersion.(pSupportedVersion); |
| 112 | } |
| 113 | |
| 114 | }; |
| 115 | class ExternalVulkanIcdcxx . . $ ExternalVulkanIcd#: public VulkanIcdcxx . . $ VulkanIcd# { |
| 116 | void *libnvcxx . . $ ExternalVulkanIcd#libnv.; |
| 117 | public: |
| 118 | ExternalVulkanIcdcxx . . $ ExternalVulkanIcd#ExternalVulkanIcd(49f6e7a06ebc5aa8).(){ |
| 119 | libnvcxx . . $ ExternalVulkanIcd#libnv. = dlopen("libGLX_nvidia.so.0", RTLD_LOCALcxx . . $ `<external>/10632388298615623587/dlfcn.h:38:9`! | RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`!); |
| 120 | auto fn2 = [this](const char* name) { |
| 121 | return (void *) dlsym(this->libnvcxx . . $ ExternalVulkanIcd#libnv., name); |
| 122 | }; |
| 123 | instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr. = (decltype(instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr.)) fn2(cxx . . $ ExternalVulkanIcd#ExternalVulkanIcd(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(2568cf0eab96bdcb)."vk_icdGetInstanceProcAddr"); |
| 124 | phyProcAddrcxx . . $ VulkanIcd#phyProcAddr. = (decltype(phyProcAddrcxx . . $ VulkanIcd#phyProcAddr.)) fn2(cxx . . $ ExternalVulkanIcd#ExternalVulkanIcd(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(2568cf0eab96bdcb)."vk_icdGetPhysicalDeviceProcAddr"); |
| 125 | negotiateVersioncxx . . $ VulkanIcd#negotiateVersion. = (decltype(negotiateVersioncxx . . $ VulkanIcd#negotiateVersion.)) fn2(cxx . . $ ExternalVulkanIcd#ExternalVulkanIcd(49f6e7a06ebc5aa8).$anonymous_type_0#`operator()`(2568cf0eab96bdcb)."vk_icdNegotiateLoaderICDInterfaceVersion"); |
| 126 | } |
| 127 | ~cxx . . $ ExternalVulkanIcd#`~ExternalVulkanIcd`(ced63f7c635d850d).ExternalVulkanIcdcxx . . $ ExternalVulkanIcd#(){ |
| 128 | dlclose(libnvcxx . . $ ExternalVulkanIcd#libnv.); |
| 129 | } |
| 130 | VkResult vk_icdNegotiateLoaderICDInterfaceVersioncxx . . $ ExternalVulkanIcd#vk_icdNegotiateLoaderICDInterfaceVersion(550863150dfdd8b9).(uint32_t* pSupportedVersion) { |
| 131 | char *prev = getenv("DISPLAY"); |
| 132 | stdcxx . . $ std/::stringcxx . . $ std/string# oldcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).{prev}; |
| 133 | setenv("DISPLAY", NV_BUMBLEBEE_DISPLAYcxx . . $ `nv_vulkan_wrapper.cpp:18:9`!, 1); |
| 134 | auto res = negotiateVersioncxx . . $ VulkanIcd#negotiateVersion.(pSupportedVersion); |
| 135 | setenv("DISPLAY",old.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), 1); |
| 136 | return res; |
| 137 | } |
| 138 | }; |
| 139 | PFN_vkVoidFunction getOverrideFncxx . . $ getOverrideFn(3efb40c7f910a1d9).(const char *pName); |
| 140 | class InternalVulkanIcdcxx . . $ InternalVulkanIcd#: public VulkanIcdcxx . . $ VulkanIcd# { |
| 141 | public: |
| 142 | PFN_vkGetDeviceProcAddr getDeviceProcAddrcxx . . $ InternalVulkanIcd#getDeviceProcAddr.; |
| 143 | |
| 144 | PFN_vkCreateInstance createInstancecxx . . $ InternalVulkanIcd#createInstance.; |
| 145 | PFN_vkDestroyInstance destroyInstancecxx . . $ InternalVulkanIcd#destroyInstance.; |
| 146 | PFN_vkCreateDevice createDevicecxx . . $ InternalVulkanIcd#createDevice.; |
| 147 | PFN_vkDestroyDevice destroyDevicecxx . . $ InternalVulkanIcd#destroyDevice.; |
| 148 | PFN_vkGetDeviceQueue getDeviceQueuecxx . . $ InternalVulkanIcd#getDeviceQueue.; |
| 149 | PFN_vkCreateSwapchainKHR createSwapchainKHRcxx . . $ InternalVulkanIcd#createSwapchainKHR.; |
| 150 | PFN_vkDestroySwapchainKHR destroySwapchainKHRcxx . . $ InternalVulkanIcd#destroySwapchainKHR.; |
| 151 | PFN_vkQueuePresentKHR queuePresentKHRcxx . . $ InternalVulkanIcd#queuePresentKHR.; |
| 152 | PFN_vkQueueSubmit queueSubmitcxx . . $ InternalVulkanIcd#queueSubmit.; |
| 153 | //PFN_vkAllocateMemory; |
| 154 | //PFN_vkBindBufferMemory |
| 155 | //PFN_vkBindImageMemory; |
| 156 | //PFN_vkAcquireNextImageKHR; |
| 157 | public: |
| 158 | InternalVulkanIcdcxx . . $ InternalVulkanIcd#InternalVulkanIcd(c6659b4fa10623b7).(BBGLXContextcxx . . $ BBGLXContext# &glx){ |
| 159 | auto guard = glx.makeCurrentcxx . . $ BBGLXContext#makeCurrent(4d1d2b7d0a0eba1c).(); |
| 160 | getproccxx . . $ getproc# fn2 = (getproccxx . . $ getproc#) glXGetProcAddress((const GLubyte*) "glGetVkProcAddrNV"); |
| 161 | // getproc fn2 = (getproc) glXGetProcAddress((const GLubyte*) "ex7991765ed"); |
| 162 | void *glfn = fn2("vk_icdGetInstanceProcAddr"); |
| 163 | |
| 164 | instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr. = (decltype(instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr.)) fn2("vk_icdGetInstanceProcAddr"); |
| 165 | phyProcAddrcxx . . $ VulkanIcd#phyProcAddr. = (decltype(phyProcAddrcxx . . $ VulkanIcd#phyProcAddr.)) fn2("vk_icdGetPhysicalDeviceProcAddr"); |
| 166 | negotiateVersioncxx . . $ VulkanIcd#negotiateVersion. = (decltype(negotiateVersioncxx . . $ VulkanIcd#negotiateVersion.)) fn2("vk_icdNegotiateLoaderICDInterfaceVersion"); |
| 167 | |
| 168 | createInstancecxx . . $ InternalVulkanIcd#createInstance. = (decltype(createInstancecxx . . $ InternalVulkanIcd#createInstance.)) fn2("vkCreateInstance"); |
| 169 | destroyInstancecxx . . $ InternalVulkanIcd#destroyInstance. = (decltype(destroyInstancecxx . . $ InternalVulkanIcd#destroyInstance.)) fn2("vkDestroyInstance"); |
| 170 | createDevicecxx . . $ InternalVulkanIcd#createDevice. = (decltype(createDevicecxx . . $ InternalVulkanIcd#createDevice.)) fn2("vkCreateDevice"); |
| 171 | destroyDevicecxx . . $ InternalVulkanIcd#destroyDevice. = (decltype(destroyDevicecxx . . $ InternalVulkanIcd#destroyDevice.)) fn2("vkDestroyDevice"); |
| 172 | getDeviceProcAddrcxx . . $ InternalVulkanIcd#getDeviceProcAddr. = (decltype(getDeviceProcAddrcxx . . $ InternalVulkanIcd#getDeviceProcAddr.)) fn2("vkGetDeviceProcAddr"); |
| 173 | getDeviceQueuecxx . . $ InternalVulkanIcd#getDeviceQueue. = (decltype(getDeviceQueuecxx . . $ InternalVulkanIcd#getDeviceQueue.)) fn2("vkGetDeviceQueue"); |
| 174 | createSwapchainKHRcxx . . $ InternalVulkanIcd#createSwapchainKHR. = (decltype(createSwapchainKHRcxx . . $ InternalVulkanIcd#createSwapchainKHR.)) fn2("vkCreateSwapchainKHR"); |
| 175 | destroySwapchainKHRcxx . . $ InternalVulkanIcd#destroySwapchainKHR. = (decltype(destroySwapchainKHRcxx . . $ InternalVulkanIcd#destroySwapchainKHR.)) fn2("vkDestroySwapchainKHR"); |
| 176 | queuePresentKHRcxx . . $ InternalVulkanIcd#queuePresentKHR. = (decltype(queuePresentKHRcxx . . $ InternalVulkanIcd#queuePresentKHR.)) fn2("vkQueuePresentKHR"); |
| 177 | queueSubmitcxx . . $ InternalVulkanIcd#queueSubmit. = (decltype(queueSubmitcxx . . $ InternalVulkanIcd#queueSubmit.)) fn2("vkQueueSubmit"); |
| 178 | } |
| 179 | virtual PFN_vkVoidFunction vk_icdGetInstanceProcAddrcxx . . $ InternalVulkanIcd#vk_icdGetInstanceProcAddr(548f0cd88e4f79b1).( |
| 180 | VkInstance instance, |
| 181 | const char* pName){ |
| 182 | auto internalFn = instanceProcAddrcxx . . $ VulkanIcd#instanceProcAddr.(instance, pName); |
| 183 | if(internalFn != nullptr){ |
| 184 | auto overrideFnc = getOverrideFncxx . . $ getOverrideFn(3efb40c7f910a1d9).(pName); |
| 185 | if(overrideFnc != nullptr){ |
| 186 | return overrideFnc; |
| 187 | } |
| 188 | } |
| 189 | return internalFn; |
| 190 | } |
| 191 | VkResult vk_icdNegotiateLoaderICDInterfaceVersioncxx . . $ InternalVulkanIcd#vk_icdNegotiateLoaderICDInterfaceVersion(550863150dfdd8b9).(uint32_t* pSupportedVersion) { |
| 192 | return VulkanIcdcxx . . $ VulkanIcd#::vk_icdNegotiateLoaderICDInterfaceVersioncxx . . $ VulkanIcd#vk_icdNegotiateLoaderICDInterfaceVersion(550863150dfdd8b9).(pSupportedVersion); |
| 193 | } |
| 194 | |
| 195 | }; |
| 196 | |
| 197 | class StaticInitializecxx . . $ StaticInitialize# { |
| 198 | void *nvDrivercxx . . $ StaticInitialize#nvDriver.; |
| 199 | void *glLibGLcxx . . $ StaticInitialize#glLibGL.; |
| 200 | public: |
| 201 | BBGLXContextcxx . . $ BBGLXContext# glxcxx . . $ StaticInitialize#glx.; |
| 202 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<VulkanIcdcxx . . $ VulkanIcd#> icdcxx . . $ StaticInitialize#icd.; |
| 203 | |
| 204 | public: |
| 205 | StaticInitializecxx . . $ StaticInitialize#StaticInitialize(49f6e7a06ebc5aa8).(){ |
| 206 | // Load libGL from LD_LIBRARY_PATH before loading the NV-driver (unluckily also named libGL |
| 207 | // This ensures that ld.so will find this libGL before the Nvidia one, when |
| 208 | // again asked to load libGL. |
| 209 | glLibGLcxx . . $ StaticInitialize#glLibGL. = dlopen("libGL.so.1", RTLD_GLOBALcxx . . $ `<external>/10632388298615623587/dlfcn.h:33:9`! | RTLD_NOWcxx . . $ `<external>/10632388298615623587/dlfcn.h:25:9`!); |
| 210 | glxcxx . . $ StaticInitialize#glx. =cxx . . $ BBGLXContext#`operator=`(cdd3499b3743034d). BBGLXContextcxx . . $ BBGLXContext#(NV_BUMBLEBEE_DISPLAYcxx . . $ `nv_vulkan_wrapper.cpp:18:9`!); |
| 211 | if(!glxcxx . . $ StaticInitialize#glx..isValidcxx . . $ BBGLXContext#isValid(c9857a73d68e59ba).()){ |
| 212 | return; |
| 213 | } |
| 214 | // icd = std::unique_ptr<ExternalVulkanIcd>(new ExternalVulkanIcd()); |
| 215 | icdcxx . . $ StaticInitialize#icd. =cxx . . $ std/unique_ptr#`operator=`(274635e25750a47f). stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<InternalVulkanIcdcxx . . $ InternalVulkanIcd#>(new InternalVulkanIcdcxx . . $ InternalVulkanIcd#(glxcxx . . $ StaticInitialize#glx.)); |
| 216 | |
| 217 | } |
| 218 | ~cxx . . $ StaticInitialize#`~StaticInitialize`(ced63f7c635d850d).StaticInitializecxx . . $ StaticInitialize#(){ |
| 219 | dlclose(glLibGLcxx . . $ StaticInitialize#glLibGL.); |
| 220 | } |
| 221 | bool IsInitedcxx . . $ StaticInitialize#IsInited(c9857a73d68e59ba).(){ |
| 222 | return icdcxx . . $ StaticInitialize#icd. !=cxx . . $ std/`operator!=`(e445595a98297a59). nullptr; |
| 223 | } |
| 224 | InternalVulkanIcdcxx . . $ InternalVulkanIcd# &internalcxx . . $ StaticInitialize#internal(10481f6bafb83272).(){ |
| 225 | return *reinterpret_cast<InternalVulkanIcdcxx . . $ InternalVulkanIcd#*>(icdcxx . . $ StaticInitialize#icd..getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()); |
| 226 | } |
| 227 | }; |
| 228 | |
| 229 | StaticInitializecxx . . $ StaticInitialize# initcxx . . $ init.; |
| 230 | |
| 231 | template<typename PFN, PFN InternalVulkanIcdcxx . . $ InternalVulkanIcd#::*p, typename... Args> |
| 232 | VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! auto VKAPI_CALLcxx . . $ `<external>/12100432684025345130/vk_platform.h:57:13`! forwardcxx . . $ forward(2a5a2e1cf9882da6).(Args... args) -> decltype((initcxx . . $ init..internalcxx . . $ StaticInitialize#internal(10481f6bafb83272).().*p)(args...)) { |
| 233 | auto guard = initcxx . . $ init..glxcxx . . $ StaticInitialize#glx..makeCurrentcxx . . $ BBGLXContext#makeCurrent(4d1d2b7d0a0eba1c).(); |
| 234 | return (initcxx . . $ init..internalcxx . . $ StaticInitialize#internal(10481f6bafb83272).().*p)(args...); |
| 235 | } |
| 236 | |
| 237 | template<auto p, typename PFN = typename stdcxx . . $ std/::remove_reference<decltype(init.internal().*p)>::type> |
| 238 | auto forwardercxx . . $ forwarder(ec908ef952b256c2).() -> PFN { |
| 239 | return &forwardcxx . . $ forward(2a5a2e1cf9882da6).<PFN, p>; |
| 240 | } |
| 241 | PFN_vkVoidFunction vk_GetDeviceProcAddrcxx . . $ vk_GetDeviceProcAddr(29d0f37f971a0e47).( |
| 242 | VkDevice device, |
| 243 | const char* pName){ |
| 244 | auto ret = initcxx . . $ init..internalcxx . . $ StaticInitialize#internal(10481f6bafb83272).().getDeviceProcAddrcxx . . $ InternalVulkanIcd#getDeviceProcAddr.(device, pName); |
| 245 | if(ret != nullptr){ |
| 246 | auto r2 = getOverrideFncxx . . $ getOverrideFn(3efb40c7f910a1d9).(pName); |
| 247 | if(r2 != nullptr){ |
| 248 | return r2; |
| 249 | } |
| 250 | } |
| 251 | return ret; |
| 252 | } |
| 253 | |
| 254 | extern "C" VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! PFN_vkVoidFunction VKAPI_CALLcxx . . $ `<external>/12100432684025345130/vk_platform.h:57:13`! vk_icdGetInstanceProcAddr( |
| 255 | VkInstance instance, |
| 256 | const char* pName){ |
| 257 | if (!initcxx . . $ init..IsInitedcxx . . $ StaticInitialize#IsInited(c9857a73d68e59ba).()) return nullptr; |
| 258 | return initcxx . . $ init..icdcxx . . $ StaticInitialize#icd.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).vk_icdGetInstanceProcAddrcxx . . $ VulkanIcd#vk_icdGetInstanceProcAddr(548f0cd88e4f79b1).(instance, pName); |
| 259 | } |
| 260 | |
| 261 | PFN_vkVoidFunction getOverrideFncxx . . $ getOverrideFn(3efb40c7f910a1d9).(const char *pName){ |
| 262 | stdcxx . . $ std/::stringcxx . . $ std/string# name = pNamecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 263 | if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkGetInstanceProcAddr") { |
| 264 | return (PFN_vkVoidFunction) vk_icdGetInstanceProcAddr; |
| 265 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkGetDeviceProcAddr") { |
| 266 | return (PFN_vkVoidFunction) vk_GetDeviceProcAddrcxx . . $ vk_GetDeviceProcAddr(29d0f37f971a0e47).; |
| 267 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkCreateInstance") { |
| 268 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::createInstancecxx . . $ InternalVulkanIcd#createInstance.>(); |
| 269 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkDestroyInstance") { |
| 270 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::destroyInstancecxx . . $ InternalVulkanIcd#destroyInstance.>(); |
| 271 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkCreateDevice") { |
| 272 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::createDevicecxx . . $ InternalVulkanIcd#createDevice.>(); |
| 273 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkDestroyDevice") { |
| 274 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::destroyDevicecxx . . $ InternalVulkanIcd#destroyDevice.>(); |
| 275 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkGetDeviceQueue") { |
| 276 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::getDeviceQueuecxx . . $ InternalVulkanIcd#getDeviceQueue.>(); |
| 277 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkCreateSwapchainKHR") { |
| 278 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::createSwapchainKHRcxx . . $ InternalVulkanIcd#createSwapchainKHR.>(); |
| 279 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkDestroySwapchainKHR") { |
| 280 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::destroySwapchainKHRcxx . . $ InternalVulkanIcd#destroySwapchainKHR.>(); |
| 281 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkQueuePresentKHR") { |
| 282 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::queuePresentKHRcxx . . $ InternalVulkanIcd#queuePresentKHR.>(); |
| 283 | }else if(name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "vkQueueSubmit") { |
| 284 | return (PFN_vkVoidFunction) forwardercxx . . $ forwarder(ec908ef952b256c2).<&InternalVulkanIcdcxx . . $ InternalVulkanIcd#::queueSubmitcxx . . $ InternalVulkanIcd#queueSubmit.>(); |
| 285 | } |
| 286 | return nullptr; |
| 287 | } |
| 288 | |
| 289 | extern "C" VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! PFN_vkVoidFunction vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, |
| 290 | const char* pName){ |
| 291 | if (!initcxx . . $ init..IsInitedcxx . . $ StaticInitialize#IsInited(c9857a73d68e59ba).()) return nullptr; |
| 292 | return initcxx . . $ init..icdcxx . . $ StaticInitialize#icd.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).vk_icdGetPhysicalDeviceProcAddrcxx . . $ VulkanIcd#vk_icdGetPhysicalDeviceProcAddr(548f0cd88e4f79b1).(instance, pName); |
| 293 | } |
| 294 | extern "C" VKAPI_ATTRcxx . . $ `<external>/12100432684025345130/vk_platform.h:56:13`! VkResult VKAPI_CALLcxx . . $ `<external>/12100432684025345130/vk_platform.h:57:13`! vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion){ |
| 295 | if (!initcxx . . $ init..IsInitedcxx . . $ StaticInitialize#IsInited(c9857a73d68e59ba).()) { |
| 296 | return VK_ERROR_INCOMPATIBLE_DRIVER; |
| 297 | } |
| 298 | return initcxx . . $ init..icdcxx . . $ StaticInitialize#icd.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).vk_icdNegotiateLoaderICDInterfaceVersioncxx . . $ VulkanIcd#vk_icdNegotiateLoaderICDInterfaceVersion(550863150dfdd8b9).(pSupportedVersion); |
| 299 | } |