//----------------------------------------------------------------------- ID3D11InputLayout* D3D11VertexDeclaration::getILayoutByShader(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding) { ShaderToILayoutMapIterator foundIter = mShaderToILayoutMap.find(boundVertexProgram); ID3D11InputLayout* pVertexLayout = 0; if (foundIter == mShaderToILayoutMap.end()) { // if not found - create DWORD dwShaderFlags = 0; const MicroCode & vSBuf = boundVertexProgram->getMicroCode(); D3D11_INPUT_ELEMENT_DESC * pVertexDecl=getD3DVertexDeclaration(boundVertexProgram, binding); // bad bug tracing. see what will happen next. //if (pVertexDecl->Format == DXGI_FORMAT_R16G16_SINT) // pVertexDecl->Format = DXGI_FORMAT_R16G16_FLOAT; HRESULT hr = mlpD3DDevice->CreateInputLayout( pVertexDecl, boundVertexProgram->getNumInputs(), &vSBuf[0], vSBuf.size(), &pVertexLayout ); if (FAILED(hr)|| mlpD3DDevice.isError()) { String errorDescription = mlpD3DDevice.getErrorDescription(hr); errorDescription += "\nBound shader name: " + boundVertexProgram->getName(); OGRE_EXCEPT_EX(Exception::ERR_RENDERINGAPI_ERROR, hr, "Unable to set D3D11 vertex declaration" + errorDescription, "D3D11VertexDeclaration::getILayoutByShader"); } mShaderToILayoutMap[boundVertexProgram] = pVertexLayout; } else { pVertexLayout = foundIter->second; } return pVertexLayout; }
//----------------------------------------------------------------------- ID3D11InputLayout* D3D11VertexDeclaration::getILayoutByShader(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding) { ShaderToILayoutMapIterator foundIter = mShaderToILayoutMap.find(boundVertexProgram); ID3D11InputLayout* pVertexLayout = 0; if (foundIter == mShaderToILayoutMap.end()) { // if not found - create DWORD dwShaderFlags = 0; const MicroCode & vSBuf = boundVertexProgram->getMicroCode(); if (boundVertexProgram->getName() == "595364079_VS") { int u = 1; } D3D11_INPUT_ELEMENT_DESC * pVertexDecl=getD3DVertexDeclaration(boundVertexProgram, binding); HRESULT hr = mlpD3DDevice->CreateInputLayout( pVertexDecl, boundVertexProgram->getNumInputs(), &vSBuf[0], vSBuf.size(), &pVertexLayout ); if (FAILED(hr)|| mlpD3DDevice.isError()) { String errorDescription = mlpD3DDevice.getErrorDescription(); OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration"+errorDescription , "D3D11VertexDeclaration::getILayoutByShader"); } mShaderToILayoutMap[boundVertexProgram] = pVertexLayout; } else { pVertexLayout = foundIter->second; } return pVertexLayout; }
//----------------------------------------------------------------------- ID3D11InputLayout* D3D11VertexDeclaration::getILayoutByShader(D3D11HLSLProgram* boundVertexProgram) { ShaderToILayoutMapIterator foundIter = mShaderToILayoutMap.find(boundVertexProgram); ID3D11InputLayout* pVertexLayout = 0; if (foundIter == mShaderToILayoutMap.end()) { // if not found - create DWORD dwShaderFlags = 0; ID3D10Blob* pVSBuf = boundVertexProgram->getMicroCode(); D3D11_INPUT_ELEMENT_DESC * pVertexDecl=getD3DVertexDeclaration(); HRESULT hr = mlpD3DDevice->CreateInputLayout( pVertexDecl, (UINT)getElementCount(), pVSBuf->GetBufferPointer(), pVSBuf->GetBufferSize(), &pVertexLayout ); if (FAILED(hr)|| mlpD3DDevice.isError()) { String errorDescription = mlpD3DDevice.getErrorDescription(); OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration"+errorDescription , "D3D11VertexDeclaration::getILayoutByShader"); } mShaderToILayoutMap[boundVertexProgram] = pVertexLayout; } else { pVertexLayout = foundIter->second; } return pVertexLayout; }