• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // dawncpp.h and X.h don't get along. Include this first, before X11 defines None, Success etc.
13 #ifdef SK_DAWN
14 #include "dawn/dawncpp.h"
15 #endif
16 #include <X11/Xlib.h>
17 #include <GL/glx.h>
18 
19 #include <memory>
20 
21 typedef Window XWindow;
22 
23 namespace sk_app {
24 
25 class WindowContext;
26 struct DisplayParams;
27 
28 namespace window_context_factory {
29 
30 struct XlibWindowInfo {
31     Display*     fDisplay;
32     XWindow      fWindow;
33     GLXFBConfig* fFBConfig;
34     XVisualInfo* fVisualInfo;
35     int          fWidth;
36     int          fHeight;
37 };
38 
39 std::unique_ptr<WindowContext> MakeVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
40 
41 std::unique_ptr<WindowContext> MakeGLForXlib(const XlibWindowInfo&, const DisplayParams&);
42 
43 #ifdef SK_DAWN
44 std::unique_ptr<WindowContext> MakeDawnVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
45 #endif
46 
47 std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&, const DisplayParams&);
48 
49 }  // namespace window_context_factory
50 
51 }  // namespace sk_app
52 
53 #endif
54