Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualyadango

Posted 05 August 2012 - 06:29 PM

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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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.

#6yadango

Posted 05 August 2012 - 06:23 PM

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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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.

#5yadango

Posted 05 August 2012 - 05:23 PM

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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!vsfile) { FreeDirect3D(); MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // OK! return FALSE; }[/source]

#4yadango

Posted 05 August 2012 - 05:21 PM

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.

This crashes.

[source lang="cpp"]// open vertex shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!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 shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!vsfile) { FreeDirect3D(); MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // OK! return FALSE; }[/source]

#3yadango

Posted 05 August 2012 - 05:20 PM

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.

[source lang="cpp"]// open vertex shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!vsfile) { MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // crash! FreeDirect3D(); return FALSE; }// vertex shader filesizevsfile.seekg(0, std::ios::end);SIZE_T vsfilesize = (SIZE_T)vsfile.tellg();vsfile.seekg(0, std::ios::beg);// read vertex shaderboost::shared_array<char> vsdata(new char[vsfilesize]);vsfile.read(vsdata.get(), vsfilesize);if(vsfile.fail()) { MessageBox(GetMainWindow(), TEXT("Failed to read vertex shader file."), TEXT("Error"), MB_ICONSTOP); FreeDirect3D(); return FALSE; }// create vertex shaderresult = lpDevice->CreateVertexShader((LPCVOID)vsdata.get(), vsfilesize, NULL, &lpVertexShader);if(FAILED(result)) { MessageBox(GetMainWindow(), TEXT("Failed to create vertex shader."), TEXT("Error"), MB_ICONSTOP); FreeDirect3D(); return FALSE; }[/source]
[source lang="cpp"]// open vertex shaderstd::ifstream vsfile("002.vs", std::ios::binary); // oops! wrong filenameif(!vsfile) { FreeDirect3D(); MessageBox(GetMainWindow(), TEXT("Failed to open vertex shader file."), TEXT("Error"), MB_ICONSTOP); // OK! return FALSE; }[/source]

#2yadango

Posted 05 August 2012 - 05:18 PM

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.


// 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;

   }



// vertex shader filesize

vsfile.seekg(0, std::ios::end);

SIZE_T vsfilesize = (SIZE_T)vsfile.tellg();

vsfile.seekg(0, std::ios::beg);



// read vertex shader

boost::shared_array<char> vsdata(new char[vsfilesize]);

vsfile.read(vsdata.get(), vsfilesize);

if(vsfile.fail()) {

	MessageBox(GetMainWindow(), TEXT("Failed to read vertex shader file."), TEXT("Error"), MB_ICONSTOP);

	FreeDirect3D();

	return FALSE;

   }



// create vertex shader

result = lpDevice->CreateVertexShader((LPCVOID)vsdata.get(), vsfilesize, NULL, &lpVertexShader);

if(FAILED(result)) {

	MessageBox(GetMainWindow(), TEXT("Failed to create vertex shader."), TEXT("Error"), MB_ICONSTOP);

	FreeDirect3D();

	return FALSE;

   }




// 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;

   }


PARTNERS