Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

#Actualpapulko

Posted 10 January 2013 - 09:31 AM

Error handling with the CompileFromFile function is a somewhat different from most other d3dx functions since it's dealing with compiling hlsl code. If I remember it right you can access any hlsl syntax errors by passing a ID3D10Blob** as the second-to-last parameter ('ppErrorMsgs').

If you want to put the error message in a MessageBox you would need something like
ID3D10Blob* pErrorBlob = NULL;
if (FAILED(D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, &pErrorBlob, 0)))
{   
   char* pErrors_mb = static_cast<char*>(pErrorBlob->GetBufferPointer());   
   wchar_t pErrors_w[512];   
   mbstowcs(pErrors_w, pErrors_mb, 512);   
   MessageBox(NULL, pErrors_w, L"Error", MB_OK);   
   return 0;
}
edit: On a sidenote, MSDN recommends precompiling any shader code (for example by using fxc.exe) rather than using this function.

#4papulko

Posted 10 January 2013 - 09:30 AM

Error handling with the CompileFromFile function is a somewhat different from most other d3dx functions since it's dealing with compiling hlsl code. If I remember it right you can access any hlsl syntax errors by passing a ID3D10Blob** as the second-to-last parameter ('ppErrorMsgs').

If you want to put the error message in a MessageBox you would need something like
ID3D10Blob* pErrorBlob = NULL;
if (FAILED(D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, &pErrorBlob, 0)))
{   
   char* pErrors_mb = static_cast<char*>(pErrorBlob->GetBufferPointer());   
   wchar_t pErrors_w[512];   mbstowcs(pErrors_w, pErrors_mb, 512);   
   MessageBox(NULL, pErrors_w, L"Error", MB_OK);   
   return 0;}
edit: On a sidenote, MSDN recommends precompiling any shader code (for example by using fxc.exe) rather than using this function.

#3papulko

Posted 10 January 2013 - 09:29 AM

Error handling with the CompileFromFile function is a somewhat different from most other d3dx functions since it's dealing with compiling hlsl code. If I remember it right you can access any hlsl syntax errors by passing a ID3D10Blob** as the second-to-last parameter ('ppErrorMsgs').

If you want to put the error message in a MessageBox you would need something like
ID3D10Blob* pErrorBlob = NULL;if (FAILED(D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, &pErrorBlob, 0))){   char* pErrors_mb = static_cast<char*>(pErrorBlob->GetBufferPointer());   wchar_t pErrors_w[512];   mbstowcs(pErrors_w, pErrors_mb, 512);   MessageBox(NULL, pErrors_w, L"Error", MB_OK);   return 0;}

edit: On a sidenote, MSDN recommends precompiling any shader code (for example by using fxc.exe) rather than using this function.

#2papulko

Posted 10 January 2013 - 09:29 AM

Error handling with the CompileFromFile function is a somewhat different from most other d3dx functions since it's dealing with compiling hlsl code. If I remember it right you can access any hlsl syntax errors by passing a ID3D10Blob** as the second-to-last parameter ('ppErrorMsgs').

If you want to put the error message in a MessageBox you would need something like
ID3D10Blob* pErrorBlob = NULL;if (FAILED(D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, &pErrorBlob, 0))){   char* pErrors_mb = static_cast<char*>(pErrorBlob->GetBufferPointer());   wchar_t pErrors_w[512];   mbstowcs(pErrors_w, pErrors_mb, 512);   MessageBox(NULL, pErrors_w, L"Error", MB_OK);   return 0;}

edit: On a sidenote, MSDN recommends precompiling any shader code (for example by using fxc.exe) rather than using this function.

#1papulko

Posted 10 January 2013 - 09:19 AM

Error handling with the CompileFromFile function is a somewhat different from most other d3dx functions since it's dealing with compiling hlsl code. If I remember it right you can access any hlsl syntax errors by passing a ID3D10Blob** as the second-to-last parameter ('ppErrorMsgs').

 

If you want to put the error message in a MessageBox you would need something like 

ID3D10Blob* pErrorBlob = NULL;
if (FAILED(D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, &pErrorBlob, 0)))
{
   char* pErrors_mb = static_cast<char*>(pErrorBlob->GetBufferPointer());
   wchar_t pErrors_w[512];
   mbstowcs(pErrors_w, pErrors_mb, 512);
   MessageBox(NULL, pErrors_w, L"Error", MB_OK);
   return 0;
}


PARTNERS