#pragma once #include #include #define DYNAMIC_TEXTURE_VULKAN_MULTITHREADED_UPLOAD 0 namespace mbgl { namespace vulkan { class Context; struct BufferAllocation; using SharedBufferAllocation = std::shared_ptr; class DynamicTexture : public gfx::DynamicTexture { public: DynamicTexture(Context& context, Size size, gfx::TexturePixelType pixelType); ~DynamicTexture() override; void uploadImage(const uint8_t* pixelData, gfx::TextureHandle& texHandle) override; void uploadDeferredImages(gfx::UploadPass&) override; bool removeTexture(const gfx::TextureHandle& texHandle) override; #if DYNAMIC_TEXTURE_VULKAN_MULTITHREADED_UPLOAD using TexturesToBlit = std::unordered_map, gfx::TextureHandle::Hasher>; #else using TextureBuffersToUpload = std::unordered_map; #endif private: vulkan::Context& context; #if DYNAMIC_TEXTURE_VULKAN_MULTITHREADED_UPLOAD TexturesToBlit texturesToBlit; vk::UniqueCommandPool commandPool; #else TextureBuffersToUpload textureBuffersToUpload; #endif }; } // namespace vulkan } // namespace mbgl