https://bitbucket.org/sinbad/ogre/commi ... nt-1510991
Code: Select all
D3D11_INPUT_ELEMENT_DESC * D3D11VertexDeclaration::getD3DVertexDeclaration(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding)
{
// Create D3D elements
size_t iNumElements = boundVertexProgram->getNumInputs();
if (mD3delems.find(boundVertexProgram) == mD3delems.end())
{
D3D11_INPUT_ELEMENT_DESC* D3delems = new D3D11_INPUT_ELEMENT_DESC[iNumElements];
ZeroMemory(D3delems, sizeof(D3D11_INPUT_ELEMENT_DESC) * iNumElements);
unsigned int idx;
for (idx = 0; idx < iNumElements; ++idx)
{
D3D11_SIGNATURE_PARAMETER_DESC inputDesc = boundVertexProgram->getInputParamDesc(idx);
VertexElementList::const_iterator i, iend;
iend = mElementList.end();
bool found = false;
for (i = mElementList.begin(); i != iend; ++i)
{
LPCSTR semanticName = D3D11Mappings::get(i->getSemantic());
UINT semanticIndex = i->getIndex();
if(
strcmp(semanticName, inputDesc.SemanticName) == 0
&& semanticIndex == inputDesc.SemanticIndex
)
{
found = true;
break;
}
}
/* this code was deleted
if ( !found )
{
// find by pos
i = mElementList.begin();
for ( unsigned int count = 0; count < idx && i != iend; count++, ++i )
{
}
if ( i != iend )
{
found = true;
}
}
*/
if(!found)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration" ,
"D3D11VertexDeclaration::getILayoutByShader");
}
...