//////// vs.fx
#include "skinning.fx"...
//////// skinning.fx
cbuffer cbPerObject{ row_major float4x4 WVP_Matrix; row_major float4x4 ModelView_Matrix; row_major float4x4 SkinningMatrices[ 72 ]; bool bSkinning; //<-- added this};
///////// .cpp
struct VSConstantBuffer{ D3DXMATRIX WVP_Matrix; D3DXMATRIX ModelView_Matrix; D3DXMATRIX SkinningMatrices[ MAX_SKELETON_JOINTS ]; bool bSkinning; //<-- added this};...D3D10_BUFFER_DESC cbDesc;ZeroMemory( &cbDesc, sizeof(D3D10_BUFFER_DESC) );cbDesc.ByteWidth = sizeof( VSConstantBuffer );cbDesc.Usage = D3D10_USAGE_DYNAMIC;cbDesc.BindFlags = D3D10_BIND_CONSTANT_BUFFER;cbDesc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;HRESULT VSConstantBufferResult = 0;VSConstantBufferResult = m_pd3dDevice->CreateBuffer( &cbDesc, NULL, &VScBuffer );assert( VSConstantBufferResult == D3D_OK );
now VSConstantBufferResult returns E_INVALIDARG.
By commenting out "bool bSkinning;" in VSConstantBuffer, the CreateBuffer function succeeds.
What am I missing???
-edit-
I've also added the D3D10_SUBRESOURCE_DATA argument :
VSConstantBuffer init;ZeroMemory( &init, sizeof(VSConstantBuffer) );init.ApplySkinning = true;D3D10_SUBRESOURCE_DATA subres;ZeroMemory( &subres, sizeof(D3D10_SUBRESOURCE_DATA) );subres.pSysMem = (void*)&init;HRESULT VSConstantBufferResult = 0;VSConstantBufferResult = m_pd3dDevice->CreateBuffer( &cbDesc, &subres, &VScBuffer );
but that didn't work...
[Edited by - 16bit_port on October 28, 2010 2:18:12 PM]