Use createBuffer function from Vulkan device class
This commit is contained in:
parent
1fa3364513
commit
a7a174f389
1 changed files with 20 additions and 22 deletions
|
|
@ -467,38 +467,36 @@ public:
|
||||||
} vertexStaging, indexStaging;
|
} vertexStaging, indexStaging;
|
||||||
|
|
||||||
// Create staging buffers
|
// Create staging buffers
|
||||||
// Vertex data
|
|
||||||
createBuffer(
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
|
|
||||||
vertexBufferSize,
|
|
||||||
vertices,
|
|
||||||
&vertexStaging.buffer,
|
|
||||||
&vertexStaging.memory);
|
|
||||||
// Index data
|
|
||||||
createBuffer(
|
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
|
|
||||||
indexBufferSize,
|
|
||||||
indices,
|
|
||||||
&indexStaging.buffer,
|
|
||||||
&indexStaging.memory);
|
|
||||||
|
|
||||||
createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
|
vertexBufferSize,
|
||||||
|
&vertexStaging.buffer,
|
||||||
|
&vertexStaging.memory,
|
||||||
|
vertices));
|
||||||
|
|
||||||
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
|
indexBufferSize,
|
||||||
|
&indexStaging.buffer,
|
||||||
|
&indexStaging.memory,
|
||||||
|
indices));
|
||||||
|
|
||||||
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
vertexBufferSize,
|
vertexBufferSize,
|
||||||
nullptr,
|
|
||||||
&meshes.terrain.vertices.buf,
|
&meshes.terrain.vertices.buf,
|
||||||
&meshes.terrain.vertices.mem);
|
&meshes.terrain.vertices.mem));
|
||||||
|
|
||||||
createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||||
indexBufferSize,
|
indexBufferSize,
|
||||||
nullptr,
|
|
||||||
&meshes.terrain.indices.buf,
|
&meshes.terrain.indices.buf,
|
||||||
&meshes.terrain.indices.mem);
|
&meshes.terrain.indices.mem));
|
||||||
|
|
||||||
// Copy from staging buffers
|
// Copy from staging buffers
|
||||||
VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue