2014-09-12 38 views
0

我已经在互联网上搜索了这个错误很长一段时间了,我找不到我的问题的答案,有人可以帮我解决这个错误吗?错误MSB6006:用代码1退出的“fxc.exe”

我对FX档案代码:

cbuffer cbPerObject 
{ 
    float4x4 gWorldViewProj; 
}; 

struct VertexIn 
{ 
    float3 PosL : POSITION; 
    float4 Color : COLOR; 
}; 

struct VertexOut 
{ 
    float4 PosH : SV_POSITION; 
    float4 Color : COLOR; 
}; 

VertexOut VS(VertexIn vin) 
{ 
    VertexOut vout; 
    vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj); 
    vout.Color = vin.Color; 
    return vout; 
} 

float4 PS(VertexOut pin): SV_Target 
{ 
    return pin.Color; 
} 

technique11 ColorTech 
{ 
    pass P0 
    { 
     SetVertexShader(CompileShader(vs_5_0, VS())); 
     SetGeometryShader(NULL); 
     SetPixelShader(CompileShader(ps_5_0, PS())); 
    } 
} 

和我的主要程序代码是这样的:

void BoxApp::BuildFX() 
{ 
    DWORD shaderFlags = 0; 

    ID3D10Blob * compiledShader; 
    ID3D10Blob * compiledShaderMsgs; 
    HRESULT hr = D3DX11CompileFromFile((LPSTR)"mColor.fx", 0, 0, "FXfile", "fx_5_0", shaderFlags, 0, 0, &compiledShader, &compiledShaderMsgs, 0); 

    if (compiledShaderMsgs != 0) 
    { 
     MessageBoxA(0, (char*)compiledShaderMsgs->GetBufferPointer(), 0, 0); 
     ReleaseCOM(compiledShaderMsgs); 
    } 

    D3DX11CreateEffectFromMemory(compiledShader->GetBufferPointer(), compiledShader->GetBufferSize(), 0, MainD3DDevice, &mFX); 
    ReleaseCOM(compiledShader); 

    mTech = mFX->GetTechniqueByName("ColorTech"); 
    mfxWorldViewProj = mFX->GetVariableByName("gWorldViewProj")->AsMatrix(); 
} 

感谢已经帮助。

+0

听起来像'exit(EXIT_FAILURE);' – Surt 2014-09-12 18:45:48

+0

好,但我该怎么办呢? – PVermillion 2014-09-12 20:26:16

+0

3个简单的选项,在代码中搜索EXIT_FAILURE(但很可能在includes/libs中),或者使用调试器直到出现错误。分而治之,在代码中加入一些日志来找到它的位置,然后从那里启动调试器。 – Surt 2014-09-12 20:37:50

回答

0

不知道DX11我只能猜测有一个关键检查缺失,当我将您的代码与this one进行比较时,我发现缺少hr检查和缺少回复。

+0

我已经解决了这个问题,显然我没有设置fx文件的格式,但现在我明白了。感谢所有的帮助,我真的很感激它。 – PVermillion 2014-09-13 18:10:27

相关问题