summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2026-08-22 11:22:33 +0200
committerJosJuice <josjuice@gmail.com>2026-08-22 11:52:22 +0200
commitf93a8a995b6e16625c60303ccabb0ea71e7dbeb2 (patch)
treec6303977d6dcd7538ac0eca1561cdb6b1b476b19 /Source/Core/VideoBackends/Vulkan
parent82f7ec53902d805a6f5091f913035f29499c873a (diff)
Common: Add DivideRoundingUp function
Many callers of AlignUp are dividing immediately after aligning. Let's add a helper function for this so callers don't have to specify the alignment size twice.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKShader.cpp4
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKTexture.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VKShader.cpp b/Source/Core/VideoBackends/Vulkan/VKShader.cpp
index 9132085748..914fc0c8e4 100644
--- a/Source/Core/VideoBackends/Vulkan/VKShader.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VKShader.cpp
@@ -138,8 +138,8 @@ std::unique_ptr<VKShader> VKShader::CreateFromSource(ShaderStage stage, std::str
std::unique_ptr<VKShader> VKShader::CreateFromBinary(ShaderStage stage, const void* data,
size_t length, std::string_view name)
{
- const size_t size_in_words = Common::AlignUp(length, sizeof(ShaderCompiler::SPIRVCodeType)) /
- sizeof(ShaderCompiler::SPIRVCodeType);
+ const size_t size_in_words =
+ Common::DivideRoundingUp(length, sizeof(ShaderCompiler::SPIRVCodeType));
ShaderCompiler::SPIRVCodeVector spv(size_in_words);
if (length > 0)
std::memcpy(spv.data(), data, length);
diff --git a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp
index ee6a1b77b3..ea7472597b 100644
--- a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp
@@ -378,7 +378,7 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
// that lie outside of the texture's dimensions.
const u32 upload_alignment = static_cast<u32>(g_vulkan_context->GetBufferImageGranularity());
const u32 block_size = GetBlockSizeForFormat(GetFormat());
- const u32 num_rows = Common::AlignUp(height, block_size) / block_size;
+ const u32 num_rows = Common::DivideRoundingUp(height, block_size);
const u32 source_pitch = CalculateStrideForFormat(m_config.format, row_length);
const u32 upload_size = source_pitch * num_rows;
std::unique_ptr<StagingBuffer> temp_buffer;