mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 23:23:34 +00:00
fixing compatibility, workign on renderer
This commit is contained in:
49
src/renderer/buffers/vk_vbo.cpp
git.filemode.normal_file
49
src/renderer/buffers/vk_vbo.cpp
git.filemode.normal_file
@@ -0,0 +1,49 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* vk_vbo.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:28:08 by maldavid #+# #+# */
|
||||
/* Updated: 2022/12/18 00:28:52 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "vk_vbo.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
void VBO::setData(uint32_t size, const void* data)
|
||||
{
|
||||
if(size > _size)
|
||||
core::error::report(e_kind::error, "Vulkan : trying to store to much data in a vertex buffer (%d on %d)", size, _size);
|
||||
|
||||
if(data == nullptr)
|
||||
core::error::report(e_kind::warning, "Vulkan : mapping null data in a vertex buffer");
|
||||
|
||||
void* temp = nullptr;
|
||||
mapMem(&temp);
|
||||
std::memcpy(temp, data, static_cast<size_t>(size));
|
||||
unmapMem();
|
||||
|
||||
_used_size += size;
|
||||
}
|
||||
|
||||
void VBO::setSubData(uint32_t offset, uint32_t size, const void* data)
|
||||
{
|
||||
if(size + _used_size > _size)
|
||||
core::error::report(e_kind::error, "Vulkan : trying to store to much data in a vertex buffer (%d on %d)", size + _used_size, _size);
|
||||
|
||||
if(data == nullptr)
|
||||
core::error::report(e_kind::warning, "Vulkan : mapping null data in a vertex buffer");
|
||||
|
||||
void* temp = nullptr;
|
||||
mapMem(&temp, size, offset);
|
||||
std::memcpy(temp, data, static_cast<size_t>(size));
|
||||
unmapMem();
|
||||
|
||||
_used_size += size;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user