Skip to content

Commit 40e23c5

Browse files
committed
Added a break for the adapter selection...
My head exploded when I saw the performance issues were at the break statement.
1 parent c11bc23 commit 40e23c5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/private/Core/Renderer/D3D12.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#include "Core/Renderer/D3D12.h"
22
#include "Core/Renderer/ScreenQuad.h"
33
#include "Core/Scene/SceneManager.h"
4+
#include <chrono>
5+
6+
using Clock = std::chrono::high_resolution_clock;
7+
using TimePoint = std::chrono::time_point<Clock>;
8+
9+
// Variables globales o del renderer
10+
TimePoint lastFrameTime = Clock::now();
411

512
D3D12::D3D12() : Renderer::Renderer() {
613
this->m_nBackBuffers = 2;
714
this->m_nCurrentFence = 0;
815
this->m_hFence = NULL;
9-
this->m_vsyncState = VSYNC::ENABLED;
16+
this->m_vsyncState = VSYNC::DISABLED;
1017

1118
this->m_nAlbedoIndex = 0;
1219
this->m_nUVIndex = 0;
@@ -153,6 +160,7 @@ void D3D12::Init(HWND hwnd) {
153160
ID3D12CommandList* lists[] = {
154161
this->m_list.Get()
155162
};
163+
156164
this->m_queue->ExecuteCommandLists(1, lists);
157165
this->WaitFrame();
158166
}
@@ -278,6 +286,10 @@ void D3D12::Update() {
278286
this->m_sc->Present(this->m_vsyncState, 0);
279287
this->m_nActualBackBuffer = this->m_sc->GetCurrentBackBufferIndex();
280288
this->WaitFrame();
289+
TimePoint now = Clock::now();
290+
std::chrono::duration<float> delta = now - lastFrameTime;
291+
lastFrameTime = now;
292+
std::cout << delta.count() << std::endl;
281293
}
282294

283295
void D3D12::WaitFrame() {
@@ -413,6 +425,7 @@ void D3D12::GetMostCapableAdapter() {
413425
IID_PPV_ARGS(tempDevice.GetAddressOf()
414426
)))) {
415427
this->m_adapter = adapter;
428+
break;
416429
}
417430
}
418431

0 commit comments

Comments
 (0)