win32: Embed quirks struct in display struct
No need to manually allocate it (and then not freeing it in dispose ;)).
This commit is contained in:
@@ -213,9 +213,9 @@ struct _GdkWin32Display
|
||||
guint hasWglARBPixelFormat : 1;
|
||||
guint hasGlWINSwapHint : 1;
|
||||
|
||||
struct wgl_quirks {
|
||||
struct {
|
||||
guint disallow_swap_exchange : 1;
|
||||
} *wgl_quirks;
|
||||
} wgl_quirks;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
guint hasEglKHRCreateContext : 1;
|
||||
|
@@ -394,7 +394,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
|
||||
{
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
{
|
||||
format = formats[index];
|
||||
goto done;
|
||||
@@ -405,7 +405,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
const int swap_methods[] =
|
||||
{
|
||||
(display_win32->wgl_quirks->disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
|
||||
(display_win32->wgl_quirks.disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
|
||||
WGL_SWAP_COPY_ARB,
|
||||
};
|
||||
for (size_t i = 0; i < G_N_ELEMENTS (swap_methods); i++)
|
||||
@@ -420,7 +420,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
&count));
|
||||
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
|
||||
{
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
{
|
||||
format = formats[index];
|
||||
goto done;
|
||||
@@ -481,7 +481,7 @@ choose_pixel_format_opengl32 (GdkWin32Display *display_win32,
|
||||
const DWORD required_flags = PFD_DRAW_TO_WINDOW |
|
||||
PFD_SUPPORT_OPENGL;
|
||||
const DWORD best_swap_flags = PFD_SWAP_COPY |
|
||||
(display_win32->wgl_quirks->disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
|
||||
(display_win32->wgl_quirks.disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
|
||||
|
||||
struct {
|
||||
int index;
|
||||
@@ -640,9 +640,7 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
|
||||
return NULL;
|
||||
|
||||
g_assert (display_win32->wgl_quirks == NULL);
|
||||
display_win32->wgl_quirks = g_new0 (struct wgl_quirks, 1);
|
||||
|
||||
|
||||
/* acquire and cache dummy Window (HWND & HDC) and
|
||||
* dummy GL Context, it is used to query functions
|
||||
* and used for other stuff as well
|
||||
@@ -683,7 +681,7 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
display_win32->hasGlWINSwapHint =
|
||||
epoxy_has_gl_extension ("GL_WIN_swap_hint");
|
||||
|
||||
display_win32->wgl_quirks->disallow_swap_exchange = check_vendor_is_nvidia ();
|
||||
display_win32->wgl_quirks.disallow_swap_exchange = check_vendor_is_nvidia ();
|
||||
|
||||
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
|
||||
"display", display,
|
||||
@@ -712,7 +710,7 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
major, minor,
|
||||
glGetString (GL_VENDOR),
|
||||
glGetString (GL_RENDERER),
|
||||
display_win32->wgl_quirks->disallow_swap_exchange ? "enabled" : "disabled",
|
||||
display_win32->wgl_quirks.disallow_swap_exchange ? "enabled" : "disabled",
|
||||
display_win32->hasWglARBPixelFormat ? "yes" : "no",
|
||||
display_win32->hasWglARBCreateContext ? "yes" : "no",
|
||||
display_win32->hasWglEXTSwapControl ? "yes" : "no",
|
||||
@@ -1127,7 +1125,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
context_wgl->swap_method = SWAP_METHOD_COPY;
|
||||
break;
|
||||
case WGL_SWAP_EXCHANGE_ARB:
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange)
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange)
|
||||
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
|
||||
break;
|
||||
}
|
||||
@@ -1143,7 +1141,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
|
||||
if (pfd.dwFlags & PFD_SWAP_COPY)
|
||||
context_wgl->swap_method = SWAP_METHOD_COPY;
|
||||
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks->disallow_swap_exchange)
|
||||
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks.disallow_swap_exchange)
|
||||
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
|
||||
else
|
||||
context_wgl->swap_method = SWAP_METHOD_UNDEFINED;
|
||||
|
Reference in New Issue
Block a user