From 5b04c29a2a330612a11d53e72d32487315efb085 Mon Sep 17 00:00:00 2001
From: Ken Thomases <ken@codeweavers.com>
Date: Sun, 14 Sep 2014 19:46:53 -0500
Subject: Revert "wined3d: Track if a context's private hdc has had its pixel
 format set, so we don't need to check it."

This reverts commit f3aa4812382caa459b9b612f66998c6ea8257594.
---
 dlls/wined3d/context.c         | 22 +++++-----------------
 dlls/wined3d/wined3d_private.h |  3 +--
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d83cad5..c11dd08 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -815,13 +815,9 @@ static BOOL context_restore_pixel_format(struct wined3d_context *ctx)
 static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BOOL private, int format)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    int current;
+    int current = GetPixelFormat(dc);
 
-    if (dc == context->hdc && context->hdc_is_private && context->hdc_has_format)
-        return TRUE;
-
-    current = GetPixelFormat(dc);
-    if (current == format) goto success;
+    if (current == format) return TRUE;
 
     if (!current)
     {
@@ -835,7 +831,7 @@ static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BO
 
         context->restore_pf = 0;
         context->restore_pf_win = private ? NULL : WindowFromDC(dc);
-        goto success;
+        return TRUE;
     }
 
     /* By default WGL doesn't allow pixel format adjustments but we need it
@@ -862,7 +858,7 @@ static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BO
             context->restore_pf_win = win;
         }
 
-        goto success;
+        return TRUE;
     }
 
     /* OpenGL doesn't allow pixel format adjustments. Print an error and
@@ -872,11 +868,6 @@ static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BO
     ERR("Unable to set pixel format %d on device context %p. Already using format %d.\n",
             format, dc, current);
     return TRUE;
-
-success:
-    if (dc == context->hdc && context->hdc_is_private)
-        context->hdc_has_format = TRUE;
-    return TRUE;
 }
 
 static BOOL context_set_gl_context(struct wined3d_context *ctx)
@@ -962,7 +953,6 @@ static void context_update_window(struct wined3d_context *context)
 
     context->win_handle = context->swapchain->win_handle;
     context->hdc_is_private = FALSE;
-    context->hdc_has_format = FALSE;
     context->needs_set = 1;
     context->valid = 1;
 
@@ -1223,8 +1213,7 @@ static void context_enter(struct wined3d_context *context)
             context->restore_dc = wglGetCurrentDC();
             context->needs_set = 1;
         }
-        else if (!context->needs_set && !(context->hdc_is_private && context->hdc_has_format)
-                    && context->pixel_format != GetPixelFormat(context->hdc))
+        else if (!context->needs_set && context->pixel_format != GetPixelFormat(context->hdc))
             context->needs_set = 1;
     }
 }
@@ -1662,7 +1651,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     ret->win_handle = swapchain->win_handle;
     ret->hdc = hdc;
     ret->hdc_is_private = hdc_is_private;
-    ret->hdc_has_format = TRUE;
     ret->pixel_format = pixel_format;
     ret->needs_set = 1;
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 288d683..d5a881f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1196,9 +1196,8 @@ struct wined3d_context
     DWORD rebind_fbo : 1;
     DWORD needs_set : 1;
     DWORD hdc_is_private : 1;
-    DWORD hdc_has_format : 1;           /* only meaningful if hdc_is_private */
     DWORD update_shader_resource_bindings : 1;
-    DWORD padding : 14;
+    DWORD padding : 15;
     DWORD shader_update_mask;
     DWORD constant_update_mask;
     DWORD                   numbered_array_mask;
-- 
2.6.4

