@ -11,6 +11,7 @@
// CHANGELOG
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// (minor and older changes stripped away, please see git history for details)
// 2021-04-23: DirectX9: Explicitly setting up more graphics states to increase compatibility with unusual non-default states.
// 2021-03-18: DirectX9: Calling IDirect3DStateBlock9::Capture() after CreateStateBlock() as a workaround for state restoring issues (see #3857).
// 2021-03-18: DirectX9: Calling IDirect3DStateBlock9::Capture() after CreateStateBlock() as a workaround for state restoring issues (see #3857).
// 2021-03-03: DirectX9: Added support for IMGUI_USE_BGRA_PACKED_COLOR in user's imconfig file.
// 2021-03-03: DirectX9: Added support for IMGUI_USE_BGRA_PACKED_COLOR in user's imconfig file.
// 2021-02-18: DirectX9: Change blending equation to preserve alpha in output buffer.
// 2021-02-18: DirectX9: Change blending equation to preserve alpha in output buffer.
@ -66,11 +67,13 @@ static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data)
// Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient)
// Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient)
g_pd3dDevice - > SetPixelShader ( NULL ) ;
g_pd3dDevice - > SetPixelShader ( NULL ) ;
g_pd3dDevice - > SetVertexShader ( NULL ) ;
g_pd3dDevice - > SetVertexShader ( NULL ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_FILLMODE , D3DFILL_SOLID ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SHADEMODE , D3DSHADE_GOURAUD ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ZWRITEENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ALPHATESTENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_CULLMODE , D3DCULL_NONE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_CULLMODE , D3DCULL_NONE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_LIGHTING , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ZENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ZENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ALPHABLENDENABLE , TRUE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ALPHABLENDENABLE , TRUE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_ALPHATESTENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_BLENDOP , D3DBLENDOP_ADD ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_BLENDOP , D3DBLENDOP_ADD ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA ) ;
@ -78,8 +81,12 @@ static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data)
g_pd3dDevice - > SetRenderState ( D3DRS_SRCBLENDALPHA , D3DBLEND_ONE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SRCBLENDALPHA , D3DBLEND_ONE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_DESTBLENDALPHA , D3DBLEND_INVSRCALPHA ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_DESTBLENDALPHA , D3DBLEND_INVSRCALPHA ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SCISSORTESTENABLE , TRUE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SCISSORTESTENABLE , TRUE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SHADEMODE , D3DSHADE_GOURAUD ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_FOGENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_FOGENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_RANGEFOGENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_SPECULARENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_STENCILENABLE , FALSE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_CLIPPING , TRUE ) ;
g_pd3dDevice - > SetRenderState ( D3DRS_LIGHTING , FALSE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLOROP , D3DTOP_MODULATE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLOROP , D3DTOP_MODULATE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLORARG1 , D3DTA_TEXTURE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLORARG1 , D3DTA_TEXTURE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLORARG2 , D3DTA_DIFFUSE ) ;
g_pd3dDevice - > SetTextureStageState ( 0 , D3DTSS_COLORARG2 , D3DTA_DIFFUSE ) ;