aboutsummaryrefslogtreecommitdiff
path: root/pacc/pacc-d3d9.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-10-23 22:08:23 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-10-23 22:08:23 +0900
commit6ab52ffca0262bde8b3ab858fa63db8369874ff4 (patch)
treec49236b731180b188bfb196f0466e8111a8ec529 /pacc/pacc-d3d9.c
parentacb405ba36ec82511525f4f9e2a0775e2d85308e (diff)
pacc-d3d9: prepare for D3DERR_DEVICELOST
Diffstat (limited to 'pacc/pacc-d3d9.c')
-rw-r--r--pacc/pacc-d3d9.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/pacc/pacc-d3d9.c b/pacc/pacc-d3d9.c
index 5189afd..e645366 100644
--- a/pacc/pacc-d3d9.c
+++ b/pacc/pacc-d3d9.c
@@ -34,6 +34,8 @@ struct pacc_ctx {
void *renderptr;
HANDLE renderthread;
HANDLE rendermtx;
+ UINT msg_reset;
+ HWND msg_wnd;
};
struct pacc_buf {
@@ -423,7 +425,10 @@ static DWORD WINAPI pacc_renderproc(void *ptr) {
1.0, 0);
}
pc->d3d9d->lpVtbl->EndScene(pc->d3d9d);
- pc->d3d9d->lpVtbl->Present(pc->d3d9d, 0, 0, 0, 0);
+ HRESULT res = pc->d3d9d->lpVtbl->Present(pc->d3d9d, 0, 0, 0, 0);
+ if (res == D3DERR_DEVICELOST) {
+ PostMessage(pc->msg_wnd, pc->msg_reset, 0, 0);
+ }
}
ReleaseMutex(pc->rendermtx);
}
@@ -463,7 +468,8 @@ struct pacc_win_vtable pacc_win_vtable = {
struct pacc_ctx *pacc_init_d3d9(
HWND hwnd,
pacc_rendercb *rendercb, void *renderptr,
- struct pacc_vtable *vt, struct pacc_win_vtable *winvt) {
+ struct pacc_vtable *vt, struct pacc_win_vtable *winvt,
+ UINT msg_reset, HWND msg_wnd) {
struct pacc_ctx *pc = malloc(sizeof(*pc));
if (!pc) goto err;
RECT wr;
@@ -474,6 +480,8 @@ struct pacc_ctx *pacc_init_d3d9(
.hwnd = hwnd,
.rendercb = rendercb,
.renderptr = renderptr,
+ .msg_reset = msg_reset,
+ .msg_wnd = msg_wnd,
};
atomic_init(&pc->killthread, false);
pc->rendermtx = CreateMutex(0, FALSE, 0);