1

I have a small application that loads a model and displays it without lighting or anything much. I have been trying to build a release and run it on another computer but D3DX10CreateEffectFromFile keeps returning E_FAIL.

The Effect file compiles perfectly and works perfectly on my development machine but not on the other PC. The specs of the pc arent that different. Both are Windows7, both have GeForce graphics cards. The only real difference is that the computer I am trying to run the release on has a DirectX 11 compatible graphics card.

The folder with my release build looks like this...

G:\ModelLoader

d3dx10_43.dll

ModelViewer.exe

Simple.fx

test.txt (model file)

This runs perfectly fine on my development machine(i have commented out most of the code so that all i do is open a window, initD3D10 and try and load a Effect). On the other PC it all works fine untill...

ID3D10Blob* l_pBlob_Errors = NULL;

HRESULT hr = D3DX10CreateEffectFromFile(L"Simple.fx", 
    NULL, 
    NULL, 
    "fx_4_0",
    //D3D10_SHADER_ENABLE_STRICTNESS || D3D10_SHADER_WARNINGS_ARE_ERRORS, 
    0,
    0, 
    pD3DDevice, 
    NULL, 
    NULL, 
    &modelObject->pEffect,
     &l_pBlob_Errors ,
     NULL); 

if (FAILED(hr))
{
       LPVOID l_pError = NULL;
    if( l_pBlob_Errors )
    {
          l_pError = l_pBlob_Errors->GetBufferPointer();
          char* myChar = (char*)l_pError;
          MessageBoxA(0, myChar, 0,0);
           }
else
{
     MessageBox(0,0,0,0);
        }
    return false;
 }

The shader I dont think contains any errors cus it compiles properly on my development pc

matrix Projection;

// PS_INPUT - input variables to the pixel shader
// This struct is created and fill in by the 
// vertex shader
struct PS_INPUT
{
float4 Pos : SV_POSITION;
float4 Color : COLOR0;
};

PS_INPUT VS(float4 Pos : POSITION, float4 Color : COLOR)
{
PS_INPUT psInput;

// Pass through both the position and the color
psInput.Pos = mul( Pos, Projection );
psInput.Color = Color;

return psInput;
}

float4 PS(PS_INPUT psInput) : SV_Target
{
return psInput.Color;
}

// Define the technique
technique10 Render
{
pass P0
{
    SetVertexShader( CompileShader( vs_4_0, VS() ) );
    SetGeometryShader( NULL );
    SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}

L"simple.fx" is the right filepath aswell, as i am able to use std::ifstream to read from it. I have searched for a few hours and have been unable to find an answer, all the related questions have turned out to be an error in the Effect file, which compiles right on my dev machine.

when I add an error to the Effect file and run it on my dev machine the error is shown in the messagebox. When I run the same errored code on my other pc no error is printed and l_pBlob_Errors == 0

Its probly something really noob and easy but I just dont understand what is happening. Any help would be greatly appreciated

1 Answers1

0

The root cause of your problem is that you rely on both d3dx10_43.dll and d3dcompile_43.dll. D3DX10 started using D3DCompile instead of having yet another copy of the HLSL compiler in the DirectX SDK (April 2007) release. See this post and this post.

Remember also that you are not allowed by the license to just copy D3DX10*.DLL or D3DCompiler #43 side-by-side with your application. You have to use the legacy DirectSetup REDIST. You should also be using the refreshed version rather than one that came with DirectX SDK (June 2010).

Of course, a better solution is to just drop Direct3D 10, move to Direct3D 11, and avoid using the legacy DirectX SDK entirely... Plus you are allowed by the license to just copy D3DCompile #46 or #47 side-by-side with your application.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81