[英]error MSB6006: “fxc.exe” exited with code 1
我已經在互聯網上搜索此錯誤已有相當長的時間了,但是我找不到我的問題的答案,有人可以幫助我解決此錯誤嗎?
我的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();
}
感謝您的幫助。
不知道DX11,我只能猜測缺少關鍵檢查,將您的代碼與此代碼進行比較時,我發現缺少hr的檢查,並且缺少返回。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.