xref: /OK3568_Linux_fs/external/xserver/hw/xwin/glx/indirect.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright © 2014 Jon TURNEY
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef indirect_h
25 #define indirect_h
26 
27 #include <X11/Xwindows.h>
28 #include <GL/wglext.h>
29 #include <glx/extension_string.h>
30 
31 /* ---------------------------------------------------------------------- */
32 /*
33  *   structure definitions
34  */
35 
36 typedef struct __GLXWinContext __GLXWinContext;
37 typedef struct __GLXWinDrawable __GLXWinDrawable;
38 typedef struct __GLXWinScreen glxWinScreen;
39 typedef struct __GLXWinConfig GLXWinConfig;
40 
41 struct __GLXWinContext {
42     __GLXcontext base;
43     HGLRC ctx;                  /* Windows GL Context */
44     __GLXWinContext *shareContext;      /* Context with which we will share display lists and textures */
45     HWND hwnd;                  /* For detecting when HWND has changed */
46 };
47 
48 struct __GLXWinDrawable {
49     __GLXdrawable base;
50     __GLXWinContext *drawContext;
51     __GLXWinContext *readContext;
52 
53     /* If this drawable is GLX_DRAWABLE_PBUFFER */
54     HPBUFFERARB hPbuffer;
55 
56     /* If this drawable is GLX_DRAWABLE_PIXMAP */
57     HDC dibDC;
58     HANDLE hSection;            /* file mapping handle */
59     HBITMAP hDIB;
60     HBITMAP hOldDIB;            /* original DIB for DC */
61     void *pOldBits;             /* original pBits for this drawable's pixmap */
62 };
63 
64 struct __GLXWinScreen {
65     __GLXscreen base;
66 
67     Bool has_WGL_ARB_multisample;
68     Bool has_WGL_ARB_pixel_format;
69     Bool has_WGL_ARB_pbuffer;
70     Bool has_WGL_ARB_render_texture;
71     Bool has_WGL_ARB_make_current_read;
72 
73     /* wrapped screen functions */
74     RealizeWindowProcPtr RealizeWindow;
75     UnrealizeWindowProcPtr UnrealizeWindow;
76     CopyWindowProcPtr CopyWindow;
77 };
78 
79 struct __GLXWinConfig {
80     __GLXconfig base;
81     int pixelFormatIndex;
82 };
83 
84 /* ---------------------------------------------------------------------- */
85 /*
86  *   function prototypes
87  */
88 
89 void
90 glxWinDeferredCreateDrawable(__GLXWinDrawable *draw, __GLXconfig *config);
91 
92 #endif /* indirect_h */
93