void GPUData::InitInputLayout(D3D11_INPUT_ELEMENT_DESC* aVertexDescArray, int aArraySize, EffectID aEffect) { Effect* effect = AssetContainer::GetInstance()->GetEffect(aEffect); D3DX11_PASS_DESC passDesc; effect->GetTechnique("Render")->GetPassByIndex(0)->GetDesc(&passDesc); HRESULT hr = Engine::GetInstance()->GetDevice()->CreateInputLayout(aVertexDescArray , aArraySize, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &myInputLayout); if (FAILED(hr) != S_OK) { DL_MESSAGE_BOX("Failed to CreateInputLayout", "GPUData::Init", MB_ICONWARNING); } }
void GPUData::InitInputLayout(EffectID aEffect, GPUContext& aGPUContext, AssetContainer& aAssetContainer) { D3DX11_PASS_DESC passDesc; Effect* effect = aAssetContainer.GetEffect(aEffect); effect->GetTechnique("Render")->GetPassByIndex(0)->GetDesc(&passDesc); const int size = myVertexFormat.Size(); D3D11_INPUT_ELEMENT_DESC* vertexDesc = new D3D11_INPUT_ELEMENT_DESC[size]; for (int i = 0; i < myVertexFormat.Size(); ++i) { vertexDesc[i] = *myVertexFormat[i]; } HRESULT hr = aGPUContext.GetDevice()->CreateInputLayout(vertexDesc , myVertexFormat.Size(), passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &myInputLayout); delete[] vertexDesc; if (FAILED(hr) != S_OK) { DL_MESSAGE_BOX("Failed to CreateInputLayout", "GPUData::Init", MB_ICONWARNING); } }