HRESULT result;
ID3DXBuffer* errors = NULL;
result = D3DXCompileShaderFromFile( "pixel.psh", //filepath
NULL, //macro's
NULL, //includes
"ps_main", //main function
"ps_1_1", //shader profile
0, //flags
&code, //compiled operations
&errors, //errors
NULL); //constants
if(FAILED(result)) {
const char* errstring = "";
if(errors != NULL)
errstring = reinterpret_cast<const char*>(errors->GetBufferPointer());
printf("failed: %s", errstring);
}
Show differencesHistory of post edits
#ActualMJP
Posted 15 June 2012 - 11:41 AM
The compilation errors are returned to you in the ppErrorMsgs parameter. It will be in an ID3DXBuffer object, so you just need to call GetBufferPointer and cast the pointer to char* to read it as a string.
#1MJP
Posted 15 June 2012 - 11:38 AM
The compilation errors are returned to you in the ppErrorMsgs parameter. It will be in an ID3DXBuffer object, so you just need to call GetBufferPointer and cast the pointer to char* to read it as a string.