/* * 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/. */ #pragma once #include "MetalBackedTexture.h" #import #import namespace OpenVulkano::Vulkan { class MetalTextureCache { CVMetalTextureCacheRef m_textureCache = nullptr; Vulkan::ResourceManager* m_resourceManager = nullptr; std::map m_mtlToVkTextureMap; public: ~MetalTextureCache() { if (m_resourceManager) Close(); } void Init(IRenderer* renderer); void Close(); Scene::Texture* Get(CVPixelBufferRef pixelBuffer, MTLPixelFormat pixelFormat); void ReturnTexture(Scene::Texture* texture); operator bool() const { return m_resourceManager; } }; }