diff --git a/code/addons/dynui/imguicontext.cc b/code/addons/dynui/imguicontext.cc index f8d1e99c8..2ad9733cb 100644 --- a/code/addons/dynui/imguicontext.cc +++ b/code/addons/dynui/imguicontext.cc @@ -109,12 +109,10 @@ ImguiDrawFunction(const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle< CoreGraphics::CmdSetGraphicsPipeline(cmdBuf, ImguiContext::state.editorPipeline); } else +#endif { CoreGraphics::CmdSetGraphicsPipeline(cmdBuf, ImguiContext::state.pipeline); } -#else - CoreGraphics::CmdSetGraphicsPipeline(cmdBuf, ImguiContext::state.pipeline); -#endif // setup input buffers CoreGraphics::CmdSetVertexLayout(cmdBuf, ImguiContext::state.vlo); @@ -355,25 +353,7 @@ ImguiContext::Create() components.Append(VertexComponent(1, VertexComponent::Float2, 0)); components.Append(VertexComponent(2, VertexComponent::UByte4N, 0)); state.vlo = CoreGraphics::CreateVertexLayout({ .name = "ImGui"_atm, .comps = components }); - - /* - FrameScript_default::RegisterSubgraphPipelines_ImGUI_Pass([](const CoreGraphics::PassId pass, uint subpass) - { - CoreGraphics::InputAssemblyKey inputAssembly{ CoreGraphics::PrimitiveTopology::TriangleList, false }; - if (state.pipeline != CoreGraphics::InvalidPipelineId) - CoreGraphics::DestroyGraphicsPipeline(state.pipeline); - state.pipeline = CoreGraphics::CreateGraphicsPipeline({ state.prog, pass, subpass, inputAssembly }); - }); - FrameScript_default::RegisterSubgraph_ImGUI_Pass([](const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle& viewport, const IndexT frame, const IndexT bufferIndex) - { -#ifdef NEBULA_NO_DYNUI_ASSERTS - ImguiContext::RecoverImGuiContextErrors(); -#endif - ImGui::Render(); - ImguiDrawFunction(cmdBuf, viewport); - }); - */ - + #if WITH_NEBULA_EDITOR if (App::GameApplication::IsEditorEnabled()) { @@ -394,7 +374,25 @@ ImguiContext::Create() ImguiDrawFunction(cmdBuf, viewport); }); } + else +#endif + { + FrameScript_default::RegisterSubgraphPipelines_ImGUI_Pass([](const CoreGraphics::PassId pass, uint subpass) + { + CoreGraphics::InputAssemblyKey inputAssembly{ CoreGraphics::PrimitiveTopology::TriangleList, false }; + if (state.pipeline != CoreGraphics::InvalidPipelineId) + CoreGraphics::DestroyGraphicsPipeline(state.pipeline); + state.pipeline = CoreGraphics::CreateGraphicsPipeline({ state.prog, pass, subpass, inputAssembly }); + }); + FrameScript_default::RegisterSubgraph_ImGUI_Pass([](const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle& viewport, const IndexT frame, const IndexT bufferIndex) + { +#ifdef NEBULA_NO_DYNUI_ASSERTS + ImguiContext::RecoverImGuiContextErrors(); #endif + ImGui::Render(); + ImguiDrawFunction(cmdBuf, viewport); + }); + } SizeT numBuffers = CoreGraphics::GetNumBufferedFrames(); diff --git a/code/addons/graphicsfeature/graphicsfeatureunit.cc b/code/addons/graphicsfeature/graphicsfeatureunit.cc index 0847d4562..20160eb60 100644 --- a/code/addons/graphicsfeature/graphicsfeatureunit.cc +++ b/code/addons/graphicsfeature/graphicsfeatureunit.cc @@ -147,7 +147,10 @@ GraphicsFeatureUnit::OnActivate() FrameScript_shadows::Initialize(1024, 1024); FrameScript_default::Initialize(mode.GetWidth(), mode.GetHeight()); #if WITH_NEBULA_EDITOR - FrameScript_editorframe::Initialize(mode.GetWidth(), mode.GetHeight()); + if (App::GameApplication::IsEditorEnabled()) + { + FrameScript_editorframe::Initialize(mode.GetWidth(), mode.GetHeight()); + } #endif this->defaultView = gfxServer->CreateView("mainview", FrameScript_default::Run, Math::rectangle(0, 0, mode.GetWidth(), mode.GetHeight())); this->defaultStage = gfxServer->CreateStage("defaultStage", true); @@ -269,8 +272,11 @@ GraphicsFeatureUnit::OnActivate() FrameScript_default::Initialize(windowWidth, windowHeight); FrameScript_default::SetupPipelines(); #if WITH_NEBULA_EDITOR - FrameScript_editorframe::Initialize(windowWidth, windowHeight); - FrameScript_editorframe::SetupPipelines(); + if (App::GameApplication::IsEditorEnabled()) + { + FrameScript_editorframe::Initialize(windowWidth, windowHeight); + FrameScript_editorframe::SetupPipelines(); + } #endif }); @@ -354,7 +360,10 @@ GraphicsFeatureUnit::OnActivate() FrameScript_default::SetupPipelines(); FrameScript_shadows::SetupPipelines(); #if WITH_NEBULA_EDITOR - FrameScript_editorframe::SetupPipelines(); + if (App::GameApplication::IsEditorEnabled()) + { + FrameScript_editorframe::SetupPipelines(); + } #endif this->defaultViewHandle = CameraManager::RegisterView(this->defaultView); }