/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#include "ManagedBuffer.hpp"
#include "Base/Logger.hpp"

namespace OpenVulkano::Vulkan
{
	void MemoryAllocation::HandleChildMappingValidation() const
	{
		if (IsChildMapped())
		{
			Logger::RENDER->error("A single memory allocation should only be mapped once! Mapping a single allocation multiple times might not work or might not work reliable with all driver implementations.");
#ifdef CRASH_ON_MULTIPLE_MAPPINGS_TO_SAME_ALLOCATION
			throw std::runtime_error("A single memory allocation should only be mapped once!");
#endif
		}
	}
}
