From 9baa91b7e37c178fcbdc37ff6c65d2b76ba8079e Mon Sep 17 00:00:00 2001 From: lisyarus Date: Sat, 13 Mar 2021 14:30:11 +0300 Subject: [PATCH] Map buffer data as shared_ptr --- libs/gfx/include/psemek/gfx/buffer.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/gfx/include/psemek/gfx/buffer.hpp b/libs/gfx/include/psemek/gfx/buffer.hpp index f71e564b..3772fcc2 100644 --- a/libs/gfx/include/psemek/gfx/buffer.hpp +++ b/libs/gfx/include/psemek/gfx/buffer.hpp @@ -55,13 +55,13 @@ namespace psemek::gfx } template - std::shared_ptr map() + std::shared_ptr map() { if (auto p = mapped_.lock()) - return std::static_pointer_cast(p); + return std::static_pointer_cast(p); bind(); - std::shared_ptr p(reinterpret_cast(gl::MapBuffer(gl::ARRAY_BUFFER, gl::WRITE_ONLY)), [this](T *){ + std::shared_ptr p(reinterpret_cast(gl::MapBuffer(gl::ARRAY_BUFFER, gl::WRITE_ONLY)), [this](T *){ bind(); gl::UnmapBuffer(gl::ARRAY_BUFFER); });