forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 4
/
10bpc-gl.diff
96 lines (95 loc) · 2.84 KB
/
10bpc-gl.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c
index b90a8e40c3..e57c4df194 100644
--- a/gfx/drivers_context/wgl_ctx.c
+++ b/gfx/drivers_context/wgl_ctx.c
@@ -78,6 +78,47 @@
#ifndef WGL_CONTEXT_DEBUG_BIT_ARB
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
#endif
+
+#ifndef WGL_ACCELERATION_ARB
+#define WGL_ACCELERATION_ARB 0x2003
+#endif
+
+#ifndef WGL_FULL_ACCELERATION_ARB
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#endif
+
+#ifndef WGL_DRAW_TO_WINDOW_ARB
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#endif
+
+#ifndef WGL_DOUBLE_BUFFER_ARB
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#endif
+
+#ifndef WGL_RED_BITS_ARB
+#define WGL_RED_BITS_ARB 0x2015
+#endif
+
+#ifndef WGL_GREEN_BITS_ARB
+#define WGL_GREEN_BITS_ARB 0x2017
+#endif
+
+#ifndef WGL_BLUE_BITS_ARB
+#define WGL_BLUE_BITS_ARB 0x2019
+#endif
+
+#ifndef WGL_ALPHA_BITS_ARB
+#define WGL_ALPHA_BITS_ARB 0x201B
+#endif
+
+#ifndef WGL_PIXEL_TYPE_ARB
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#endif
+
+#ifndef WGL_TYPE_RGBA_ARB
+#define WGL_TYPE_RGBA_ARB 0x202B
+#endif
+
#endif
#if defined(HAVE_OPENGL)
@@ -313,6 +354,43 @@ static void create_gl_context(HWND hwnd, bool *quit)
RARCH_LOG("[WGL]: Adaptive VSync supported.\n");
wgl_adaptive_vsync = true;
}
+ if (wgl_has_extension("WGL_ARB_pixel_format", extensions))
+ {
+ BOOL (WINAPI * wglChoosePixelFormatARB)
+ (HDC hdc,
+ const int *piAttribIList,
+ const FLOAT *pfAttribFList,
+ UINT nMaxFormats,
+ int *piFormats,
+ UINT *nNumFormats);
+ UINT nMatchingFormats;
+ int index = 0;
+ int attribsDesired[] = {
+ WGL_DRAW_TO_WINDOW_ARB, 1,
+ WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
+ WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
+ WGL_RED_BITS_ARB, 10,
+ WGL_GREEN_BITS_ARB, 10,
+ WGL_BLUE_BITS_ARB, 10,
+ WGL_ALPHA_BITS_ARB, 2,
+ WGL_DOUBLE_BUFFER_ARB, 1,
+ 0,0
+ };
+ wglChoosePixelFormatARB = (BOOL (WINAPI *) (HDC, const int *,
+ const FLOAT*, UINT, int*, UINT*))
+ gfx_ctx_wgl_get_proc_address("wglChoosePixelFormatARB");
+
+ RARCH_LOG("[WGL]: ARB pixel format supported.\n");
+
+ if (wglChoosePixelFormatARB(win32_hdc, attribsDesired,
+ NULL, 1, &index, &nMatchingFormats))
+ {
+ if (nMatchingFormats == 0)
+ {
+ RARCH_WARN("No 10bpc WGL_ARB_pixel_formats found!\n");
+ }
+ }
+ }
}
}
#endif