This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/gpu/vulkan/vk_uniform_buffer.cc
Jeroen Bakker 0ad06cd39d Vulkan: Automap Buffers.
It is recommended to map buffers once and not each time the
mapped memory is needed. This patch will map the buffer when
created and unmap the buffer when the buffer is freed.

This patch will reduce the overhead where the Vulkan driver or
the virtual memory manager needs to be accessed.

Pull Request: blender/blender#105588
2023-03-09 09:27:42 +01:00

44 lines
764 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 Blender Foundation. All rights reserved. */
/** \file
* \ingroup gpu
*/
#include "vk_uniform_buffer.hh"
#include "vk_context.hh"
namespace blender::gpu {
void VKUniformBuffer::update(const void *data)
{
if (!buffer_.is_allocated()) {
VKContext &context = *VKContext::get();
allocate(context);
}
buffer_.update(data);
}
void VKUniformBuffer::allocate(VKContext &context)
{
buffer_.create(context, size_in_bytes_, GPU_USAGE_STATIC, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
}
void VKUniformBuffer::clear_to_zero()
{
}
void VKUniformBuffer::bind(int /*slot*/)
{
}
void VKUniformBuffer::bind_as_ssbo(int /*slot*/)
{
}
void VKUniformBuffer::unbind()
{
}
} // namespace blender::gpu