Skip to content

Commit

Permalink
vulkan: simplify code with alignUp
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeinikei committed Mar 13, 2024
1 parent 295fb21 commit 07c5c44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/graphics/vulkan/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "common/Exception.h"
#include "common/pixelformat.h"
#include "common/version.h"
#include "common/memory.h"
#include "window/Window.h"
#include "Buffer.h"
#include "Graphics.h"
Expand Down Expand Up @@ -2872,7 +2873,7 @@ int Graphics::getVsync() const

void Graphics::mapLocalUniformData(void *data, size_t size, VkDescriptorBufferInfo &bufferInfo)
{
size_t alignedSize = static_cast<size_t>(std::ceil(static_cast<float>(size) / static_cast<float>(minUniformBufferOffsetAlignment))) * minUniformBufferOffsetAlignment;
size_t alignedSize = alignUp(size, minUniformBufferOffsetAlignment);

if (localUniformBuffer->getUsableSize() < alignedSize)
localUniformBuffer.set(new StreamBuffer(this, BUFFERUSAGE_UNIFORM, localUniformBuffer->getSize() * 2), Acquire::NORETAIN);
Expand Down

0 comments on commit 07c5c44

Please sign in to comment.