2014-09-12 39 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

相關問題