| 65 | |
| 66 | template <typename T> |
| 67 | void UpdateBuffer(ref_ptr<dp::GraphicsContext> context, uint32_t bufferInd, std::vector<T> const & vertices) |
| 68 | { |
| 69 | CHECK(m_initialized, ()); |
| 70 | CHECK_LESS(bufferInd, static_cast<uint32_t>(m_buffers.size()), ()); |
| 71 | CHECK(!vertices.empty(), ()); |
| 72 | |
| 73 | auto & buffer = m_buffers[bufferInd]; |
| 74 | CHECK_LESS_OR_EQUAL(static_cast<uint32_t>(vertices.size() * sizeof(T)), buffer->GetSizeInBytes(), ()); |
| 75 | memcpy(buffer->GetData(), vertices.data(), vertices.size() * sizeof(T)); |
| 76 | |
| 77 | UpdateImpl(context, bufferInd); |
| 78 | } |
| 79 | |
| 80 | void SetIndexBuffer(std::vector<uint16_t> && indices); |
| 81 | void UpdateIndexBuffer(ref_ptr<dp::GraphicsContext> context, std::vector<uint16_t> const & indices); |