Sign in to follow this  
yadango

MessageBox and Direct3D11

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.

[url="http://www.sticklove.com/003.7z"]Full source code[/url] crashes on line 47 of d3dapp.cpp. Edited by yadango

Share this post


Link to post
Share on other sites
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this