crash fix

This commit is contained in:
Jorijn van der Graaf 2026-03-09 21:00:58 +01:00
commit c8ab2bf22e

View file

@ -590,10 +590,12 @@ void Window::StopUpdate() {
updating = false;
}
std::chrono::time_point<std::chrono::high_resolution_clock> startTime;
void Window::Update() {
auto start = std::chrono::high_resolution_clock::now();
startTime = std::chrono::high_resolution_clock::now();
#ifdef CRAFTER_TIMING
vblank = duration_cast<std::chrono::milliseconds>(start - frameEnd);
vblank = duration_cast<std::chrono::milliseconds>(startTime - frameEnd);
#endif
#ifdef CRAFTER_TIMING
@ -616,7 +618,7 @@ void Window::Update() {
frameTimes.erase(frameTimes.begin());
}
#endif
lastFrameBegin = start;
lastFrameBegin = startTime;
}
void Window::Render() {
@ -662,7 +664,7 @@ void Window::Render() {
vkCmdPipelineBarrier(drawCmdBuffers[currentBuffer], VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
onUpdate.Invoke({start, start-lastFrameBegin});
onUpdate.Invoke({startTime, startTime-lastFrameBegin});
#ifdef CRAFTER_TIMING
totalUpdate = std::chrono::nanoseconds(0);
updateTimings.clear();