• Advertisement
Sign in to follow this  

MessageBox and Direct3D11

This topic is 1994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys,
Is it ok to call MessageBox with an active device and swap chain? Just by chance I forgot to rename a compiled shader file... and the following code started to crash on the MessageBox line. But if I move the MessageBox line to below the FreeDirect3D call, the message box displays fine. I'm on on an AMD card with latest drivers running a sample D3D11 application in windowed mode.

Thanks!

This crashes.

[source lang="cpp"]// open vertex shader
std::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filename
if(!vsfile) {
MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // crash!
FreeDirect3D();
return FALSE;
}[/source]

This works OK.

[source lang="cpp"]// open vertex shader
std::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filename
if(!vsfile) {
FreeDirect3D();
MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // OK!
return FALSE;
}[/source]

EDIT: After some more testing, for me, any MessageBox called after D3D11CreateDeviceAndSwapChain but before a call to CreateVertexShader crashes atidxx32. Any MessageBox after the call to CreateVertexShader doesn't crash.

Full source code crashes on line 47 of d3dapp.cpp. Edited by yadango

Share this post


Link to post
Share on other sites
Advertisement
It's fine to use MessageBox in a windowed D3D11 app.

You've probably hit a driver bug, probably due to something in your shader that's breaking the JIT compiler used in the driver. Usually for things like this I will start commenting out blocks of code until I find whichever bit is causing the problem, and then I'll try to re-write that bit of code until I work around the bug.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement