summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-10-08 11:40:58 +0100
committerJosé Fonseca <[email protected]>2012-10-08 15:42:50 +0100
commit88e417d7614aa1dbb46187fb0609a3a2c2291905 (patch)
tree1c4963e8175ef7794b61b46ada68bda61d08118e
parent86de501f14f11f1e993c8703c0d69bdf1f6c7835 (diff)
st/wgl: Don't cache HDC anywhere.
Applications may destroy HDC at any time. So always get a HDC as needed. Fixes lack of presents with Solidworks eDrawings when screen resolution is changed. Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_pbuffer.c2
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c7
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.h1
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.c13
4 files changed, 12 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
index 7596cb6bd95..0bd60c064d7 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c
@@ -248,8 +248,6 @@ wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
hDC = GetDC(fb->hWnd);
- assert(hDC == fb->hDC);
-
return hDC;
}
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index d0d5e9e0fe6..449c5373b06 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -92,8 +92,6 @@ stw_framebuffer_destroy_locked(
stw_st_destroy_framebuffer_locked(fb->stfb);
- ReleaseDC(fb->hWnd, fb->hDC);
-
pipe_mutex_unlock( fb->mutex );
pipe_mutex_destroy( fb->mutex );
@@ -254,11 +252,6 @@ stw_framebuffer_create(
if (fb == NULL)
return NULL;
- /* Applications use, create, destroy device contexts, so the hdc passed is. We create our own DC
- * because we need one for single buffered visuals.
- */
- fb->hDC = GetDC(hWnd);
-
fb->hWnd = hWnd;
fb->iPixelFormat = iPixelFormat;
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h
index bf20d6a3d29..3ba51ba6898 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
@@ -58,7 +58,6 @@ struct stw_framebuffer
* above, to prevent the framebuffer from being destroyed.
*/
- HDC hDC;
HWND hWnd;
int iPixelFormat;
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index 28c93f4fb57..7151508b73e 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -175,10 +175,21 @@ stw_st_framebuffer_flush_front(struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
+ boolean ret;
+ HDC hDC;
pipe_mutex_lock(stwfb->fb->mutex);
- return stw_st_framebuffer_present_locked(stwfb->fb->hDC, &stwfb->base, statt);
+ /* We must not cache HDCs anywhere, as they can be invalidated by the
+ * application, or screen resolution changes. */
+
+ hDC = GetDC(stwfb->fb->hWnd);
+
+ ret = stw_st_framebuffer_present_locked(hDC, &stwfb->base, statt);
+
+ ReleaseDC(stwfb->fb->hWnd, hDC);
+
+ return ret;
}
/**