Program Listing for File MemoryHelper.hpp#
↰ Return to documentation for file (Src/GraphicsEngineVulkan/common/MemoryHelper.hpp)
#pragma once
#include <cstdint>
namespace Kataglyphis {
// aligned piece of memory appropiately and when necessary return bigger piece
constexpr uint32_t align_up(uint32_t memory, uint32_t alignment)
{
return (memory + alignment - 1) & ~(alignment - 1);
}
// vkGetRayTracingShaderGroupHandlesKHR writes handles tightly packed at
// handleSize, regardless of the device's handle alignment requirement.
constexpr uint32_t sbt_handle_source_offset(uint32_t groupIndex, uint32_t handleSize)
{
return groupIndex * handleSize;
}
// SBT device records must each start at a shaderGroupHandleAlignment-aligned
// offset, which can be larger than the packed handle size above.
constexpr uint32_t sbt_record_offset(uint32_t recordIndex, uint32_t handleSizeAligned)
{
return recordIndex * handleSizeAligned;
}
}// namespace Kataglyphis