Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window Resize needs improvement #7

Open
mtuncbilek95 opened this issue Aug 6, 2024 · 0 comments
Open

Window Resize needs improvement #7

mtuncbilek95 opened this issue Aug 6, 2024 · 0 comments
Labels
Improvement Something works but that can cause bugs in future Mid Mid level priority

Comments

@mtuncbilek95
Copy link
Owner

Currently some modules have repetitive skip frame functions for resizing

void ImGuiWindowModule::Update() noexcept
{
	auto swapchain = GraphicsAPI::GetAPI()->GetSwapchain();
        // SKIP FRAME
	if (swapchain->GetImageSize().x == 0 || swapchain->GetImageSize().y == 0)
		return;

	auto windows = mImGuiAPI->GetGuiWindows();

	for (auto& window : windows)
	{
		window->OnUpdate();
	}

	for (auto& window : windows)
	{
		window->OnPaint();
	}

	if (mImGuiAPI->IsRequestQuit())
	{
		GetOwnerApp()->RequestQuit();
		GetOwnerApp()->QuitReason("Quit from MenuBar.");
	}
}
void ImGuiEndModule::Update() noexcept
{
        // SKIP FRAME
	if (mSwapchain->GetImageSize().x == 0 || mSwapchain->GetImageSize().y == 0)
		return;

	ImGui::Render();

	if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
	{
		ImGui::UpdatePlatformWindows();
		ImGui::RenderPlatformWindowsDefault();
	}

	ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), mCmdBuffer->GetAs<VCmdBuffer>()->GetVkCmdBuffer());
}
void ImGuiBeginModule::Update() noexcept
{
        // SKIP FRAME
	if(mSwapchain->GetImageSize().x == 0 || mSwapchain->GetImageSize().y == 0)
		return;

	u32 index = mSwapchain->AcquireNextImage(mFence.get(), nullptr);
	mDevice->WaitFence(mFence.get());
	mDevice->ResetFence(mFence.get());

	mCmdBuffer->BeginRecording();
	// ......... GOES ON
}

A couple functions also have that skip mechanism but I believe this is the most cheesy way to solve a problem

@mtuncbilek95 mtuncbilek95 added Mid Mid level priority Improvement Something works but that can cause bugs in future labels Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Something works but that can cause bugs in future Mid Mid level priority
Projects
None yet
Development

No branches or pull requests

1 participant