From a5aa71ff3a7257b3a37ad9c88971e2804ae30867 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 5 Nov 2021 18:36:50 +0100 Subject: [PATCH] fix d9d9 clear issues on windows xp --- src/render_d3d9.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/render_d3d9.c b/src/render_d3d9.c index 9e93450..f640fb0 100644 --- a/src/render_d3d9.c +++ b/src/render_d3d9.c @@ -286,6 +286,7 @@ static BOOL d3d9_set_states() } } + /* D3DVIEWPORT9 view_data = { g_ddraw->render.viewport.x, g_ddraw->render.viewport.y, @@ -295,7 +296,7 @@ static BOOL d3d9_set_states() 1.0f }; err = err || FAILED(IDirect3DDevice9_SetViewport(g_d3d9.device, &view_data)); - + */ return !err; } @@ -337,6 +338,7 @@ DWORD WINAPI d3d9_render_main(void) fpsl_init(); BOOL needs_update = FALSE; + LONG clear_count = 0; DWORD timeout = g_ddraw->render.minfps > 0 ? g_ddraw->render.minfps_tick_len : 200; @@ -349,6 +351,9 @@ DWORD WINAPI d3d9_render_main(void) static int tex_index = 0, pal_index = 0; + if (InterlockedExchange(&g_ddraw->render.clear_screen, FALSE)) + clear_count = 10; + fpsl_frame_start(); EnterCriticalSection(&g_ddraw->cs); @@ -416,11 +421,6 @@ DWORD WINAPI d3d9_render_main(void) } } - if (InterlockedExchange(&g_ddraw->render.clear_screen, FALSE)) - { - IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); - } - if (g_ddraw->fixchilds) { g_ddraw->child_window_exists = FALSE; @@ -446,6 +446,12 @@ DWORD WINAPI d3d9_render_main(void) LeaveCriticalSection(&g_ddraw->cs); + if (clear_count > 0) + { + clear_count--; + IDirect3DDevice9_Clear(g_d3d9.device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + } + IDirect3DDevice9_BeginScene(g_d3d9.device); IDirect3DDevice9_DrawPrimitive(g_d3d9.device, D3DPT_TRIANGLESTRIP, 0, 2); IDirect3DDevice9_EndScene(g_d3d9.device);