Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorton06 committed Nov 14, 2024
1 parent 3b3ff20 commit 6b9d644
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
10 changes: 9 additions & 1 deletion Editor/Source/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ namespace Lumos
timer = 0.0;
stats = Engine::Get().Statistics();
}

#if 0
auto size = ImGui::CalcTextSize("%.2f ms (%.i FPS)");
float sizeOfGfxAPIDropDown = ImGui::GetFontSize() * 8;
ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - size.x - ImGui::GetStyle().ItemSpacing.x * 2.0f - sizeOfGfxAPIDropDown);
Expand Down Expand Up @@ -1079,6 +1079,14 @@ namespace Lumos

ImGui::PopStyleColor(2);
ImGui::PopStyleVar();
#else
auto size = ImGui::CalcTextSize("%.2f ms (%.i FPS)");
ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - size.x - ImGui::GetStyle().ItemSpacing.x * 2.0f);

int fps = int(Maths::Round(1000.0 / stats.FrameTime));
ImGui::Text("%.2f ms (%.i FPS)", stats.FrameTime, fps);
ImGui::PopStyleColor();
#endif

ImGui::EndMainMenuBar();
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Editor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#include <string>
#include <Lumos/Maths/Transform.h>
#include <Lumos/Utilities/IniFile.h>
#include <Lumos/Graphics/Camera/EditorCamera.h>
Expand Down
1 change: 1 addition & 0 deletions Lumos/Source/Lumos/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ namespace Lumos
FileSystem::CreateFolderIfDoesntExist(m_ProjectSettings.m_ProjectRoot + "Assets/Prefabs");
FileSystem::CreateFolderIfDoesntExist(m_ProjectSettings.m_ProjectRoot + "Assets/Materials");

Graphics::Renderer::GetGraphicsContext()->WaitIdle();
m_SceneManager = CreateUniquePtr<SceneManager>();

Deserialise();
Expand Down
1 change: 1 addition & 0 deletions Lumos/Source/Lumos/Graphics/Renderers/SceneRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3966,6 +3966,7 @@ namespace Lumos::Graphics
}

Graphics::CommandBuffer* commandBuffer = Renderer::GetMainSwapChain()->GetCurrentCommandBuffer();
commandBuffer->UnBindPipeline();

currentDescriptors[0] = m_DebugDrawData.m_Renderer2DData.m_DescriptorSet[0][0].get();
currentDescriptors[1] = m_DebugDrawData.m_Renderer2DData.m_DescriptorSet[0][1].get();
Expand Down
4 changes: 3 additions & 1 deletion Lumos/Source/Lumos/Platform/Vulkan/VKCommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,11 @@ namespace Lumos
LUMOS_PROFILE_FUNCTION_LOW();
ASSERT(m_State == CommandBufferState::Submitted);

m_Fence->WaitAndReset();
m_State = CommandBufferState::Idle;

if(!m_Fence->WaitAndReset())
return false;

return true;
}

Expand Down
12 changes: 7 additions & 5 deletions Lumos/Source/Lumos/Platform/Vulkan/VKFence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ namespace Lumos
if(result == VK_SUCCESS)
{
m_Signaled = true;
return false;
return true;
}

return true;
return false;
}

void VKFence::Reset()
Expand All @@ -75,13 +75,15 @@ namespace Lumos
m_Signaled = false;
}

void VKFence::WaitAndReset()
bool VKFence::WaitAndReset()
{
LUMOS_PROFILE_FUNCTION();
LUMOS_PROFILE_FUNCTION();
bool succeeded = true;
if(!IsSignaled())
Wait();
succeeded = Wait();

Reset();
return succeeded;
}
}
}
2 changes: 1 addition & 1 deletion Lumos/Source/Lumos/Platform/Vulkan/VKFence.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Lumos

bool Wait(uint64_t timeoutNanoseconds = 1000000000);
void Reset();
void WaitAndReset();
bool WaitAndReset();

private:
VkFence m_Handle;
Expand Down
3 changes: 3 additions & 0 deletions Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ namespace Lumos
{
if(!commandBuffer->Wait())
{
//Exit app
LFATAL("Failed to submit command buffer");
Application::Get().SetAppState(AppState::Closing);
return;
}
}
Expand Down
4 changes: 1 addition & 3 deletions Runtime/Runtime.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <string>
#include <Lumos/Core/Application.h>
#include <Lumos/Core/EntryPoint.h>
#include <Lumos/Core/OS/Window.h>
Expand All @@ -10,9 +11,6 @@
#include <Lumos/Maths/Vector4.h>
#include <Lumos/Maths/Matrix4.h>
#include <Lumos/Maths/MathsUtilities.h>

#include <imgui/imgui.h>

#include <imgui/imgui.h>

using namespace Lumos;
Expand Down

0 comments on commit 6b9d644

Please sign in to comment.