mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
Reuse image data instead of fetching it every time off the GPU
This commit is contained in:
parent
8a8c1525fd
commit
0b6ba2faee
5 changed files with 29 additions and 16 deletions
|
|
@ -5,8 +5,9 @@
|
|||
#include "graphics/core/Texture.hpp"
|
||||
|
||||
gui::Canvas::Canvas(ImageFormat inFormat, glm::uvec2 inSize) : UINode(inSize) {
|
||||
ImageData data {inFormat, inSize.x, inSize.y};
|
||||
mTexture = Texture::from(&data);
|
||||
auto data = std::make_shared<ImageData>(inFormat, inSize.x, inSize.y);
|
||||
mTexture = Texture::from(data.get());
|
||||
mData = std::move(data);
|
||||
}
|
||||
|
||||
void gui::Canvas::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue