4 #include "uniforms-vk.h"
6 UniformBufferVK::UniformBufferVK()
11 UniformBufferVK::~UniformBufferVK()
16 bool UniformBufferVK::create(int size)
18 if(!(ubo = vku_create_buffer(size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT))) {
19 fprintf(stderr, "Failed to create vulkan uniform buffer object.\n");
23 if(!UniformBuffer::create(size)) {
24 fprintf(stderr, "Failed to create uniform buffer object.\n");
30 void UniformBufferVK::destroy()
32 vku_destroy_buffer(ubo);
35 void UniformBufferVK::bind(int binding) const
37 if(vkBindBufferMemory(vk_device, ubo->buf, ubo->mem_pool, 0) !=
39 fprintf(stderr, "Failed to bind ubo.\n");
43 bool UniformBufferVK::update(void *data)
45 if(!vku_update_buffer(ubo, size, data)) {
46 fprintf(stderr, "Failed to update ubo.\n");
52 int UniformBufferVK::get_size()