| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
- // All rights reserved.
- // Code licensed under the BSD License.
- // http://www.anki3d.org/LICENSE
- #pragma once
- #include <AnKi/Gr/Vulkan/DescriptorSet.h>
- #include <AnKi/Util/HashMap.h>
- namespace anki {
- /// @addtogroup vulkan
- /// @{
- class PipelineLayout
- {
- friend class PipelineLayoutFactory;
- public:
- VkPipelineLayout getHandle() const
- {
- ANKI_ASSERT(m_handle);
- return m_handle;
- }
- private:
- VkPipelineLayout m_handle = VK_NULL_HANDLE;
- };
- /// Creator of pipeline layouts.
- class PipelineLayoutFactory
- {
- public:
- PipelineLayoutFactory() = default;
- ~PipelineLayoutFactory() = default;
- void init(GrAllocator<U8> alloc, VkDevice dev)
- {
- m_alloc = alloc;
- m_dev = dev;
- }
- void destroy();
- /// @note It's thread-safe.
- ANKI_USE_RESULT Error newPipelineLayout(const WeakArray<DescriptorSetLayout>& dsetLayouts, U32 pushConstantsSize,
- PipelineLayout& layout);
- private:
- GrAllocator<U8> m_alloc;
- VkDevice m_dev = VK_NULL_HANDLE;
- HashMap<U64, VkPipelineLayout> m_layouts;
- Mutex m_layoutsMtx;
- };
- /// @}
- } // end namespace anki
|