I follow instructions from http://asawicki.info/news_1371_effects_in_directx_11.html to create an effect by loading from a file, but there is a problem with pixel shader. It looks like it was not be loaded
As you can see in the image, the pipeline does not have the pixel shader. And the source code for creating the effect and rendering is:
DWORD shaderFlags = 0;
#if defined( DEBUG ) || defined( _DEBUG )
shaderFlags |= D3D10_SHADER_DEBUG;
shaderFlags |= D3D10_SHADER_SKIP_OPTIMIZATION;
#endif
ID3D10Blob *effectBlob = 0, *errorsBlob = 0;
HRESULT hr = D3DX11CompileFromFile(
L"Test.fx", 0, 0, 0, "fx_5_0", shaderFlags, 0, 0, &effectBlob, &errorsBlob, 0);
//assert(SUCCEEDED(hr) && effectBlob);
if (errorsBlob)
{
MessageBoxA(0, (char*)errorsBlob->GetBufferPointer(), 0, 0);
errorsBlob->Release();
}
SIZE_T temp = effectBlob->GetBufferSize();
// Create D3DX11 effect from compiled binary memory block
ID3DX11Effect *g_Effect;
hr = D3DX11CreateEffectFromMemory(
effectBlob->GetBufferPointer(), effectBlob->GetBufferSize(), 0, pd3dDevice, &g_pEffect);
//assert(SUCCEEDED(hr));
effectBlob->Release();
g_pTech = g_pEffect->GetTechniqueByName("Test");
GetEffectParameters();
UINT stride = sizeof(Vertex);
UINT offset = 0;
pd3dImmediateContext->IASetVertexBuffers(0, 1, &mBoxVB, &stride, &offset);
pd3dImmediateContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0);
// Render objects here...
D3DX11_TECHNIQUE_DESC techDesc;
g_pTech->GetDesc(&techDesc);
ID3DX11EffectPass *g_EffectPass; // No need to be Release()-d.
g_EffectPass = g_pTech->GetPassByIndex(0);
g_EffectPass->Apply(0, pd3dImmediateContext);
pd3dImmediateContext->DrawIndexed(36, 0, 0);
Anybody helps me, please?