Heaps with HashLink Debugger Issue

Hi, I am having the same issue. My Notebook has an Intel HD Graphics 630 driver and a NVIDIA GTX 1050. After selecting the hl application to always use the nvidia graphics card in the graphic-settings the error still persisted.

Is there any known workaround for this issue? I can run the compiled hl file but can’t use the debugger.

Edit: I have forced the nvidia card for the hl executable.

Edit2: I wanted to say that I just discovered Haxe and Heaps. I think they are both very awesome and I am very surprised that I have never heard of them before. Thank you for your amazing work @ncannasse

Hello. I have also run into this same behavior and unsurprisingly I am also running a similar configuration.

Windows 10
A laptop with Intel HD 530 and Nvidia GTX 960M.
Using latest NVIDIA drivers

Testing the basic samples from Hello Hashlink:

With hlsdl:
hl.exe from command line: works as intended
from the VS Code debugger: Window is white and unresponsive

With hldx:
hl.exe from command line: works as intended
from the VS Code debugger: Exception thrown: DXError 8007000E line 184

Actually forcing the Nvidia card on hl.exe or haxe.exe didn’t work. Forcing the integrated Intel graphics card on both executables actually did, though. So thanks for the tip, because that made me tinker around with the settings.

@floatvoid and @derivmug could you guys try this out as well? Maybe it’s a common solution for the issue. You can set the default graphics card for any executable in the Nvidia control panel, which you find in the old control panel here: https://i.imgur.com/JR52PKF.png

What’s interesting though, if I set the compilation to use hldx it would throw an exception at line 169 in the file DirectXDriver.hx:
if( driver == null ) throw "Failed to initialize DirectX driver";

It only happens when debugging though, if I start the program directly on the command line, it all works. Compiling with the hlsdl option works for both, debugging and executing on the command line. So I will just use this for now then. Any idea though why the program is not able to find the DirectX driver in debug mode?

I’ve had no luck forcing either card with either graphics library.

I’ve got exactly the same issue here for an Intel / Nvidia laptop with helloHeaps. When trying to debug from vscode:

hldx / Intel Graphics UHD 620: Failed to initialize DirectX driver Called from h3d.impl.DirectXDriver.reset (h3d/impl/DirectXDriver.hx line 169)
hldx / NVIDIA GeForce MX150: DXError 8007000E line 184 Called from h3d.impl.DirectXDriver.onDXError (h3d/impl/DirectXDriver.hx line 193)
hlsdl / Intel Graphics UHD 620: No exception, but a white-filled window.
hlsdl / NVIDIA GeForce MX150: No exception, but a white-filled window.

I’ve not tried every combination but that ones I did all worked fine with hl hello.hl.

Seems to work fine with the debugger in command line mode:

hl debug.hl --cwd path/to/helloHeaps hello.hl
break Main.hx:4
run
# breaks
c
# Shows "Hello World!"

@moreginger it’s quite interesting that it fails when launched from VSCode but works when using the standalone debugger. Can you check if it works by attaching the VSCode debugger to an already launched hl ? (using hl --debug port --debug-wait hello.hl). In which case this might be related to the way the VSCode debugger launch the process.

Can you check if it works by attaching the VSCode debugger to an already launched hl ? (using hl --debug port --debug-wait hello.hl).

Yes, attaching to a separately launched hl started in that way works perfectly (very useful in itself, thanks).

FWIW I noticed that it does hit a breakpoint in init() if I launch debug from vscode, but I get the DXError after continuing and before seeing anything rendered.

@moreginger interesting… so it seems indeed related to the way the process is launched. Could you compare the env vars (using Sys.environment()). Also, I think the program works correctly when not using any graphics library right?

@ncannasse

Thanks for all your help. Fiddling with the env allowed me to get it working. I’ve created an issue (https://github.com/vshaxe/hashlink-debugger/issues/51) and PR.

FWIW just omitting the env entirely also fixes the issue, I figured a minimal one was better.