| 1498 | } |
| 1499 | |
| 1500 | void CGraphics_Threaded::QuadContainerUpload(int ContainerIndex) |
| 1501 | { |
| 1502 | if(IsQuadContainerBufferingEnabled()) |
| 1503 | { |
| 1504 | SQuadContainer &Container = m_vQuadContainers[ContainerIndex]; |
| 1505 | if(!Container.m_vQuads.empty()) |
| 1506 | { |
| 1507 | if(Container.m_QuadBufferObjectIndex == -1) |
| 1508 | { |
| 1509 | size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad); |
| 1510 | Container.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, Container.m_vQuads.data(), 0); |
| 1511 | } |
| 1512 | else |
| 1513 | { |
| 1514 | size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad); |
| 1515 | RecreateBufferObject(Container.m_QuadBufferObjectIndex, UploadDataSize, Container.m_vQuads.data(), 0); |
| 1516 | } |
| 1517 | |
| 1518 | if(Container.m_QuadBufferContainerIndex == -1) |
| 1519 | { |
| 1520 | SBufferContainerInfo Info; |
| 1521 | Info.m_Stride = sizeof(CCommandBuffer::SVertex); |
| 1522 | Info.m_VertBufferBindingIndex = Container.m_QuadBufferObjectIndex; |
| 1523 | |
| 1524 | Info.m_vAttributes.emplace_back(); |
| 1525 | SBufferContainerInfo::SAttribute *pAttr = &Info.m_vAttributes.back(); |
| 1526 | pAttr->m_DataTypeCount = 2; |
| 1527 | pAttr->m_FuncType = 0; |
| 1528 | pAttr->m_Normalized = false; |
| 1529 | pAttr->m_pOffset = nullptr; |
| 1530 | pAttr->m_Type = GRAPHICS_TYPE_FLOAT; |
| 1531 | Info.m_vAttributes.emplace_back(); |
| 1532 | pAttr = &Info.m_vAttributes.back(); |
| 1533 | pAttr->m_DataTypeCount = 2; |
| 1534 | pAttr->m_FuncType = 0; |
| 1535 | pAttr->m_Normalized = false; |
| 1536 | pAttr->m_pOffset = (void *)(sizeof(float) * 2); |
| 1537 | pAttr->m_Type = GRAPHICS_TYPE_FLOAT; |
| 1538 | Info.m_vAttributes.emplace_back(); |
| 1539 | pAttr = &Info.m_vAttributes.back(); |
| 1540 | pAttr->m_DataTypeCount = 4; |
| 1541 | pAttr->m_FuncType = 0; |
| 1542 | pAttr->m_Normalized = true; |
| 1543 | pAttr->m_pOffset = (void *)(sizeof(float) * 2 + sizeof(float) * 2); |
| 1544 | pAttr->m_Type = GRAPHICS_TYPE_UNSIGNED_BYTE; |
| 1545 | |
| 1546 | Container.m_QuadBufferContainerIndex = CreateBufferContainer(&Info); |
| 1547 | } |
| 1548 | } |
| 1549 | } |
| 1550 | } |
| 1551 | |
| 1552 | int CGraphics_Threaded::QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num) |
| 1553 | { |