| 2097 | } |
| 2098 | |
| 2099 | int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerInfo) |
| 2100 | { |
| 2101 | int Index = -1; |
| 2102 | if(m_FirstFreeVertexArrayInfo == -1) |
| 2103 | { |
| 2104 | Index = m_vVertexArrayInfo.size(); |
| 2105 | m_vVertexArrayInfo.emplace_back(); |
| 2106 | } |
| 2107 | else |
| 2108 | { |
| 2109 | Index = m_FirstFreeVertexArrayInfo; |
| 2110 | m_FirstFreeVertexArrayInfo = m_vVertexArrayInfo[Index].m_FreeIndex; |
| 2111 | m_vVertexArrayInfo[Index].m_FreeIndex = Index; |
| 2112 | } |
| 2113 | |
| 2114 | CCommandBuffer::SCommand_CreateBufferContainer Cmd; |
| 2115 | Cmd.m_BufferContainerIndex = Index; |
| 2116 | Cmd.m_AttrCount = pContainerInfo->m_vAttributes.size(); |
| 2117 | Cmd.m_Stride = pContainerInfo->m_Stride; |
| 2118 | Cmd.m_VertBufferBindingIndex = pContainerInfo->m_VertBufferBindingIndex; |
| 2119 | Cmd.m_pAttributes = (SBufferContainerInfo::SAttribute *)AllocCommandBufferData(Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute)); |
| 2120 | |
| 2121 | AddCmd(Cmd, [&] { |
| 2122 | Cmd.m_pAttributes = (SBufferContainerInfo::SAttribute *)m_pCommandBuffer->AllocData(Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute)); |
| 2123 | return Cmd.m_pAttributes != nullptr; |
| 2124 | }); |
| 2125 | |
| 2126 | mem_copy(Cmd.m_pAttributes, pContainerInfo->m_vAttributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute)); |
| 2127 | |
| 2128 | m_vVertexArrayInfo[Index].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex; |
| 2129 | |
| 2130 | return Index; |
| 2131 | } |
| 2132 | |
| 2133 | void CGraphics_Threaded::DeleteBufferContainer(int &ContainerIndex, bool DestroyAllBO) |
| 2134 | { |
no test coverage detected