我已经在互联网上搜索了这个错误已经有一段时间了,而且我无法找到问题的答案,有人可以帮我解决这个错误吗?
我的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();
}
感谢您的帮助。