EtrediaEmpires/utils/include/allocator.hpp
legatt 389ed599c8 Pipeline factory and materials
- AssetManager uses static assets ID from path hash
- PipelineFactory creates Vulkan pipelines using PipelineConfig structure depending on AssetMaterial and creation flags
- AssetMaterial describes pipelines (e.g. used shaders)
- Materials are described with JSON in sources with path references to other assets
- AssetMaterial is parsed from binary file with asset IDs in references
- compile_config tool compiles material JSON file to binary file with path references replaced with asset IDs
- Allocator supports type's constructors with arguments
- NativeFileSystem: fixed empty bufferSize and buffer trash
2025-08-29 13:13:11 +03:00

22 lines
369 B
C++

#pragma once
#include <utility>
template<typename T, typename... Args> T* Allocate(Args&&... args)
{
return new T(std::forward<Args>(args)...);
}
template<typename T> void Deallocate(T* obj)
{
delete obj;
}
template<typename T> T* AllocateArray(size_t size)
{
return new T[size];
}
template<typename T> void DeallocateArray(T* obj)
{
delete[] obj;
}