Jump to content
  • Advertisement
Sign in to follow this  
dawoodr

DX11 D3DCompileFromFile

This topic is 1414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

 

I am stuck on tutorial 4 on this website: http://www.braynzarsoft.net/index.php?p=D3D11BD#still

 

Theese two lines are messing everything up for me:

hResult = D3DCompileFromFile(L"C:\\Users\\Dawood\\Documents\\Visual Studio 2013\\Projects\\Direct3D\\Direct3D\\Effects.fx", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, NULL, "vs_5_0", 0, 0, &VS_Buffer, NULL);

hResult = D3DCompileFromFile(L"C:\\Users\\Dawood\\Documents\\Visual Studio 2013\\Projects\\Direct3D\\Direct3D\\Effects.fx", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, NULL, "ps_5_0", 0, 0, &PS_Buffer, NULL);

I am not using the exact same code as he is using so please notice that. I have included my Effects.fx file in the project and also placed it where my .cpp and .h files are located for the project. I have also changed the properties->HLSL Compiler->General and there I changed the "shader type" to Effect (/fx) and the "shader model" to Shader Model 5 (/5_0)

 

I can't understand why this isn't working. The issue is that our VS_Buffer and PS_Buffer is still pointing to NULL after this line of code is done and the result of hResult is some weird numbers like "0x8876086c" and not "S_OK"

 

He has written the following lines just to save you some time in your search but I am not using that stuff since msdn doesn't recommend it anymore.

hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, 0, 0);
hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "PS", "ps_4_0", 0, 0, 0, &PS_Buffer, 0, 0);

I have already tried changing the vs_5_0 to vs_4_0 but that is not the issue here.

 

Regards!

 
Edited by dawoodr

Share this post


Link to post
Share on other sites
Advertisement

the result of hResult is some weird numbers like "0x8876086c"

 

That's called an error code. 0x8876086c is the informative error "Invalid Call."

 

So.. you need to check each parameter for validity.

 

Do you have debug output enabled? You should be able to get more informative info from that. Or, add the error msgs blob parameter and get the error description from that.

 

- Is the file path correct?

- If you have "#include some-file" in your shader file, can they be found?

- Are VS_ and PS_BUFFER ID3DBlob* objects? I know, if they aren't, it shouldn't compile.

- Have you tried specifying the entry points explicitly?

- Try setting the shader flags to D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_DEBUG.

 


I changed ... the "shader model" to Shader Model 5 (/5_0)

 

Is that supported? Do you have code in the fx file that needs 5_0? [shrug]

Edited by Buckeye

Share this post


Link to post
Share on other sites

http://msdn.microsoft.com/en-us/library/windows/desktop/hh446872%28v=vs.85%29.aspx

 

The last parameter is an ID3DBlob that will receive error messages that occur during the compilation.  Instead of setting it to NULL, I recommend that you actually use it; you can then use it's GetBufferPointer member to access those error messages and find out what went wrong.  Cast it to the appropriate char * or string type and print them, or whatever; e.g:

 

if (pErrorBlob) {OutputDebugString ((LPCTSTR) pErrorBlob->GetBufferPointer ()); pErrorBlob->Release ();}

Share this post


Link to post
Share on other sites

Ok, I created on ID3DBlob* pErrorBlob, I assume that was what you wanted me to do and just placed it instead of NULL.
The pErrorBlob showed the following message: + 0x01485510 <Information not available, no symbols loaded for D3DCompiler_47.dll> ID3D10Blob *

 

Also what do you mean by this "- Have you tried specifying the entry points explicitly?" I am a beginner so I don't know what you mean really

Share this post


Link to post
Share on other sites

I don't know how much this will help but perhaps It will so I am just pasting this

'Direct3D.exe' (Win32): Loaded 'C:\Users\Dawood\Documents\Visual Studio 2013\Projects\Direct3D\Debug\Direct3D.exe'. Symbols loaded.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Program Files (x86)\Norton Internet Security\NortonData\21.0.0.100\Definitions\BASHDefs\20140912.003\UMEngx86.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\D3DCompiler_47.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvinit.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\advapi32.dll'
'Direct3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\nvinit.dll'
The thread 0xf3c has exited with code 0 (0x0).
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igd10iumd32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncrypt.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntasn1.dll'. Cannot find or open the PDB file.
'Direct3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.

Share this post


Link to post
Share on other sites

Perhaps this can help
 

- &VS_Buffer 0x00e2bee0 {0x00000000 <NULL>} ID3D10Blob * *
    - 0x00000000 <NULL> ID3D10Blob *
        - IUnknown <struct at NULL> IUnknown
            __vfptr <Unable to read memory> void * *
 
 

Share this post


Link to post
Share on other sites

First: It appears the code you're working with is for Direct3D 11, and you're using ID3D10Blob. If so, use ID3DBlob.

 

You should have something like:

// ID3DBlob VS_BUFFER; // NO! VS_BUFFER must be a pointer to a blob.
ID3DBlob *VS_BUFFER = NULL;
ID3DBlob *errMsg = NULL;
DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_DEBUG;

hr = D3DCompileFromFile( filename, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "your-entry-point", "vs_4_0", dwShaderFlags, NULL, &VS_BUFFER, &errMsg );
if( FAILED(hr) )
{
   if( NULL != errMsg )
   {
      OutputErrorMessage( (char*)errMsg->GetBufferPointer() );
      errMsg->Release();
      return some-error;
   }
   // .. output the error condition for the user
   ReportErrorCondition(hr);
}
if( NULL != errMsg ) errMsg->Release(); // ensure cleanup 
Edited by Buckeye

Share this post


Link to post
Share on other sites

That parameter is the entry point for the vertex shader in your shader file.

 

If, for instance, your shader file has:

PS_INPUT MyVertexShader( VS_INPUT input )
{
   ...

then that parameter would be "MyVertexShader" - i.e., D3DCompileFromFile(..., "MyVertexShader", "vs_4_0", ...)

Share this post


Link to post
Share on other sites

Hmm, I think that was it, now it is atleast working, however nothing is being drawn :(

Thanks alot for the help!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!