Fix instance buffer size
This commit is contained in:
1 parent
b2508ce4ff
commit
99d7546e3d
8 files changed
+24
-22
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "vulkan_buffers.h"
|
||||
|
||||
#include "src/vulkan_commons.h"
|
||||
#include "vulkan_errors.h"
|
||||
#include "locale_vulkan.h"
|
||||
#include "utilities/logger.h"
|
||||
@@ -11,7 +12,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_VERTEX_BUFFER_SIZE 33554432 /* 32 MB*/
|
||||
#define MAX_INSTANCE_BUFFER_SIZE 8192 /* 8 MB*/
|
||||
|
||||
/* GPU visible buffer */
|
||||
size_t g_vertex_offset = 0;
|
||||
@@ -99,7 +99,7 @@ static rse_err_t create_instance_buffers()
|
||||
size_t iter = 0U;
|
||||
VkDeviceSize buffer_size;
|
||||
|
||||
buffer_size = MAX_VERTEX_BUFFER_SIZE;
|
||||
buffer_size = sizeof(struct rse_instance_data_t) * MAX_INSTANCE_NUMBER;
|
||||
|
||||
for (iter = 0; iter < MAX_MESH_NUMBER; ++iter) {
|
||||
/* Create Instance Buffer */
|
||||
@@ -250,7 +250,7 @@ rse_err_t rse_add_vertices(uint16_t mesh_id,
|
||||
g_vertex_buffer.allocated_size += vertices_size;
|
||||
|
||||
/* Fill staging buffer with index data */
|
||||
memset(staging_buffer.allocation_info.pMappedData, 0, MAX_VERTEX_BUFFER_SIZE);
|
||||
memset(staging_buffer.allocation_info.pMappedData, 0, indices_size);
|
||||
memcpy(staging_buffer.allocation_info.pMappedData, indices, indices_size);
|
||||
copy_buffer(staging_buffer.buffer,
|
||||
index_buffer->buffer,
|
||||
@@ -281,7 +281,7 @@ rse_err_t update_mesh_instances(uint16_t mesh_id, struct rse_instance_data_t* in
|
||||
size_t instance_size = sizeof(struct rse_instance_data_t);
|
||||
|
||||
/* Creating staging buffer*/
|
||||
STATUS_CHECK(create_buffer(MAX_VERTEX_BUFFER_SIZE,
|
||||
STATUS_CHECK(create_buffer(instance_size,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||
VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
|
||||
VMA_ALLOCATION_CREATE_MAPPED_BIT
|
||||
|
||||
Reference in new issue
Block a user