Jump to content
  • Advertisement
Sign in to follow this  
Matruz

Simple blend shapes in DX10

This topic is 3265 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm working on a program that does a simple animation using blend shapes, by reading a sample on the GPU GEMs 3 book from NVIDIA I decided to pass the info on the blend shapes to the vertex shader by this:
D3D10_INPUT_ELEMENT_DESC layout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },  
        { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
		{ "DPOS01", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },  
        //{ "DELTANORMAL01", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 36, D3D10_INPUT_PER_VERTEX_DATA, 0 },
		//{ "DELTAPOS02", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 48, D3D10_INPUT_PER_VERTEX_DATA, 0 },  
        //{ "DELTANORMAL02", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 60, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    };

	UINT numElements = sizeof(layout) / sizeof(layout[0]);

	D3D10_PASS_DESC passDesc;
    g_pTechnique->GetPassByIndex(0)->GetDesc(&passDesc);
    hr = pD3DDevice->CreateInputLayout(layout, numElements, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &g_pVertexLayout);
    if(FAILED(hr))
        return false;
And the Shader:
struct VS_INPUT
{
	float4 Pos : POSITION;
	float3 Normal : NORMAL;
	float3 DeltaPos01 : DPOS01;
	//float3 DeltaNormal01 : DELTANORMAL01;
	//float3 DeltaPos02 : DELTAPOS02;
	//float3 DeltaNormal02 : DELTANORMAL02;
	//float2 Tex : TEXTURE;	
};

struct PS_INPUT
{
	float4 Pos : SV_POSITION;
	float3 Normal : NORMAL;
	float3 DeltaPos01 : POSITION0;
	//float3 DeltaNormal01 : TEXCOORD2;
	//float3 DeltaPos02 : TEXCOORD3;
	//float3 DeltaNormal02 : TEXCOORD4;
};

PS_INPUT VS(VS_INPUT input)
{
	PS_INPUT output;
	
	output.Pos = mul(input.Pos, World);
    output.Pos = mul(output.Pos, View);
    output.Pos = mul(output.Pos, Projection);
    output.Normal = mul(input.Normal, World);
	output.DeltaPos01 = input.DeltaPos01;
	
	
    return output;
}
However everytime I run
hr = pD3DDevice->CreateInputLayout(layout, numElements, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &g_pVertexLayout); 
The hr in the C++ code returns E_INVALIDARG. I have read that the VS Shader Output and PS Input must be "compatible" but I think they are already, and if I comment the reference to DPOS01 in the layout (and on the shader) the hr returns OK. Does anyone knows whats going on? Thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Use the debug device to enable sdklayers and then run the app under a debugger. It'll provide feedback through debug print with specific error details.

Share this post


Link to post
Share on other sites
Thanks for your reply DieterVW. sorry I could not post earlier.

Could you please tell me how to do that? Since that's the first time I hear about it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!