80 static constexpr VkDeviceSize allocation_size = 1 << 26;
84 static constexpr int max_unused_cycles_ = 8;
88 struct AllocationHandle {
89 VmaAllocation allocation = VK_NULL_HANDLE;
90 VmaAllocationInfo allocation_info = {};
93 int unused_cycles_count = 0;
96 std::list<VKMemorySegment> segments;
99 void alloc(VkMemoryRequirements memory_requirements);
103 std::optional<VKMemorySegment> acquire(VkMemoryRequirements memory_requirements);
109 bool is_unused()
const
111 return !segments.empty() && segments.front().size == allocation_info.size;
121 bool operator==(
const AllocationHandle &o)
const
123 return allocation == o.allocation;
129 struct TextureHandle {
150 std::optional<VKImageCache> image_cache_;
158 struct LogUsageData {
161 VkDeviceSize acquired_segment_size = 0;
162 VkDeviceSize acquired_segment_size_max = 0;
166 return allocation_count == o.allocation_count && image_cache_size == o.image_cache_size &&
167 acquired_segment_size == o.acquired_segment_size &&
168 acquired_segment_size_max == o.acquired_segment_size_max;
171 LogUsageData previous_usage_data_ = {};
172 LogUsageData current_usage_data_ = {};
175 void log_usage_data();
183 const char *name =
nullptr)
override;
191 void reset(
bool force_free =
false)
override;
Texture * acquire_texture_impl(int3 extent, int mip_len, GPUTextureType type, TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, const char *name=nullptr) override
void release_texture(Texture *texture) override
void reset(bool force_free=false) override
void offset_users_count(Texture *texture, int offset) override