| 18 | } |
| 19 | |
| 20 | GL46InputLayout* GL46InputLayoutManager::Bind(GLuint programHandle, |
| 21 | GLuint vbufferHandle, VertexBuffer const* vbuffer) |
| 22 | { |
| 23 | LogAssert(programHandle != 0, "Invalid input."); |
| 24 | |
| 25 | if (vbuffer) |
| 26 | { |
| 27 | mMutex.lock(); |
| 28 | VBPPair vbp(vbuffer, programHandle); |
| 29 | auto iter = mMap.find(vbp); |
| 30 | if (iter == mMap.end()) |
| 31 | { |
| 32 | auto layout = std::make_shared<GL46InputLayout>(programHandle, vbufferHandle, vbuffer); |
| 33 | iter = mMap.insert(std::make_pair(vbp, layout)).first; |
| 34 | } |
| 35 | GL46InputLayout* inputLayout = iter->second.get(); |
| 36 | mMutex.unlock(); |
| 37 | return inputLayout; |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | // A null vertex buffer is passed when an effect wants to bypass the |
| 42 | // input assembler. |
| 43 | return nullptr; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | bool GL46InputLayoutManager::Unbind(VertexBuffer const* vbuffer) |
| 48 | { |