Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#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.

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);
}

#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.

PARTNERS