mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Merge branch 'master' of https://github.com/trezanik/imgui into trezanik-master
This commit is contained in:
commit
e41fbb0390
@ -58,14 +58,10 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup some DX9 state (not all!)
|
// Backup the DX9 state
|
||||||
// FIXME: Backup/restore everything else
|
IDirect3DStateBlock9* d3d9_state_block = NULL;
|
||||||
D3DRENDERSTATETYPE last_render_state_to_backup[] = { D3DRS_CULLMODE, D3DRS_LIGHTING, D3DRS_ZENABLE, D3DRS_ALPHABLENDENABLE, D3DRS_ALPHATESTENABLE, D3DRS_BLENDOP, D3DRS_SRCBLEND, D3DRS_DESTBLEND, D3DRS_SCISSORTESTENABLE };
|
if ( g_pd3dDevice->CreateStateBlock(D3DSBT_ALL, &d3d9_state_block) < 0 )
|
||||||
DWORD last_render_state_values[ARRAYSIZE(last_render_state_to_backup)] = { 0 };
|
return;
|
||||||
IDirect3DPixelShader9* last_ps; g_pd3dDevice->GetPixelShader( &last_ps );
|
|
||||||
IDirect3DVertexShader9* last_vs; g_pd3dDevice->GetVertexShader( &last_vs );
|
|
||||||
for (int n = 0; n < ARRAYSIZE(last_render_state_to_backup); n++)
|
|
||||||
g_pd3dDevice->GetRenderState(last_render_state_to_backup[n], &last_render_state_values[n]);
|
|
||||||
|
|
||||||
// Copy and convert all vertices into a single contiguous buffer
|
// Copy and convert all vertices into a single contiguous buffer
|
||||||
CUSTOMVERTEX* vtx_dst;
|
CUSTOMVERTEX* vtx_dst;
|
||||||
@ -161,11 +157,9 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
vtx_offset += cmd_list->VtxBuffer.size();
|
vtx_offset += cmd_list->VtxBuffer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore some modified DX9 state (not all!)
|
// Restore the DX9 state
|
||||||
g_pd3dDevice->SetPixelShader( last_ps );
|
d3d9_state_block->Apply();
|
||||||
g_pd3dDevice->SetVertexShader( last_vs );
|
d3d9_state_block->Release();
|
||||||
for (int n = 0; n < ARRAYSIZE(last_render_state_to_backup); n++)
|
|
||||||
g_pd3dDevice->SetRenderState(last_render_state_to_backup[n], last_render_state_values[n]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_API LRESULT ImGui_ImplDX9_WndProcHandler(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
Loading…
Reference in New Issue
Block a user