adding multiple mapping support on textures

This commit is contained in:
kbz_8
2023-04-23 22:11:44 +02:00
parent 77f707ca7a
commit 4edd619841
20 changed files with 133 additions and 89 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/08 02:24:58 by maldavid #+# #+# */
/* Updated: 2023/04/21 19:05:34 by maldavid ### ########.fr */
/* Updated: 2023/04/23 15:23:44 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,12 +29,11 @@ namespace mlx
public:
Texture() = default;
void create(uint8_t* pixels, uint32_t width, uint32_t height, VkFormat format);
void create(uint8_t* pixels, uint32_t width, uint32_t height, VkFormat format, bool enable_mapping = false);
void render(class Renderer& renderer, int x, int y);
void destroy() noexcept override;
void* openCPUmap();
inline void* getMap() const noexcept { return _cpu_map_adress; }
inline void setDescriptor(DescriptorSet set) noexcept { _set = std::move(set); }
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
@@ -48,8 +47,8 @@ namespace mlx
C_VBO _vbo;
C_IBO _ibo;
DescriptorSet _set;
std::shared_ptr<Buffer> _cpu_map;
void* _cpu_map_adress;
std::optional<Buffer> _buf_map = std::nullopt;
void* _cpu_map = nullptr;
bool _has_been_updated = false;
};