Map buffer data as shared_ptr<T[]>
This commit is contained in:
parent
0a367b8ab4
commit
9baa91b7e3
1 changed files with 3 additions and 3 deletions
|
|
@ -55,13 +55,13 @@ namespace psemek::gfx
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> map()
|
||||
std::shared_ptr<T[]> map()
|
||||
{
|
||||
if (auto p = mapped_.lock())
|
||||
return std::static_pointer_cast<T>(p);
|
||||
return std::static_pointer_cast<T[]>(p);
|
||||
|
||||
bind();
|
||||
std::shared_ptr<T> p(reinterpret_cast<T *>(gl::MapBuffer(gl::ARRAY_BUFFER, gl::WRITE_ONLY)), [this](T *){
|
||||
std::shared_ptr<T[]> p(reinterpret_cast<T *>(gl::MapBuffer(gl::ARRAY_BUFFER, gl::WRITE_ONLY)), [this](T *){
|
||||
bind();
|
||||
gl::UnmapBuffer(gl::ARRAY_BUFFER);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue