Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Error using Effects in Directx 11.0


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Solid_Spy   Members   -  Reputation: 454

Like
0Likes
Like

Posted 11 February 2013 - 08:13 PM

Hello, I've been trying to get an effect file to load in my directx game, however, i seem to get some strange errors. I followed the tutorial from a book I got, but it doesn't seem to work. It appears that I get the error every time i reach the CreateShaderFromMemory() function. Here's the code for my .cpp:

 

 

 

void InitPipeline()
{
    // load and compile the two shaders


    ID3D10Blob *compiledShader = 0;
    ID3D10Blob *errorMessage = 0;


    HRESULT hr;


    hr = D3DX11CompileFromFile("shader.txt", 0, 0, 0, "fx_5_0", D3D10_SHADER_DEBUG | D3D10_SHADER_SKIP_OPTIMIZATION, 0, 0, &compiledShader, &errorMessage, 0);


    if(FAILED(hr))
    {
        MessageBox(0, "shader compiler error", "ERROR", MB_OK);
    }


    errorMessage->Release();


    hr = D3DX11CreateEffectFromMemory(compiledShader->GetBufferPointer(), compiledShader->GetBufferSize(), 0, dev, &normalShader);
 

 

And here is my shader file:

 

 

 

struct vertexIn
{
    float3 position : POSITION;
    float4 color    : COLOR;
};


struct vertexOut
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};


vertexOut VS(vertexIn vIn)
{
    vertexOut vOut;
    vOut.position = float4 (vIn.position, 1.0f);
    vOut.color = vIn.color;


    return vOut;
}


float4 PS(vertexOut pixelinsert) : SV_Target
{
    return pixelinsert.color;
}


technique11 t0
{
    pass p0
    {
        SetVertexShader(CompileShader(vs_5_0, VS()));
        SetPixelShader(CompileShader(ps_5_0, PS()));
    }
}
 

 

Here are the errors I am getting:

 

 

Error    3    error LNK1120: 2 unresolved externals    C:\..Project30.exe    1    1    Project30
Error    2    error LNK2019: unresolved external symbol _D3DGetInputSignatureBlob@12 referenced in function "protected: long __thiscall D3DX11Effects::CEffectLoader::BuildShaderBlock(struct D3DX11Effects::SShaderBlock *)" (?BuildShaderBlock@CEffectLoader@D3DX11Effects@@IAEJPAUSShaderBlock@2@@Z)    C:\...Effects11.lib(EffectLoad.obj)    Project30
Error    1    error LNK2019: unresolved external symbol _D3DReflect@16 referenced in function "protected: long __thiscall D3DX11Effects::CEffectLoader::BuildShaderBlock(struct D3DX11Effects::SShaderBlock *)" (?BuildShaderBlock@CEffectLoader@D3DX11Effects@@IAEJPAUSShaderBlock@2@@Z)    C:\...Effects11.lib(EffectLoad.obj)    Project30
 
Any help would be appreciated smile.png

Edited by Solid_Spy, 11 February 2013 - 08:15 PM.


Sponsor:

#2 Lucky_Alex   Members   -  Reputation: 105

Like
0Likes
Like

Posted 10 April 2013 - 04:33 PM

In your project properties under Linker > Input > Additional Dependencies is d3dcompiler.lib specified in this list? If not, try adding it. I had the same issue and it's because those methods are defined in d3dcompiler.lib and I was missing it in my Linker dependencies.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS