mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Vulkan: Add VKIndexBuffer::update_sub
IndexBuffer::update_sub was never used, and a Vulkan implementation was never added. !162144 needs it to partial update index buffers. This PR adds the vulkan implementation Pull Request: https://projects.blender.org/blender/blender/pulls/162532
This commit is contained in:
parent
7a3c23b71b
commit
986f55b332
1 changed files with 15 additions and 2 deletions
|
|
@ -100,9 +100,22 @@ void VKIndexBuffer::read(uint32_t *data) const
|
|||
}
|
||||
}
|
||||
|
||||
void VKIndexBuffer::update_sub(uint /*start*/, uint /*len*/, const void * /*data*/)
|
||||
void VKIndexBuffer::update_sub(uint start, uint len, const void *data)
|
||||
{
|
||||
NOT_YET_IMPLEMENTED
|
||||
if (!buffer_.is_allocated()) {
|
||||
/* Allocating huge buffers can fail, in that case we skip copying data. */
|
||||
return;
|
||||
}
|
||||
BLI_assert_msg(start + len <= buffer_.size_in_bytes(), "Out of bound write to index buffer");
|
||||
if (buffer_.is_mapped()) {
|
||||
buffer_.update_sub_immediately(start, len, data);
|
||||
}
|
||||
else {
|
||||
VKContext &context = *VKContext::get();
|
||||
VKStagingBuffer staging_buffer(buffer_, VKStagingBuffer::Direction::HostToDevice, start, len);
|
||||
memcpy(staging_buffer.host_buffer_get().mapped_memory_get(), data, len);
|
||||
staging_buffer.copy_to_device(context);
|
||||
}
|
||||
}
|
||||
|
||||
void VKIndexBuffer::strip_restart_indices()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue