fixes to buffer class
This commit is contained in:
@@ -36,17 +36,14 @@ Buffer::~Buffer() {
|
||||
vmaDestroyBuffer(this->device.getAllocator(), this->buffer, this->allocation);
|
||||
}
|
||||
|
||||
// VMA always maps the whole allocation, so `size` only exists to keep the
|
||||
// interface; `offset` is applied to the returned pointer.
|
||||
vk::Result Buffer::map(vk::DeviceSize size, vk::DeviceSize offset) {
|
||||
vk::Result Buffer::map() {
|
||||
SOPHIA_ASSERT(buffer && allocation, "Called map on buffer before create");
|
||||
(void)size;
|
||||
|
||||
void* base = nullptr;
|
||||
vk::Result result = static_cast<vk::Result>(
|
||||
vmaMapMemory(this->device.getAllocator(), this->allocation, &base));
|
||||
if (result == vk::Result::eSuccess) {
|
||||
this->mapped = static_cast<char*>(base) + offset;
|
||||
this->mapped = base;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ class Buffer {
|
||||
vk::DeviceSize minOffsetAlignment = 1);
|
||||
~Buffer();
|
||||
|
||||
vk::Result map(vk::DeviceSize size = VK_WHOLE_SIZE,
|
||||
vk::DeviceSize offset = 0);
|
||||
vk::Result map();
|
||||
void unmap();
|
||||
|
||||
void writeToBuffer(void* data, vk::DeviceSize size = VK_WHOLE_SIZE,
|
||||
@@ -41,7 +40,7 @@ class Buffer {
|
||||
void* getMappedMemory() const { return mapped; }
|
||||
uint32_t getInstanceCount() const { return instanceCount; }
|
||||
vk::DeviceSize getInstanceSize() const { return instanceSize; }
|
||||
vk::DeviceSize getAlignmentSize() const { return instanceSize; }
|
||||
vk::DeviceSize getAlignmentSize() const { return alignmentSize; }
|
||||
vk::BufferUsageFlags getUsageFlags() const { return usageFlags; }
|
||||
vk::MemoryPropertyFlags getMemoryPropertyFlags() const {
|
||||
return memoryPropertyFlags;
|
||||
|
||||
Reference in New Issue
Block a user