Fix DirectX memory leak (thanks integerbang)

This commit is contained in:
MysterD 2023-04-21 22:53:32 -07:00
parent e788f84d1a
commit c6f33966b4
1 changed files with 5 additions and 5 deletions

View File

@ -549,10 +549,10 @@ static bool gfx_dxgi_start_frame(void) {
static void gfx_dxgi_swap_buffers_begin(void) {
ThrowIfFailed(dxgi.swap_chain->Present(dxgi.length_in_vsync_frames, 0));
UINT this_present_id;
if (dxgi.swap_chain->GetLastPresentCount(&this_present_id) == S_OK) {
dxgi.pending_frame_stats.insert(std::make_pair(this_present_id, dxgi.length_in_vsync_frames));
}
//UINT this_present_id;
//if (dxgi.swap_chain->GetLastPresentCount(&this_present_id) == S_OK) {
// dxgi.pending_frame_stats.insert(std::make_pair(this_present_id, dxgi.length_in_vsync_frames));
//}
dxgi.dropped_frame = false;
}
@ -573,7 +573,7 @@ static void gfx_dxgi_swap_buffers_end(void) {
QueryPerformanceCounter(&t2);
dxgi.sync_interval_means_frames_to_wait = dxgi.pending_frame_stats.rbegin()->first == stats.PresentCount;
//dxgi.sync_interval_means_frames_to_wait = dxgi.pending_frame_stats.rbegin()->first == stats.PresentCount;
//printf("done %llu gpu:%d wait:%d freed:%llu frame:%u %u monitor:%u t:%llu\n", (unsigned long long)(t0.QuadPart - dxgi.qpc_init), (int)(t1.QuadPart - t0.QuadPart), (int)(t2.QuadPart - t0.QuadPart), (unsigned long long)(t2.QuadPart - dxgi.qpc_init), dxgi.pending_frame_stats.rbegin()->first, stats.PresentCount, stats.SyncRefreshCount, (unsigned long long)(stats.SyncQPCTime.QuadPart - dxgi.qpc_init));
}