diff --git a/src/Magnum/Vk/CMakeLists.txt b/src/Magnum/Vk/CMakeLists.txt index 68777ac2b..e664ade43 100644 --- a/src/Magnum/Vk/CMakeLists.txt +++ b/src/Magnum/Vk/CMakeLists.txt @@ -32,6 +32,8 @@ set(MagnumVk_SRCS CommandBuffer.cpp CommandPool.cpp Context.cpp + DescriptorPool.cpp + DescriptorSet.cpp Device.cpp DeviceMemory.cpp Framebuffer.cpp @@ -51,6 +53,8 @@ set(MagnumVk_HEADERS CommandBuffer.h CommandPool.h Context.h + DescriptorPool.h + DescriptorSet.h Device.h DeviceMemory.h Framebuffer.h @@ -63,6 +67,7 @@ set(MagnumVk_HEADERS RenderPass.h Semaphore.h Shader.h + ShaderStage.h Swapchain.h visibility.h) diff --git a/src/Magnum/Vk/DescriptorPool.cpp b/src/Magnum/Vk/DescriptorPool.cpp new file mode 100644 index 000000000..05d23086c --- /dev/null +++ b/src/Magnum/Vk/DescriptorPool.cpp @@ -0,0 +1,36 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 + Vladimír Vondruš + Copyright © 2016 Jonathan Hale + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "DescriptorPool.h" + + +namespace Magnum { namespace Vk { + +DescriptorPool::~DescriptorPool() { + vkDestroyDescriptorPool(_device, _descriptorPool, nullptr); +} + +}} diff --git a/src/Magnum/Vk/DescriptorPool.h b/src/Magnum/Vk/DescriptorPool.h new file mode 100644 index 000000000..d1e3df215 --- /dev/null +++ b/src/Magnum/Vk/DescriptorPool.h @@ -0,0 +1,126 @@ +#ifndef Magnum_Vk_DescriptorPool_h +#define Magnum_Vk_DescriptorPool_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 + Vladimír Vondruš + Copyright © 2016 Jonathan Hale + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::Vk::DescriptorPool + */ + +#include + +#include "Magnum/Magnum.h" +#include "Magnum/Vk/DescriptorSet.h" +#include "Magnum/Vk/Device.h" +#include "Magnum/Vk/visibility.h" + +#include "vulkan.h" + +namespace Magnum { namespace Vk { + +class MAGNUM_VK_EXPORT DescriptorPoolCreateInfo { + friend class DescriptorPool; +public: + DescriptorPoolCreateInfo(Device& device): + _device{device}, _poolSizes{} + { + } + + DescriptorPoolCreateInfo& setPoolSize(DescriptorType type, UnsignedInt size) { + _poolSizes.push_back(VkDescriptorPoolSize{VkDescriptorType(type), size}); + return *this; + } + +private: + + Device& _device; + std::vector _poolSizes; + +}; + +class MAGNUM_VK_EXPORT DescriptorPool { + public: + + DescriptorPool(Device& device, UnsignedLong maxSets, const DescriptorPoolCreateInfo& ci): + _device{device} + { + VkDescriptorPoolCreateInfo createInfo = { + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO, nullptr, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, + maxSets, + ci._poolSizes.size(), ci._poolSizes.data() + }; + + VkResult err = vkCreateDescriptorPool(_device, &createInfo, nullptr, &_descriptorPool); + MAGNUM_VK_ASSERT_ERROR(err); + } + + /** @brief Copying is not allowed */ + DescriptorPool(const DescriptorPool&) = delete; + + /** @brief Move constructor */ + DescriptorPool(DescriptorPool&& other); + + /** + * @brief Destructor + * + * @see @fn_vk{DestroyDescriptorPool} + */ + ~DescriptorPool(); + + /** @brief Copying is not allowed */ + DescriptorPool& operator=(const DescriptorPool&) = delete; + + /** @brief Move assignment is not allowed */ + DescriptorPool& operator=(DescriptorPool&&) = delete; + + operator VkDescriptorPool() const { + return _descriptorPool; + } + + std::unique_ptr allocateDescriptorSet(const DescriptorSetLayout& layout) { + VkDescriptorSetLayout vkLayout = layout; + VkDescriptorSetAllocateInfo allocateInfo = { + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO, nullptr, + *this, + 1, + &vkLayout + }; + + VkDescriptorSet set; + VkResult err = vkAllocateDescriptorSets(_device, &allocateInfo, &set); + MAGNUM_VK_ASSERT_ERROR(err); + + return std::unique_ptr(new DescriptorSet{_device, *this, set}); + } + + private: + Device& _device; + VkDescriptorPool _descriptorPool; +}; + +}} + +#endif diff --git a/src/Magnum/Vk/DescriptorSet.cpp b/src/Magnum/Vk/DescriptorSet.cpp new file mode 100644 index 000000000..67969962b --- /dev/null +++ b/src/Magnum/Vk/DescriptorSet.cpp @@ -0,0 +1,38 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 + Vladimír Vondruš + Copyright © 2016 Jonathan Hale + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "DescriptorSet.h" + +#include "Magnum/Vk/DescriptorPool.h" + + +namespace Magnum { namespace Vk { + +DescriptorSet::~DescriptorSet() { + vkFreeDescriptorSets(_device, _pool, 1, &_descriptorSet); +} + +}} diff --git a/src/Magnum/Vk/DescriptorSet.h b/src/Magnum/Vk/DescriptorSet.h new file mode 100644 index 000000000..72a510417 --- /dev/null +++ b/src/Magnum/Vk/DescriptorSet.h @@ -0,0 +1,165 @@ +#ifndef Magnum_Vk_DescriptorSet_h +#define Magnum_Vk_DescriptorSet_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 + Vladimír Vondruš + Copyright © 2016 Jonathan Hale + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::Vk::DescriptorSet + */ + +#include + +#include "Magnum/Magnum.h" +#include "Magnum/Vk/Device.h" +#include "Magnum/Vk/visibility.h" +#include "Magnum/Vk/ShaderStage.h" + +#include "vulkan.h" + +namespace Magnum { namespace Vk { + +class DescriptorPool; +class ShadereStageFlags; + +enum class DescriptorType: UnsignedInt { + Sampler = VK_DESCRIPTOR_TYPE_SAMPLER, + CombinedImageSampler = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, + SampledImage = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + StorageImage = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + UniformTexelBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, + StorageTexelBuffer = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, + UniformBuffer = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, + StorageBuffer = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + UniformBufferDynamic = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, + StorageBufferDynamic = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, + InputAttachment = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, +}; + +struct DescriptorSetLayoutBinding { + public: + + DescriptorSetLayoutBinding(UnsignedInt binding, DescriptorType type, + UnsignedInt descriptorsCount, ShaderStageFlags flags): // TODO: Immutable samplers + _layoutBinding{ + binding, VkDescriptorType(type), descriptorsCount, + VkShaderStageFlags(flags), nullptr + } + {} + + private: + VkDescriptorSetLayoutBinding _layoutBinding; +}; + +class MAGNUM_VK_EXPORT DescriptorSetLayout { + public: + + DescriptorSetLayout(Device& device, + std::initializer_list bindings): + _device{device} + { + const std::vector bndgs{bindings}; + VkDescriptorSetLayoutCreateInfo descLayout = { + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, + nullptr, 0, + bndgs.size(), + reinterpret_cast(bndgs.data()) + }; + + VkResult err = vkCreateDescriptorSetLayout(_device, &descLayout, nullptr, &_layout); + } + + /** @brief Copying is not allowed */ + DescriptorSetLayout(const DescriptorSetLayout&) = delete; + + /** @brief Move constructor */ + DescriptorSetLayout(DescriptorSetLayout&& other); + + /** + * @brief Destructor + * + * @see @fn_vk{DestroyDescriptorSet} + */ + ~DescriptorSetLayout() { + vkDestroyDescriptorSetLayout(_device, _layout, nullptr); + } + + /** @brief Copying is not allowed */ + DescriptorSetLayout& operator=(const DescriptorSetLayout&) = delete; + + /** @brief Move assignment is not allowed */ + DescriptorSetLayout& operator=(DescriptorSetLayout&&) = delete; + + operator VkDescriptorSetLayout() const { + return _layout; + } + + private: + Device& _device; + VkDescriptorSetLayout _layout; +}; + +class MAGNUM_VK_EXPORT DescriptorSet { + public: + + DescriptorSet(Device& device, DescriptorPool& pool, VkDescriptorSet vkDescriptorSet): + _device{device}, + _pool{pool}, + _descriptorSet{vkDescriptorSet} + { + } + + /** @brief Copying is not allowed */ + DescriptorSet(const DescriptorSet&) = delete; + + /** @brief Move constructor */ + DescriptorSet(DescriptorSet&& other); + + /** + * @brief Destructor + * + * @see @fn_vk{DestroyDescriptorSet} + */ + ~DescriptorSet(); + + /** @brief Copying is not allowed */ + DescriptorSet& operator=(const DescriptorSet&) = delete; + + /** @brief Move assignment is not allowed */ + DescriptorSet& operator=(DescriptorSet&&) = delete; + + operator VkDescriptorSet() const { + return _descriptorSet; + } + + private: + Device& _device; + DescriptorPool& _pool; + VkDescriptorSet _descriptorSet; +}; + +}} + +#endif diff --git a/src/Magnum/Vk/Framebuffer.cpp b/src/Magnum/Vk/Framebuffer.cpp index 85b8541dc..a295c4c58 100644 --- a/src/Magnum/Vk/Framebuffer.cpp +++ b/src/Magnum/Vk/Framebuffer.cpp @@ -30,6 +30,10 @@ namespace Magnum { namespace Vk { Framebuffer::~Framebuffer() { + // TODO: The spec allowes VK_NULL_HANDLE for _framebuffer, but validation failes? + if (_framebuffer == VK_NULL_HANDLE) { + return; + } vkDestroyFramebuffer(_device, _framebuffer, nullptr); } diff --git a/src/Magnum/Vk/Framebuffer.h b/src/Magnum/Vk/Framebuffer.h index 6105287f7..ea9b7f99f 100644 --- a/src/Magnum/Vk/Framebuffer.h +++ b/src/Magnum/Vk/Framebuffer.h @@ -43,33 +43,39 @@ namespace Magnum { namespace Vk { class MAGNUM_VK_EXPORT Framebuffer { public: - Framebuffer(Device& device, RenderPass& renderPass, Vector2ui size, std::initializer_list& attachments): + Framebuffer(Device& device, RenderPass& renderPass, const Vector3ui& size, + const std::initializer_list>& attachments): _device{device} { std::vector vkAttachments; vkAttachments.reserve(attachments.size()); for (auto& imageView : attachments) { - vkAttachments.push_back(imageView); + vkAttachments.push_back(imageView.get()); } - VkFramebufferCreateInfo createInfo = {}; - createInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; - createInfo.pNext = nullptr; - createInfo.renderPass = renderPass; - createInfo.attachmentCount = attachments.size(); - createInfo.pAttachments = vkAttachments.data(); - createInfo.width = size.x(); - createInfo.height = size.y(); - createInfo.layers = 1; - - vkCreateFramebuffer(_device, &createInfo, nullptr, &_framebuffer); + VkFramebufferCreateInfo createInfo = { + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, + nullptr, 0, + renderPass, + vkAttachments.size(), + vkAttachments.data(), + size.x(), size.y(), size.z() + }; + + VkResult err = vkCreateFramebuffer(_device, &createInfo, nullptr, &_framebuffer); + MAGNUM_VK_ASSERT_ERROR(err); } /** @brief Copying is not allowed */ Framebuffer(const Framebuffer&) = delete; /** @brief Move constructor */ - Framebuffer(Framebuffer&& other); + Framebuffer(Framebuffer&& other): + _device{other._device}, + _framebuffer{other._framebuffer} + { + other._framebuffer = VK_NULL_HANDLE; + } /** * @brief Destructor diff --git a/src/Magnum/Vk/Image.cpp b/src/Magnum/Vk/Image.cpp index 85ec33127..29ace52aa 100644 --- a/src/Magnum/Vk/Image.cpp +++ b/src/Magnum/Vk/Image.cpp @@ -30,7 +30,9 @@ namespace Magnum { namespace Vk { Image::~Image() { - vkDestroyImage(_device, _image, nullptr); + if(_flags >= ObjectFlag::DeleteOnDestruction) { + vkDestroyImage(_device, _image, nullptr); + } } }} diff --git a/src/Magnum/Vk/Image.h b/src/Magnum/Vk/Image.h index 33f0a9ba7..11910d2e3 100644 --- a/src/Magnum/Vk/Image.h +++ b/src/Magnum/Vk/Image.h @@ -34,6 +34,7 @@ #include "Magnum/Magnum.h" #include "Magnum/Math/Vector3.h" #include "Magnum/Vk/Device.h" +#include "Magnum/Vk/DeviceMemory.h" #include "Magnum/Vk/Math.h" #include "Magnum/Vk/visibility.h" @@ -94,15 +95,27 @@ enum class ImageLayout: UnsignedInt { PresentSrc = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, }; +enum class ObjectFlag: UnsignedByte { + /** Delete the object on destruction. */ + DeleteOnDestruction = 1 << 1 +}; + +typedef Containers::EnumSet ObjectFlags; + +CORRADE_ENUMSET_OPERATORS(ObjectFlags) + class MAGNUM_VK_EXPORT Image { public: Image(Device& device, VkImage vkImage): _device{device}, - _image{vkImage} + _image{vkImage}, + _flags{} {} - Image(Device& device, Vector3ui extent, VkFormat format, ImageUsageFlags usage): _device{device} { + Image(Device& device, Vector3ui extent, VkFormat format, ImageUsageFlags usage): + _device{device}, _flags{ObjectFlag::DeleteOnDestruction} + { VkImageCreateInfo image = {}; image.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; image.flags = 0; @@ -150,9 +163,17 @@ class MAGNUM_VK_EXPORT Image { return memReqs; } + Image& bindImageMemory(DeviceMemory& memory, UnsignedLong memoryOffset=0) { + VkResult err = vkBindImageMemory(_device, _image, memory, memoryOffset); + MAGNUM_VK_ASSERT_ERROR(err); + + return *this; + } + private: Device& _device; VkImage _image; + ObjectFlags _flags; }; struct ImageMemoryBarrier { diff --git a/src/Magnum/Vk/Pipeline.h b/src/Magnum/Vk/Pipeline.h index feacbfcb5..98e9a62f9 100644 --- a/src/Magnum/Vk/Pipeline.h +++ b/src/Magnum/Vk/Pipeline.h @@ -36,6 +36,7 @@ #include "Magnum/Vk/Device.h" #include "Magnum/Vk/RenderPass.h" #include "Magnum/Vk/Shader.h" +#include "Magnum/Vk/DescriptorSet.h" #include "Magnum/Math/Vector3.h" // TEMPORARY!!! @@ -45,16 +46,7 @@ namespace Magnum { namespace Vk { -enum class ShaderStage: UnsignedInt { - Vertex = VK_SHADER_STAGE_VERTEX_BIT, - TesslationControl = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, - TesslationEvaluation = VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, - Geometry = VK_SHADER_STAGE_GEOMETRY_BIT, - Fragment = VK_SHADER_STAGE_FRAGMENT_BIT, - Compute = VK_SHADER_STAGE_COMPUTE_BIT, - AllGraphics = VK_SHADER_STAGE_ALL_GRAPHICS, - All = VK_SHADER_STAGE_ALL, -}; +class DescriptorSetLayout; enum class DynamicState: UnsignedInt { Viewport = VK_DYNAMIC_STATE_VIEWPORT, @@ -147,13 +139,30 @@ class MAGNUM_VK_EXPORT Pipeline { return _layout; } - auto bind(BindPoint bindPoint, std::initializer_list descriptorSets) { + auto bind(BindPoint bindPoint) { + const VkPipeline pipeline = _pipeline; + return [bindPoint, pipeline](VkCommandBuffer cmdBuffer){ + vkCmdBindPipeline(cmdBuffer, + VkPipelineBindPoint(bindPoint), + pipeline); + }; + } + + auto bindDescriptorSets(BindPoint bindPoint, std::initializer_list> descriptorSets) { const VkPipelineLayout pl = _layout; return [bindPoint, &descriptorSets, pl](VkCommandBuffer cmdBuffer){ + + std::vector vkDescriptorSets{}; + vkDescriptorSets.reserve(descriptorSets.size()); + + for (auto& ds : descriptorSets) { + vkDescriptorSets.push_back(VkDescriptorSet(ds.get())); + } + vkCmdBindDescriptorSets(cmdBuffer, VkPipelineBindPoint(bindPoint), pl, 0, - descriptorSets.size(), std::vector(descriptorSets).data(), + descriptorSets.size(), vkDescriptorSets.data(), 0, nullptr); }; } @@ -333,7 +342,7 @@ class MAGNUM_VK_EXPORT GraphicsPipelineFactory { return *this; } - GraphicsPipelineFactory& addDescriptorSetLayout(const VkDescriptorSetLayout& layout) { + GraphicsPipelineFactory& addDescriptorSetLayout(const DescriptorSetLayout& layout) { _setLayouts.push_back(layout); return *this; } diff --git a/src/Magnum/Vk/ShaderStage.h b/src/Magnum/Vk/ShaderStage.h new file mode 100644 index 000000000..993ea2b96 --- /dev/null +++ b/src/Magnum/Vk/ShaderStage.h @@ -0,0 +1,67 @@ +#ifndef Magnum_Vk_ShaderStage_h +#define Magnum_Vk_ShaderStage_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 + Vladimír Vondruš + Copyright © 2016 Jonathan Hale + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::Vk::ShaderStage + */ + +#include "Magnum/Magnum.h" +#include "Magnum/Vk/visibility.h" + +#include "Magnum/Vk/Device.h" +#include "Magnum/Vk/RenderPass.h" +#include "Magnum/Vk/Shader.h" +#include "Magnum/Vk/DescriptorSet.h" + +#include "Magnum/Math/Vector3.h" // TEMPORARY!!! + +#include + +#include "vulkan.h" + +namespace Magnum { namespace Vk { + + +enum class ShaderStage: UnsignedInt { + Vertex = VK_SHADER_STAGE_VERTEX_BIT, + TesslationControl = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, + TesslationEvaluation = VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, + Geometry = VK_SHADER_STAGE_GEOMETRY_BIT, + Fragment = VK_SHADER_STAGE_FRAGMENT_BIT, + Compute = VK_SHADER_STAGE_COMPUTE_BIT, + AllGraphics = VK_SHADER_STAGE_ALL_GRAPHICS, + All = VK_SHADER_STAGE_ALL, +}; + +typedef Containers::EnumSet ShaderStageFlags; + +CORRADE_ENUMSET_OPERATORS(ShaderStageFlags) + +}} + +#endif