Skip to content

Commit 9538897

Browse files
Merge remote-tracking branch 'remotes/origin/unroll-path_tracer_beauty' into path_tracer_beauty
2 parents 619315e + 292d751 commit 9538897

8 files changed

Lines changed: 20 additions & 13 deletions

File tree

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "nbl/ext/ImGui/ImGui.h"
1111
#include "nbl/ext/ImGui/builtin/hlsl/common.hlsl"
1212
#include "imgui/imgui.h"
13+
#include "imgui/imgui_internal.h"
1314
#include "imgui/misc/cpp/imgui_stdlib.h"
1415

1516
#ifdef NBL_EMBED_BUILTIN_RESOURCES
@@ -948,14 +949,20 @@ UI::UI(SCreationParameters&& creationParams, core::smart_refctd_ptr<video::IGPUG
948949
UI::~UI()
949950
{
950951
// I assume somebody has not killed ImGUI context & atlas but if so then we do nothing
952+
auto* const context = reinterpret_cast<ImGuiContext*>(m_imContextBackPointer);
953+
ImGuiContext* const previousContext = ImGui::GetCurrentContext();
954+
if (context && previousContext != context)
955+
ImGui::SetCurrentContext(context);
951956

952957
// we must call it to unlock atlas from potential "render" state before we kill it (obvsly if its ours!)
953-
if(m_imFontAtlasBackPointer)
958+
if (m_imFontAtlasBackPointer && context && context->WithinFrameScope)
954959
ImGui::EndFrame();
955960

956961
// context belongs to the instance, we must free it
957-
if(m_imContextBackPointer)
958-
ImGui::DestroyContext(reinterpret_cast<ImGuiContext*>(m_imContextBackPointer));
962+
if (context)
963+
ImGui::DestroyContext(context);
964+
if (previousContext && previousContext != context)
965+
ImGui::SetCurrentContext(previousContext);
959966

960967
// and if we own the atlas we must free it as well, if user passed its own at creation time then its "shared" - at this point m_imFontAtlasBackPointer is nullptr and we don't free anything
961968
if (m_imFontAtlasBackPointer)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nsc-windows-x64-release-29bda527be490f8214e937ae33bbffd438cce6e6
1+
nsc-windows-x64-release-eb1bc723b1159029c572f5bf539dafeea03bbbcc
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: f739d206ca9055781c891f130c6ebc1b
3-
size: 1311
2+
- md5: 27b41f54ba2fbed4e8a0c507e3efb152
3+
size: 1337
44
hash: md5
55
path: build-info.json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: c4bb7179384f8fe59a5706751a2ef473
2+
- md5: 2f6ac2e50fe11b36b5a426bcb3b3fa3a
33
size: 258048
44
hash: md5
55
path: nsc.exe
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: 862b11b94cb23c8bac2a20a215eb6597
3-
size: 21601280
2+
- md5: 2f88a872e7e2c9b1c07683f265559b05
3+
size: 21609472
44
hash: md5
55
path: dxcompiler.dll
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
outs:
2-
- md5: 5edb2790e9ceae424e3c0a04e3d84718
3-
size: 29212672
2+
- md5: f3efa28ec945dae71bf6bbe34331d8ca
3+
size: 29222400
44
hash: md5
55
path: Nabla.dll

0 commit comments

Comments
 (0)