Direct2D debug messages

Hi @matt

Yes, these exceptions seem to be gone.
I do see other exceptions popup now, not sure if they were there before as they are much less frequent:

  • Microsoft C++ exception: CacheOverflowException when the text is updated frequently
  • The thread 'JUCE D2D swap chain thread' (XXX) has exited with code 0 (0x0) in popupmenus

Right on - thanks for trying the patch.

Good to hear the patch improved matters.

Microsoft C++ exception: CacheOverflowException when the text is updated frequently

Are you recreating the typeface every time you paint or just creating it once?

The thread 'JUCE D2D swap chain thread' (XXX) has exited with code 0 (0x0) in popupmenus

That’s to be expected - every heavyweight window has its own swap chain with its own dedicated thread.

Matt

Hi @matt

I was indeed recreating the typeface in my test code!

OK I see.
I get 5 of these messages every time a menu is closed though.
It gets noisy when browsing a menu with submenus :smiley:

For what it’s worth, the Visual Studio output window has a setting to disable this message: c# - Is there a way to prevent Visual Studio from printing Thread exited statements into the Output Window? - Stack Overflow

1 Like

Now that the noise level is lower (thanks @jdv!) I see other exceptions in my app as well as in the most basic GUI project template:

JUCE v8.0.0
-- NewProjectApplication constructor
-- NewProjectApplication::initialise()
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055529FF760.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055528FF8F0.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055529FFC10.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055528FFB70.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055529FFE60.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055528FFBC0.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055529FFCC0.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055528FFE20.
-- MainWindow constructor
-- MainWindow::closeButtonPressed()
-- NewProjectApplication::shutdown()
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055529FFD20.
Exception thrown at 0x00007FFEC52453AC in NewProject.exe: Microsoft C++ exception: MONZA::IgcThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000055528FFE10.
Detected memory leaks!
Dumping objects ->
{2165} normal block at 0x0000018C72FD4110, 6 bytes long.
 Data: <en-us > 65 6E 2D 75 73 00 
{2164} normal block at 0x0000018C72FD3A80, 16 bytes long.
 Data: < r s     A r    > 00 72 0E 73 8C 01 00 00 10 41 FD 72 8C 01 00 00 
{1963} normal block at 0x0000018C7314EB10, 2 bytes long.
 Data: <c > 63 00 
{1962} normal block at 0x0000018C730E7200, 16 bytes long.
 Data: <           s    > 00 00 00 00 00 00 00 00 10 EB 14 73 8C 01 00 00 
{1959} normal block at 0x0000018C731019D0, 216 bytes long.
 Data: <                > 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
{1938} normal block at 0x0000018C66E0FEE0, 184 bytes long.
 Data: <                > 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Object dump complete.

I get these with all JUCE 8 versions I have tried, but not with either JUCE 7.0.10 or JUCE 7 Direct2D.

1 Like

Are you running this under some sort of virtualization or emulation?

No, this is a Windows 11 install.
Might still be the fact that I don’t have a dedicated GPU?

No idea, but when searching for MONZA, it comes up with some Microsoft stuff for virtualization.

Also comparisons with the JUCE7 D2D are not really valid anymore, as a LOT has changed since then. Especially when it comes to text rendering. It’s like saying “the new code behaves differently than before it existed”.

I’m not getting any of these exceptions so it might really be driver thing.

I suspect the leaks are from the Harfbuzz library.

You can set Visual Studio to break when the exception happens to get a stack trace. Go to Debug/Windows/Exception Settings and enable all the C++, common language, and Win32 exceptions.

Matt

Comparing the JUCE 7 vs JUCE 8 renderers is still useful for me, at least for now.

Matt

 	[External Code]	
>	igd10um64xe.dll!00007ffebbb3deb3()	Unknown
 	igd10um64xe.dll!00007ffebbe2ec2c()	Unknown
 	igd10um64xe.dll!00007ffebba26901()	Unknown
 	igd10um64xe.dll!00007ffebbb0fb16()	Unknown
 	igd10um64xe.dll!00007ffebbb5027f()	Unknown
 	kernel32.dll!00007ffec635257d()	Unknown
 	ntdll.dll!00007ffec7d0aa48()	Unknown

igd10um64xe.dll is the Intel GPU driver. Wasn’t recently some code changed in JUCE8 regarding DPI stuff?

I updated my Intel driver to the last version (from 4 days ago) with no difference.
I suspect all these recent updates are for dedicated ARC dedicated graphic cards and the new Xe in laptops.

I just tried with a 100% DPI setting (was 200%), same exceptions and leak.

Is that call stack from the message thread?

The scale doesn’t matter. The calls to the API still have to be made to find out the current desktop scale, etc. I’m just trying to provide context.

More details.

 	[External Code]	
>	NewProject.exe!juce::ComSmartPtr<ID3D11Device>::release() Line 190	C++
 	NewProject.exe!juce::ComSmartPtr<ID3D11Device>::~ComSmartPtr<ID3D11Device>() Line 113	C++
 	[External Code]	
 	NewProject.exe!juce::ContainerDeletePolicy<juce::DxgiAdapter>::destroy(juce::DxgiAdapter * object) Line 66	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::releaseObject(juce::DxgiAdapter * o) Line 883	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::releaseAllObjects() Line 876	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::clearQuick() Line 159	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::clear() Line 148	C++
 	NewProject.exe!juce::DxgiAdapters::releaseAdapters() Line 173	C++
 	NewProject.exe!juce::DxgiAdapters::~DxgiAdapters() Line 134	C++
 	[External Code]	
 	NewProject.exe!juce::SharedResourcePointer<juce::DirectX>::~SharedResourcePointer<juce::DirectX>() Line 114	C++
 	NewProject.exe!juce::VBlankDispatcher::reconfigureDisplays() Line 259	C++
 	NewProject.exe!juce::VBlankDispatcher::VBlankDispatcher() Line 269	C++
 	NewProject.exe!juce::SingletonHolder<juce::VBlankDispatcher,juce::DummyCriticalSection,0>::getWithoutChecking() Line 115	C++
 	NewProject.exe!juce::SingletonHolder<juce::VBlankDispatcher,juce::DummyCriticalSection,0>::get() Line 104	C++
 	NewProject.exe!juce::VBlankDispatcher::getInstance() Line 261	C++
 	NewProject.exe!juce::HWNDComponentPeer::updateCurrentMonitorAndRefreshVBlankDispatcher(juce::HWNDComponentPeer::ForceRefreshDispatcher force) Line 3337	C++
 	NewProject.exe!juce::HWNDComponentPeer::HWNDComponentPeer(juce::Component & comp, int windowStyleFlags, HWND__ * parent, bool nonRepainting, int engine) Line 1511	C++
 	NewProject.exe!juce::Component::createNewPeer(int styleFlags, void * parentHWND) Line 4327	C++
 	NewProject.exe!juce::Component::addToDesktop(int styleWanted, void * nativeWindowToAttachTo) Line 380	C++
 	NewProject.exe!juce::TopLevelWindow::TopLevelWindow(const juce::String & name, bool shouldAddToDesktop) Line 47	C++
 	NewProject.exe!juce::ResizableWindow::ResizableWindow(const juce::String & name, juce::Colour bkgnd, bool shouldAddToDesktop) Line 45	C++
 	NewProject.exe!juce::DocumentWindow::DocumentWindow(const juce::String & title, juce::Colour backgroundColour, int requiredButtons_, bool addToDesktop_) Line 61	C++
 	NewProject.exe!NewProjectApplication::MainWindow::MainWindow(juce::String name) Line 64	C++
 	NewProject.exe!NewProjectApplication::initialise(const juce::String & commandLine) Line 30	C++
 	NewProject.exe!juce::JUCEApplicationBase::initialiseApp() Line 312	C++
 	NewProject.exe!juce::JUCEApplication::initialiseApp() Line 97	C++
 	NewProject.exe!juce::JUCEApplicationBase::main() Line 271	C++
 	NewProject.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 98	C++
 	[External Code]	


on shutdown:

 	[External Code]	
>	NewProject.exe!juce::ComSmartPtr<ID3D11Device>::release() Line 190	C++
 	NewProject.exe!juce::ComSmartPtr<ID3D11Device>::~ComSmartPtr<ID3D11Device>() Line 113	C++
 	[External Code]	
 	NewProject.exe!juce::ContainerDeletePolicy<juce::DxgiAdapter>::destroy(juce::DxgiAdapter * object) Line 66	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::releaseObject(juce::DxgiAdapter * o) Line 883	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::releaseAllObjects() Line 876	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::clearQuick() Line 159	C++
 	NewProject.exe!juce::ReferenceCountedArray<juce::DxgiAdapter,juce::DummyCriticalSection>::clear() Line 148	C++
 	NewProject.exe!juce::DxgiAdapters::releaseAdapters() Line 173	C++
 	NewProject.exe!juce::DxgiAdapters::~DxgiAdapters() Line 134	C++
 	[External Code]	
 	NewProject.exe!juce::SharedResourcePointer<juce::DirectX>::~SharedResourcePointer<juce::DirectX>() Line 114	C++
 	NewProject.exe!juce::Direct2DGraphicsContext::Pimpl::~Pimpl() Line 461	C++
 	NewProject.exe!juce::Direct2DHwndContext::HwndPimpl::~HwndPimpl() Line 368	C++
 	[External Code]	
 	NewProject.exe!juce::Direct2DHwndContext::~Direct2DHwndContext() Line 673	C++
 	[External Code]	
 	NewProject.exe!juce::HWNDComponentPeer::~HWNDComponentPeer() Line 1551	C++
 	[External Code]	
 	NewProject.exe!juce::Component::removeFromDesktop() Line 449	C++
 	NewProject.exe!juce::Component::~Component() Line 206	C++
 	NewProject.exe!juce::TopLevelWindow::~TopLevelWindow() Line 60	C++
 	NewProject.exe!juce::ResizableWindow::~ResizableWindow() Line 66	C++
 	NewProject.exe!juce::DocumentWindow::~DocumentWindow() Line 88	C++
 	[External Code]	
 	NewProject.exe!NewProjectApplication::shutdown() Line 38	C++
 	NewProject.exe!juce::JUCEApplicationBase::shutdownApp() Line 343	C++
 	NewProject.exe!juce::JUCEApplicationBase::main() Line 281	C++
 	NewProject.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 98	C++
 	[External Code]	

OK, I take it you’re seeing an exception when the adapter is released?

Matt

I couldn’t say.
I have a series of 8 exceptions when the application is created, and then 2 exceptions when it is shutdown.
If you need me to test specific things let me known.