aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/wgl/stw_st.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-05-23 20:38:41 +0100
committerJosé Fonseca <[email protected]>2011-05-24 13:12:39 +0100
commitc3c1976f522a67be6a0619e938a90cf186ad42e6 (patch)
tree94a99b1612a0796894a23f84139621f8a47f97c5 /src/gallium/state_trackers/wgl/stw_st.c
parent5af46e836073d2112b147b524e441bdb808cc128 (diff)
wgl: Don't hold on to user supplied HDC.
Certain applications (e.g., Bernina My Label, and the Windows implementation of Processing language) destroy the device context used when creating the frame-buffer, causing presents to fail because we were still referring to the old device context internally. This change ensures we always use the same HDC passed to the ICD entry-points when available, or our own HDC when not available (necessary only when flushing on single buffered visuals).
Diffstat (limited to 'src/gallium/state_trackers/wgl/stw_st.c')
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index b58d91673b7..9174533fc06 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -154,7 +154,8 @@ stw_st_framebuffer_validate(struct st_framebuffer_iface *stfb,
* Present an attachment of the framebuffer.
*/
static boolean
-stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
+stw_st_framebuffer_present_locked(HDC hdc,
+ struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
@@ -162,7 +163,7 @@ stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
resource = stwfb->textures[statt];
if (resource) {
- stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, resource);
+ stw_framebuffer_present_locked(hdc, stwfb->fb, resource);
}
return TRUE;
@@ -176,7 +177,7 @@ stw_st_framebuffer_flush_front(struct st_framebuffer_iface *stfb,
pipe_mutex_lock(stwfb->fb->mutex);
- return stw_st_framebuffer_present_locked(&stwfb->base, statt);
+ return stw_st_framebuffer_present_locked(stwfb->fb->hDC, &stwfb->base, statt);
}
/**
@@ -220,7 +221,7 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb)
* Swap the buffers of the given framebuffer.
*/
boolean
-stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
+stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
unsigned front = ST_ATTACHMENT_FRONT_LEFT, back = ST_ATTACHMENT_BACK_LEFT;
@@ -245,7 +246,7 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
stwfb->texture_mask = mask;
front = ST_ATTACHMENT_FRONT_LEFT;
- return stw_st_framebuffer_present_locked(&stwfb->base, front);
+ return stw_st_framebuffer_present_locked(hdc, &stwfb->base, front);
}
/**