mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Examples: DX12: Fixed compilation of imgui_impl_dx12.cpp in viewport branch. Multi-viewport is still not functional.
This commit is contained in:
parent
4cadb57c46
commit
19c4fa8dd5
@ -38,9 +38,9 @@ static D3D12_CPU_DESCRIPTOR_HANDLE g_mainRenderTargetDescriptor[NUM_BACK_BUFFER
|
|||||||
|
|
||||||
void CreateRenderTarget()
|
void CreateRenderTarget()
|
||||||
{
|
{
|
||||||
ID3D12Resource* pBackBuffer;
|
|
||||||
for (UINT i = 0; i < NUM_BACK_BUFFERS; i++)
|
for (UINT i = 0; i < NUM_BACK_BUFFERS; i++)
|
||||||
{
|
{
|
||||||
|
ID3D12Resource* pBackBuffer = NULL;
|
||||||
g_pSwapChain->GetBuffer(i, IID_PPV_ARGS(&pBackBuffer));
|
g_pSwapChain->GetBuffer(i, IID_PPV_ARGS(&pBackBuffer));
|
||||||
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, g_mainRenderTargetDescriptor[i]);
|
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, g_mainRenderTargetDescriptor[i]);
|
||||||
g_mainRenderTargetResource[i] = pBackBuffer;
|
g_mainRenderTargetResource[i] = pBackBuffer;
|
||||||
@ -415,7 +415,7 @@ int main(int, char**)
|
|||||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
{
|
{
|
||||||
ImGui::UpdatePlatformWindows();
|
ImGui::UpdatePlatformWindows();
|
||||||
ImGui::RenderPlatformWindowsDefault();
|
ImGui::RenderPlatformWindowsDefault(NULL, (void*)g_pd3dCommandList);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||||
|
@ -731,18 +731,22 @@ static void ImGui_ImplDX12_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport, void*)
|
// arg = ID3D12GraphicsCommandList*
|
||||||
|
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport, void* renderer_arg)
|
||||||
{
|
{
|
||||||
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
|
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList* command_list = (ID3D12GraphicsCommandList*)renderer_arg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
g_pd3dDeviceContext->OMSetRenderTargets(1, &data->RTView, NULL);
|
g_pd3dDeviceContext->OMSetRenderTargets(1, &data->RTView, NULL);
|
||||||
if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear))
|
if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear))
|
||||||
g_pd3dDeviceContext->ClearRenderTargetView(data->RTView, (float*)&clear_color);
|
g_pd3dDeviceContext->ClearRenderTargetView(data->RTView, (float*)&clear_color);
|
||||||
*/
|
*/
|
||||||
ImGui_ImplDX12_RenderDrawData(viewport->DrawData);
|
ImGui_ImplDX12_RenderDrawData(viewport->DrawData, command_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport, void*)
|
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport, void*)
|
||||||
|
Loading…
Reference in New Issue
Block a user