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 "dawn/webgpu_cpp.h"
15#endif
16#include <X11/Xlib.h>
17#include <GL/glx.h>
18
19#include <memory>
20
21typedef Window XWindow;
22
23namespace sk_app {
24
25class WindowContext;
26struct DisplayParams;
27
28namespace window_context_factory {
29
30struct XlibWindowInfo {
31    Display*     fDisplay;
32    XWindow      fWindow;
33    GLXFBConfig* fFBConfig;
34    XVisualInfo* fVisualInfo;
35    int          fWidth;
36    int          fHeight;
37};
38
39std::unique_ptr<WindowContext> MakeVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
40
41std::unique_ptr<WindowContext> MakeGLForXlib(const XlibWindowInfo&, const DisplayParams&);
42
43#ifdef SK_DAWN
44std::unique_ptr<WindowContext> MakeDawnVulkanForXlib(const XlibWindowInfo&, const DisplayParams&);
45#endif
46
47std::unique_ptr<WindowContext> MakeRasterForXlib(const XlibWindowInfo&, const DisplayParams&);
48
49}  // namespace window_context_factory
50
51}  // namespace sk_app
52
53#endif
54