I've been trying to learn vertex shaders. I made a simple vertex shader using hlsl and compiled it to assembly language in vp.vp and then try to use it in my code but don't get any display at all (I do when I just use the fixed pipeline). Am I missing some vital step, or have I messed something up?
D3DXAssembleShaderFromFile("c:\\source\\vp.vp", NULL, NULL, 0, &b, &e);
if (e != NULL)
{
MessageBox(NULL, (char*)e->GetBufferPointer(), "Error", MB_OK);
exit(0);
}
g_pd3dDevice->CreateVertexShader((DWORD*)b->GetBufferPointer(), &pVertexShader);
g_pd3dDevice->SetVertexShader(pVertexShader);
The code of my shader is
struct in_s
{
float4 position : POSITION;
float4 Col0 : COLOR0;
};
struct out_s
{
float4 HPos : POSITION;
float4 Col0 : COLOR0;
};
out_s main(in_s IN, uniform float4x4 ModelViewProj)
{
out_s OUT;
OUT.HPos = mul(ModelViewProj, IN.position);
OUT.Col0 = IN.Col0;
OUT.Col0.x = 1.0;
return OUT;
}