mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 12:28:07 +01:00
Check if we actually created a new frame
This commit is contained in:
parent
548f21c2f0
commit
0711c83440
5 changed files with 60 additions and 51 deletions
|
@ -80,17 +80,19 @@ void DX10_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX10_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
if (ImGui_ImplDX10_NewFrame())
|
||||
{
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui::Render();
|
||||
|
||||
pDevice->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
||||
pDevice->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX10_Hook::MyPresent(IDXGISwapChain *_this, UINT SyncInterval, UINT Flags)
|
||||
|
|
|
@ -92,17 +92,19 @@ void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX11_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
if (ImGui_ImplDX11_NewFrame())
|
||||
{
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui::Render();
|
||||
|
||||
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX11_Hook::MyPresent(IDXGISwapChain *_this, UINT SyncInterval, UINT Flags)
|
||||
|
|
|
@ -176,39 +176,40 @@ void DX12_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
|||
pDevice->Release();
|
||||
}
|
||||
|
||||
ImGui_ImplDX12_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(sc_desc.OutputWindow);
|
||||
if (ImGui_ImplDX12_NewFrame())
|
||||
{
|
||||
Windows_Hook::Inst()->prepareForOverlay(sc_desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
|
||||
UINT bufferIndex = pSwapChain3->GetCurrentBackBufferIndex();
|
||||
UINT bufferIndex = pSwapChain3->GetCurrentBackBufferIndex();
|
||||
|
||||
D3D12_RESOURCE_BARRIER barrier = {};
|
||||
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrier.Transition.pResource = pBackBuffer[bufferIndex];
|
||||
barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
D3D12_RESOURCE_BARRIER barrier = {};
|
||||
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||
barrier.Transition.pResource = pBackBuffer[bufferIndex];
|
||||
barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
|
||||
pCmdAlloc[bufferIndex]->Reset();
|
||||
pCmdList->Reset(pCmdAlloc[bufferIndex], NULL);
|
||||
pCmdList->ResourceBarrier(1, &barrier);
|
||||
pCmdList->OMSetRenderTargets(1, &mainRenderTargets[bufferIndex], FALSE, NULL);
|
||||
pCmdList->SetDescriptorHeaps(1, &pSrvDescHeap);
|
||||
pCmdAlloc[bufferIndex]->Reset();
|
||||
pCmdList->Reset(pCmdAlloc[bufferIndex], NULL);
|
||||
pCmdList->ResourceBarrier(1, &barrier);
|
||||
pCmdList->OMSetRenderTargets(1, &mainRenderTargets[bufferIndex], FALSE, NULL);
|
||||
pCmdList->SetDescriptorHeaps(1, &pSrvDescHeap);
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), pCmdList);
|
||||
ImGui::Render();
|
||||
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), pCmdList);
|
||||
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
|
||||
pCmdList->ResourceBarrier(1, &barrier);
|
||||
pCmdList->Close();
|
||||
|
||||
pCmdQueue->ExecuteCommandLists(1, (ID3D12CommandList**)&pCmdList);
|
||||
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
|
||||
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
|
||||
pCmdList->ResourceBarrier(1, &barrier);
|
||||
pCmdList->Close();
|
||||
|
||||
pCmdQueue->ExecuteCommandLists(1, (ID3D12CommandList**)&pCmdList);
|
||||
}
|
||||
pSwapChain3->Release();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,16 +75,18 @@ void DX9_Hook::prepareForOverlay(IDirect3DDevice9 *pDevice)
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX9_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(param.hFocusWindow);
|
||||
if (ImGui_ImplDX9_NewFrame())
|
||||
{
|
||||
Windows_Hook::Inst()->prepareForOverlay(param.hFocusWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui::Render();
|
||||
|
||||
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
||||
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX9_Hook::MyReset(IDirect3DDevice9* _this, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
||||
|
|
|
@ -83,16 +83,18 @@ void OpenGL_Hook::prepareForOverlay(HDC hDC)
|
|||
|
||||
initialized = true;
|
||||
}
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(hWnd);
|
||||
if (ImGui_ImplOpenGL3_NewFrame())
|
||||
{
|
||||
Windows_Hook::Inst()->prepareForOverlay(hWnd);
|
||||
|
||||
ImGui::NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
get_steam_client()->steam_overlay->OverlayProc();
|
||||
|
||||
ImGui::Render();
|
||||
ImGui::Render();
|
||||
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI OpenGL_Hook::MywglSwapBuffers(HDC hDC)
|
||||
|
|
Loading…
Reference in a new issue