1 2 /* 3 * Copyright 2016 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef WindowContextFactory_unix_DEFINED 10 #define WindowContextFactory_unix_DEFINED 11 12 // webgpu_cpp.h and X.h don't get along. Include this first, before X11 defines None, Success etc. 13 #ifdef SK_DAWN 14 #include "webgpu/webgpu_cpp.h" // NO_G3_REWRITE 15 #endif 16 #include <X11/Xlib.h> 17 #include <GL/glx.h> 18 19 #include <memory> 20 21 typedef Window XWindow; 22 23 namespace skwindow { 24 25 class WindowContext; 26 struct DisplayParams; 27 28 struct XlibWindowInfo { 29 Display* fDisplay; 30 XWindow fWindow; 31 GLXFBConfig* fFBConfig; 32 XVisualInfo* fVisualInfo; 33 int fWidth; 34 int fHeight; 35 }; 36 37 #ifdef SK_VULKAN 38 std::unique_ptr<WindowContext> MakeVulkanForXlib(const XlibWindowInfo&, const DisplayParams&); 39 #if defined(SK_GRAPHITE) 40 std::unique_ptr<WindowContext> MakeGraphiteVulkanForXlib(const XlibWindowInfo&, 41 const DisplayParams&); 42 #endif 43 #endif 44 45 #ifdef SK_GL 46 std::unique_ptr<WindowContext> MakeGLForXlib(const XlibWindowInfo&, const DisplayParams&); 47 #endif 48 49 #if defined(SK_DAWN) && defined(SK_GRAPHITE) 50 std::unique_ptr<WindowContext> MakeGraphiteDawnVulkanForXlib(const XlibWindowInfo&, 51 const DisplayParams&); 52 #endif 53 54 std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&, const DisplayParams&); 55 56 } // namespace skwindow 57 58 #endif 59