Reuse image data instead of fetching it every time off the GPU

This commit is contained in:
ShadelessFox
2025-02-22 17:49:36 +01:00
parent 8a8c1525fd
commit 0b6ba2faee
5 changed files with 29 additions and 16 deletions
+3 -2
View File
@@ -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) {